export type DatabaseId = string; export type CreateApiV2DatabasesDbIdAuthRevokeArgs = {db_id: DatabaseId}; export type CreateApiV2DatabasesDbIdAuthRevokeOptions = {baseUrl?: string | undefined, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Invalidate Tokens * * POST /v2/databases/{db_id}/auth/revoke * * Also accepts auth: AccessKey */ export const createApiV2DatabasesDbIdAuthRevoke = async (args: CreateApiV2DatabasesDbIdAuthRevokeArgs, options?: CreateApiV2DatabasesDbIdAuthRevokeOptions) => { const {baseUrl = "https://api.bunny.net/database", fetch: fetchFn = fetch, Bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (Bearer !== undefined) headers.set("Authorization", Bearer) const url = `${baseUrl.replace(/\/+$/, '')}/v2/databases/${encodeURIComponent(String(args.db_id))}/auth/revoke${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };