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 for Jina Embedding Serving API to 0.1.79 #61

Merged
merged 1 commit into from
Oct 21, 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@

#nullable enable

namespace Jina
{
public partial class ClassificationClient
{
partial void PrepareDeleteClassifierArguments(
global::System.Net.Http.HttpClient httpClient,
ref string classifierId);
partial void PrepareDeleteClassifierRequest(
global::System.Net.Http.HttpClient httpClient,
global::System.Net.Http.HttpRequestMessage httpRequestMessage,
string classifierId);
partial void ProcessDeleteClassifierResponse(
global::System.Net.Http.HttpClient httpClient,
global::System.Net.Http.HttpResponseMessage httpResponseMessage);

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

/// <summary>
/// Delete Classifier<br/>
/// List classifiers.
/// </summary>
/// <param name="classifierId"></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<string> DeleteClassifierAsync(
string classifierId,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
client: _httpClient);
PrepareDeleteClassifierArguments(
httpClient: _httpClient,
classifierId: ref classifierId);

var __pathBuilder = new PathBuilder(
path: $"/v1/classifiers/{classifierId}",
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);
}
}

PrepareRequest(
client: _httpClient,
request: httpRequest);
PrepareDeleteClassifierRequest(
httpClient: _httpClient,
httpRequestMessage: httpRequest,
classifierId: classifierId);

using var response = await _httpClient.SendAsync(
request: httpRequest,
completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
cancellationToken: cancellationToken).ConfigureAwait(false);

ProcessResponse(
client: _httpClient,
response: response);
ProcessDeleteClassifierResponse(
httpClient: _httpClient,
httpResponseMessage: response);

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

ProcessResponseContent(
client: _httpClient,
response: response,
content: ref __content);
ProcessDeleteClassifierResponseContent(
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 __content;
}
}
}
102 changes: 102 additions & 0 deletions src/libs/Jina/Generated/Jina.ClassificationClient.ListClassifier.g.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@

#nullable enable

namespace Jina
{
public partial class ClassificationClient
{
partial void PrepareListClassifierArguments(
global::System.Net.Http.HttpClient httpClient);
partial void PrepareListClassifierRequest(
global::System.Net.Http.HttpClient httpClient,
global::System.Net.Http.HttpRequestMessage httpRequestMessage);
partial void ProcessListClassifierResponse(
global::System.Net.Http.HttpClient httpClient,
global::System.Net.Http.HttpResponseMessage httpResponseMessage);

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

/// <summary>
/// List Classifier<br/>
/// List classifiers.
/// </summary>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<string> ListClassifierAsync(
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
client: _httpClient);
PrepareListClassifierArguments(
httpClient: _httpClient);

var __pathBuilder = new PathBuilder(
path: "/v1/classifiers",
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(__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);
}
}

PrepareRequest(
client: _httpClient,
request: httpRequest);
PrepareListClassifierRequest(
httpClient: _httpClient,
httpRequestMessage: httpRequest);

using var response = await _httpClient.SendAsync(
request: httpRequest,
completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
cancellationToken: cancellationToken).ConfigureAwait(false);

ProcessResponse(
client: _httpClient,
response: response);
ProcessListClassifierResponse(
httpClient: _httpClient,
httpResponseMessage: response);

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

ProcessResponseContent(
client: _httpClient,
response: response,
content: ref __content);
ProcessListClassifierResponseContent(
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 __content;
}
}
}
8 changes: 4 additions & 4 deletions src/libs/Jina/Generated/Jina.ClassificationClient.Train.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ partial void ProcessTrainResponseContent(
/// The identifier of the classifier. If not provided, a new classifier will be created.<br/>
/// You can provide only either `model` or `classifier_id`
/// </param>
/// <param name="visibility">
/// The visibility of the classifier when created. Will be ignored if `classifier_id` is provided<br/>
/// <param name="access">
/// The accessibility of the classifier when created. Will be ignored if `classifier_id` is provided<br/>
/// Default Value: public
/// </param>
/// <param name="input">
Expand All @@ -152,15 +152,15 @@ partial void ProcessTrainResponseContent(
global::Jina.AnyOf<global::System.Collections.Generic.IList<global::Jina.AnyOf<global::Jina.TextExampleDoc, global::Jina.ImageExampleDoc>>, global::Jina.TextExampleDoc, global::Jina.ImageExampleDoc> input,
string? model = default,
string? classifierId = default,
global::Jina.TrainingAPIInputVisibility? visibility = global::Jina.TrainingAPIInputVisibility.Public,
global::Jina.TrainingAPIInputAccess? access = global::Jina.TrainingAPIInputAccess.Public,
int? numIters = 10,
global::System.Threading.CancellationToken cancellationToken = default)
{
var request = new global::Jina.TrainingAPIInput
{
Model = model,
ClassifierId = classifierId,
Visibility = visibility,
Access = access,
Input = input,
NumIters = numIters,
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#nullable enable

namespace Jina
{
public partial interface IClassificationClient
{
/// <summary>
/// Delete Classifier<br/>
/// List classifiers.
/// </summary>
/// <param name="classifierId"></param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
global::System.Threading.Tasks.Task<string> DeleteClassifierAsync(
string classifierId,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#nullable enable

namespace Jina
{
public partial interface IClassificationClient
{
/// <summary>
/// List Classifier<br/>
/// List classifiers.
/// </summary>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
global::System.Threading.Tasks.Task<string> ListClassifierAsync(
global::System.Threading.CancellationToken cancellationToken = default);
}
}
6 changes: 3 additions & 3 deletions src/libs/Jina/Generated/Jina.IClassificationClient.Train.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ public partial interface IClassificationClient
/// The identifier of the classifier. If not provided, a new classifier will be created.<br/>
/// You can provide only either `model` or `classifier_id`
/// </param>
/// <param name="visibility">
/// The visibility of the classifier when created. Will be ignored if `classifier_id` is provided<br/>
/// <param name="access">
/// The accessibility of the classifier when created. Will be ignored if `classifier_id` is provided<br/>
/// Default Value: public
/// </param>
/// <param name="input">
Expand All @@ -52,7 +52,7 @@ public partial interface IClassificationClient
global::Jina.AnyOf<global::System.Collections.Generic.IList<global::Jina.AnyOf<global::Jina.TextExampleDoc, global::Jina.ImageExampleDoc>>, global::Jina.TextExampleDoc, global::Jina.ImageExampleDoc> input,
string? model = default,
string? classifierId = default,
global::Jina.TrainingAPIInputVisibility? visibility = global::Jina.TrainingAPIInputVisibility.Public,
global::Jina.TrainingAPIInputAccess? access = global::Jina.TrainingAPIInputAccess.Public,
int? numIters = 10,
global::System.Threading.CancellationToken cancellationToken = default);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@

#nullable enable

namespace Jina
{
/// <summary>
///
/// </summary>
public sealed partial class DeleteClassifierV1ClassifiersClassifierIdDeleteResponse
{

/// <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>();


/// <summary>
/// Serializes the current instance to a JSON string using the provided JsonSerializerContext.
/// </summary>
public string ToJson(
global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext)
{
return global::System.Text.Json.JsonSerializer.Serialize(
this,
this.GetType(),
jsonSerializerContext);
}

/// <summary>
/// Serializes the current instance to a JSON string using the provided JsonSerializerOptions.
/// </summary>
#if NET8_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
[global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")]
#endif
public string ToJson(
global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null)
{
return global::System.Text.Json.JsonSerializer.Serialize(
this,
jsonSerializerOptions);
}

/// <summary>
/// Deserializes a JSON string using the provided JsonSerializerContext.
/// </summary>
public static global::Jina.DeleteClassifierV1ClassifiersClassifierIdDeleteResponse? FromJson(
string json,
global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext)
{
return global::System.Text.Json.JsonSerializer.Deserialize(
json,
typeof(global::Jina.DeleteClassifierV1ClassifiersClassifierIdDeleteResponse),
jsonSerializerContext) as global::Jina.DeleteClassifierV1ClassifiersClassifierIdDeleteResponse;
}

/// <summary>
/// Deserializes a JSON string using the provided JsonSerializerOptions.
/// </summary>
#if NET8_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
[global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")]
#endif
public static global::Jina.DeleteClassifierV1ClassifiersClassifierIdDeleteResponse? FromJson(
string json,
global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null)
{
return global::System.Text.Json.JsonSerializer.Deserialize<global::Jina.DeleteClassifierV1ClassifiersClassifierIdDeleteResponse>(
json,
jsonSerializerOptions);
}

}
}
Loading