import { ConfigureAPI } from "../baseWellsClient"; import { Source } from "src/model/source"; import { SourceItems } from "src/model/sourceItems"; import { rethrowAsHttpError } from "../errorHandlingUtils"; import { DeleteSources } from "src/model/deleteSources"; export class SourcesAPI extends ConfigureAPI { public list = async (): Promise => { const path: string = this.getPath(`/sources`); return await this.client .asyncGet(path) .then((response) => response.data) .catch((err) => { throw rethrowAsHttpError(err); }); }; public ingest = async (sources: Source[]): Promise => { const path: string = this.getPath(`/sources`); const ingestionItems: SourceItems = { items: sources }; return await this.client .asyncPost(path, { data: ingestionItems }) .then((response) => response.data) .catch((err) => { throw rethrowAsHttpError(err); }); }; public delete = async (request: DeleteSources): Promise => { const path: string = this.getPath(`/sources/delete`); return await this.client .asyncPost(path, { data: request }) .then((response) => response.data) .catch((err) => { throw rethrowAsHttpError(err); }); }; }