Skip to content

Commit

Permalink
feat: Updated code to new PathBuilder.
Browse files Browse the repository at this point in the history
  • Loading branch information
HavenDV committed Sep 20, 2024
1 parent 392b4f0 commit b391057
Show file tree
Hide file tree
Showing 93 changed files with 634 additions and 175 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,13 @@ partial void ProcessCreateCatalogResponseContent(
namespaceId: ref namespaceId,
request: request);

var __pathBuilder = new PathBuilder(
path: $"/v1alpha/namespaces/{namespaceId}/catalogs",
baseUri: _httpClient.BaseAddress);
var __path = __pathBuilder.ToString();
using var httpRequest = new global::System.Net.Http.HttpRequestMessage(
method: global::System.Net.Http.HttpMethod.Post,
requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + $"/v1alpha/namespaces/{namespaceId}/catalogs", global::System.UriKind.RelativeOrAbsolute));
requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, request.GetType(), JsonSerializerContext);
var __httpRequestContent = new global::System.Net.Http.StringContent(
content: __httpRequestContentBody,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,13 @@ partial void ProcessDeleteCatalogResponseContent(
namespaceId: ref namespaceId,
catalogId: ref catalogId);

var __pathBuilder = new PathBuilder(
path: $"/v1alpha/namespaces/{namespaceId}/catalogs/{catalogId}",
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(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + $"/v1alpha/namespaces/{namespaceId}/catalogs/{catalogId}", global::System.UriKind.RelativeOrAbsolute));
requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));

PrepareRequest(
client: _httpClient,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,16 @@ partial void ProcessDeleteCatalogFileResponseContent(
httpClient: _httpClient,
fileUid: ref fileUid);

var __pathBuilder = new PathBuilder(
path: "/v1alpha/catalogs/files",
baseUri: _httpClient.BaseAddress);
__pathBuilder
.AddRequiredParameter("fileUid", fileUid)
;
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(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + $"/v1alpha/catalogs/files?fileUid={fileUid}", global::System.UriKind.RelativeOrAbsolute));
requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));

PrepareRequest(
client: _httpClient,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,17 @@ partial void ProcessGetFileCatalogResponseContent(
fileId: ref fileId,
fileUid: ref fileUid);

var __pathBuilder = new PathBuilder(
path: $"/v1alpha/namespaces/{namespaceId}/catalogs/{catalogId}",
baseUri: _httpClient.BaseAddress);
__pathBuilder
.AddOptionalParameter("fileId", fileId)
.AddOptionalParameter("fileUid", fileUid)
;
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(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + $"/v1alpha/namespaces/{namespaceId}/catalogs/{catalogId}?fileId={fileId}&fileUid={fileUid}", global::System.UriKind.RelativeOrAbsolute));
requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));

PrepareRequest(
client: _httpClient,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,13 @@ partial void ProcessGetSourceFileResponseContent(
catalogId: ref catalogId,
fileUid: ref fileUid);

var __pathBuilder = new PathBuilder(
path: $"/v1alpha/namespaces/{namespaceId}/catalogs/{catalogId}/files/{fileUid}/source",
baseUri: _httpClient.BaseAddress);
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(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + $"/v1alpha/namespaces/{namespaceId}/catalogs/{catalogId}/files/{fileUid}/source", global::System.UriKind.RelativeOrAbsolute));
requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));

PrepareRequest(
client: _httpClient,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System.Linq;

#nullable enable

Expand All @@ -10,15 +9,15 @@ partial void PrepareListCatalogFilesArguments(
global::System.Net.Http.HttpClient httpClient,
ref string namespaceId,
ref string catalogId,
ref int pageSize,
ref int? pageSize,
ref string? pageToken,
global::System.Collections.Generic.IList<string>? filterFileUids);
partial void PrepareListCatalogFilesRequest(
global::System.Net.Http.HttpClient httpClient,
global::System.Net.Http.HttpRequestMessage httpRequestMessage,
string namespaceId,
string catalogId,
int pageSize,
int? pageSize,
string? pageToken,
global::System.Collections.Generic.IList<string>? filterFileUids);
partial void ProcessListCatalogFilesResponse(
Expand All @@ -43,7 +42,7 @@ partial void ProcessListCatalogFilesResponseContent(
public async global::System.Threading.Tasks.Task<global::Instill.ListCatalogFilesResponse> ListCatalogFilesAsync(
string namespaceId,
string catalogId,
int pageSize = default,
int? pageSize = default,
string? pageToken = default,
global::System.Collections.Generic.IList<string>? filterFileUids = default,
global::System.Threading.CancellationToken cancellationToken = default)
Expand All @@ -58,9 +57,18 @@ partial void ProcessListCatalogFilesResponseContent(
pageToken: ref pageToken,
filterFileUids: filterFileUids);

var __pathBuilder = new PathBuilder(
path: $"/v1alpha/namespaces/{namespaceId}/catalogs/{catalogId}/files",
baseUri: _httpClient.BaseAddress);
__pathBuilder
.AddOptionalParameter("pageSize", pageSize?.ToString())
.AddOptionalParameter("pageToken", pageToken)
.AddOptionalParameter("filter.fileUids", filterFileUids, 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(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + $"/v1alpha/namespaces/{namespaceId}/catalogs/{catalogId}/files?pageSize={pageSize}&pageToken={pageToken}&{string.Join("&", filterFileUids?.Select(static x => $"filterFileUids={x}") ?? global::System.Array.Empty<string>())}", global::System.UriKind.RelativeOrAbsolute));
requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));

PrepareRequest(
client: _httpClient,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,13 @@ partial void ProcessListCatalogsResponseContent(
httpClient: _httpClient,
namespaceId: ref namespaceId);

var __pathBuilder = new PathBuilder(
path: $"/v1alpha/namespaces/{namespaceId}/catalogs",
baseUri: _httpClient.BaseAddress);
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(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + $"/v1alpha/namespaces/{namespaceId}/catalogs", global::System.UriKind.RelativeOrAbsolute));
requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));

PrepareRequest(
client: _httpClient,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,16 @@ partial void ProcessListChunksResponseContent(
catalogId: ref catalogId,
fileUid: ref fileUid);

var __pathBuilder = new PathBuilder(
path: $"/v1alpha/namespaces/{namespaceId}/catalogs/{catalogId}/chunks",
baseUri: _httpClient.BaseAddress);
__pathBuilder
.AddOptionalParameter("fileUid", fileUid)
;
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(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + $"/v1alpha/namespaces/{namespaceId}/catalogs/{catalogId}/chunks?fileUid={fileUid}", global::System.UriKind.RelativeOrAbsolute));
requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));

PrepareRequest(
client: _httpClient,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,13 @@ partial void ProcessProcessCatalogFilesResponseContent(
httpClient: _httpClient,
request: request);

var __pathBuilder = new PathBuilder(
path: "/v1alpha/catalogs/files/processAsync",
baseUri: _httpClient.BaseAddress);
var __path = __pathBuilder.ToString();
using var httpRequest = new global::System.Net.Http.HttpRequestMessage(
method: global::System.Net.Http.HttpMethod.Post,
requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + "/v1alpha/catalogs/files/processAsync", global::System.UriKind.RelativeOrAbsolute));
requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, request.GetType(), JsonSerializerContext);
var __httpRequestContent = new global::System.Net.Http.StringContent(
content: __httpRequestContentBody,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,13 @@ partial void ProcessQuestionAnsweringResponseContent(
catalogId: ref catalogId,
request: request);

var __pathBuilder = new PathBuilder(
path: $"/v1alpha/namespaces/{namespaceId}/catalogs/{catalogId}/ask",
baseUri: _httpClient.BaseAddress);
var __path = __pathBuilder.ToString();
using var httpRequest = new global::System.Net.Http.HttpRequestMessage(
method: global::System.Net.Http.HttpMethod.Post,
requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + $"/v1alpha/namespaces/{namespaceId}/catalogs/{catalogId}/ask", global::System.UriKind.RelativeOrAbsolute));
requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, request.GetType(), JsonSerializerContext);
var __httpRequestContent = new global::System.Net.Http.StringContent(
content: __httpRequestContentBody,
Expand Down Expand Up @@ -119,7 +123,7 @@ partial void ProcessQuestionAnsweringResponseContent(
string namespaceId,
string catalogId,
string? question = default,
int topK = default,
int? topK = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var request = new global::Instill.QuestionAnsweringBody
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,13 @@ partial void ProcessSimilarityChunksSearchResponseContent(
catalogId: ref catalogId,
request: request);

var __pathBuilder = new PathBuilder(
path: $"/v1alpha/namespaces/{namespaceId}/catalogs/{catalogId}/chunks/retrieve",
baseUri: _httpClient.BaseAddress);
var __path = __pathBuilder.ToString();
using var httpRequest = new global::System.Net.Http.HttpRequestMessage(
method: global::System.Net.Http.HttpMethod.Post,
requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + $"/v1alpha/namespaces/{namespaceId}/catalogs/{catalogId}/chunks/retrieve", global::System.UriKind.RelativeOrAbsolute));
requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, request.GetType(), JsonSerializerContext);
var __httpRequestContent = new global::System.Net.Http.StringContent(
content: __httpRequestContentBody,
Expand Down Expand Up @@ -119,7 +123,7 @@ partial void ProcessSimilarityChunksSearchResponseContent(
string namespaceId,
string catalogId,
string? textPrompt = default,
long topK = default,
long? topK = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var request = new global::Instill.SimilarityChunksSearchBody
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,13 @@ partial void ProcessUpdateCatalogResponseContent(
catalogId: ref catalogId,
request: request);

var __pathBuilder = new PathBuilder(
path: $"/v1alpha/namespaces/{namespaceId}/catalogs/{catalogId}",
baseUri: _httpClient.BaseAddress);
var __path = __pathBuilder.ToString();
using var httpRequest = new global::System.Net.Http.HttpRequestMessage(
method: global::System.Net.Http.HttpMethod.Put,
requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + $"/v1alpha/namespaces/{namespaceId}/catalogs/{catalogId}", global::System.UriKind.RelativeOrAbsolute));
requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, request.GetType(), JsonSerializerContext);
var __httpRequestContent = new global::System.Net.Http.StringContent(
content: __httpRequestContentBody,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,13 @@ partial void ProcessUpdateChunkResponseContent(
chunkUid: ref chunkUid,
request: request);

var __pathBuilder = new PathBuilder(
path: $"/v1alpha/chunks/{chunkUid}",
baseUri: _httpClient.BaseAddress);
var __path = __pathBuilder.ToString();
using var httpRequest = new global::System.Net.Http.HttpRequestMessage(
method: global::System.Net.Http.HttpMethod.Post,
requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + $"/v1alpha/chunks/{chunkUid}", global::System.UriKind.RelativeOrAbsolute));
requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, request.GetType(), JsonSerializerContext);
var __httpRequestContent = new global::System.Net.Http.StringContent(
content: __httpRequestContentBody,
Expand Down Expand Up @@ -109,7 +113,7 @@ partial void ProcessUpdateChunkResponseContent(
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<global::Instill.UpdateChunkResponse> UpdateChunkAsync(
string chunkUid,
bool retrievable = default,
bool? retrievable = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var request = new global::Instill.UpdateChunkBody
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,13 @@ partial void ProcessUploadCatalogFileResponseContent(
catalogId: ref catalogId,
request: request);

var __pathBuilder = new PathBuilder(
path: $"/v1alpha/namespaces/{namespaceId}/catalogs/{catalogId}/files",
baseUri: _httpClient.BaseAddress);
var __path = __pathBuilder.ToString();
using var httpRequest = new global::System.Net.Http.HttpRequestMessage(
method: global::System.Net.Http.HttpMethod.Post,
requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + $"/v1alpha/namespaces/{namespaceId}/catalogs/{catalogId}/files", global::System.UriKind.RelativeOrAbsolute));
requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, request.GetType(), JsonSerializerContext);
var __httpRequestContent = new global::System.Net.Http.StringContent(
content: __httpRequestContentBody,
Expand Down Expand Up @@ -137,7 +141,7 @@ partial void ProcessUploadCatalogFileResponseContent(
string? fileUid = default,
global::Instill.AllOf<global::Instill.FileProcessStatus2?>? processStatus = default,
string? processOutcome = default,
bool retrievable = default,
bool? retrievable = default,
string? content = default,
string? ownerUid = default,
string? creatorUid = default,
Expand All @@ -146,8 +150,8 @@ partial void ProcessUploadCatalogFileResponseContent(
global::System.DateTime? updateTime = default,
global::System.DateTime? deleteTime = default,
string? size = default,
int totalChunks = default,
int totalTokens = default,
int? totalChunks = default,
int? totalTokens = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var request = new global::Instill.File
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,13 @@ partial void ProcessGetRemainingCreditResponseContent(
httpClient: _httpClient,
namespaceId: ref namespaceId);

var __pathBuilder = new PathBuilder(
path: $"/v1beta/namespaces/{namespaceId}/credit",
baseUri: _httpClient.BaseAddress);
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(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + $"/v1beta/namespaces/{namespaceId}/credit", global::System.UriKind.RelativeOrAbsolute));
requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));

PrepareRequest(
client: _httpClient,
Expand Down
Loading

0 comments on commit b391057

Please sign in to comment.