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 @@ -48,6 +48,9 @@ public partial interface ISubpackageGuardrailsClient
/// <param name="resetInterval">
/// Interval at which the limit resets (daily, weekly, monthly)
/// </param>
/// <param name="workspaceId">
/// The workspace to create the guardrail in. Defaults to the default workspace if not provided.
/// </param>
/// <param name="requestOptions">Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.</param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
Expand All @@ -61,6 +64,7 @@ public partial interface ISubpackageGuardrailsClient
global::System.Collections.Generic.IList<string>? ignoredProviders = default,
double? limitUsd = default,
global::OpenRouter.GuardrailInterval? resetInterval = default,
global::System.Guid? workspaceId = default,
global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ public partial interface ISubpackageGuardrailsClient
/// </summary>
/// <param name="offset"></param>
/// <param name="limit"></param>
/// <param name="workspaceId"></param>
/// <param name="requestOptions">Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.</param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::OpenRouter.ApiException"></exception>
global::System.Threading.Tasks.Task<global::OpenRouter.ListGuardrailsResponse> ListGuardrailsAsync(
int? offset = default,
int? limit = default,
global::System.Guid? workspaceId = default,
global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ public sealed partial class CreateGuardrailRequest
[global::System.Text.Json.Serialization.JsonConverter(typeof(global::OpenRouter.JsonConverters.GuardrailIntervalJsonConverter))]
public global::OpenRouter.GuardrailInterval? ResetInterval { get; set; }

/// <summary>
/// The workspace to create the guardrail in. Defaults to the default workspace if not provided.
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("workspace_id")]
public global::System.Guid? WorkspaceId { get; set; }

/// <summary>
/// Additional properties that are not explicitly defined in the schema
/// </summary>
Expand Down Expand Up @@ -100,6 +106,9 @@ public sealed partial class CreateGuardrailRequest
/// <param name="resetInterval">
/// Interval at which the limit resets (daily, weekly, monthly)
/// </param>
/// <param name="workspaceId">
/// The workspace to create the guardrail in. Defaults to the default workspace if not provided.
/// </param>
#if NET7_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers]
#endif
Expand All @@ -112,7 +121,8 @@ public CreateGuardrailRequest(
global::System.Collections.Generic.IList<string>? ignoredModels,
global::System.Collections.Generic.IList<string>? ignoredProviders,
double? limitUsd,
global::OpenRouter.GuardrailInterval? resetInterval)
global::OpenRouter.GuardrailInterval? resetInterval,
global::System.Guid? workspaceId)
{
this.AllowedModels = allowedModels;
this.AllowedProviders = allowedProviders;
Expand All @@ -123,6 +133,7 @@ public CreateGuardrailRequest(
this.LimitUsd = limitUsd;
this.Name = name ?? throw new global::System.ArgumentNullException(nameof(name));
this.ResetInterval = resetInterval;
this.WorkspaceId = workspaceId;
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,13 @@ public sealed partial class CreateGuardrailResponseData
[global::System.Text.Json.Serialization.JsonPropertyName("updated_at")]
public string? UpdatedAt { get; set; }

/// <summary>
/// The workspace ID this guardrail belongs to.
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("workspace_id")]
[global::System.Text.Json.Serialization.JsonRequired]
public required string WorkspaceId { get; set; }

/// <summary>
/// Additional properties that are not explicitly defined in the schema
/// </summary>
Expand All @@ -102,6 +109,9 @@ public sealed partial class CreateGuardrailResponseData
/// <param name="name">
/// Name of the guardrail
/// </param>
/// <param name="workspaceId">
/// The workspace ID this guardrail belongs to.
/// </param>
/// <param name="allowedModels">
/// Array of model canonical_slugs (immutable identifiers)
/// </param>
Expand Down Expand Up @@ -136,6 +146,7 @@ public CreateGuardrailResponseData(
string createdAt,
global::System.Guid id,
string name,
string workspaceId,
global::System.Collections.Generic.IList<string>? allowedModels,
global::System.Collections.Generic.IList<string>? allowedProviders,
string? description,
Expand All @@ -158,6 +169,7 @@ public CreateGuardrailResponseData(
this.Name = name ?? throw new global::System.ArgumentNullException(nameof(name));
this.ResetInterval = resetInterval;
this.UpdatedAt = updatedAt;
this.WorkspaceId = workspaceId ?? throw new global::System.ArgumentNullException(nameof(workspaceId));
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,13 @@ public sealed partial class GetGuardrailResponseData
[global::System.Text.Json.Serialization.JsonPropertyName("updated_at")]
public string? UpdatedAt { get; set; }

/// <summary>
/// The workspace ID this guardrail belongs to.
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("workspace_id")]
[global::System.Text.Json.Serialization.JsonRequired]
public required string WorkspaceId { get; set; }

/// <summary>
/// Additional properties that are not explicitly defined in the schema
/// </summary>
Expand All @@ -102,6 +109,9 @@ public sealed partial class GetGuardrailResponseData
/// <param name="name">
/// Name of the guardrail
/// </param>
/// <param name="workspaceId">
/// The workspace ID this guardrail belongs to.
/// </param>
/// <param name="allowedModels">
/// Array of model canonical_slugs (immutable identifiers)
/// </param>
Expand Down Expand Up @@ -136,6 +146,7 @@ public GetGuardrailResponseData(
string createdAt,
global::System.Guid id,
string name,
string workspaceId,
global::System.Collections.Generic.IList<string>? allowedModels,
global::System.Collections.Generic.IList<string>? allowedProviders,
string? description,
Expand All @@ -158,6 +169,7 @@ public GetGuardrailResponseData(
this.Name = name ?? throw new global::System.ArgumentNullException(nameof(name));
this.ResetInterval = resetInterval;
this.UpdatedAt = updatedAt;
this.WorkspaceId = workspaceId ?? throw new global::System.ArgumentNullException(nameof(workspaceId));
}

/// <summary>
Expand Down
12 changes: 12 additions & 0 deletions src/libs/OpenRouter/Generated/OpenRouter.Models.Guardrail.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,13 @@ public sealed partial class Guardrail
[global::System.Text.Json.Serialization.JsonPropertyName("updated_at")]
public string? UpdatedAt { get; set; }

/// <summary>
/// The workspace ID this guardrail belongs to.
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("workspace_id")]
[global::System.Text.Json.Serialization.JsonRequired]
public required string WorkspaceId { get; set; }

/// <summary>
/// Additional properties that are not explicitly defined in the schema
/// </summary>
Expand All @@ -102,6 +109,9 @@ public sealed partial class Guardrail
/// <param name="name">
/// Name of the guardrail
/// </param>
/// <param name="workspaceId">
/// The workspace ID this guardrail belongs to.
/// </param>
/// <param name="allowedModels">
/// Array of model canonical_slugs (immutable identifiers)
/// </param>
Expand Down Expand Up @@ -136,6 +146,7 @@ public Guardrail(
string createdAt,
global::System.Guid id,
string name,
string workspaceId,
global::System.Collections.Generic.IList<string>? allowedModels,
global::System.Collections.Generic.IList<string>? allowedProviders,
string? description,
Expand All @@ -158,6 +169,7 @@ public Guardrail(
this.Name = name ?? throw new global::System.ArgumentNullException(nameof(name));
this.ResetInterval = resetInterval;
this.UpdatedAt = updatedAt;
this.WorkspaceId = workspaceId ?? throw new global::System.ArgumentNullException(nameof(workspaceId));
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,13 @@ public sealed partial class UpdateGuardrailResponseData
[global::System.Text.Json.Serialization.JsonPropertyName("updated_at")]
public string? UpdatedAt { get; set; }

/// <summary>
/// The workspace ID this guardrail belongs to.
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("workspace_id")]
[global::System.Text.Json.Serialization.JsonRequired]
public required string WorkspaceId { get; set; }

/// <summary>
/// Additional properties that are not explicitly defined in the schema
/// </summary>
Expand All @@ -102,6 +109,9 @@ public sealed partial class UpdateGuardrailResponseData
/// <param name="name">
/// Name of the guardrail
/// </param>
/// <param name="workspaceId">
/// The workspace ID this guardrail belongs to.
/// </param>
/// <param name="allowedModels">
/// Array of model canonical_slugs (immutable identifiers)
/// </param>
Expand Down Expand Up @@ -136,6 +146,7 @@ public UpdateGuardrailResponseData(
string createdAt,
global::System.Guid id,
string name,
string workspaceId,
global::System.Collections.Generic.IList<string>? allowedModels,
global::System.Collections.Generic.IList<string>? allowedProviders,
string? description,
Expand All @@ -158,6 +169,7 @@ public UpdateGuardrailResponseData(
this.Name = name ?? throw new global::System.ArgumentNullException(nameof(name));
this.ResetInterval = resetInterval;
this.UpdatedAt = updatedAt;
this.WorkspaceId = workspaceId ?? throw new global::System.ArgumentNullException(nameof(workspaceId));
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,44 @@ partial void ProcessCreateGuardrailResponseContent(
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 new global::OpenRouter.ApiException<global::OpenRouter.ForbiddenResponse>(
message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
innerException: __exception_403,
statusCode: __response.StatusCode)
{
ResponseBody = __content_403,
ResponseObject = __value_403,
ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
__response.Headers,
h => h.Key,
h => h.Value),
};
}
// Internal Server Error - Unexpected server error
if ((int)__response.StatusCode == 500)
{
Expand Down Expand Up @@ -532,6 +570,9 @@ partial void ProcessCreateGuardrailResponseContent(
/// <param name="resetInterval">
/// Interval at which the limit resets (daily, weekly, monthly)
/// </param>
/// <param name="workspaceId">
/// The workspace to create the guardrail in. Defaults to the default workspace if not provided.
/// </param>
/// <param name="requestOptions">Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.</param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
Expand All @@ -545,6 +586,7 @@ partial void ProcessCreateGuardrailResponseContent(
global::System.Collections.Generic.IList<string>? ignoredProviders = default,
double? limitUsd = default,
global::OpenRouter.GuardrailInterval? resetInterval = default,
global::System.Guid? workspaceId = default,
global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
Expand All @@ -559,6 +601,7 @@ partial void ProcessCreateGuardrailResponseContent(
LimitUsd = limitUsd,
Name = name,
ResetInterval = resetInterval,
WorkspaceId = workspaceId,
};

return await CreateGuardrailAsync(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@ public partial class SubpackageGuardrailsClient
partial void PrepareListGuardrailsArguments(
global::System.Net.Http.HttpClient httpClient,
ref int? offset,
ref int? limit);
ref int? limit,
ref global::System.Guid? workspaceId);
partial void PrepareListGuardrailsRequest(
global::System.Net.Http.HttpClient httpClient,
global::System.Net.Http.HttpRequestMessage httpRequestMessage,
int? offset,
int? limit);
int? limit,
global::System.Guid? workspaceId);
partial void ProcessListGuardrailsResponse(
global::System.Net.Http.HttpClient httpClient,
global::System.Net.Http.HttpResponseMessage httpResponseMessage);
Expand All @@ -49,12 +51,14 @@ partial void ProcessListGuardrailsResponseContent(
/// </summary>
/// <param name="offset"></param>
/// <param name="limit"></param>
/// <param name="workspaceId"></param>
/// <param name="requestOptions">Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.</param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::OpenRouter.ApiException"></exception>
public async global::System.Threading.Tasks.Task<global::OpenRouter.ListGuardrailsResponse> ListGuardrailsAsync(
int? offset = default,
int? limit = default,
global::System.Guid? workspaceId = default,
global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
Expand All @@ -63,7 +67,8 @@ partial void ProcessListGuardrailsResponseContent(
PrepareListGuardrailsArguments(
httpClient: HttpClient,
offset: ref offset,
limit: ref limit);
limit: ref limit,
workspaceId: ref workspaceId);


var __authorizations = global::OpenRouter.EndPointSecurityResolver.ResolveAuthorizations(
Expand Down Expand Up @@ -92,7 +97,8 @@ partial void ProcessListGuardrailsResponseContent(
baseUri: HttpClient.BaseAddress);
__pathBuilder
.AddOptionalParameter("offset", offset?.ToString())
.AddOptionalParameter("limit", limit?.ToString())
.AddOptionalParameter("limit", limit?.ToString())
.AddOptionalParameter("workspace_id", workspaceId?.ToString())
;
var __path = __pathBuilder.ToString();
__path = global::OpenRouter.AutoSDKRequestOptionsSupport.AppendQueryParameters(
Expand Down Expand Up @@ -135,7 +141,8 @@ partial void ProcessListGuardrailsResponseContent(
httpClient: HttpClient,
httpRequestMessage: __httpRequest,
offset: offset,
limit: limit);
limit: limit,
workspaceId: workspaceId);

return __httpRequest;
}
Expand Down
Loading