export type ApplicationTokenExpireIn = {expiry?: (number | null) | undefined, sessionIds?: Array | undefined}; export type CreateApiApiV1AuthAppAppIdExpireAllArgs = {app_id: string, 'idempotency-key'?: string | undefined, body: ApplicationTokenExpireIn}; export type CreateApiApiV1AuthAppAppIdExpireAllOptions = {baseUrl?: string | undefined, HTTPBearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Expire All * * POST /api/v1/auth/app/{app_id}/expire-all */ export const createApiApiV1AuthAppAppIdExpireAll = async (args: CreateApiApiV1AuthAppAppIdExpireAllArgs, options?: CreateApiApiV1AuthAppAppIdExpireAllOptions) => { const {baseUrl = "https://api.eu.svix.com", fetch: fetchFn = fetch, HTTPBearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['idempotency-key'] != null) headers.set("idempotency-key", String(args['idempotency-key'])) if (HTTPBearer !== undefined) headers.set('authorization', `Bearer ${HTTPBearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/auth/app/${encodeURIComponent(String(args.app_id))}/expire-all${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };