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:Update OpenAPI Specification with New Endpoints and Response Schemas #59

Merged
merged 1 commit into from
Nov 29, 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
15 changes: 4 additions & 11 deletions src/libs/Instill/Generated/Instill.ArtifactClient.ListChunks.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,13 @@ partial void PrepareListChunksArguments(
global::System.Net.Http.HttpClient httpClient,
ref string namespaceId,
ref string catalogId,
ref string? fileUid,
global::System.Collections.Generic.IList<string>? chunkUids);
ref string? fileUid);
partial void PrepareListChunksRequest(
global::System.Net.Http.HttpClient httpClient,
global::System.Net.Http.HttpRequestMessage httpRequestMessage,
string namespaceId,
string catalogId,
string? fileUid,
global::System.Collections.Generic.IList<string>? chunkUids);
string? fileUid);
partial void ProcessListChunksResponse(
global::System.Net.Http.HttpClient httpClient,
global::System.Net.Http.HttpResponseMessage httpResponseMessage);
Expand All @@ -34,15 +32,13 @@ partial void ProcessListChunksResponseContent(
/// <param name="namespaceId"></param>
/// <param name="catalogId"></param>
/// <param name="fileUid"></param>
/// <param name="chunkUids"></param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::Instill.ApiException"></exception>
[global::System.Diagnostics.CodeAnalysis.Experimental(diagnosticId: "INSTILL_BETA_001")]
public async global::System.Threading.Tasks.Task<global::Instill.ListChunksResponse> ListChunksAsync(
string namespaceId,
string catalogId,
string? fileUid = default,
global::System.Collections.Generic.IList<string>? chunkUids = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
Expand All @@ -51,15 +47,13 @@ partial void ProcessListChunksResponseContent(
httpClient: HttpClient,
namespaceId: ref namespaceId,
catalogId: ref catalogId,
fileUid: ref fileUid,
chunkUids: chunkUids);
fileUid: ref fileUid);

var __pathBuilder = new PathBuilder(
path: $"/v1alpha/namespaces/{namespaceId}/catalogs/{catalogId}/chunks",
baseUri: HttpClient.BaseAddress);
__pathBuilder
.AddOptionalParameter("fileUid", fileUid)
.AddOptionalParameter("chunkUids", chunkUids, delimiter: ",", explode: true)
;
var __path = __pathBuilder.ToString();
using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
Expand Down Expand Up @@ -94,8 +88,7 @@ partial void ProcessListChunksResponseContent(
httpRequestMessage: __httpRequest,
namespaceId: namespaceId,
catalogId: catalogId,
fileUid: fileUid,
chunkUids: chunkUids);
fileUid: fileUid);

using var __response = await HttpClient.SendAsync(
request: __httpRequest,
Expand Down
219 changes: 219 additions & 0 deletions src/libs/Instill/Generated/Instill.ArtifactClient.SearchChunks.g.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,219 @@

#nullable enable

namespace Instill
{
public partial class ArtifactClient
{
partial void PrepareSearchChunksArguments(
global::System.Net.Http.HttpClient httpClient,
ref string namespaceId,
global::System.Collections.Generic.IList<string>? chunkUids);
partial void PrepareSearchChunksRequest(
global::System.Net.Http.HttpClient httpClient,
global::System.Net.Http.HttpRequestMessage httpRequestMessage,
string namespaceId,
global::System.Collections.Generic.IList<string>? chunkUids);
partial void ProcessSearchChunksResponse(
global::System.Net.Http.HttpClient httpClient,
global::System.Net.Http.HttpResponseMessage httpResponseMessage);

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

/// <summary>
/// Search catalog chunks<br/>
/// Returns a paginated list of catalog chunks based on search criteria.
/// </summary>
/// <param name="namespaceId"></param>
/// <param name="chunkUids"></param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::Instill.ApiException"></exception>
[global::System.Diagnostics.CodeAnalysis.Experimental(diagnosticId: "INSTILL_BETA_001")]
public async global::System.Threading.Tasks.Task<global::Instill.SearchChunksResponse> SearchChunksAsync(
string namespaceId,
global::System.Collections.Generic.IList<string>? chunkUids = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
client: HttpClient);
PrepareSearchChunksArguments(
httpClient: HttpClient,
namespaceId: ref namespaceId,
chunkUids: chunkUids);

var __pathBuilder = new PathBuilder(
path: $"/v1alpha/namespaces/{namespaceId}/chunks",
baseUri: HttpClient.BaseAddress);
__pathBuilder
.AddOptionalParameter("chunkUids", chunkUids, delimiter: ",", explode: true)
;
var __path = __pathBuilder.ToString();
using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
method: global::System.Net.Http.HttpMethod.Get,
requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
#if NET6_0_OR_GREATER
__httpRequest.Version = global::System.Net.HttpVersion.Version11;
__httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif

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);
}
}

PrepareRequest(
client: HttpClient,
request: __httpRequest);
PrepareSearchChunksRequest(
httpClient: HttpClient,
httpRequestMessage: __httpRequest,
namespaceId: namespaceId,
chunkUids: chunkUids);

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

ProcessResponse(
client: HttpClient,
response: __response);
ProcessSearchChunksResponse(
httpClient: HttpClient,
httpResponseMessage: __response);
// Returned when the client credentials are not valid.
if ((int)__response.StatusCode == 401)
{
string? __content_401 = null;
string? __value_401 = null;
if (ReadResponseAsString)
{
__content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
__value_401 = global::System.Text.Json.JsonSerializer.Deserialize(__content_401, typeof(string), JsonSerializerContext) as string;
}
else
{
var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
__value_401 = await global::System.Text.Json.JsonSerializer.DeserializeAsync(__contentStream_401, typeof(string), JsonSerializerContext).ConfigureAwait(false) as string;
}

throw new global::Instill.ApiException<string>(
message: __response.ReasonPhrase ?? string.Empty,
statusCode: __response.StatusCode)
{
ResponseBody = __content_401,
ResponseObject = __value_401,
ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
__response.Headers,
h => h.Key,
h => h.Value),
};
}
// An unexpected error response.
if (!__response.IsSuccessStatusCode)
{
string? __content_default = null;
global::Instill.RpcStatus? __value_default = null;
if (ReadResponseAsString)
{
__content_default = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
__value_default = global::Instill.RpcStatus.FromJson(__content_default, JsonSerializerContext);
}
else
{
var __contentStream_default = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
__value_default = await global::Instill.RpcStatus.FromJsonStreamAsync(__contentStream_default, JsonSerializerContext).ConfigureAwait(false);
}

throw new global::Instill.ApiException<global::Instill.RpcStatus>(
message: __response.ReasonPhrase ?? string.Empty,
statusCode: __response.StatusCode)
{
ResponseBody = __content_default,
ResponseObject = __value_default,
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);
ProcessSearchChunksResponseContent(
httpClient: HttpClient,
httpResponseMessage: __response,
content: ref __content);

try
{
__response.EnsureSuccessStatusCode();
}
catch (global::System.Net.Http.HttpRequestException __ex)
{
throw new global::Instill.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
global::Instill.SearchChunksResponse.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
}
else
{
try
{
__response.EnsureSuccessStatusCode();
}
catch (global::System.Net.Http.HttpRequestException __ex)
{
throw new global::Instill.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),
};
}

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

return
await global::Instill.SearchChunksResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
}
}
}
}
Loading
Loading