export type GetApiV1ApplicationsApplicationIdExportEffectsArgs = {applicationId: number, campaignId?: number | undefined, createdBefore?: string | undefined, createdAfter?: string | undefined, dateFormat?: ('excel' | 'ISO8601') | undefined}; export type GetApiV1ApplicationsApplicationIdExportEffectsOptions = {baseUrl?: string | undefined, managerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Export triggered effects * * GET /v1/applications/{applicationId}/export_effects * * Also accepts auth: management_key */ export const getApiV1ApplicationsApplicationIdExportEffects = async (args: GetApiV1ApplicationsApplicationIdExportEffectsArgs, options?: GetApiV1ApplicationsApplicationIdExportEffectsOptions) => { const {baseUrl = "https://yourbaseurl.talon.one", fetch: fetchFn = fetch, managerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/csv") if (args.campaignId != null) query.append("campaignId", String(args.campaignId)) if (args.createdBefore != null) query.append("createdBefore", String(args.createdBefore)) if (args.createdAfter != null) query.append("createdAfter", String(args.createdAfter)) if (args.dateFormat != null) query.append("dateFormat", String(args.dateFormat)) if (managerAuth !== undefined) headers.set("Authorization", managerAuth) const url = `${baseUrl.replace(/\/+$/, '')}/v1/applications/${encodeURIComponent(String(args.applicationId))}/export_effects${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 res.blob() };