export type GetApiV1ApplicationsApplicationIdExportCustomerSessionsArgs = {applicationId: number, createdBefore?: string | undefined, createdAfter?: string | undefined, updatedBefore?: string | undefined, updatedAfter?: string | undefined, profileIntegrationId?: string | undefined, dateFormat?: ('excel' | 'ISO8601') | undefined, customerSessionState?: ('open' | 'closed' | 'partially_returned' | 'cancelled') | undefined}; export type GetApiV1ApplicationsApplicationIdExportCustomerSessionsOptions = {baseUrl?: string | undefined, managerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Export customer sessions * * GET /v1/applications/{applicationId}/export_customer_sessions * * Also accepts auth: management_key */ export const getApiV1ApplicationsApplicationIdExportCustomerSessions = async (args: GetApiV1ApplicationsApplicationIdExportCustomerSessionsArgs, options?: GetApiV1ApplicationsApplicationIdExportCustomerSessionsOptions) => { 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.createdBefore != null) query.append("createdBefore", String(args.createdBefore)) if (args.createdAfter != null) query.append("createdAfter", String(args.createdAfter)) if (args.updatedBefore != null) query.append("updatedBefore", String(args.updatedBefore)) if (args.updatedAfter != null) query.append("updatedAfter", String(args.updatedAfter)) if (args.profileIntegrationId != null) query.append("profileIntegrationId", String(args.profileIntegrationId)) if (args.dateFormat != null) query.append("dateFormat", String(args.dateFormat)) if (args.customerSessionState != null) query.append("customerSessionState", String(args.customerSessionState)) if (managerAuth !== undefined) headers.set("Authorization", managerAuth) const url = `${baseUrl.replace(/\/+$/, '')}/v1/applications/${encodeURIComponent(String(args.applicationId))}/export_customer_sessions${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() };