export type Prices = {id: unknown, product_id?: unknown | undefined, active?: boolean | undefined, description?: unknown | undefined, unit_amount?: number | undefined, currency?: unknown | undefined, type?: ('one_time' | 'recurring') | undefined, interval?: ('day' | 'week' | 'month' | 'year') | undefined, interval_count?: number | undefined, trial_period_days?: number | undefined, metadata: unknown}; export type PatchApiPricesArgs = {id?: unknown | undefined, product_id?: unknown | undefined, active?: unknown | undefined, description?: unknown | undefined, unit_amount?: unknown | undefined, currency?: unknown | undefined, type?: unknown | undefined, interval?: unknown | undefined, interval_count?: unknown | undefined, trial_period_days?: unknown | undefined, metadata?: unknown | undefined, Prefer?: ('return=representation' | 'return=minimal' | 'return=none') | undefined, body: Prices}; export type PatchApiPricesOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * PATCH /prices */ export const patchApiPrices = async (args: PatchApiPricesArgs, options?: PatchApiPricesOptions) => { 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.id != null) query.append("id", String(args.id)) if (args.product_id != null) query.append("product_id", String(args.product_id)) if (args.active != null) query.append("active", String(args.active)) if (args.description != null) query.append("description", String(args.description)) if (args.unit_amount != null) query.append("unit_amount", String(args.unit_amount)) if (args.currency != null) query.append("currency", String(args.currency)) if (args.type != null) query.append("type", String(args.type)) if (args.interval != null) query.append("interval", String(args.interval)) if (args.interval_count != null) query.append("interval_count", String(args.interval_count)) if (args.trial_period_days != null) query.append("trial_period_days", String(args.trial_period_days)) if (args.metadata != null) query.append("metadata", String(args.metadata)) if (args.Prefer != null) headers.set("Prefer", String(args.Prefer)) const url = `${baseUrl.replace(/\/+$/, '')}/prices${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", 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 };