Skip to content

Commit

Permalink
feat: Updated OpenAPI spec
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Nov 20, 2024
1 parent d1c1a84 commit f04ac3c
Show file tree
Hide file tree
Showing 10 changed files with 934 additions and 50 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@

#nullable enable

namespace DeepInfra
{
public partial class DeepInfraApi
{
partial void PrepareDeleteLoraModelArguments(
global::System.Net.Http.HttpClient httpClient,
ref string loraModelName,
ref string? xiApiKey);
partial void PrepareDeleteLoraModelRequest(
global::System.Net.Http.HttpClient httpClient,
global::System.Net.Http.HttpRequestMessage httpRequestMessage,
string loraModelName,
string? xiApiKey);
partial void ProcessDeleteLoraModelResponse(
global::System.Net.Http.HttpClient httpClient,
global::System.Net.Http.HttpResponseMessage httpResponseMessage);

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

/// <summary>
/// Delete Lora Model
/// </summary>
/// <param name="loraModelName"></param>
/// <param name="xiApiKey"></param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::DeepInfra.ApiException"></exception>
public async global::System.Threading.Tasks.Task<string> DeleteLoraModelAsync(
string loraModelName,
string? xiApiKey = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
client: HttpClient);
PrepareDeleteLoraModelArguments(
httpClient: HttpClient,
loraModelName: ref loraModelName,
xiApiKey: ref xiApiKey);

var __pathBuilder = new PathBuilder(
path: $"/lora-model/{loraModelName}",
baseUri: HttpClient.BaseAddress);
var __path = __pathBuilder.ToString();
using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
method: global::System.Net.Http.HttpMethod.Delete,
requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));

foreach (var __authorization in Authorizations)
{
if (__authorization.Type == "Http" ||
__authorization.Type == "OAuth2")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
parameter: __authorization.Value);
}
else if (__authorization.Type == "ApiKey" &&
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
}
}

if (xiApiKey != default)
{
__httpRequest.Headers.TryAddWithoutValidation("xi-api-key", xiApiKey.ToString());
}


PrepareRequest(
client: HttpClient,
request: __httpRequest);
PrepareDeleteLoraModelRequest(
httpClient: HttpClient,
httpRequestMessage: __httpRequest,
loraModelName: loraModelName,
xiApiKey: xiApiKey);

using var __response = await HttpClient.SendAsync(
request: __httpRequest,
completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
cancellationToken: cancellationToken).ConfigureAwait(false);

ProcessResponse(
client: HttpClient,
response: __response);
ProcessDeleteLoraModelResponse(
httpClient: HttpClient,
httpResponseMessage: __response);
// Bad Request
if ((int)__response.StatusCode == 400)
{
string? __content_400 = null;
global::DeepInfra.DeepError? __value_400 = null;
if (ReadResponseAsString)
{
__content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
__value_400 = global::DeepInfra.DeepError.FromJson(__content_400, JsonSerializerContext);
}
else
{
var __contentStream_400 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
__value_400 = await global::DeepInfra.DeepError.FromJsonStreamAsync(__contentStream_400, JsonSerializerContext).ConfigureAwait(false);
}

throw new global::DeepInfra.ApiException<global::DeepInfra.DeepError>(
message: __response.ReasonPhrase ?? string.Empty,
statusCode: __response.StatusCode)
{
ResponseBody = __content_400,
ResponseObject = __value_400,
ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
__response.Headers,
h => h.Key,
h => h.Value),
};
}
// Validation Error
if ((int)__response.StatusCode == 422)
{
string? __content_422 = null;
global::DeepInfra.HTTPValidationError? __value_422 = null;
if (ReadResponseAsString)
{
__content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
__value_422 = global::DeepInfra.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
}
else
{
var __contentStream_422 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
__value_422 = await global::DeepInfra.HTTPValidationError.FromJsonStreamAsync(__contentStream_422, JsonSerializerContext).ConfigureAwait(false);
}

throw new global::DeepInfra.ApiException<global::DeepInfra.HTTPValidationError>(
message: __response.ReasonPhrase ?? string.Empty,
statusCode: __response.StatusCode)
{
ResponseBody = __content_422,
ResponseObject = __value_422,
ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
__response.Headers,
h => h.Key,
h => h.Value),
};
}

if (ReadResponseAsString)
{
var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);

ProcessResponseContent(
client: HttpClient,
response: __response,
content: ref __content);
ProcessDeleteLoraModelResponseContent(
httpClient: HttpClient,
httpResponseMessage: __response,
content: ref __content);

try
{
__response.EnsureSuccessStatusCode();
}
catch (global::System.Net.Http.HttpRequestException __ex)
{
throw new global::DeepInfra.ApiException(
message: __content ?? __response.ReasonPhrase ?? string.Empty,
innerException: __ex,
statusCode: __response.StatusCode)
{
ResponseBody = __content,
ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
__response.Headers,
h => h.Key,
h => h.Value),
};
}

return __content;
}
else
{
try
{
__response.EnsureSuccessStatusCode();
}
catch (global::System.Net.Http.HttpRequestException __ex)
{
throw new global::DeepInfra.ApiException(
message: __response.ReasonPhrase ?? string.Empty,
innerException: __ex,
statusCode: __response.StatusCode)
{
ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
__response.Headers,
h => h.Key,
h => h.Value),
};
}

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

return __content;
}
}
}
}
Loading

0 comments on commit f04ac3c

Please sign in to comment.