Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:Updated OpenAPI spec #29

Merged
merged 1 commit into from
Aug 12, 2024
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@

#nullable enable

namespace DeepInfra
{
public partial class DeepInfraApi
{
partial void PrepareAccountSetUsernameV1MeUsernamePatchArguments(
global::System.Net.Http.HttpClient httpClient,
global::DeepInfra.MeUsername request);
partial void PrepareAccountSetUsernameV1MeUsernamePatchRequest(
global::System.Net.Http.HttpClient httpClient,
global::System.Net.Http.HttpRequestMessage httpRequestMessage,
global::DeepInfra.MeUsername request);
partial void ProcessAccountSetUsernameV1MeUsernamePatchResponse(
global::System.Net.Http.HttpClient httpClient,
global::System.Net.Http.HttpResponseMessage httpResponseMessage);

partial void ProcessAccountSetUsernameV1MeUsernamePatchResponseContent(
global::System.Net.Http.HttpClient httpClient,
global::System.Net.Http.HttpResponseMessage httpResponseMessage,
ref string content);

/// <summary>
/// Account Set Username
/// </summary>
/// <param name="request"></param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<global::DeepInfra.AccountSetUsernameV1MeUsernamePatchResponse> AccountSetUsernameV1MeUsernamePatchAsync(
global::DeepInfra.MeUsername request,
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));

PrepareArguments(
client: _httpClient);
PrepareAccountSetUsernameV1MeUsernamePatchArguments(
httpClient: _httpClient,
request: request);

using var httpRequest = new global::System.Net.Http.HttpRequestMessage(
method: new global::System.Net.Http.HttpMethod("PATCH"),
requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + "/v1/me/username", global::System.UriKind.RelativeOrAbsolute));
var __httpRequestContent = new global::System.Net.Http.StringContent(
content: global::System.Text.Json.JsonSerializer.Serialize(request, global::DeepInfra.SourceGenerationContext.Default.MeUsername),
encoding: global::System.Text.Encoding.UTF8,
mediaType: "application/json");
httpRequest.Content = __httpRequestContent;

PrepareRequest(
client: _httpClient,
request: httpRequest);
PrepareAccountSetUsernameV1MeUsernamePatchRequest(
httpClient: _httpClient,
httpRequestMessage: httpRequest,
request: request);

using var response = await _httpClient.SendAsync(
request: httpRequest,
completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
cancellationToken: cancellationToken).ConfigureAwait(false);

ProcessResponse(
client: _httpClient,
response: response);
ProcessAccountSetUsernameV1MeUsernamePatchResponse(
httpClient: _httpClient,
httpResponseMessage: response);

var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);

ProcessResponseContent(
client: _httpClient,
response: response,
content: ref __content);
ProcessAccountSetUsernameV1MeUsernamePatchResponseContent(
httpClient: _httpClient,
httpResponseMessage: response,
content: ref __content);

try
{
response.EnsureSuccessStatusCode();
}
catch (global::System.Net.Http.HttpRequestException ex)
{
throw new global::System.InvalidOperationException(__content, ex);
}

return
global::System.Text.Json.JsonSerializer.Deserialize(__content, global::DeepInfra.SourceGenerationContext.Default.AccountSetUsernameV1MeUsernamePatchResponse) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
}

/// <summary>
/// Account Set Username
/// </summary>
/// <param name="username">
/// String with length between 1 and 39 characters. Only alphanumeric characters and dashes allowed. Must contain no leading, trailing or consecutive dashes.
/// </param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<global::DeepInfra.AccountSetUsernameV1MeUsernamePatchResponse> AccountSetUsernameV1MeUsernamePatchAsync(
string username,
global::System.Threading.CancellationToken cancellationToken = default)
{
var request = new global::DeepInfra.MeUsername
{
Username = username,
};

return await AccountSetUsernameV1MeUsernamePatchAsync(
request: request,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

#nullable enable

namespace DeepInfra
{
/// <summary>
///
/// </summary>
public sealed partial class AccountSetUsernameV1MeUsernamePatchResponse
{

/// <summary>
/// Additional properties that are not explicitly defined in the schema
/// </summary>
[global::System.Text.Json.Serialization.JsonExtensionData]
public global::System.Collections.Generic.IDictionary<string, object> AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary<string, object>();
}
}
24 changes: 24 additions & 0 deletions src/libs/DeepInfra/Generated/DeepInfra.Models.MeUsername.g.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

#nullable enable

namespace DeepInfra
{
/// <summary>
///
/// </summary>
public sealed partial class MeUsername
{
/// <summary>
/// String with length between 1 and 39 characters. Only alphanumeric characters and dashes allowed. Must contain no leading, trailing or consecutive dashes.
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("username")]
[global::System.Text.Json.Serialization.JsonRequired]
public required string Username { get; set; }

/// <summary>
/// Additional properties that are not explicitly defined in the schema
/// </summary>
[global::System.Text.Json.Serialization.JsonExtensionData]
public global::System.Collections.Generic.IDictionary<string, object> AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary<string, object>();
}
}
Loading
Loading