Skip to content

Commit 6aae91b

Browse files
author
github-actions[bot]
committed
feat: Updated OpenAPI spec
1 parent 5824d1e commit 6aae91b

36 files changed

Lines changed: 484 additions & 490 deletions

File tree

src/libs/HeyGen/Generated/HeyGen.AssetsClient.V1AssetUpload.g.cs

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -350,17 +350,15 @@ await V1AssetUploadAsResponseAsync(
350350
}
351351
catch (global::System.Exception __ex)
352352
{
353-
throw new global::HeyGen.ApiException(
353+
throw global::HeyGen.ApiException.Create(
354+
statusCode: __response.StatusCode,
354355
message: __content ?? __response.ReasonPhrase ?? string.Empty,
355356
innerException: __ex,
356-
statusCode: __response.StatusCode)
357-
{
358-
ResponseBody = __content,
359-
ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
357+
responseBody: __content,
358+
responseHeaders: global::System.Linq.Enumerable.ToDictionary(
360359
__response.Headers,
361360
h => h.Key,
362-
h => h.Value),
363-
};
361+
h => h.Value));
364362
}
365363
}
366364
else
@@ -388,17 +386,15 @@ await V1AssetUploadAsResponseAsync(
388386
{
389387
}
390388

391-
throw new global::HeyGen.ApiException(
389+
throw global::HeyGen.ApiException.Create(
390+
statusCode: __response.StatusCode,
392391
message: __content ?? __response.ReasonPhrase ?? string.Empty,
393392
innerException: __ex,
394-
statusCode: __response.StatusCode)
395-
{
396-
ResponseBody = __content,
397-
ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
393+
responseBody: __content,
394+
responseHeaders: global::System.Linq.Enumerable.ToDictionary(
398395
__response.Headers,
399396
h => h.Key,
400-
h => h.Value),
401-
};
397+
h => h.Value));
402398
}
403399
}
404400

src/libs/HeyGen/Generated/HeyGen.CreateVideoApiClient.V1VideoDelete.g.cs

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -366,17 +366,15 @@ await V1VideoDeleteAsResponseAsync(
366366
}
367367
catch (global::System.Exception __ex)
368368
{
369-
throw new global::HeyGen.ApiException(
369+
throw global::HeyGen.ApiException.Create(
370+
statusCode: __response.StatusCode,
370371
message: __content ?? __response.ReasonPhrase ?? string.Empty,
371372
innerException: __ex,
372-
statusCode: __response.StatusCode)
373-
{
374-
ResponseBody = __content,
375-
ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
373+
responseBody: __content,
374+
responseHeaders: global::System.Linq.Enumerable.ToDictionary(
376375
__response.Headers,
377376
h => h.Key,
378-
h => h.Value),
379-
};
377+
h => h.Value));
380378
}
381379
}
382380
else
@@ -404,17 +402,15 @@ await V1VideoDeleteAsResponseAsync(
404402
{
405403
}
406404

407-
throw new global::HeyGen.ApiException(
405+
throw global::HeyGen.ApiException.Create(
406+
statusCode: __response.StatusCode,
408407
message: __content ?? __response.ReasonPhrase ?? string.Empty,
409408
innerException: __ex,
410-
statusCode: __response.StatusCode)
411-
{
412-
ResponseBody = __content,
413-
ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
409+
responseBody: __content,
410+
responseHeaders: global::System.Linq.Enumerable.ToDictionary(
414411
__response.Headers,
415412
h => h.Key,
416-
h => h.Value),
417-
};
413+
h => h.Value));
418414
}
419415
}
420416

src/libs/HeyGen/Generated/HeyGen.CreateVideoApiClient.V2VideoGenerate.g.cs

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -372,17 +372,15 @@ await V2VideoGenerateAsResponseAsync(
372372
}
373373
catch (global::System.Exception __ex)
374374
{
375-
throw new global::HeyGen.ApiException(
375+
throw global::HeyGen.ApiException.Create(
376+
statusCode: __response.StatusCode,
376377
message: __content ?? __response.ReasonPhrase ?? string.Empty,
377378
innerException: __ex,
378-
statusCode: __response.StatusCode)
379-
{
380-
ResponseBody = __content,
381-
ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
379+
responseBody: __content,
380+
responseHeaders: global::System.Linq.Enumerable.ToDictionary(
382381
__response.Headers,
383382
h => h.Key,
384-
h => h.Value),
385-
};
383+
h => h.Value));
386384
}
387385
}
388386
else
@@ -410,17 +408,15 @@ await V2VideoGenerateAsResponseAsync(
410408
{
411409
}
412410

413-
throw new global::HeyGen.ApiException(
411+
throw global::HeyGen.ApiException.Create(
412+
statusCode: __response.StatusCode,
414413
message: __content ?? __response.ReasonPhrase ?? string.Empty,
415414
innerException: __ex,
416-
statusCode: __response.StatusCode)
417-
{
418-
ResponseBody = __content,
419-
ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
415+
responseBody: __content,
416+
responseHeaders: global::System.Linq.Enumerable.ToDictionary(
420417
__response.Headers,
421418
h => h.Key,
422-
h => h.Value),
423-
};
419+
h => h.Value));
424420
}
425421
}
426422

src/libs/HeyGen/Generated/HeyGen.Exceptions.g.cs

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,19 @@ public partial class ApiException : global::System.Exception
1212
/// The HTTP status code of the response.
1313
/// </summary>
1414
public global::System.Net.HttpStatusCode StatusCode { get; }
15+
1516
/// <summary>
1617
/// The response body as a string, or <c>null</c> if the body could not be read.
1718
/// This is always populated for error responses regardless of the <c>ReadResponseAsString</c> setting.
1819
/// For success-path failures (e.g. deserialization errors), the client attempts a best-effort read.
1920
/// </summary>
2021
public string? ResponseBody { get; set; }
22+
2123
/// <summary>
2224
/// The response headers.
2325
/// </summary>
2426
public global::System.Collections.Generic.Dictionary<string, global::System.Collections.Generic.IEnumerable<string>>? ResponseHeaders { get; set; }
27+
2528
/// <summary>
2629
/// Initializes a new instance of the <see cref="ApiException"/> class.
2730
/// </summary>
@@ -49,6 +52,103 @@ public ApiException(string message, global::System.Exception? innerException, gl
4952
{
5053
StatusCode = statusCode;
5154
}
55+
56+
/// <summary>
57+
/// Constructs an <see cref="ApiException"/> instance whose runtime type matches the response status code when the typed exception hierarchy is enabled. Always returns a plain <see cref="ApiException"/> when the hierarchy is disabled.
58+
/// </summary>
59+
/// <param name="statusCode">The HTTP status code of the response.</param>
60+
/// <param name="message">The error message.</param>
61+
/// <param name="innerException">An inner exception, when one is available.</param>
62+
/// <param name="responseHeaders">The response headers; consulted for 429 <c>Retry-After</c> parsing when present.</param>
63+
public static global::HeyGen.ApiException Create(
64+
global::System.Net.HttpStatusCode statusCode,
65+
string message,
66+
global::System.Exception? innerException = null,
67+
global::System.Collections.Generic.IDictionary<string, global::System.Collections.Generic.IEnumerable<string>>? responseHeaders = null)
68+
{
69+
return new global::HeyGen.ApiException(message, innerException, statusCode);
70+
}
71+
72+
/// <summary>
73+
/// Convenience overload that constructs an <see cref="ApiException"/> with response body and headers populated.
74+
/// </summary>
75+
public static global::HeyGen.ApiException Create(
76+
global::System.Net.HttpStatusCode statusCode,
77+
string message,
78+
global::System.Exception? innerException,
79+
string? responseBody,
80+
global::System.Collections.Generic.Dictionary<string, global::System.Collections.Generic.IEnumerable<string>>? responseHeaders)
81+
{
82+
var exception = global::HeyGen.ApiException.Create(statusCode, message, innerException, responseHeaders);
83+
exception.ResponseBody = responseBody;
84+
exception.ResponseHeaders = responseHeaders;
85+
return exception;
86+
}
87+
88+
/// <summary>
89+
/// Parses a <c>Retry-After</c> response header (delta-seconds or HTTP-date) into a <see cref="global::System.TimeSpan"/>.
90+
/// Returns <c>null</c> when the header is missing or unparseable. Public so consumer code that observes
91+
/// <see cref="ApiException"/> directly can recover the value without re-implementing the parser.
92+
/// </summary>
93+
public static global::System.TimeSpan? TryParseRetryAfter(
94+
global::System.Collections.Generic.IDictionary<string, global::System.Collections.Generic.IEnumerable<string>>? headers)
95+
{
96+
if (headers == null)
97+
{
98+
return null;
99+
}
100+
101+
global::System.Collections.Generic.IEnumerable<string>? values = null;
102+
foreach (var entry in headers)
103+
{
104+
if (string.Equals(entry.Key, "Retry-After", global::System.StringComparison.OrdinalIgnoreCase))
105+
{
106+
values = entry.Value;
107+
break;
108+
}
109+
}
110+
111+
if (values == null)
112+
{
113+
return null;
114+
}
115+
116+
string? raw = null;
117+
foreach (var value in values)
118+
{
119+
if (!string.IsNullOrWhiteSpace(value))
120+
{
121+
raw = value.Trim();
122+
break;
123+
}
124+
}
125+
126+
if (string.IsNullOrEmpty(raw))
127+
{
128+
return null;
129+
}
130+
131+
if (int.TryParse(
132+
raw,
133+
global::System.Globalization.NumberStyles.Integer,
134+
global::System.Globalization.CultureInfo.InvariantCulture,
135+
out var seconds) && seconds >= 0)
136+
{
137+
return global::System.TimeSpan.FromSeconds(seconds);
138+
}
139+
140+
if (global::System.DateTimeOffset.TryParse(
141+
raw,
142+
global::System.Globalization.CultureInfo.InvariantCulture,
143+
global::System.Globalization.DateTimeStyles.AssumeUniversal | global::System.Globalization.DateTimeStyles.AdjustToUniversal,
144+
out var when))
145+
{
146+
var delta = when - global::System.DateTimeOffset.UtcNow;
147+
return delta > global::System.TimeSpan.Zero ? delta : global::System.TimeSpan.Zero;
148+
}
149+
150+
return null;
151+
}
52152
}
53153

54154
/// <summary>
@@ -88,5 +188,39 @@ public ApiException(string message, global::System.Net.HttpStatusCode statusCode
88188
public ApiException(string message, global::System.Exception? innerException, global::System.Net.HttpStatusCode statusCode) : base(message, innerException, statusCode)
89189
{
90190
}
191+
192+
/// <summary>
193+
/// Constructs an <see cref="ApiException{T}"/> whose runtime type matches the response status code when the typed exception hierarchy is enabled.
194+
/// </summary>
195+
/// <param name="statusCode">The HTTP status code of the response.</param>
196+
/// <param name="message">The error message.</param>
197+
/// <param name="innerException">An inner exception, when one is available.</param>
198+
/// <param name="responseHeaders">The response headers; consulted for 429 <c>Retry-After</c> parsing when present.</param>
199+
public static new global::HeyGen.ApiException<T> Create(
200+
global::System.Net.HttpStatusCode statusCode,
201+
string message,
202+
global::System.Exception? innerException = null,
203+
global::System.Collections.Generic.IDictionary<string, global::System.Collections.Generic.IEnumerable<string>>? responseHeaders = null)
204+
{
205+
return new global::HeyGen.ApiException<T>(message, innerException, statusCode);
206+
}
207+
208+
/// <summary>
209+
/// Convenience overload that constructs an <see cref="ApiException{T}"/> with response body, object, and headers populated.
210+
/// </summary>
211+
public static global::HeyGen.ApiException<T> Create(
212+
global::System.Net.HttpStatusCode statusCode,
213+
string message,
214+
global::System.Exception? innerException,
215+
string? responseBody,
216+
T? responseObject,
217+
global::System.Collections.Generic.Dictionary<string, global::System.Collections.Generic.IEnumerable<string>>? responseHeaders)
218+
{
219+
var exception = global::HeyGen.ApiException<T>.Create(statusCode, message, innerException, responseHeaders);
220+
exception.ResponseBody = responseBody;
221+
exception.ResponseObject = responseObject;
222+
exception.ResponseHeaders = responseHeaders;
223+
return exception;
224+
}
91225
}
92226
}

src/libs/HeyGen/Generated/HeyGen.HeyGenClient.V1VideoStatusGet.g.cs

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -366,17 +366,15 @@ await V1VideoStatusGetAsResponseAsync(
366366
}
367367
catch (global::System.Exception __ex)
368368
{
369-
throw new global::HeyGen.ApiException(
369+
throw global::HeyGen.ApiException.Create(
370+
statusCode: __response.StatusCode,
370371
message: __content ?? __response.ReasonPhrase ?? string.Empty,
371372
innerException: __ex,
372-
statusCode: __response.StatusCode)
373-
{
374-
ResponseBody = __content,
375-
ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
373+
responseBody: __content,
374+
responseHeaders: global::System.Linq.Enumerable.ToDictionary(
376375
__response.Headers,
377376
h => h.Key,
378-
h => h.Value),
379-
};
377+
h => h.Value));
380378
}
381379
}
382380
else
@@ -404,17 +402,15 @@ await V1VideoStatusGetAsResponseAsync(
404402
{
405403
}
406404

407-
throw new global::HeyGen.ApiException(
405+
throw global::HeyGen.ApiException.Create(
406+
statusCode: __response.StatusCode,
408407
message: __content ?? __response.ReasonPhrase ?? string.Empty,
409408
innerException: __ex,
410-
statusCode: __response.StatusCode)
411-
{
412-
ResponseBody = __content,
413-
ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
409+
responseBody: __content,
410+
responseHeaders: global::System.Linq.Enumerable.ToDictionary(
414411
__response.Headers,
415412
h => h.Key,
416-
h => h.Value),
417-
};
413+
h => h.Value));
418414
}
419415
}
420416

0 commit comments

Comments
 (0)