Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 47 additions & 4 deletions src/libs/HeyGen/Generated/HeyGen.AssetsClient.V1AssetUpload.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,22 @@ partial void ProcessV1AssetUploadResponse(
public async global::System.Threading.Tasks.Task V1AssetUploadAsync(
global::HeyGen.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
await V1AssetUploadAsResponseAsync(
requestOptions: requestOptions,
cancellationToken: cancellationToken
).ConfigureAwait(false);
}
/// <summary>
/// v1/asset (upload)<br/>
/// v1/asset (upload)
/// </summary>
/// <param name="requestOptions">Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.</param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::HeyGen.ApiException"></exception>
public async global::System.Threading.Tasks.Task<global::HeyGen.AutoSDKHttpResponse> V1AssetUploadAsResponseAsync(
global::HeyGen.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
client: HttpClient);
Expand Down Expand Up @@ -85,6 +101,7 @@ partial void ProcessV1AssetUploadResponse(

global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{

var __pathBuilder = new global::HeyGen.PathBuilder(
path: "/v1/asset",
baseUri: ResolveBaseUri(
Expand Down Expand Up @@ -159,6 +176,8 @@ partial void ProcessV1AssetUploadResponse(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
retryDelay: null,
retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
Expand All @@ -169,6 +188,11 @@ partial void ProcessV1AssetUploadResponse(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
var __retryDelay = global::HeyGen.AutoSDKRequestOptionsSupport.GetRetryDelay(
clientOptions: Options,
requestOptions: requestOptions,
response: null,
attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::HeyGen.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
Expand All @@ -186,6 +210,8 @@ partial void ProcessV1AssetUploadResponse(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
Expand All @@ -195,8 +221,7 @@ partial void ProcessV1AssetUploadResponse(
__httpRequest.Dispose();
__httpRequest = null;
await global::HeyGen.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
clientOptions: Options,
requestOptions: requestOptions,
retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
Expand All @@ -205,6 +230,11 @@ partial void ProcessV1AssetUploadResponse(
__attempt < __maxAttempts &&
global::HeyGen.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
var __retryDelay = global::HeyGen.AutoSDKRequestOptionsSupport.GetRetryDelay(
clientOptions: Options,
requestOptions: requestOptions,
response: __response,
attempt: __attempt);
await global::HeyGen.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::HeyGen.AutoSDKRequestOptionsSupport.CreateHookContext(
Expand All @@ -221,14 +251,15 @@ partial void ProcessV1AssetUploadResponse(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
retryDelay: __retryDelay,
retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::HeyGen.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
clientOptions: Options,
requestOptions: requestOptions,
retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
Expand Down Expand Up @@ -268,6 +299,8 @@ partial void ProcessV1AssetUploadResponse(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
retryDelay: null,
retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
Expand All @@ -288,6 +321,8 @@ partial void ProcessV1AssetUploadResponse(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
retryDelay: null,
retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}

Expand All @@ -308,6 +343,10 @@ partial void ProcessV1AssetUploadResponse(
{
__response.EnsureSuccessStatusCode();

return new global::HeyGen.AutoSDKHttpResponse(
statusCode: __response.StatusCode,
headers: global::HeyGen.AutoSDKHttpResponse.CreateHeaders(__response),
requestUri: __response.RequestMessage?.RequestUri);
}
catch (global::System.Exception __ex)
{
Expand All @@ -329,6 +368,10 @@ partial void ProcessV1AssetUploadResponse(
try
{
__response.EnsureSuccessStatusCode();
return new global::HeyGen.AutoSDKHttpResponse(
statusCode: __response.StatusCode,
headers: global::HeyGen.AutoSDKHttpResponse.CreateHeaders(__response),
requestUri: __response.RequestMessage?.RequestUri);
}
catch (global::System.Exception __ex)
{
Expand Down
8 changes: 4 additions & 4 deletions src/libs/HeyGen/Generated/HeyGen.AssetsClient.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ public AssetsClient(
/// <param name="options">Client-wide request defaults such as headers, query parameters, retries, and timeout.</param>
/// <param name="disposeHttpClient">Dispose the HttpClient when the instance is disposed. True by default.</param>
public AssetsClient(
global::System.Net.Http.HttpClient? httpClient = null,
global::System.Uri? baseUri = null,
global::System.Collections.Generic.List<global::HeyGen.EndPointAuthorization>? authorizations = null,
global::HeyGen.AutoSDKClientOptions? options = null,
global::System.Net.Http.HttpClient? httpClient,
global::System.Uri? baseUri,
global::System.Collections.Generic.List<global::HeyGen.EndPointAuthorization>? authorizations,
global::HeyGen.AutoSDKClientOptions? options,
bool disposeHttpClient = true)
{

Expand Down
121 changes: 121 additions & 0 deletions src/libs/HeyGen/Generated/HeyGen.AutoSDKHttpResponse.g.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@

#nullable enable

namespace HeyGen
{
/// <summary>
/// Represents a successful HTTP response with status code and headers.
/// </summary>
public partial class AutoSDKHttpResponse
{
/// <summary>
/// Initializes a new instance of the <see cref="AutoSDKHttpResponse"/> class.
/// </summary>
public AutoSDKHttpResponse(
global::System.Net.HttpStatusCode statusCode,
global::System.Collections.Generic.Dictionary<string, global::System.Collections.Generic.IEnumerable<string>> headers)
: this(
statusCode: statusCode,
headers: headers,
requestUri: null)
{
}

/// <summary>
/// Initializes a new instance of the <see cref="AutoSDKHttpResponse"/> class.
/// </summary>
public AutoSDKHttpResponse(
global::System.Net.HttpStatusCode statusCode,
global::System.Collections.Generic.Dictionary<string, global::System.Collections.Generic.IEnumerable<string>> headers,
global::System.Uri? requestUri)
{
StatusCode = statusCode;
Headers = headers ?? throw new global::System.ArgumentNullException(nameof(headers));
RequestUri = requestUri;
}

/// <summary>
/// Gets the HTTP status code.
/// </summary>
public global::System.Net.HttpStatusCode StatusCode { get; }
/// <summary>
/// Gets the response headers.
/// </summary>
public global::System.Collections.Generic.Dictionary<string, global::System.Collections.Generic.IEnumerable<string>> Headers { get; }
/// <summary>
/// Gets the final request URI associated with the response.
/// </summary>
public global::System.Uri? RequestUri { get; }

internal static global::System.Collections.Generic.Dictionary<string, global::System.Collections.Generic.IEnumerable<string>> CreateHeaders(
global::System.Net.Http.HttpResponseMessage response)
{
response = response ?? throw new global::System.ArgumentNullException(nameof(response));

var headers = global::System.Linq.Enumerable.ToDictionary(
response.Headers,
static header => header.Key,
static header => (global::System.Collections.Generic.IEnumerable<string>)global::System.Linq.Enumerable.ToArray(header.Value),
global::System.StringComparer.OrdinalIgnoreCase);

if (response.Content?.Headers == null)
{
return headers;
}

foreach (var header in response.Content.Headers)
{
if (headers.TryGetValue(header.Key, out var existingValues))
{
headers[header.Key] = global::System.Linq.Enumerable.ToArray(
global::System.Linq.Enumerable.Concat(existingValues, header.Value));
}
else
{
headers[header.Key] = global::System.Linq.Enumerable.ToArray(header.Value);
}
}

return headers;
}
}

/// <summary>
/// Represents a successful HTTP response with status code, headers, and body.
/// </summary>
public partial class AutoSDKHttpResponse<T> : AutoSDKHttpResponse
{
/// <summary>
/// Initializes a new instance of the <see cref="AutoSDKHttpResponse{T}"/> class.
/// </summary>
public AutoSDKHttpResponse(
global::System.Net.HttpStatusCode statusCode,
global::System.Collections.Generic.Dictionary<string, global::System.Collections.Generic.IEnumerable<string>> headers,
T body)
: this(
statusCode: statusCode,
headers: headers,
requestUri: null,
body: body)
{
}

/// <summary>
/// Initializes a new instance of the <see cref="AutoSDKHttpResponse{T}"/> class.
/// </summary>
public AutoSDKHttpResponse(
global::System.Net.HttpStatusCode statusCode,
global::System.Collections.Generic.Dictionary<string, global::System.Collections.Generic.IEnumerable<string>> headers,
global::System.Uri? requestUri,
T body)
: base(statusCode, headers, requestUri)
{
Body = body;
}

/// <summary>
/// Gets the response body.
/// </summary>
public T Body { get; }
}
}
Loading