import { ExportFile, ExportRequest, ExportStarted, } from '../../interfaces/export.interface' import { Api, ApiResponse } from '../api' import { ENDPOINTS } from '.' /** * Listing exports. These go straight to the search service rather than through * membrane: the work is a single backend job, and nothing in between has * anything to add to it. */ const EXPORT_PATH = `${ENDPOINTS.SEARCH}/v3/export` export class Exports { api: Api constructor(api: Api) { this.api = api } /** * Starts an export. Returns as soon as the job is queued; the file itself * arrives as a notification on `notifications//`, whose popupId is * the returned key. */ async start(request: ExportRequest): Promise> { return this.api.apisauce.post(EXPORT_PATH, request) } /** Every export of the signed in user, newest first, with signed links. */ async list(): Promise> { return this.api.apisauce.get(EXPORT_PATH) } }