Skip to content

Commit

Permalink
Merge pull request #29 from tryAGI/bot/update-openapi_202408121821
Browse files Browse the repository at this point in the history
feat:Updated OpenAPI spec
  • Loading branch information
HavenDV authored Aug 12, 2024
2 parents 8b0f043 + d11f17c commit 1c8d06a
Show file tree
Hide file tree
Showing 5 changed files with 312 additions and 89 deletions.
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

0 comments on commit 1c8d06a

Please sign in to comment.