Skip to content
This repository was archived by the owner on Apr 1, 2025. It is now read-only.

Commit e136a32

Browse files
committed
SDK regeneration
1 parent 49d0c93 commit e136a32

File tree

7 files changed

+25
-37
lines changed

7 files changed

+25
-37
lines changed

src/AssemblyAI/Core/Constants.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@ namespace AssemblyAI.Core;
22

33
internal static class Constants
44
{
5-
internal const string Version = "1.0.0-beta3";
6-
internal const string DateTimeFormat = "yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffK";
5+
public const string DateTimeFormat = "yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffK";
76
}

src/AssemblyAI/Core/Public/ApiException.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ namespace AssemblyAI;
44
/// This exception type will be thrown for any non-2XX API responses.
55
/// </summary>
66
public class ApiException(string message, int statusCode, object body)
7-
: AssemblyAIException(body is Error error ? error.Error_ : message)
7+
: AssemblyAIException(message)
88
{
99
/// <summary>
1010
/// The error code of the response that triggered the exception.
@@ -14,5 +14,5 @@ public class ApiException(string message, int statusCode, object body)
1414
/// <summary>
1515
/// The body of the response that triggered the exception.
1616
/// </summary>
17-
internal object Body { get; } = body;
17+
public object Body { get; } = body;
1818
}

src/AssemblyAI/Core/Public/ClientOptions.cs

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,33 +7,23 @@ namespace AssemblyAI;
77

88
public partial class ClientOptions
99
{
10-
/// <summary>
11-
/// The AssemblyAI API key
12-
/// </summary>
13-
public required string ApiKey { get; set; }
14-
1510
/// <summary>
1611
/// The Base URL for the API.
1712
/// </summary>
18-
public string BaseUrl { get; set; } = AssemblyAIClientEnvironment.Default;
19-
20-
/// <summary>
21-
/// The AssemblyAI user agent
22-
/// </summary>
23-
public UserAgent UserAgent { get; set; } = new();
13+
public string BaseUrl { get; init; } = AssemblyAIClientEnvironment.Default;
2414

2515
/// <summary>
2616
/// The http client used to make requests.
2717
/// </summary>
28-
public HttpClient? HttpClient { get; set; }
18+
public HttpClient HttpClient { get; init; } = new HttpClient();
2919

3020
/// <summary>
3121
/// The http client used to make requests.
3222
/// </summary>
33-
public int MaxRetries { get; set; } = 2;
23+
public int MaxRetries { get; init; } = 2;
3424

3525
/// <summary>
3626
/// The timeout for the request.
3727
/// </summary>
38-
public TimeSpan Timeout { get; set; } = TimeSpan.FromSeconds(30);
28+
public TimeSpan Timeout { get; init; } = TimeSpan.FromSeconds(30);
3929
}

src/AssemblyAI/Files/FilesClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public async Task<UploadedFile> UploadAsync(Stream request, RequestOptions? opti
4747
throw new ApiException(
4848
$"Error with status code {response.StatusCode}",
4949
response.StatusCode,
50-
JsonUtils.Deserialize<object>(responseBody)
50+
responseBody
5151
);
5252
}
5353
}

src/AssemblyAI/Lemur/LemurClient.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public async Task<LemurTaskResponse> TaskAsync(
5151
throw new ApiException(
5252
$"Error with status code {response.StatusCode}",
5353
response.StatusCode,
54-
JsonUtils.Deserialize<object>(responseBody)
54+
responseBody
5555
);
5656
}
5757

@@ -90,7 +90,7 @@ public async Task<LemurSummaryResponse> SummaryAsync(
9090
throw new ApiException(
9191
$"Error with status code {response.StatusCode}",
9292
response.StatusCode,
93-
JsonUtils.Deserialize<object>(responseBody)
93+
responseBody
9494
);
9595
}
9696

@@ -129,7 +129,7 @@ public async Task<LemurQuestionAnswerResponse> QuestionAnswerAsync(
129129
throw new ApiException(
130130
$"Error with status code {response.StatusCode}",
131131
response.StatusCode,
132-
JsonUtils.Deserialize<object>(responseBody)
132+
responseBody
133133
);
134134
}
135135

@@ -167,7 +167,7 @@ public async Task<LemurActionItemsResponse> ActionItemsAsync(
167167
throw new ApiException(
168168
$"Error with status code {response.StatusCode}",
169169
response.StatusCode,
170-
JsonUtils.Deserialize<object>(responseBody)
170+
responseBody
171171
);
172172
}
173173

@@ -206,7 +206,7 @@ public async Task<OneOf<LemurStringResponse, LemurQuestionAnswerResponse>> GetRe
206206
throw new ApiException(
207207
$"Error with status code {response.StatusCode}",
208208
response.StatusCode,
209-
JsonUtils.Deserialize<object>(responseBody)
209+
responseBody
210210
);
211211
}
212212

@@ -244,7 +244,7 @@ public async Task<PurgeLemurRequestDataResponse> PurgeRequestDataAsync(
244244
throw new ApiException(
245245
$"Error with status code {response.StatusCode}",
246246
response.StatusCode,
247-
JsonUtils.Deserialize<object>(responseBody)
247+
responseBody
248248
);
249249
}
250250
}

src/AssemblyAI/Realtime/RealtimeClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public async Task<RealtimeTemporaryTokenResponse> CreateTemporaryTokenAsync(
5050
throw new ApiException(
5151
$"Error with status code {response.StatusCode}",
5252
response.StatusCode,
53-
JsonUtils.Deserialize<object>(responseBody)
53+
responseBody
5454
);
5555
}
5656
}

src/AssemblyAI/Transcripts/TranscriptsClient.cs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public async Task<TranscriptList> ListAsync(
7676
throw new ApiException(
7777
$"Error with status code {response.StatusCode}",
7878
response.StatusCode,
79-
JsonUtils.Deserialize<object>(responseBody)
79+
responseBody
8080
);
8181
}
8282

@@ -114,7 +114,7 @@ public async Task<Transcript> SubmitAsync(
114114
throw new ApiException(
115115
$"Error with status code {response.StatusCode}",
116116
response.StatusCode,
117-
JsonUtils.Deserialize<object>(responseBody)
117+
responseBody
118118
);
119119
}
120120

@@ -148,7 +148,7 @@ public async Task<Transcript> GetAsync(string transcriptId, RequestOptions? opti
148148
throw new ApiException(
149149
$"Error with status code {response.StatusCode}",
150150
response.StatusCode,
151-
JsonUtils.Deserialize<object>(responseBody)
151+
responseBody
152152
);
153153
}
154154

@@ -183,7 +183,7 @@ public async Task<Transcript> DeleteAsync(string transcriptId, RequestOptions? o
183183
throw new ApiException(
184184
$"Error with status code {response.StatusCode}",
185185
response.StatusCode,
186-
JsonUtils.Deserialize<object>(responseBody)
186+
responseBody
187187
);
188188
}
189189

@@ -202,13 +202,12 @@ public async Task<string> GetSubtitlesAsync(
202202
{
203203
_query["chars_per_caption"] = request.CharsPerCaption.ToString();
204204
}
205-
var formatSlug = subtitleFormat == SubtitleFormat.Srt ? "srt" : "vtt";
206205
var response = await _client.MakeRequestAsync(
207206
new RawClient.JsonApiRequest
208207
{
209208
BaseUrl = _client.Options.BaseUrl,
210209
Method = HttpMethod.Get,
211-
Path = $"v2/transcript/{transcriptId}/{formatSlug}",
210+
Path = $"v2/transcript/{transcriptId}/{subtitleFormat}",
212211
Query = _query,
213212
Options = options
214213
}
@@ -221,7 +220,7 @@ public async Task<string> GetSubtitlesAsync(
221220
throw new ApiException(
222221
$"Error with status code {response.StatusCode}",
223222
response.StatusCode,
224-
JsonUtils.Deserialize<object>(responseBody)
223+
responseBody
225224
);
226225
}
227226

@@ -258,7 +257,7 @@ public async Task<SentencesResponse> GetSentencesAsync(
258257
throw new ApiException(
259258
$"Error with status code {response.StatusCode}",
260259
response.StatusCode,
261-
JsonUtils.Deserialize<object>(responseBody)
260+
responseBody
262261
);
263262
}
264263

@@ -295,7 +294,7 @@ public async Task<ParagraphsResponse> GetParagraphsAsync(
295294
throw new ApiException(
296295
$"Error with status code {response.StatusCode}",
297296
response.StatusCode,
298-
JsonUtils.Deserialize<object>(responseBody)
297+
responseBody
299298
);
300299
}
301300

@@ -336,7 +335,7 @@ public async Task<WordSearchResponse> WordSearchAsync(
336335
throw new ApiException(
337336
$"Error with status code {response.StatusCode}",
338337
response.StatusCode,
339-
JsonUtils.Deserialize<object>(responseBody)
338+
responseBody
340339
);
341340
}
342341

@@ -373,7 +372,7 @@ public async Task<RedactedAudioResponse> GetRedactedAudioAsync(
373372
throw new ApiException(
374373
$"Error with status code {response.StatusCode}",
375374
response.StatusCode,
376-
JsonUtils.Deserialize<object>(responseBody)
375+
responseBody
377376
);
378377
}
379378
}

0 commit comments

Comments
 (0)