export type ExportOrderListFormat = 'csv'; export type BeezUPCommonStoreId = unknown; export type BeezUPCommonMarketplaceTechnicalCode = string; export type BeezUPCommonMarketplaceBusinessCode = string; export type AccountId = number; export type BeezUPOrderStatus = string; export type DateSearchType = 'Modification' | 'Purchase' | 'MarketPlaceModification'; export type InvoiceAvailabilityType = string; export type OrderBuyerName = string; export type MarketplaceOrderId = string; export type OrderMerchantInfoSynchronizationStatus = string; export type OrderMerchantOrderId = string; export type OrderListRequestWithoutPagination = {marketplaceTechnicalCodes?: Array | undefined, marketplaceBusinessCodes?: Array | undefined, accountIds?: Array | undefined, storeIds?: Array | undefined, beezUPOrderStatuses?: Array | undefined, dateSearchType?: DateSearchType | undefined, beginPeriodUtcDate: string, endPeriodUtcDate: string, invoiceAvailabilityType?: InvoiceAvailabilityType | undefined, order_Buyer_Name?: OrderBuyerName | undefined, marketplaceOrderIds?: Array | undefined, orderMerchantInfoSynchronizationStatus?: OrderMerchantInfoSynchronizationStatus | undefined, order_MerchantOrderIds?: Array | undefined}; export type ExportOrderListRequest = {format?: ExportOrderListFormat | undefined, storeId: BeezUPCommonStoreId, orderListRequestWithoutPagination: OrderListRequestWithoutPagination}; export type CreateApiV2UserMarketplacesOrdersExportationsArgs = {body: ExportOrderListRequest}; export type CreateApiV2UserMarketplacesOrdersExportationsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Request a new Order report exportation to be generated * * POST /v2/user/marketplaces/orders/exportations */ export const createApiV2UserMarketplacesOrdersExportations = async (args: CreateApiV2UserMarketplacesOrdersExportationsArgs, options?: CreateApiV2UserMarketplacesOrdersExportationsOptions) => { const {baseUrl = "https://api.beezup.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/v2/user/marketplaces/orders/exportations${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 };