export type DeleteApiV0UsersUserIdKeysKeyIdArgs = {user_id: string, key_id: string}; export type DeleteApiV0UsersUserIdKeysKeyIdOptions = {baseUrl?: string | undefined, bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Remove SSH Public Key * * DELETE /v0/users/{user_id}/keys/{key_id} */ export const deleteApiV0UsersUserIdKeysKeyId = async (args: DeleteApiV0UsersUserIdKeysKeyIdArgs, options?: DeleteApiV0UsersUserIdKeysKeyIdOptions) => { const {baseUrl = "https://api.pantheon.io", fetch: fetchFn = fetch, bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (bearer !== undefined) headers.set("Authorization", bearer) const url = `${baseUrl.replace(/\/+$/, '')}/v0/users/${encodeURIComponent(String(args.user_id))}/keys/${encodeURIComponent(String(args.key_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 };