export type DeleteServiceAccountAPIKeyParams = {$schema?: string | undefined, identifier: string}; export type DeleteApiServiceAccountsIdOrNameApiKeysArgs = {idOrName: string, body: DeleteServiceAccountAPIKeyParams}; export type DeleteApiServiceAccountsIdOrNameApiKeysOptions = {baseUrl?: string | undefined, AccessTokenAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete API key for service account * * DELETE /service-accounts/{idOrName}/api-keys * * Also accepts auth: APIKeyAuth */ export const deleteApiServiceAccountsIdOrNameApiKeys = async (args: DeleteApiServiceAccountsIdOrNameApiKeysArgs, options?: DeleteApiServiceAccountsIdOrNameApiKeysOptions) => { const {baseUrl = "https://api.tower.dev/v1", fetch: fetchFn = fetch, AccessTokenAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (AccessTokenAuth !== undefined) headers.set('authorization', `Bearer ${AccessTokenAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/service-accounts/${encodeURIComponent(String(args.idOrName))}/api-keys${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", 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 };