export type IdentityOidcKeyRequest = {algorithm?: string | undefined, allowed_client_ids?: Array | undefined, rotation_period?: number | undefined, verification_ttl?: number | undefined}; export type CreateApiIdentityOidcKeyNameArgs = {body: IdentityOidcKeyRequest}; export type CreateApiIdentityOidcKeyNameOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * CRUD operations for OIDC keys. * * POST /identity/oidc/key/{name} */ export const createApiIdentityOidcKeyName = async (args: CreateApiIdentityOidcKeyNameArgs, options: CreateApiIdentityOidcKeyNameOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/identity/oidc/key/${encodeURIComponent(String(args.name))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };