export type DeleteApiV1SubAccountsSubAccountIdApiKeysIdArgs = {sub_account_id: string, id: string}; export type DeleteApiV1SubAccountsSubAccountIdApiKeysIdOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete a sub-account API key * * DELETE /v1/sub_accounts/{sub_account_id}/api_keys/{id} */ export const deleteApiV1SubAccountsSubAccountIdApiKeysId = async (args: DeleteApiV1SubAccountsSubAccountIdApiKeysIdArgs, options?: DeleteApiV1SubAccountsSubAccountIdApiKeysIdOptions) => { const {baseUrl = "https://api.middesk.com", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/sub_accounts/${encodeURIComponent(String(args.sub_account_id))}/api_keys/${encodeURIComponent(String(args.id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };