import { ScraperTargetRequest, ScraperTargetResponse, ScraperTargetsApi, } from '../api' import {ServiceOptions} from '../types' export default class { private service: ScraperTargetsApi private serviceOptions: ServiceOptions constructor(basePath: string, baseOptions: ServiceOptions) { this.service = new ScraperTargetsApi({basePath, baseOptions}) this.serviceOptions = baseOptions } public async getAll(orgID: string): Promise { const { data: {configurations}, } = await this.service.getScrapers( undefined, undefined, undefined, orgID, undefined, this.serviceOptions ) return configurations || [] } public async create( request: ScraperTargetRequest ): Promise { const {data} = await this.service.postScrapers( request, undefined, this.serviceOptions ) return data } public async update( id: string, changes: ScraperTargetRequest ): Promise { const {data} = await this.service.patchScrapersID( id, changes, undefined, this.serviceOptions ) return data } public async delete(id: string): Promise { const {data} = await this.service.deleteScrapersID( id, undefined, this.serviceOptions ) return data } }