Skip to content
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
Expand Up @@ -891,6 +891,9 @@ partial void ProcessCreateResponseContent(
/// Submit a Decisions request<br/>
/// Submits a Decisions request to the Decisions router
/// </summary>
/// <param name="assets">
/// Images keyed by reference string, as in TypeSafe's API. Write a reference wherever the image belongs in `state`, `instructions`, or `criteria`; every asset must be referenced at least once. Jev reads a reference as a whole string value or inside longer text. Other Decisions models read a whole-string reference wherever they read an `image_url` part and reject a reference inside longer text.
/// </param>
/// <param name="model"></param>
/// <param name="provider"></param>
/// <param name="questions"></param>
Expand All @@ -913,6 +916,7 @@ partial void ProcessCreateResponseContent(
string model,
object questions,
global::OpenRouter.AnyOf<string, object, global::System.Collections.Generic.IList<object>> state,
global::System.Collections.Generic.Dictionary<string, global::OpenRouter.DecisionsImageAsset>? assets = default,
global::OpenRouter.AllOf<global::OpenRouter.ProviderPreferences, object>? provider = default,
string? sessionId = default,
global::OpenRouter.TraceConfig? trace = default,
Expand All @@ -922,6 +926,7 @@ partial void ProcessCreateResponseContent(
{
var __request = new global::OpenRouter.DecisionsRequest
{
Assets = assets,
Model = model,
Provider = provider,
Questions = questions,
Expand Down
37 changes: 37 additions & 0 deletions src/libs/OpenRouter/Generated/OpenRouter.EndpointsClient.List.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,43 @@ partial void ProcessListResponseContent(
h => h.Key,
h => h.Value));
}
// Service Unavailable - Service temporarily unavailable
if ((int)__response.StatusCode == 503)
{
string? __content_503 = null;
global::System.Exception? __exception_503 = null;
global::OpenRouter.ServiceUnavailableResponse? __value_503 = null;
try
{
if (__effectiveReadResponseAsString)
{
__content_503 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
__value_503 = global::OpenRouter.ServiceUnavailableResponse.FromJson(__content_503, JsonSerializerContext);
}
else
{
__content_503 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);

__value_503 = global::OpenRouter.ServiceUnavailableResponse.FromJson(__content_503, JsonSerializerContext);
}
}
catch (global::System.Exception __ex)
{
__exception_503 = __ex;
}


throw global::OpenRouter.ApiException<global::OpenRouter.ServiceUnavailableResponse>.Create(
statusCode: __response.StatusCode,
message: __content_503 ?? __response.ReasonPhrase ?? string.Empty,
innerException: __exception_503,
responseBody: __content_503,
responseObject: __value_503,
responseHeaders: global::System.Linq.Enumerable.ToDictionary(
__response.Headers,
h => h.Key,
h => h.Value));
}

if (__effectiveReadResponseAsString)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,43 @@ partial void ProcessListZdrEndpointsResponseContent(
h => h.Key,
h => h.Value));
}
// Service Unavailable - Service temporarily unavailable
if ((int)__response.StatusCode == 503)
{
string? __content_503 = null;
global::System.Exception? __exception_503 = null;
global::OpenRouter.ServiceUnavailableResponse? __value_503 = null;
try
{
if (__effectiveReadResponseAsString)
{
__content_503 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
__value_503 = global::OpenRouter.ServiceUnavailableResponse.FromJson(__content_503, JsonSerializerContext);
}
else
{
__content_503 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);

__value_503 = global::OpenRouter.ServiceUnavailableResponse.FromJson(__content_503, JsonSerializerContext);
}
}
catch (global::System.Exception __ex)
{
__exception_503 = __ex;
}


throw global::OpenRouter.ApiException<global::OpenRouter.ServiceUnavailableResponse>.Create(
statusCode: __response.StatusCode,
message: __content_503 ?? __response.ReasonPhrase ?? string.Empty,
innerException: __exception_503,
responseBody: __content_503,
responseObject: __value_503,
responseHeaders: global::System.Linq.Enumerable.ToDictionary(
__response.Headers,
h => h.Key,
h => h.Value));
}

if (__effectiveReadResponseAsString)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@

#nullable enable

namespace OpenRouter
{ /// <summary>
///
/// </summary>
public sealed partial class ExternalUsersSourceGenerationContext : global::System.Text.Json.Serialization.JsonSerializerContext
{
private static readonly global::System.Text.Json.Serialization.Metadata.IJsonTypeInfoResolver Resolver = new LazyChunkResolver();

[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
internal static global::System.Text.Json.Serialization.Metadata.IJsonTypeInfoResolver TypeInfoResolver => Resolver;


private static readonly global::System.Text.Json.JsonSerializerOptions DefaultOptions = CreateDefaultOptions();

/// <summary>
///
/// </summary>
public static ExternalUsersSourceGenerationContext Default { get; } = new(DefaultOptions);

private ExternalUsersSourceGenerationContext(global::System.Text.Json.JsonSerializerOptions options)
: base(options)
{
}

/// <inheritdoc />
protected override global::System.Text.Json.JsonSerializerOptions? GeneratedSerializerOptions => DefaultOptions;

/// <inheritdoc />
public override global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? GetTypeInfo(global::System.Type type)
{
return Resolver.GetTypeInfo(type, Options);
}

/// <summary>
/// Adds this package's converters to <paramref name="options"/>.
/// </summary>
/// <remarks>
/// A converter has to be on the options a chained resolver builds its JsonTypeInfo against,
/// and a context resolves types from every package below it. Each package contributes only
/// what it owns and calls down the chain for the rest, so the family's converter table is
/// written once rather than copied into all of them.
/// </remarks>
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public static void AddConverters(global::System.Text.Json.JsonSerializerOptions options)
{
global::OpenRouter.SourceGenerationContext.AddConverters(options);
}

private static global::System.Text.Json.JsonSerializerOptions CreateDefaultOptions()
{
var options = new global::System.Text.Json.JsonSerializerOptions
{
DefaultIgnoreCondition = global::System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull,
TypeInfoResolver = Resolver,
};
AddConverters(options);

return options;
}

private sealed class LazyChunkResolver : global::System.Text.Json.Serialization.Metadata.IJsonTypeInfoResolver
{
private readonly object _gate = new();
private readonly global::System.Text.Json.Serialization.Metadata.IJsonTypeInfoResolver?[] _resolvers = new global::System.Text.Json.Serialization.Metadata.IJsonTypeInfoResolver?[1];

public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? GetTypeInfo(
global::System.Type type,
global::System.Text.Json.JsonSerializerOptions options)
{
for (var index = 0; index < _resolvers.Length; index++)
{
var typeInfo = GetResolver(index).GetTypeInfo(type, options);
if (typeInfo is not null)
{
return typeInfo;
}
}

return null;
}

private global::System.Text.Json.Serialization.Metadata.IJsonTypeInfoResolver GetResolver(int index)
{
var resolver = global::System.Threading.Volatile.Read(ref _resolvers[index]);
if (resolver is not null)
{
return resolver;
}

lock (_gate)
{
return _resolvers[index] ??= CreateResolver(index);
}
}

private static global::System.Text.Json.Serialization.Metadata.IJsonTypeInfoResolver CreateResolver(int index)
{
return index switch
{
0 => global::OpenRouter.SourceGenerationContext.TypeInfoResolver,
_ => throw new global::System.ArgumentOutOfRangeException(nameof(index)),
};
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
namespace OpenRouter
{
/// <summary>
/// External Users endpoints<br/>
/// If no httpClient is provided, a new one will be created.<br/>
/// If no baseUri is provided, the default baseUri from OpenAPI spec will be used.
/// </summary>
Expand Down Expand Up @@ -48,7 +49,7 @@ public sealed partial class ExternalUsersClient : global::OpenRouter.IExternalUs
/// </summary>
public global::System.Text.Json.Serialization.JsonSerializerContext JsonSerializerContext
{
get => JsonSerializerContextProvider?.Value ?? global::OpenRouter.SourceGenerationContext.Default;
get => JsonSerializerContextProvider?.Value ?? global::OpenRouter.ExternalUsersSourceGenerationContext.Default;
set => JsonSerializerContextProvider = new(() => value);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,43 @@ partial void ProcessSubmitFeedbackResponseContent(
h => h.Key,
h => h.Value));
}
// Forbidden - Authentication successful but insufficient permissions
if ((int)__response.StatusCode == 403)
{
string? __content_403 = null;
global::System.Exception? __exception_403 = null;
global::OpenRouter.ForbiddenResponse? __value_403 = null;
try
{
if (__effectiveReadResponseAsString)
{
__content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
__value_403 = global::OpenRouter.ForbiddenResponse.FromJson(__content_403, JsonSerializerContext);
}
else
{
__content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);

__value_403 = global::OpenRouter.ForbiddenResponse.FromJson(__content_403, JsonSerializerContext);
}
}
catch (global::System.Exception __ex)
{
__exception_403 = __ex;
}


throw global::OpenRouter.ApiException<global::OpenRouter.ForbiddenResponse>.Create(
statusCode: __response.StatusCode,
message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
innerException: __exception_403,
responseBody: __content_403,
responseObject: __value_403,
responseHeaders: global::System.Linq.Enumerable.ToDictionary(
__response.Headers,
h => h.Key,
h => h.Value));
}
// Not Found - Resource does not exist
if ((int)__response.StatusCode == 404)
{
Expand Down Expand Up @@ -559,6 +596,43 @@ partial void ProcessSubmitFeedbackResponseContent(
h => h.Key,
h => h.Value));
}
// Service Unavailable - Service temporarily unavailable
if ((int)__response.StatusCode == 503)
{
string? __content_503 = null;
global::System.Exception? __exception_503 = null;
global::OpenRouter.ServiceUnavailableResponse? __value_503 = null;
try
{
if (__effectiveReadResponseAsString)
{
__content_503 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
__value_503 = global::OpenRouter.ServiceUnavailableResponse.FromJson(__content_503, JsonSerializerContext);
}
else
{
__content_503 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);

__value_503 = global::OpenRouter.ServiceUnavailableResponse.FromJson(__content_503, JsonSerializerContext);
}
}
catch (global::System.Exception __ex)
{
__exception_503 = __ex;
}


throw global::OpenRouter.ApiException<global::OpenRouter.ServiceUnavailableResponse>.Create(
statusCode: __response.StatusCode,
message: __content_503 ?? __response.ReasonPhrase ?? string.Empty,
innerException: __exception_503,
responseBody: __content_503,
responseObject: __value_503,
responseHeaders: global::System.Linq.Enumerable.ToDictionary(
__response.Headers,
h => h.Key,
h => h.Value));
}

if (__effectiveReadResponseAsString)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ public partial interface IAlphaDecisionsClient
/// Submit a Decisions request<br/>
/// Submits a Decisions request to the Decisions router
/// </summary>
/// <param name="assets">
/// Images keyed by reference string, as in TypeSafe's API. Write a reference wherever the image belongs in `state`, `instructions`, or `criteria`; every asset must be referenced at least once. Jev reads a reference as a whole string value or inside longer text. Other Decisions models read a whole-string reference wherever they read an `image_url` part and reject a reference inside longer text.
/// </param>
/// <param name="model"></param>
/// <param name="provider"></param>
/// <param name="questions"></param>
Expand All @@ -56,6 +59,7 @@ public partial interface IAlphaDecisionsClient
string model,
object questions,
global::OpenRouter.AnyOf<string, object, global::System.Collections.Generic.IList<object>> state,
global::System.Collections.Generic.Dictionary<string, global::OpenRouter.DecisionsImageAsset>? assets = default,
global::OpenRouter.AllOf<global::OpenRouter.ProviderPreferences, object>? provider = default,
string? sessionId = default,
global::OpenRouter.TraceConfig? trace = default,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
namespace OpenRouter
{
/// <summary>
/// External Users endpoints<br/>
/// If no httpClient is provided, a new one will be created.<br/>
/// If no baseUri is provided, the default baseUri from OpenAPI spec will be used.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public partial interface IImagesClient
/// Example: 1
/// </param>
/// <param name="outputCompression">
/// Compression level (0-100) for jpeg/webp output. Ignored by providers without a compression knob; providers that honor it may reject it with other output formats (e.g. OpenAI requires output_format "jpeg" or "webp").<br/>
/// Compression level (0-100) for webp/jpeg output. Ignored for png and by providers without a compression knob.<br/>
/// Example: 100
/// </param>
/// <param name="outputFormat">
Expand Down
Loading
Loading