export type DeleteApiApiVVersionUsersKeysIdArgs = {version: string, id: string}; export type DeleteApiApiVVersionUsersKeysIdOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete API Key * * DELETE /api/v{version}/users/keys/{id} */ export const deleteApiApiVVersionUsersKeysId = async (args: DeleteApiApiVVersionUsersKeysIdArgs, options?: DeleteApiApiVVersionUsersKeysIdOptions) => { const {baseUrl = "https://api.zrexpress.app", fetch: fetchFn = fetch, bearerAuth, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) if (apiKey !== undefined) headers.set("X-Api-Key", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/api/v${encodeURIComponent(String(args.version))}/users/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 };