Skip to content

Commit

Permalink
Merge pull request #98 from tryAGI/bot/update-openapi_202412161519
Browse files Browse the repository at this point in the history
feat:Enhance DeepInfra OpenAPI with Improved Error Handling and New Endpoint
  • Loading branch information
github-actions[bot] authored Dec 16, 2024
2 parents 971522c + bff5f1d commit 915d282
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,34 @@ partial void ProcessInferenceDeployResponseContent(
ProcessInferenceDeployResponse(
httpClient: HttpClient,
httpResponseMessage: __response);
// Forbidden
if ((int)__response.StatusCode == 403)
{
string? __content_403 = null;
global::DeepInfra.DeepError? __value_403 = null;
if (ReadResponseAsString)
{
__content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
__value_403 = global::DeepInfra.DeepError.FromJson(__content_403, JsonSerializerContext);
}
else
{
var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
__value_403 = await global::DeepInfra.DeepError.FromJsonStreamAsync(__contentStream_403, JsonSerializerContext).ConfigureAwait(false);
}

throw new global::DeepInfra.ApiException<global::DeepInfra.DeepError>(
message: __response.ReasonPhrase ?? string.Empty,
statusCode: __response.StatusCode)
{
ResponseBody = __content_403,
ResponseObject = __value_403,
ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
__response.Headers,
h => h.Key,
h => h.Value),
};
}
// Not Found
if ((int)__response.StatusCode == 404)
{
Expand Down
6 changes: 6 additions & 0 deletions src/libs/DeepInfra/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1211,6 +1211,12 @@ paths:
content:
application/json:
schema: { }
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/DeepError'
'404':
description: Not Found
content:
Expand Down

0 comments on commit 915d282

Please sign in to comment.