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
37 changes: 36 additions & 1 deletion src/libs/Picsart/Generated/Picsart.AutoSDKHttpResponse.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,24 @@ public partial class AutoSDKHttpResponse
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>
Expand All @@ -27,6 +42,10 @@ public AutoSDKHttpResponse(
/// 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)
Expand Down Expand Up @@ -73,7 +92,23 @@ public AutoSDKHttpResponse(
global::System.Net.HttpStatusCode statusCode,
global::System.Collections.Generic.Dictionary<string, global::System.Collections.Generic.IEnumerable<string>> headers,
T body)
: base(statusCode, headers)
: 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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,11 @@ partial void ProcessGenaiExpandImageResponseContent(
var __maxAttempts = global::Picsart.AutoSDKRequestOptionsSupport.GetMaxAttempts(
clientOptions: Options,
requestOptions: requestOptions,
supportsRetry: true);
supportsRetry: false);

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

var __pathBuilder = new global::Picsart.PathBuilder(
path: "/genai/painting/expand",
baseUri: HttpClient.BaseAddress);
Expand Down Expand Up @@ -142,8 +143,11 @@ partial void ProcessGenaiExpandImageResponseContent(
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
}
}

var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent();

__httpRequest.Content = __httpRequestContent;

global::Picsart.AutoSDKRequestOptionsSupport.ApplyHeaders(
request: __httpRequest,
clientHeaders: Options.Headers,
Expand Down Expand Up @@ -185,6 +189,8 @@ partial void ProcessGenaiExpandImageResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
retryDelay: null,
retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
Expand All @@ -195,6 +201,11 @@ partial void ProcessGenaiExpandImageResponseContent(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
var __retryDelay = global::Picsart.AutoSDKRequestOptionsSupport.GetRetryDelay(
clientOptions: Options,
requestOptions: requestOptions,
response: null,
attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::Picsart.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
Expand All @@ -212,6 +223,8 @@ partial void ProcessGenaiExpandImageResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
Expand All @@ -221,8 +234,7 @@ partial void ProcessGenaiExpandImageResponseContent(
__httpRequest.Dispose();
__httpRequest = null;
await global::Picsart.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
clientOptions: Options,
requestOptions: requestOptions,
retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
Expand All @@ -231,6 +243,11 @@ partial void ProcessGenaiExpandImageResponseContent(
__attempt < __maxAttempts &&
global::Picsart.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
var __retryDelay = global::Picsart.AutoSDKRequestOptionsSupport.GetRetryDelay(
clientOptions: Options,
requestOptions: requestOptions,
response: __response,
attempt: __attempt);
await global::Picsart.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::Picsart.AutoSDKRequestOptionsSupport.CreateHookContext(
Expand All @@ -247,14 +264,15 @@ partial void ProcessGenaiExpandImageResponseContent(
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::Picsart.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
clientOptions: Options,
requestOptions: requestOptions,
retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
Expand Down Expand Up @@ -294,6 +312,8 @@ partial void ProcessGenaiExpandImageResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
retryDelay: null,
retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
Expand All @@ -314,6 +334,8 @@ partial void ProcessGenaiExpandImageResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
retryDelay: null,
retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
// Bad Request
Expand Down Expand Up @@ -799,6 +821,7 @@ partial void ProcessGenaiExpandImageResponseContent(
return new global::Picsart.AutoSDKHttpResponse<global::Picsart.GenaiExpandImageResponse>(
statusCode: __response.StatusCode,
headers: global::Picsart.AutoSDKHttpResponse.CreateHeaders(__response),
requestUri: __response.RequestMessage?.RequestUri,
body: __value);
}
catch (global::System.Exception __ex)
Expand Down Expand Up @@ -832,6 +855,7 @@ partial void ProcessGenaiExpandImageResponseContent(
return new global::Picsart.AutoSDKHttpResponse<global::Picsart.GenaiExpandImageResponse>(
statusCode: __response.StatusCode,
headers: global::Picsart.AutoSDKHttpResponse.CreateHeaders(__response),
requestUri: __response.RequestMessage?.RequestUri,
body: __value);
}
catch (global::System.Exception __ex)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,11 @@ partial void ProcessGenaiGenerateImageBleedResponseContent(
var __maxAttempts = global::Picsart.AutoSDKRequestOptionsSupport.GetMaxAttempts(
clientOptions: Options,
requestOptions: requestOptions,
supportsRetry: true);
supportsRetry: false);

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

var __pathBuilder = new global::Picsart.PathBuilder(
path: "/genai/painting/bleed",
baseUri: HttpClient.BaseAddress);
Expand Down Expand Up @@ -140,8 +141,11 @@ partial void ProcessGenaiGenerateImageBleedResponseContent(
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
}
}

var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent();

__httpRequest.Content = __httpRequestContent;

global::Picsart.AutoSDKRequestOptionsSupport.ApplyHeaders(
request: __httpRequest,
clientHeaders: Options.Headers,
Expand Down Expand Up @@ -183,6 +187,8 @@ partial void ProcessGenaiGenerateImageBleedResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
retryDelay: null,
retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
Expand All @@ -193,6 +199,11 @@ partial void ProcessGenaiGenerateImageBleedResponseContent(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
var __retryDelay = global::Picsart.AutoSDKRequestOptionsSupport.GetRetryDelay(
clientOptions: Options,
requestOptions: requestOptions,
response: null,
attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::Picsart.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
Expand All @@ -210,6 +221,8 @@ partial void ProcessGenaiGenerateImageBleedResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
Expand All @@ -219,8 +232,7 @@ partial void ProcessGenaiGenerateImageBleedResponseContent(
__httpRequest.Dispose();
__httpRequest = null;
await global::Picsart.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
clientOptions: Options,
requestOptions: requestOptions,
retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
Expand All @@ -229,6 +241,11 @@ partial void ProcessGenaiGenerateImageBleedResponseContent(
__attempt < __maxAttempts &&
global::Picsart.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
var __retryDelay = global::Picsart.AutoSDKRequestOptionsSupport.GetRetryDelay(
clientOptions: Options,
requestOptions: requestOptions,
response: __response,
attempt: __attempt);
await global::Picsart.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::Picsart.AutoSDKRequestOptionsSupport.CreateHookContext(
Expand All @@ -245,14 +262,15 @@ partial void ProcessGenaiGenerateImageBleedResponseContent(
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::Picsart.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
clientOptions: Options,
requestOptions: requestOptions,
retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
Expand Down Expand Up @@ -292,6 +310,8 @@ partial void ProcessGenaiGenerateImageBleedResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
retryDelay: null,
retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
Expand All @@ -312,6 +332,8 @@ partial void ProcessGenaiGenerateImageBleedResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
retryDelay: null,
retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
// Bad Request
Expand Down Expand Up @@ -797,6 +819,7 @@ partial void ProcessGenaiGenerateImageBleedResponseContent(
return new global::Picsart.AutoSDKHttpResponse<global::Picsart.GenaiGenerateImageBleedResponse>(
statusCode: __response.StatusCode,
headers: global::Picsart.AutoSDKHttpResponse.CreateHeaders(__response),
requestUri: __response.RequestMessage?.RequestUri,
body: __value);
}
catch (global::System.Exception __ex)
Expand Down Expand Up @@ -830,6 +853,7 @@ partial void ProcessGenaiGenerateImageBleedResponseContent(
return new global::Picsart.AutoSDKHttpResponse<global::Picsart.GenaiGenerateImageBleedResponse>(
statusCode: __response.StatusCode,
headers: global::Picsart.AutoSDKHttpResponse.CreateHeaders(__response),
requestUri: __response.RequestMessage?.RequestUri,
body: __value);
}
catch (global::System.Exception __ex)
Expand Down
Loading