/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { authApiKeysCreate } from "../funcs/authApiKeysCreate.js"; import { authApiKeysExchangeToken } from "../funcs/authApiKeysExchangeToken.js"; import { authApiKeysList } from "../funcs/authApiKeysList.js"; import { authApiKeysRegenerate } from "../funcs/authApiKeysRegenerate.js"; import { authApiKeysUpdate } from "../funcs/authApiKeysUpdate.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import * as operations from "../models/operations/index.js"; import { unwrapAsync } from "../types/fp.js"; export class ApiKeys extends ClientSDK { /** * Mint a scoped API key * * @remarks * Mint an API key bound to a (principal, team) carrying an explicit scope set. Requires a session, or a bearer key holding `write:apikeys`. The plaintext secret is returned once. */ async create( request: operations.CreateScopedApiKeyRequest, options?: RequestOptions, ): Promise { return unwrapAsync(authApiKeysCreate( this, request, options, )); } /** * List scoped API keys * * @remarks * List the caller's scoped API keys (metadata only — never the secret). Optional `?orgId=&teamId=` narrows; a key caller is scoped to its own org. */ async list( request: operations.ListScopedApiKeysRequest, options?: RequestOptions, ): Promise> { return unwrapAsync(authApiKeysList( this, request, options, )); } /** * Update a scoped API key * * @remarks * Update a key's scopes (and optionally name / rate limit). Scopes already on the key are retained; newly-added scopes are bounded by the caller's role (and, for a key caller, the calling key's own scopes). */ async update( request: operations.UpdateScopedApiKeyRequest, options?: RequestOptions, ): Promise { return unwrapAsync(authApiKeysUpdate( this, request, options, )); } /** * Rotate a scoped API key's secret * * @remarks * Issue a new plaintext secret for an existing key in place (id / scopes / binding preserved). Returned once. */ async regenerate( request: operations.RegenerateScopedApiKeyRequest, options?: RequestOptions, ): Promise { return unwrapAsync(authApiKeysRegenerate( this, request, options, )); } /** * Exchange API key for a JWT token * * @remarks * Exchange an API key for a short-lived JWT token. */ async exchangeToken( request: operations.ExchangeApiKeyTokenRequest, options?: RequestOptions, ): Promise { return unwrapAsync(authApiKeysExchangeToken( this, request, options, )); } }