scraper-api-datachaser
Version:
The scraping SaaS platform provides a RESTful API for developers to perform web scraping tasks. Users can submit scraping tasks, monitor task status, retrieve scraped data, and manage their account through the API.
529 lines (462 loc) • 15.5 kB
text/typescript
/* tslint:disable */
/* eslint-disable */
/**
* Scraper API
* The scraping SaaS platform provides a RESTful API for developers to perform web scraping tasks. Users can submit scraping tasks, monitor task status, retrieve scraped data, and manage their account through the API.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import * as runtime from '../runtime';
import type {
ErrorResponse,
Job,
JobCreateRequest,
JobCreateResponse,
ProcessedJob,
} from '../models/index';
import {
ErrorResponseFromJSON,
ErrorResponseToJSON,
JobFromJSON,
JobToJSON,
JobCreateRequestFromJSON,
JobCreateRequestToJSON,
JobCreateResponseFromJSON,
JobCreateResponseToJSON,
ProcessedJobFromJSON,
ProcessedJobToJSON,
} from '../models/index';
export interface JobAsyncPostRequest {
body: JobCreateRequest;
}
export interface JobIdDeleteRequest {
id: string;
}
export interface JobIdGetRequest {
id: string;
}
export interface JobIdPutRequest {
id: string;
body: JobCreateRequest;
}
export interface JobPostRequest {
body: JobCreateRequest;
}
export interface JobSyncPostRequest {
body: JobCreateRequest;
xResponseType?: JobSyncPostXResponseTypeEnum;
xProxyRegion?: JobSyncPostXProxyRegionEnum;
}
/**
*
*/
export class JobsApi extends runtime.BaseAPI {
/**
* Receives a Job in body and process it asynchronusly and returns job details as job_id which can be used to retrieve data related to that job
* Receives a job and process it asyncrhonously
*/
async jobAsyncPostRaw(requestParameters: JobAsyncPostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Job>> {
if (requestParameters['body'] == null) {
throw new runtime.RequiredError(
'body',
'Required parameter "body" was null or undefined when calling jobAsyncPost().'
);
}
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
headerParameters['Content-Type'] = 'application/json';
if (this.configuration && this.configuration.apiKey) {
headerParameters["Key"] = await this.configuration.apiKey("Key"); // key authentication
}
const response = await this.request({
path: `/job/async`,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: JobCreateRequestToJSON(requestParameters['body']),
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => JobFromJSON(jsonValue));
}
/**
* Receives a Job in body and process it asynchronusly and returns job details as job_id which can be used to retrieve data related to that job
* Receives a job and process it asyncrhonously
*/
async jobAsyncPost(requestParameters: JobAsyncPostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Job> {
const response = await this.jobAsyncPostRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Get existing jobs owned by authenticated user account
* Get jobs
*/
async jobGetRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<Job>>> {
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Key"] = await this.configuration.apiKey("Key"); // key authentication
}
const response = await this.request({
path: `/job`,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(JobFromJSON));
}
/**
* Get existing jobs owned by authenticated user account
* Get jobs
*/
async jobGet(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<Job>> {
const response = await this.jobGetRaw(initOverrides);
return await response.value();
}
/**
* Delete existing job owned by authenticated user account
* Delete existing job
*/
async jobIdDeleteRaw(requestParameters: JobIdDeleteRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Job>> {
if (requestParameters['id'] == null) {
throw new runtime.RequiredError(
'id',
'Required parameter "id" was null or undefined when calling jobIdDelete().'
);
}
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Key"] = await this.configuration.apiKey("Key"); // key authentication
}
const response = await this.request({
path: `/job/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))),
method: 'DELETE',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => JobFromJSON(jsonValue));
}
/**
* Delete existing job owned by authenticated user account
* Delete existing job
*/
async jobIdDelete(requestParameters: JobIdDeleteRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Job> {
const response = await this.jobIdDeleteRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Retrieve specific job status
* Retrieve specific job status
*/
async jobIdGetRaw(requestParameters: JobIdGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Job>> {
if (requestParameters['id'] == null) {
throw new runtime.RequiredError(
'id',
'Required parameter "id" was null or undefined when calling jobIdGet().'
);
}
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Key"] = await this.configuration.apiKey("Key"); // key authentication
}
const response = await this.request({
path: `/job/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))),
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => JobFromJSON(jsonValue));
}
/**
* Retrieve specific job status
* Retrieve specific job status
*/
async jobIdGet(requestParameters: JobIdGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Job> {
const response = await this.jobIdGetRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Update existing job owned by authenticated user account
* Update existing job
*/
async jobIdPutRaw(requestParameters: JobIdPutRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Job>> {
if (requestParameters['id'] == null) {
throw new runtime.RequiredError(
'id',
'Required parameter "id" was null or undefined when calling jobIdPut().'
);
}
if (requestParameters['body'] == null) {
throw new runtime.RequiredError(
'body',
'Required parameter "body" was null or undefined when calling jobIdPut().'
);
}
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
headerParameters['Content-Type'] = 'application/json';
if (this.configuration && this.configuration.apiKey) {
headerParameters["Key"] = await this.configuration.apiKey("Key"); // key authentication
}
const response = await this.request({
path: `/job/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))),
method: 'PUT',
headers: headerParameters,
query: queryParameters,
body: JobCreateRequestToJSON(requestParameters['body']),
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => JobFromJSON(jsonValue));
}
/**
* Update existing job owned by authenticated user account
* Update existing job
*/
async jobIdPut(requestParameters: JobIdPutRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Job> {
const response = await this.jobIdPutRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Creates new job owned authenticated user account
* Create new job
*/
async jobPostRaw(requestParameters: JobPostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<JobCreateResponse>> {
if (requestParameters['body'] == null) {
throw new runtime.RequiredError(
'body',
'Required parameter "body" was null or undefined when calling jobPost().'
);
}
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
headerParameters['Content-Type'] = 'application/json';
if (this.configuration && this.configuration.apiKey) {
headerParameters["Key"] = await this.configuration.apiKey("Key"); // key authentication
}
const response = await this.request({
path: `/job`,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: JobCreateRequestToJSON(requestParameters['body']),
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => JobCreateResponseFromJSON(jsonValue));
}
/**
* Creates new job owned authenticated user account
* Create new job
*/
async jobPost(requestParameters: JobPostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<JobCreateResponse> {
const response = await this.jobPostRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Receives a Job in body and process it synchronusly and returns the data object
* Receives a job and process it syncrhonously
*/
async jobSyncPostRaw(requestParameters: JobSyncPostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ProcessedJob>> {
if (requestParameters['body'] == null) {
throw new runtime.RequiredError(
'body',
'Required parameter "body" was null or undefined when calling jobSyncPost().'
);
}
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
headerParameters['Content-Type'] = 'application/json';
if (requestParameters['xResponseType'] != null) {
headerParameters['X-Response-Type'] = String(requestParameters['xResponseType']);
}
if (requestParameters['xProxyRegion'] != null) {
headerParameters['X-Proxy-Region'] = String(requestParameters['xProxyRegion']);
}
if (this.configuration && this.configuration.apiKey) {
headerParameters["Key"] = await this.configuration.apiKey("Key"); // key authentication
}
const response = await this.request({
path: `/job/sync`,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: JobCreateRequestToJSON(requestParameters['body']),
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => ProcessedJobFromJSON(jsonValue));
}
/**
* Receives a Job in body and process it synchronusly and returns the data object
* Receives a job and process it syncrhonously
*/
async jobSyncPost(requestParameters: JobSyncPostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ProcessedJob> {
const response = await this.jobSyncPostRaw(requestParameters, initOverrides);
return await response.value();
}
}
/**
* @export
*/
export const JobSyncPostXResponseTypeEnum = {
JsonParsed: 'json-parsed',
RawHtml: 'raw-html'
} as const;
export type JobSyncPostXResponseTypeEnum = typeof JobSyncPostXResponseTypeEnum[keyof typeof JobSyncPostXResponseTypeEnum];
/**
* @export
*/
export const JobSyncPostXProxyRegionEnum = {
Mx: 'mx',
Af: 'af',
Al: 'al',
Dz: 'dz',
Ad: 'ad',
Ao: 'ao',
Ar: 'ar',
Am: 'am',
Aw: 'aw',
Au: 'au',
At: 'at',
Az: 'az',
Bs: 'bs',
Bh: 'bh',
Bd: 'bd',
By: 'by',
Be: 'be',
Bz: 'bz',
Bj: 'bj',
Bt: 'bt',
Bo: 'bo',
Ba: 'ba',
Br: 'br',
Bn: 'bn',
Bg: 'bg',
Kh: 'kh',
Cm: 'cm',
Ca: 'ca',
Cf: 'cf',
Td: 'td',
Cl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ua: 'ua',
Ae: 'ae',
Gb: 'gb',
Tz: 'tz',
Us: 'us',
Uy: 'uy',
Uz: 'uz',
Ve: 've',
Vn: 'vn',
Vg: 'vg',
Ye: 'ye',
Zm: 'zm',
Zw: 'zw'
} as const;
export type JobSyncPostXProxyRegionEnum = typeof JobSyncPostXProxyRegionEnum[keyof typeof JobSyncPostXProxyRegionEnum];