export type CreateApiDomainsPurchaseWithMailboxesArgs = {body: {domains?: Array | undefined, domainsWithProviders?: (Array<{domain: string, provider: 'google' | 'outlook' | 'azure' | 'smtp'}>) | undefined, mailboxes?: (Array<{username: string, firstName: string, lastName?: string | undefined, domain: string, signature?: string | undefined, provider?: ('google' | 'outlook' | 'azure' | 'smtp') | undefined}>) | undefined, paymentMethodId: string, TeamId?: string | undefined, forwardingAddress?: (string | null) | undefined, dmarcEmail?: string | undefined, contactDetails?: Record | undefined, saveContactAsDefault?: boolean | undefined}}; export type CreateApiDomainsPurchaseWithMailboxesOptions = {baseUrl?: string | undefined, BearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Purchase Domains and Mailboxes * * POST /domains/purchase-with-mailboxes */ export const createApiDomainsPurchaseWithMailboxes = async (args: CreateApiDomainsPurchaseWithMailboxesArgs, options?: CreateApiDomainsPurchaseWithMailboxesOptions) => { const {baseUrl = "https://api.supersend.io/v2", fetch: fetchFn = fetch, BearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (BearerAuth !== undefined) headers.set('authorization', `Bearer ${BearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/domains/purchase-with-mailboxes${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 };