export type GetApiApiV1ProjectsProjectIdConversationsSessionIdExportArgs = {projectId: number, sessionId: string, format?: ('json' | 'excel' | 'csv' | 'pdf') | undefined, isCustomRowsNumber?: string | undefined, rowsNumber?: number | undefined, startDate?: string | undefined, endDate?: string | undefined}; export type GetApiApiV1ProjectsProjectIdConversationsSessionIdExportOptions = {baseUrl?: string | undefined, BearerToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Export conversation. * * GET /api/v1/projects/{projectId}/conversations/{sessionId}/export */ export const getApiApiV1ProjectsProjectIdConversationsSessionIdExport = async (args: GetApiApiV1ProjectsProjectIdConversationsSessionIdExportArgs, options?: GetApiApiV1ProjectsProjectIdConversationsSessionIdExportOptions) => { const {baseUrl = "https://app.customgpt.ai", fetch: fetchFn = fetch, BearerToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/octet-stream") if (args.format != null) query.append("format", String(args.format)) if (args.isCustomRowsNumber != null) query.append("isCustomRowsNumber", String(args.isCustomRowsNumber)) if (args.rowsNumber != null) query.append("rowsNumber", String(args.rowsNumber)) if (args.startDate != null) query.append("startDate", String(args.startDate)) if (args.endDate != null) query.append("endDate", String(args.endDate)) if (BearerToken !== undefined) headers.set('authorization', `Bearer ${BearerToken}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/projects/${encodeURIComponent(String(args.projectId))}/conversations/${encodeURIComponent(String(args.sessionId))}/export${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() };