export type GetApiV1StripePreviewAllArgs = {seats?: number | undefined, country?: string | undefined, vat?: string | undefined, coupon?: string | undefined, period?: number | undefined, spamCheckerPlan?: number | undefined, spamCheckerPeriod?: number | undefined, selectedSpamcheckerPlan?: number | undefined, 'x-api-key': string}; export type GetApiV1StripePreviewAllOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get invoice total preview for combined billing, seats + spamchecker * * GET /v1/stripe/preview/all */ export const getApiV1StripePreviewAll = async (args: GetApiV1StripePreviewAllArgs, options?: GetApiV1StripePreviewAllOptions) => { const {baseUrl = "https://api.mailreach.co/api", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.seats != null) query.append("seats", String(args.seats)) if (args.country != null) query.append("country", String(args.country)) if (args.vat != null) query.append("vat", String(args.vat)) if (args.coupon != null) query.append("coupon", String(args.coupon)) if (args.period != null) query.append("period", String(args.period)) if (args.spamCheckerPlan != null) query.append("spamCheckerPlan", String(args.spamCheckerPlan)) if (args.spamCheckerPeriod != null) query.append("spamCheckerPeriod", String(args.spamCheckerPeriod)) if (args.selectedSpamcheckerPlan != null) query.append("selectedSpamcheckerPlan", String(args.selectedSpamcheckerPlan)) if (args['x-api-key'] != null) headers.set("x-api-key", String(args['x-api-key'])) const url = `${baseUrl.replace(/\/+$/, '')}/v1/stripe/preview/all${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 };