export type Subscriptions = {id: unknown, user_id?: string | undefined, status?: ('trialing' | 'active' | 'canceled' | 'incomplete' | 'incomplete_expired' | 'past_due' | 'unpaid') | undefined, metadata: unknown, price_id?: unknown | undefined, quantity?: number | undefined, cancel_at_period_end?: boolean | undefined, created: unknown, current_period_start: unknown, current_period_end: unknown, ended_at?: unknown | undefined, cancel_at?: unknown | undefined, canceled_at?: unknown | undefined, trial_start?: unknown | undefined, trial_end?: unknown | undefined, organization_id: string}; export type CreateApiSubscriptionsArgs = {select?: string | undefined, Prefer?: ('return=representation' | 'return=minimal' | 'return=none' | 'resolution=ignore-duplicates' | 'resolution=merge-duplicates') | undefined, body: Subscriptions}; export type CreateApiSubscriptionsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * POST /subscriptions */ export const createApiSubscriptions = async (args: CreateApiSubscriptionsArgs, options?: CreateApiSubscriptionsOptions) => { const {baseUrl = "https://vnaabuozknwgxuvnfwjo.supabase.co:443", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args.select != null) query.append("select", String(args.select)) if (args.Prefer != null) headers.set("Prefer", String(args.Prefer)) const url = `${baseUrl.replace(/\/+$/, '')}/subscriptions${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 };