export type CreateApiAffiliatesReportingEntityTableExportArgs = {body: {from: string, to: string, timezone_id: number, currency_id: string, columns: Array<{column: string}>, format: 'csv' | 'json', query?: ({filters?: (Array<{filter_id_value?: string | undefined, resource_type?: string | undefined}>) | undefined}) | undefined}}; export type CreateApiAffiliatesReportingEntityTableExportOptions = {baseUrl?: string | undefined, APIKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Export Aggregated Data * * POST /affiliates/reporting/entity/table/export */ export const createApiAffiliatesReportingEntityTableExport = async (args: CreateApiAffiliatesReportingEntityTableExportArgs, options?: CreateApiAffiliatesReportingEntityTableExportOptions) => { const {baseUrl = "https://api.eflow.team/v1", fetch: fetchFn = fetch, APIKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (APIKey !== undefined) headers.set("X-Eflow-Api-Key", APIKey) const url = `${baseUrl.replace(/\/+$/, '')}/affiliates/reporting/entity/table/export${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 };