UNPKG

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.

134 lines (111 loc) 4.44 kB
/** * 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 ApiClient from '../ApiClient'; /** * The Data model module. * @module model/Data * @version 1.0.0 */ class Data { /** * Constructs a new <code>Data</code>. * @alias module:model/Data * @param id {String} * @param jobid {String} * @param data {Object} * @param createdAt {String} */ constructor(id, jobid, data, createdAt) { Data.initialize(this, id, jobid, data, createdAt); } /** * Initializes the fields of this object. * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins). * Only for internal use. */ static initialize(obj, id, jobid, data, createdAt) { obj['id'] = id; obj['jobid'] = jobid; obj['data'] = data; obj['created_at'] = createdAt; } /** * Constructs a <code>Data</code> from a plain JavaScript object, optionally creating a new instance. * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not. * @param {Object} data The plain JavaScript object bearing properties of interest. * @param {module:model/Data} obj Optional instance to populate. * @return {module:model/Data} The populated <code>Data</code> instance. */ static constructFromObject(data, obj) { if (data) { obj = obj || new Data(); if (data.hasOwnProperty('id')) { obj['id'] = ApiClient.convertToType(data['id'], 'String'); } if (data.hasOwnProperty('jobid')) { obj['jobid'] = ApiClient.convertToType(data['jobid'], 'String'); } if (data.hasOwnProperty('data')) { obj['data'] = ApiClient.convertToType(data['data'], Object); } if (data.hasOwnProperty('created_at')) { obj['created_at'] = ApiClient.convertToType(data['created_at'], 'String'); } } return obj; } /** * Validates the JSON data with respect to <code>Data</code>. * @param {Object} data The plain JavaScript object bearing properties of interest. * @return {boolean} to indicate whether the JSON data is valid with respect to <code>Data</code>. */ static validateJSON(data) { // check to make sure all required properties are present in the JSON string for (const property of Data.RequiredProperties) { if (!data.hasOwnProperty(property)) { throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); } } // ensure the json data is a string if (data['id'] && !(typeof data['id'] === 'string' || data['id'] instanceof String)) { throw new Error("Expected the field `id` to be a primitive type in the JSON string but got " + data['id']); } // ensure the json data is a string if (data['jobid'] && !(typeof data['jobid'] === 'string' || data['jobid'] instanceof String)) { throw new Error("Expected the field `jobid` to be a primitive type in the JSON string but got " + data['jobid']); } // ensure the json data is a string if (data['created_at'] && !(typeof data['created_at'] === 'string' || data['created_at'] instanceof String)) { throw new Error("Expected the field `created_at` to be a primitive type in the JSON string but got " + data['created_at']); } return true; } } Data.RequiredProperties = ["id", "jobid", "data", "created_at"]; /** * @member {String} id */ Data.prototype['id'] = undefined; /** * @member {String} jobid */ Data.prototype['jobid'] = undefined; /** * @member {Object} data */ Data.prototype['data'] = undefined; /** * @member {String} created_at */ Data.prototype['created_at'] = undefined; export default Data;