export type DeleteApiV4TokensTokenIdArgs = {token_id: string}; export type DeleteApiV4TokensTokenIdOptions = {baseUrl?: string | undefined, APIKeyCookie?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete * * DELETE /v4/tokens/{token_id} */ export const deleteApiV4TokensTokenId = async (args: DeleteApiV4TokensTokenIdArgs, options?: DeleteApiV4TokensTokenIdOptions) => { const {baseUrl = "https://www.mystic.ai", fetch: fetchFn = fetch, APIKeyCookie} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (APIKeyCookie !== undefined) cookies.push("access-token=" + encodeURIComponent(APIKeyCookie)) const url = `${baseUrl.replace(/\/+$/, '')}/v4/tokens/${encodeURIComponent(String(args.token_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 };