export type PatchApiTenantIdCredentialsCredentialIdArgs = {apiKey: string, credential_id: string, tenant_id: string, body: {name: string}}; export type PatchApiTenantIdCredentialsCredentialIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update Credential * * PATCH /{tenant_id}/credentials/{credential_id} */ export const patchApiTenantIdCredentialsCredentialId = async (args: PatchApiTenantIdCredentialsCredentialIdArgs, options?: PatchApiTenantIdCredentialsCredentialIdOptions) => { const {baseUrl = "https://passkeys.hanko.io", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args.apiKey != null) headers.set("apiKey", String(args.apiKey)) const url = `${baseUrl.replace(/\/+$/, '')}/${encodeURIComponent(String(args.tenant_id))}/credentials/${encodeURIComponent(String(args.credential_id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", 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 };