-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #43 from tryAGI/bot/update-openapi_202411121521
feat:@coderabbitai
- Loading branch information
Showing
19 changed files
with
854 additions
and
500 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
#nullable enable | ||
|
||
namespace HuggingFace | ||
{ | ||
public readonly partial struct AnyOf<T1, T2> | ||
{ | ||
/// <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::HuggingFace.AnyOf<T1, T2>? FromJson( | ||
string json, | ||
global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) | ||
{ | ||
return global::System.Text.Json.JsonSerializer.Deserialize( | ||
json, | ||
typeof(global::HuggingFace.AnyOf<T1, T2>), | ||
jsonSerializerContext) as global::HuggingFace.AnyOf<T1, T2>?; | ||
} | ||
|
||
/// <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::HuggingFace.AnyOf<T1, T2>? FromJson( | ||
string json, | ||
global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) | ||
{ | ||
return global::System.Text.Json.JsonSerializer.Deserialize<global::HuggingFace.AnyOf<T1, T2>>( | ||
json, | ||
jsonSerializerOptions); | ||
} | ||
|
||
/// <summary> | ||
/// Deserializes a JSON stream using the provided JsonSerializerContext. | ||
/// </summary> | ||
public static async global::System.Threading.Tasks.ValueTask<global::HuggingFace.AnyOf<T1, T2>?> FromJsonStreamAsync( | ||
global::System.IO.Stream jsonStream, | ||
global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) | ||
{ | ||
return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( | ||
jsonStream, | ||
typeof(global::HuggingFace.AnyOf<T1, T2>), | ||
jsonSerializerContext).ConfigureAwait(false)) as global::HuggingFace.AnyOf<T1, T2>?; | ||
} | ||
|
||
/// <summary> | ||
/// Deserializes a JSON stream 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::System.Threading.Tasks.ValueTask<global::HuggingFace.AnyOf<T1, T2>?> FromJsonStreamAsync( | ||
global::System.IO.Stream jsonStream, | ||
global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) | ||
{ | ||
return global::System.Text.Json.JsonSerializer.DeserializeAsync<global::HuggingFace.AnyOf<T1, T2>?>( | ||
jsonStream, | ||
jsonSerializerOptions); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 90 additions & 0 deletions
90
src/libs/HuggingFace/Generated/HuggingFace.Exceptions.g.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
#nullable enable | ||
|
||
namespace HuggingFace | ||
{ | ||
/// <summary> | ||
/// Represents an exception thrown by the API. | ||
/// </summary> | ||
[global::System.Serializable] | ||
public partial class ApiException : global::System.Exception | ||
{ | ||
/// <summary> | ||
/// The HTTP status code of the response. | ||
/// </summary> | ||
public global::System.Net.HttpStatusCode StatusCode { get; } | ||
/// <summary> | ||
/// The response body. | ||
/// </summary> | ||
public string? ResponseBody { get; set; } | ||
/// <summary> | ||
/// The response headers. | ||
/// </summary> | ||
public global::System.Collections.Generic.Dictionary<string, global::System.Collections.Generic.IEnumerable<string>>? ResponseHeaders { get; set; } | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="ApiException"/> class. | ||
/// </summary> | ||
public ApiException() | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="ApiException"/> class with a specified error message. | ||
/// </summary> | ||
/// <param name="message">The message that describes the error.</param> | ||
/// <param name="statusCode">The HTTP status code of the response.</param> | ||
public ApiException(string message, global::System.Net.HttpStatusCode statusCode) : base(message) | ||
{ | ||
StatusCode = statusCode; | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="ApiException"/> class with a specified error message and a reference to the inner exception that is the cause of this exception. | ||
/// </summary> | ||
/// <param name="message">The error message that explains the reason for the exception.</param> | ||
/// <param name="innerException">The exception that is the cause of the current exception, or a null reference if no inner exception is specified.</param> | ||
/// <param name="statusCode">The HTTP status code of the response.</param> | ||
public ApiException(string message, global::System.Exception innerException, global::System.Net.HttpStatusCode statusCode) : base(message, innerException) | ||
{ | ||
StatusCode = statusCode; | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Represents an exception thrown by the API. | ||
/// </summary> | ||
/// <typeparam name="T"></typeparam> | ||
[global::System.Serializable] | ||
public partial class ApiException<T> : ApiException | ||
{ | ||
/// <summary> | ||
/// The response object. | ||
/// </summary> | ||
public T? ResponseObject { get; set; } | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="ApiException"/> class. | ||
/// </summary> | ||
public ApiException() | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="ApiException"/> class with a specified error message. | ||
/// </summary> | ||
/// <param name="message">The message that describes the error.</param> | ||
/// <param name="statusCode">The HTTP status code of the response.</param> | ||
public ApiException(string message, global::System.Net.HttpStatusCode statusCode) : base(message, statusCode) | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="ApiException"/> class with a specified error message and a reference to the inner exception that is the cause of this exception. | ||
/// </summary> | ||
/// <param name="message">The error message that explains the reason for the exception.</param> | ||
/// <param name="innerException">The exception that is the cause of the current exception, or a null reference if no inner exception is specified.</param> | ||
/// <param name="statusCode">The HTTP status code of the response.</param> | ||
public ApiException(string message, global::System.Exception innerException, global::System.Net.HttpStatusCode statusCode) : base(message, innerException, statusCode) | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.