export type DeleteApiV1ApiKeysPrefixArgs = {prefix: string}; export type DeleteApiV1ApiKeysPrefixOptions = {baseUrl?: string | undefined, PrivyJWT?: string | undefined, fetch?: typeof fetch | undefined}; /** * Revoke API Key * * DELETE /v1/api-keys/{prefix} * * Also accepts auth: ApiKey */ export const deleteApiV1ApiKeysPrefix = async (args: DeleteApiV1ApiKeysPrefixArgs, options?: DeleteApiV1ApiKeysPrefixOptions) => { const {baseUrl = "https://api.totalis.trade", fetch: fetchFn = fetch, PrivyJWT} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (PrivyJWT !== undefined) headers.set('authorization', `Bearer ${PrivyJWT}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/api-keys/${encodeURIComponent(String(args.prefix))}${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 };