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/Writer/Generated/Writer.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 @@ -57,6 +57,31 @@ partial void ProcessGatewayDeleteFileResponseContent(
string fileId,
global::Writer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __response = await GatewayDeleteFileAsResponseAsync(
fileId: fileId,
requestOptions: requestOptions,
cancellationToken: cancellationToken
).ConfigureAwait(false);

return __response.Body;
}
/// <summary>
/// Delete file<br/>
/// Permanently delete a file from the system. This action cannot be undone.
/// </summary>
/// <param name="fileId"></param>
/// <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::Writer.ApiException"></exception>
/// <remarks>
/// curl --location --request DELETE https://api.writer.com/v1/files/{file_id} \<br/>
/// --header "Authorization: Bearer &lt;token&gt;"
/// </remarks>
public async global::System.Threading.Tasks.Task<global::Writer.AutoSDKHttpResponse<global::Writer.DeleteFileResponse>> GatewayDeleteFileAsResponseAsync(
string fileId,
global::Writer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
client: HttpClient);
Expand Down Expand Up @@ -86,6 +111,7 @@ partial void ProcessGatewayDeleteFileResponseContent(

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

var __pathBuilder = new global::Writer.PathBuilder(
path: $"/v1/files/{fileId}",
baseUri: HttpClient.BaseAddress);
Expand Down Expand Up @@ -159,6 +185,8 @@ partial void ProcessGatewayDeleteFileResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
retryDelay: null,
retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
Expand All @@ -169,6 +197,11 @@ partial void ProcessGatewayDeleteFileResponseContent(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
var __retryDelay = global::Writer.AutoSDKRequestOptionsSupport.GetRetryDelay(
clientOptions: Options,
requestOptions: requestOptions,
response: null,
attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::Writer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
Expand All @@ -186,6 +219,8 @@ partial void ProcessGatewayDeleteFileResponseContent(
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 +230,7 @@ partial void ProcessGatewayDeleteFileResponseContent(
__httpRequest.Dispose();
__httpRequest = null;
await global::Writer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
clientOptions: Options,
requestOptions: requestOptions,
retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
Expand All @@ -205,6 +239,11 @@ partial void ProcessGatewayDeleteFileResponseContent(
__attempt < __maxAttempts &&
global::Writer.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
var __retryDelay = global::Writer.AutoSDKRequestOptionsSupport.GetRetryDelay(
clientOptions: Options,
requestOptions: requestOptions,
response: __response,
attempt: __attempt);
await global::Writer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::Writer.AutoSDKRequestOptionsSupport.CreateHookContext(
Expand All @@ -221,14 +260,15 @@ partial void ProcessGatewayDeleteFileResponseContent(
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::Writer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
clientOptions: Options,
requestOptions: requestOptions,
retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
Expand Down Expand Up @@ -268,6 +308,8 @@ partial void ProcessGatewayDeleteFileResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
retryDelay: null,
retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
Expand All @@ -288,6 +330,8 @@ partial void ProcessGatewayDeleteFileResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
retryDelay: null,
retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}

Expand All @@ -312,9 +356,13 @@ partial void ProcessGatewayDeleteFileResponseContent(
{
__response.EnsureSuccessStatusCode();

return
global::Writer.DeleteFileResponse.FromJson(__content, JsonSerializerContext) ??
var __value = global::Writer.DeleteFileResponse.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
return new global::Writer.AutoSDKHttpResponse<global::Writer.DeleteFileResponse>(
statusCode: __response.StatusCode,
headers: global::Writer.AutoSDKHttpResponse.CreateHeaders(__response),
requestUri: __response.RequestMessage?.RequestUri,
body: __value);
}
catch (global::System.Exception __ex)
{
Expand Down Expand Up @@ -342,9 +390,13 @@ partial void ProcessGatewayDeleteFileResponseContent(
#endif
).ConfigureAwait(false);

return
await global::Writer.DeleteFileResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
var __value = await global::Writer.DeleteFileResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
return new global::Writer.AutoSDKHttpResponse<global::Writer.DeleteFileResponse>(
statusCode: __response.StatusCode,
headers: global::Writer.AutoSDKHttpResponse.CreateHeaders(__response),
requestUri: __response.RequestMessage?.RequestUri,
body: __value);
}
catch (global::System.Exception __ex)
{
Expand Down
Loading
Loading