export type DateFilterDto = {isnull?: boolean | undefined, notnull?: boolean | undefined, gt?: string | undefined, gte?: string | undefined, lt?: string | undefined, lte?: string | undefined}; export type CheckoutSessionMode = 'payment' | 'subscription'; export type PaymentMethodType = 'superfluid' | 'wallet' | 'allowance_based_recurring' | 'stripe' | 'binance_pay'; export type PaymentStatus = 'unpaid' | 'paid'; export type GetApiApiV1CheckoutSessionsExportArgs = {createdAt?: DateFilterDto | undefined, ids?: string | undefined, paymentLinkId?: string | undefined, subscriptionId?: string | undefined, invoiceId?: string | undefined, mode?: CheckoutSessionMode | undefined, paymentMethodTypes?: Array | undefined, status?: string | undefined, paymentStatus?: PaymentStatus | undefined, customerId?: string | undefined, couponId?: string | undefined, from?: string | undefined, to?: string | undefined}; export type GetApiApiV1CheckoutSessionsExportOptions = {baseUrl?: string | undefined, bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Export checkout sessions * * GET /api/v1/checkout/sessions/export */ export const getApiApiV1CheckoutSessionsExport = async (args: GetApiApiV1CheckoutSessionsExportArgs, options?: GetApiApiV1CheckoutSessionsExportOptions) => { const {baseUrl = "https://api.copperx.dev", fetch: fetchFn = fetch, bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.createdAt != null) query.append("createdAt", JSON.stringify(args.createdAt)) if (args.ids != null) query.append("ids", String(args.ids)) if (args.paymentLinkId != null) query.append("paymentLinkId", String(args.paymentLinkId)) if (args.subscriptionId != null) query.append("subscriptionId", String(args.subscriptionId)) if (args.invoiceId != null) query.append("invoiceId", String(args.invoiceId)) if (args.mode != null) query.append("mode", String(args.mode)) for (const item of args.paymentMethodTypes ?? []) query.append("paymentMethodTypes", String(item)) if (args.status != null) query.append("status", String(args.status)) if (args.paymentStatus != null) query.append("paymentStatus", String(args.paymentStatus)) if (args.customerId != null) query.append("customerId", String(args.customerId)) if (args.couponId != null) query.append("couponId", String(args.couponId)) if (args.from != null) query.append("from", String(args.from)) if (args.to != null) query.append("to", String(args.to)) if (bearer !== undefined) headers.set('authorization', `Bearer ${bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/checkout/sessions/export${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };