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
2 changes: 1 addition & 1 deletion .claude/skills/tryagi-openai/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ dnx tryAGI.OpenAI.CLI <group> --help
| `live` | 7 | |
| `model` | 3 | List and describe the various models available in the API. |
| `moderation` | 1 | Given text and/or image inputs, classifies if those inputs are potentially harmful. |
| `project` | 23 | |
| `project` | 24 | |
| `project-group` | 4 | |
| `project-group-role-assignment` | 4 | |
| `project-user-role-assignment` | 4 | |
Expand Down
1 change: 1 addition & 0 deletions .claude/skills/tryagi-openai/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ Given text and/or image inputs, classifies if those inputs are potentially harmf
| `retrieve-project-model-permissions` | `GET /organization/projects/{project_id}/model_permissions` | Retrieve project model permissions |
| `retrieve-project-service-account` | `GET /organization/projects/{project_id}/service_accounts/{service_account_id}` | Retrieve project service account |
| `retrieve-project-user` | `GET /organization/projects/{project_id}/users/{user_id}` | Retrieve project user |
| `update-project-api-key` | `POST /organization/projects/{project_id}/api_keys/{api_key_id}` | Update project API key |
| `update-project-model-permissions` | `POST /organization/projects/{project_id}/model_permissions` | Modify project model permissions |
| `update-project-rate-limits` | `POST /organization/projects/{project_id}/rate_limits/{rate_limit_id}` | Modify project rate limit |
| `update-project-service-account` | `POST /organization/projects/{project_id}/service_accounts/{service_account_id}` | Update project service account |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public static Command Create()
command.Subcommands.Add(ProjectsRetrieveProjectModelPermissionsCommandApiCommand.Create());
command.Subcommands.Add(ProjectsRetrieveProjectServiceAccountCommandApiCommand.Create());
command.Subcommands.Add(ProjectsRetrieveProjectUserCommandApiCommand.Create());
command.Subcommands.Add(ProjectsUpdateProjectApiKeyCommandApiCommand.Create());
command.Subcommands.Add(ProjectsUpdateProjectModelPermissionsCommandApiCommand.Create());
command.Subcommands.Add(ProjectsUpdateProjectRateLimitsCommandApiCommand.Create());
command.Subcommands.Add(ProjectsUpdateProjectServiceAccountCommandApiCommand.Create());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
#nullable enable
#pragma warning disable CS0618

using System.CommandLine;

namespace tryAGI.OpenAI.Cli.GeneratedApi.Commands;

internal static partial class ProjectsUpdateProjectApiKeyCommandApiCommand
{
private static Argument<string> ProjectId { get; } = new(
name: @"project-id")
{
Description = @"The ID of the project.",
};

private static Argument<string> ApiKeyId { get; } = new(
name: @"api-key-id")
{
Description = @"The ID of the API key.",
};

private static Option<int> ExpiresInSeconds { get; } = new(
name: @"--expires-in-seconds")
{
Description = @"Number of seconds from this request until the API key expires. Must comply with the organization and project expiry policies. Expired keys cannot be updated. Retrying resets the expiry relative to the new request.",
Required = true,
};

private static string FormatResponse(ParseResult parseResult, global::tryAGI.OpenAI.ProjectApiKey value, global::System.Text.Json.Serialization.JsonSerializerContext context, bool truncateLongStrings)
{
string? text = null;
CustomizeResponseText(parseResult, value, ref text);
if (!string.IsNullOrWhiteSpace(text))
{
return text;
}

var hints = new Dictionary<string, CliFormatHint>(StringComparer.OrdinalIgnoreCase)
{
};
CustomizeResponseFormatHints(hints);
return CliRuntime.FormatHumanReadable(value, context, truncateLongStrings, hints);
}

static partial void CustomizeResponseText(ParseResult parseResult, global::tryAGI.OpenAI.ProjectApiKey value, ref string? text);
static partial void CustomizeResponseFormatHints(Dictionary<string, CliFormatHint> hints);


static partial void CustomizeCommand(ref Command command);

public static Command Create(string? commandName = null)
{
var command = new Command(commandName ?? @"update-project-api-key", @"Update project API key
Updates the expiration of an existing API key in the project, including a
service-account-owned key. Requires permission to write project API keys.

Provide `expires_in_seconds` to set the expiration relative to this request.
The value must satisfy the organization's and project's expiry policies.
Expired keys cannot be updated. Retrying resets the expiration relative to
the new request. The response contains only the redacted key, not its secret.
");
command.Arguments.Add(ProjectId);
command.Arguments.Add(ApiKeyId);
command.Options.Add(ExpiresInSeconds);


command.SetAction(async (ParseResult parseResult, CancellationToken cancellationToken) =>
await CliRuntime.RunAsync(async () =>
{
var projectId = parseResult.GetRequiredValue(ProjectId);
var apiKeyId = parseResult.GetRequiredValue(ApiKeyId);
var expiresInSeconds = parseResult.GetRequiredValue(ExpiresInSeconds);
using var client = await CliRuntime.CreateClientAsync(parseResult, cancellationToken).ConfigureAwait(false);


var response = await client.Projects.UpdateProjectApiKeyAsync(
projectId: projectId,
apiKeyId: apiKeyId,
expiresInSeconds: expiresInSeconds,
cancellationToken: cancellationToken).ConfigureAwait(false);


await CliRuntime.WriteResponseAsync(
parseResult,
response,
global::tryAGI.OpenAI.SourceGenerationContext.Default,
FormatResponse,
cancellationToken).ConfigureAwait(false);
}, cancellationToken).ConfigureAwait(false));
CustomizeCommand(ref command);
return command;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#nullable enable

namespace tryAGI.OpenAI
{
public partial interface IProjectsClient
{
/// <summary>
/// Update project API key<br/>
/// Updates the expiration of an existing API key in the project, including a<br/>
/// service-account-owned key. Requires permission to write project API keys.<br/>
/// Provide `expires_in_seconds` to set the expiration relative to this request.<br/>
/// The value must satisfy the organization's and project's expiry policies.<br/>
/// Expired keys cannot be updated. Retrying resets the expiration relative to<br/>
/// the new request. The response contains only the redacted key, not its secret.
/// </summary>
/// <param name="projectId"></param>
/// <param name="apiKeyId"></param>
/// <param name="request"></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::tryAGI.OpenAI.ApiException"></exception>
global::System.Threading.Tasks.Task<global::tryAGI.OpenAI.ProjectApiKey> UpdateProjectApiKeyAsync(
string projectId,
string apiKeyId,

global::tryAGI.OpenAI.UpdateProjectApiKeyBody request,
global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
/// <summary>
/// Update project API key<br/>
/// Updates the expiration of an existing API key in the project, including a<br/>
/// service-account-owned key. Requires permission to write project API keys.<br/>
/// Provide `expires_in_seconds` to set the expiration relative to this request.<br/>
/// The value must satisfy the organization's and project's expiry policies.<br/>
/// Expired keys cannot be updated. Retrying resets the expiration relative to<br/>
/// the new request. The response contains only the redacted key, not its secret.
/// </summary>
/// <param name="projectId"></param>
/// <param name="apiKeyId"></param>
/// <param name="request"></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::tryAGI.OpenAI.ApiException"></exception>
global::System.Threading.Tasks.Task<global::tryAGI.OpenAI.AutoSDKHttpResponse<global::tryAGI.OpenAI.ProjectApiKey>> UpdateProjectApiKeyAsResponseAsync(
string projectId,
string apiKeyId,

global::tryAGI.OpenAI.UpdateProjectApiKeyBody request,
global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
/// <summary>
/// Update project API key<br/>
/// Updates the expiration of an existing API key in the project, including a<br/>
/// service-account-owned key. Requires permission to write project API keys.<br/>
/// Provide `expires_in_seconds` to set the expiration relative to this request.<br/>
/// The value must satisfy the organization's and project's expiry policies.<br/>
/// Expired keys cannot be updated. Retrying resets the expiration relative to<br/>
/// the new request. The response contains only the redacted key, not its secret.
/// </summary>
/// <param name="projectId"></param>
/// <param name="apiKeyId"></param>
/// <param name="expiresInSeconds">
/// Number of seconds from this request until the API key expires. Must comply with the organization and project expiry policies. Expired keys cannot be updated. Retrying resets the expiry relative to the new request.
/// </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>
global::System.Threading.Tasks.Task<global::tryAGI.OpenAI.ProjectApiKey> UpdateProjectApiKeyAsync(
string projectId,
string apiKeyId,
int expiresInSeconds,
global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
Loading
Loading