/** * Sparks OpenAPI * Generated documentation for the Logicdrop Sparks API and OpenAPI clients. Logicdrop Sparks lets users build rules, analyze data, and automate documents. Use it to make decisions faster, generate documents better, and learn from your data. ### Documentation - [User Documentation](https://docs.logicdrop.com) ### Modules - [Sparks Compute](https://docs.logicdrop.com/rules/introduction) - [Sparks Decision Tables](https://docs.logicdrop.com/rules/authoring-decision-tables) - [Sparks Documents](https://docs.logicdrop.com/documents/introduction) ### Clients - [OpenAPI Clients](https://docs.logicdrop.com/development/sample-clients) ### Security - [Authorizing API Requests](https://docs.logicdrop.com/development/authorization) * * The version of the OpenAPI document: v_VERSION_, build# _BUILD_ * Contact: support@logicdrop.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import localVarRequest = require('request'); import http = require('http'); /* tslint:disable:no-unused-locals */ import { ArtifactResponse } from '../model/artifactResponse'; import { DataResponse } from '../model/dataResponse'; import { Dataset } from '../model/dataset'; import { DeleteArtifactRequest } from '../model/deleteArtifactRequest'; import { DeleteDataRequest } from '../model/deleteDataRequest'; import { ExternalSource } from '../model/externalSource'; import { SaveContentRequest } from '../model/saveContentRequest'; import { UpdateArtifactRequest } from '../model/updateArtifactRequest'; import { UpdateDataRequest } from '../model/updateDataRequest'; import { UploadResponse } from '../model/uploadResponse'; import { UserData } from '../model/userData'; import { ObjectSerializer, Authentication, VoidAuth } from '../model/models'; import { HttpBasicAuth, ApiKeyAuth, OAuth } from '../model/models'; import { HttpError, RequestFile } from './apis'; let defaultBasePath = 'https://api.staging.com'; // =============================================== // This file is autogenerated - Please do not edit // =============================================== export enum DataServicesApiApiKeys { api, } export class DataServicesApi { protected _basePath = defaultBasePath; protected defaultHeaders : any = {}; protected _useQuerystring : boolean = false; protected authentications = { 'default': new VoidAuth(), 'jwt': new HttpBasicAuth(), 'api': new ApiKeyAuth('header', 'X-Logicdrop-ApiKey'), 'oauth2': new OAuth(), } constructor(oAuth?: OAuth); constructor(oAuth: OAuth, basePath?: string) { if (oAuth) { this.oAuth = oAuth; } if (basePath) { this.basePath = basePath; } } set useQuerystring(value: boolean) { this._useQuerystring = value; } set basePath(basePath: string) { this._basePath = basePath; } get basePath() { return this._basePath; } public setDefaultAuthentication(auth: Authentication) { this.authentications.default = auth; } public setApiKey(key: DataServicesApiApiKeys, value: string) { (this.authentications as any)[DataServicesApiApiKeys[key]].apiKey = value; } set oAuth(oAuth: OAuth) { this.authentications.oauth2 = oAuth; } set tokenUrl(tokenUrl: string) { this.authentications.oauth2.tokenUrl = tokenUrl; } set clientId(clientId: string) { this.authentications.oauth2.clientId = clientId; } set clientSecret(clientSecret: string) { this.authentications.oauth2.clientSecret = clientSecret; } /** * * @summary Delete dataset * @param client Client name * @param project Project name * @param artifact Dataset name * @param v Dataset version */ public async deleteDataset (client: string, project: string, artifact: string, v?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: ArtifactResponse; }> { const localVarPath = this.basePath + '/data/{client}/{project}/{artifact}' .replace('{' + 'client' + '}', encodeURIComponent(String(client))) .replace('{' + 'project' + '}', encodeURIComponent(String(project))) .replace('{' + 'artifact' + '}', encodeURIComponent(String(artifact))); let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); const produces = ['application/json']; // give precedence to 'application/json' if (produces.indexOf('application/json') >= 0) { localVarHeaderParams.Accept = 'application/json'; } else { localVarHeaderParams.Accept = produces.join(','); } let localVarFormParams: any = {}; // verify required parameter 'client' is not null or undefined if (client === null || client === undefined) { throw new Error('Required parameter client was null or undefined when calling deleteDataset.'); } // verify required parameter 'project' is not null or undefined if (project === null || project === undefined) { throw new Error('Required parameter project was null or undefined when calling deleteDataset.'); } // verify required parameter 'artifact' is not null or undefined if (artifact === null || artifact === undefined) { throw new Error('Required parameter artifact was null or undefined when calling deleteDataset.'); } if (v !== undefined) { localVarQueryParameters['v'] = ObjectSerializer.serialize(v, "string"); } (Object).assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; let localVarRequestOptions: localVarRequest.Options = { method: 'DELETE', qs: localVarQueryParameters, headers: localVarHeaderParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, }; let authenticationPromise = Promise.resolve(); authenticationPromise = authenticationPromise.then(async () => await this.authentications.oauth2.applyToRequest(localVarRequestOptions)); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); return authenticationPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; } else { localVarRequestOptions.form = localVarFormParams; } } return new Promise<{ response: http.ClientResponse; body: ArtifactResponse; }>((resolve, reject) => { localVarRequest(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { body = ObjectSerializer.deserialize(body, "ArtifactResponse"); if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject(new HttpError(response, body, response.statusCode)); } } }); }); }); } /** * * @summary Delete datasets * @param client Client name * @param project Project name * @param deleteArtifactRequest Remove datasets by criteria */ public async deleteDatasets (client: string, project: string, deleteArtifactRequest: DeleteArtifactRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: ArtifactResponse; }> { const localVarPath = this.basePath + '/data/{client}/{project}' .replace('{' + 'client' + '}', encodeURIComponent(String(client))) .replace('{' + 'project' + '}', encodeURIComponent(String(project))); let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); const produces = ['application/json']; // give precedence to 'application/json' if (produces.indexOf('application/json') >= 0) { localVarHeaderParams.Accept = 'application/json'; } else { localVarHeaderParams.Accept = produces.join(','); } let localVarFormParams: any = {}; // verify required parameter 'client' is not null or undefined if (client === null || client === undefined) { throw new Error('Required parameter client was null or undefined when calling deleteDatasets.'); } // verify required parameter 'project' is not null or undefined if (project === null || project === undefined) { throw new Error('Required parameter project was null or undefined when calling deleteDatasets.'); } // verify required parameter 'deleteArtifactRequest' is not null or undefined if (deleteArtifactRequest === null || deleteArtifactRequest === undefined) { throw new Error('Required parameter deleteArtifactRequest was null or undefined when calling deleteDatasets.'); } (Object).assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; let localVarRequestOptions: localVarRequest.Options = { method: 'DELETE', qs: localVarQueryParameters, headers: localVarHeaderParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, body: ObjectSerializer.serialize(deleteArtifactRequest, "DeleteArtifactRequest") }; let authenticationPromise = Promise.resolve(); authenticationPromise = authenticationPromise.then(async () => await this.authentications.oauth2.applyToRequest(localVarRequestOptions)); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); return authenticationPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; } else { localVarRequestOptions.form = localVarFormParams; } } return new Promise<{ response: http.ClientResponse; body: ArtifactResponse; }>((resolve, reject) => { localVarRequest(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { body = ObjectSerializer.deserialize(body, "ArtifactResponse"); if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject(new HttpError(response, body, response.statusCode)); } } }); }); }); } /** * * @summary Delete record * @param client Client name * @param project Project name * @param artifact Dataset name * @param id Record Id * @param v Dataset version */ public async deleteRecord (client: string, project: string, artifact: string, id: string, v?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: DataResponse; }> { const localVarPath = this.basePath + '/data/{client}/{project}/{artifact}/rows/{id}' .replace('{' + 'client' + '}', encodeURIComponent(String(client))) .replace('{' + 'project' + '}', encodeURIComponent(String(project))) .replace('{' + 'artifact' + '}', encodeURIComponent(String(artifact))) .replace('{' + 'id' + '}', encodeURIComponent(String(id))); let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); const produces = ['application/json']; // give precedence to 'application/json' if (produces.indexOf('application/json') >= 0) { localVarHeaderParams.Accept = 'application/json'; } else { localVarHeaderParams.Accept = produces.join(','); } let localVarFormParams: any = {}; // verify required parameter 'client' is not null or undefined if (client === null || client === undefined) { throw new Error('Required parameter client was null or undefined when calling deleteRecord.'); } // verify required parameter 'project' is not null or undefined if (project === null || project === undefined) { throw new Error('Required parameter project was null or undefined when calling deleteRecord.'); } // verify required parameter 'artifact' is not null or undefined if (artifact === null || artifact === undefined) { throw new Error('Required parameter artifact was null or undefined when calling deleteRecord.'); } // verify required parameter 'id' is not null or undefined if (id === null || id === undefined) { throw new Error('Required parameter id was null or undefined when calling deleteRecord.'); } if (v !== undefined) { localVarQueryParameters['v'] = ObjectSerializer.serialize(v, "string"); } (Object).assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; let localVarRequestOptions: localVarRequest.Options = { method: 'DELETE', qs: localVarQueryParameters, headers: localVarHeaderParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, }; let authenticationPromise = Promise.resolve(); authenticationPromise = authenticationPromise.then(async () => await this.authentications.oauth2.applyToRequest(localVarRequestOptions)); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); return authenticationPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; } else { localVarRequestOptions.form = localVarFormParams; } } return new Promise<{ response: http.ClientResponse; body: DataResponse; }>((resolve, reject) => { localVarRequest(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { body = ObjectSerializer.deserialize(body, "DataResponse"); if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject(new HttpError(response, body, response.statusCode)); } } }); }); }); } /** * * @summary Delete records * @param client Client name * @param project Project name * @param artifact Dataset name * @param deleteDataRequest Remove records by criteria * @param v Dataset version */ public async deleteRecords (client: string, project: string, artifact: string, deleteDataRequest: DeleteDataRequest, v?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: DataResponse; }> { const localVarPath = this.basePath + '/data/{client}/{project}/{artifact}/rows' .replace('{' + 'client' + '}', encodeURIComponent(String(client))) .replace('{' + 'project' + '}', encodeURIComponent(String(project))) .replace('{' + 'artifact' + '}', encodeURIComponent(String(artifact))); let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); const produces = ['application/json']; // give precedence to 'application/json' if (produces.indexOf('application/json') >= 0) { localVarHeaderParams.Accept = 'application/json'; } else { localVarHeaderParams.Accept = produces.join(','); } let localVarFormParams: any = {}; // verify required parameter 'client' is not null or undefined if (client === null || client === undefined) { throw new Error('Required parameter client was null or undefined when calling deleteRecords.'); } // verify required parameter 'project' is not null or undefined if (project === null || project === undefined) { throw new Error('Required parameter project was null or undefined when calling deleteRecords.'); } // verify required parameter 'artifact' is not null or undefined if (artifact === null || artifact === undefined) { throw new Error('Required parameter artifact was null or undefined when calling deleteRecords.'); } // verify required parameter 'deleteDataRequest' is not null or undefined if (deleteDataRequest === null || deleteDataRequest === undefined) { throw new Error('Required parameter deleteDataRequest was null or undefined when calling deleteRecords.'); } if (v !== undefined) { localVarQueryParameters['v'] = ObjectSerializer.serialize(v, "string"); } (Object).assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; let localVarRequestOptions: localVarRequest.Options = { method: 'DELETE', qs: localVarQueryParameters, headers: localVarHeaderParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, body: ObjectSerializer.serialize(deleteDataRequest, "DeleteDataRequest") }; let authenticationPromise = Promise.resolve(); authenticationPromise = authenticationPromise.then(async () => await this.authentications.oauth2.applyToRequest(localVarRequestOptions)); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); return authenticationPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; } else { localVarRequestOptions.form = localVarFormParams; } } return new Promise<{ response: http.ClientResponse; body: DataResponse; }>((resolve, reject) => { localVarRequest(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { body = ObjectSerializer.deserialize(body, "DataResponse"); if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject(new HttpError(response, body, response.statusCode)); } } }); }); }); } /** * Get a dataset * @summary Get dataset * @param client Client name * @param project Project name * @param artifact Dataset name * @param v Dataset version * @param view Fields to return in the results */ public async getDataset (client: string, project: string, artifact: string, v?: string, view?: Array, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Dataset; }> { const localVarPath = this.basePath + '/data/{client}/{project}/{artifact}' .replace('{' + 'client' + '}', encodeURIComponent(String(client))) .replace('{' + 'project' + '}', encodeURIComponent(String(project))) .replace('{' + 'artifact' + '}', encodeURIComponent(String(artifact))); let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); const produces = ['application/json']; // give precedence to 'application/json' if (produces.indexOf('application/json') >= 0) { localVarHeaderParams.Accept = 'application/json'; } else { localVarHeaderParams.Accept = produces.join(','); } let localVarFormParams: any = {}; // verify required parameter 'client' is not null or undefined if (client === null || client === undefined) { throw new Error('Required parameter client was null or undefined when calling getDataset.'); } // verify required parameter 'project' is not null or undefined if (project === null || project === undefined) { throw new Error('Required parameter project was null or undefined when calling getDataset.'); } // verify required parameter 'artifact' is not null or undefined if (artifact === null || artifact === undefined) { throw new Error('Required parameter artifact was null or undefined when calling getDataset.'); } if (v !== undefined) { localVarQueryParameters['v'] = ObjectSerializer.serialize(v, "string"); } if (view !== undefined) { localVarQueryParameters['view'] = ObjectSerializer.serialize(view, "Array"); } (Object).assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; let localVarRequestOptions: localVarRequest.Options = { method: 'GET', qs: localVarQueryParameters, headers: localVarHeaderParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, }; let authenticationPromise = Promise.resolve(); authenticationPromise = authenticationPromise.then(async () => await this.authentications.oauth2.applyToRequest(localVarRequestOptions)); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); return authenticationPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; } else { localVarRequestOptions.form = localVarFormParams; } } return new Promise<{ response: http.ClientResponse; body: Dataset; }>((resolve, reject) => { localVarRequest(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { body = ObjectSerializer.deserialize(body, "Dataset"); if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject(new HttpError(response, body, response.statusCode)); } } }); }); }); } /** * Get dataset content using optional simple filters * @summary Get content * @param client Client name * @param project Project name * @param artifact Dataset name * @param v Dataset version * @param view Fields to return in the results */ public async getDatasetContent (client: string, project: string, artifact: string, v?: string, view?: Array, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: object; }> { const localVarPath = this.basePath + '/data/{client}/{project}/{artifact}/content' .replace('{' + 'client' + '}', encodeURIComponent(String(client))) .replace('{' + 'project' + '}', encodeURIComponent(String(project))) .replace('{' + 'artifact' + '}', encodeURIComponent(String(artifact))); let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); const produces = ['application/json']; // give precedence to 'application/json' if (produces.indexOf('application/json') >= 0) { localVarHeaderParams.Accept = 'application/json'; } else { localVarHeaderParams.Accept = produces.join(','); } let localVarFormParams: any = {}; // verify required parameter 'client' is not null or undefined if (client === null || client === undefined) { throw new Error('Required parameter client was null or undefined when calling getDatasetContent.'); } // verify required parameter 'project' is not null or undefined if (project === null || project === undefined) { throw new Error('Required parameter project was null or undefined when calling getDatasetContent.'); } // verify required parameter 'artifact' is not null or undefined if (artifact === null || artifact === undefined) { throw new Error('Required parameter artifact was null or undefined when calling getDatasetContent.'); } if (v !== undefined) { localVarQueryParameters['v'] = ObjectSerializer.serialize(v, "string"); } if (view !== undefined) { localVarQueryParameters['view'] = ObjectSerializer.serialize(view, "Array"); } (Object).assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; let localVarRequestOptions: localVarRequest.Options = { method: 'GET', qs: localVarQueryParameters, headers: localVarHeaderParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, }; let authenticationPromise = Promise.resolve(); authenticationPromise = authenticationPromise.then(async () => await this.authentications.oauth2.applyToRequest(localVarRequestOptions)); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); return authenticationPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; } else { localVarRequestOptions.form = localVarFormParams; } } return new Promise<{ response: http.ClientResponse; body: object; }>((resolve, reject) => { localVarRequest(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { body = ObjectSerializer.deserialize(body, "object"); if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject(new HttpError(response, body, response.statusCode)); } } }); }); }); } /** * Get a record * @summary Get record * @param client Client name * @param project Project name * @param artifact Dataset name * @param id Record Id * @param v Dataset version * @param view Fields to return in the results */ public async getRecord (client: string, project: string, artifact: string, id: string, v?: string, view?: Array, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: UserData; }> { const localVarPath = this.basePath + '/data/{client}/{project}/{artifact}/rows/{id}' .replace('{' + 'client' + '}', encodeURIComponent(String(client))) .replace('{' + 'project' + '}', encodeURIComponent(String(project))) .replace('{' + 'artifact' + '}', encodeURIComponent(String(artifact))) .replace('{' + 'id' + '}', encodeURIComponent(String(id))); let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); const produces = ['application/json']; // give precedence to 'application/json' if (produces.indexOf('application/json') >= 0) { localVarHeaderParams.Accept = 'application/json'; } else { localVarHeaderParams.Accept = produces.join(','); } let localVarFormParams: any = {}; // verify required parameter 'client' is not null or undefined if (client === null || client === undefined) { throw new Error('Required parameter client was null or undefined when calling getRecord.'); } // verify required parameter 'project' is not null or undefined if (project === null || project === undefined) { throw new Error('Required parameter project was null or undefined when calling getRecord.'); } // verify required parameter 'artifact' is not null or undefined if (artifact === null || artifact === undefined) { throw new Error('Required parameter artifact was null or undefined when calling getRecord.'); } // verify required parameter 'id' is not null or undefined if (id === null || id === undefined) { throw new Error('Required parameter id was null or undefined when calling getRecord.'); } if (v !== undefined) { localVarQueryParameters['v'] = ObjectSerializer.serialize(v, "string"); } if (view !== undefined) { localVarQueryParameters['view'] = ObjectSerializer.serialize(view, "Array"); } (Object).assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; let localVarRequestOptions: localVarRequest.Options = { method: 'GET', qs: localVarQueryParameters, headers: localVarHeaderParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, }; let authenticationPromise = Promise.resolve(); authenticationPromise = authenticationPromise.then(async () => await this.authentications.oauth2.applyToRequest(localVarRequestOptions)); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); return authenticationPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; } else { localVarRequestOptions.form = localVarFormParams; } } return new Promise<{ response: http.ClientResponse; body: UserData; }>((resolve, reject) => { localVarRequest(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { body = ObjectSerializer.deserialize(body, "UserData"); if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject(new HttpError(response, body, response.statusCode)); } } }); }); }); } /** * Get datasets using optional simple filters * @summary List datasets * @param client Client name * @param project Project name * @param view Fields to return in the results */ public async listDatasets (client: string, project: string, view?: Array, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Array; }> { const localVarPath = this.basePath + '/data/{client}/{project}' .replace('{' + 'client' + '}', encodeURIComponent(String(client))) .replace('{' + 'project' + '}', encodeURIComponent(String(project))); let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); const produces = ['application/json']; // give precedence to 'application/json' if (produces.indexOf('application/json') >= 0) { localVarHeaderParams.Accept = 'application/json'; } else { localVarHeaderParams.Accept = produces.join(','); } let localVarFormParams: any = {}; // verify required parameter 'client' is not null or undefined if (client === null || client === undefined) { throw new Error('Required parameter client was null or undefined when calling listDatasets.'); } // verify required parameter 'project' is not null or undefined if (project === null || project === undefined) { throw new Error('Required parameter project was null or undefined when calling listDatasets.'); } if (view !== undefined) { localVarQueryParameters['view'] = ObjectSerializer.serialize(view, "Array"); } (Object).assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; let localVarRequestOptions: localVarRequest.Options = { method: 'GET', qs: localVarQueryParameters, headers: localVarHeaderParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, }; let authenticationPromise = Promise.resolve(); authenticationPromise = authenticationPromise.then(async () => await this.authentications.oauth2.applyToRequest(localVarRequestOptions)); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); return authenticationPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; } else { localVarRequestOptions.form = localVarFormParams; } } return new Promise<{ response: http.ClientResponse; body: Array; }>((resolve, reject) => { localVarRequest(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { body = ObjectSerializer.deserialize(body, "Array"); if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject(new HttpError(response, body, response.statusCode)); } } }); }); }); } /** * Get records using optional simple filters * @summary List records * @param client Client name * @param project Project name * @param artifact Dataset name * @param v Dataset version * @param criteria SQL-like query * @param fields Any fields that match the single value only (requires a value) * @param value Value to find in any fields (requires fields) * @param view Fields to return in the results * @param filter Filters to apply * @param order Fields to order by (field:asc|desc) * @param tags Tags to filter by * @param ignoreCase Ignore case */ public async listRecords (client: string, project: string, artifact: string, v?: string, criteria?: string, fields?: Array, value?: string, view?: Array, filter?: Array, order?: Array, tags?: Array, ignoreCase?: boolean, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Array; }> { const localVarPath = this.basePath + '/data/{client}/{project}/{artifact}/rows' .replace('{' + 'client' + '}', encodeURIComponent(String(client))) .replace('{' + 'project' + '}', encodeURIComponent(String(project))) .replace('{' + 'artifact' + '}', encodeURIComponent(String(artifact))); let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); const produces = ['application/json']; // give precedence to 'application/json' if (produces.indexOf('application/json') >= 0) { localVarHeaderParams.Accept = 'application/json'; } else { localVarHeaderParams.Accept = produces.join(','); } let localVarFormParams: any = {}; // verify required parameter 'client' is not null or undefined if (client === null || client === undefined) { throw new Error('Required parameter client was null or undefined when calling listRecords.'); } // verify required parameter 'project' is not null or undefined if (project === null || project === undefined) { throw new Error('Required parameter project was null or undefined when calling listRecords.'); } // verify required parameter 'artifact' is not null or undefined if (artifact === null || artifact === undefined) { throw new Error('Required parameter artifact was null or undefined when calling listRecords.'); } if (v !== undefined) { localVarQueryParameters['v'] = ObjectSerializer.serialize(v, "string"); } if (criteria !== undefined) { localVarQueryParameters['criteria'] = ObjectSerializer.serialize(criteria, "string"); } if (fields !== undefined) { localVarQueryParameters['fields'] = ObjectSerializer.serialize(fields, "Array"); } if (value !== undefined) { localVarQueryParameters['value'] = ObjectSerializer.serialize(value, "string"); } if (view !== undefined) { localVarQueryParameters['view'] = ObjectSerializer.serialize(view, "Array"); } if (filter !== undefined) { localVarQueryParameters['filter'] = ObjectSerializer.serialize(filter, "Array"); } if (order !== undefined) { localVarQueryParameters['order'] = ObjectSerializer.serialize(order, "Array"); } if (tags !== undefined) { localVarQueryParameters['tags'] = ObjectSerializer.serialize(tags, "Array"); } if (ignoreCase !== undefined) { localVarQueryParameters['ignoreCase'] = ObjectSerializer.serialize(ignoreCase, "boolean"); } (Object).assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; let localVarRequestOptions: localVarRequest.Options = { method: 'GET', qs: localVarQueryParameters, headers: localVarHeaderParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, }; let authenticationPromise = Promise.resolve(); authenticationPromise = authenticationPromise.then(async () => await this.authentications.oauth2.applyToRequest(localVarRequestOptions)); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); return authenticationPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; } else { localVarRequestOptions.form = localVarFormParams; } } return new Promise<{ response: http.ClientResponse; body: Array; }>((resolve, reject) => { localVarRequest(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { body = ObjectSerializer.deserialize(body, "Array"); if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject(new HttpError(response, body, response.statusCode)); } } }); }); }); } /** * Get records using a single key/value * @summary List records by key * @param client Client name * @param project Project name * @param artifact Dataset name * @param key Field name * @param value Field value * @param v Dataset version * @param view Fields to return in the results */ public async listRecordsByKey (client: string, project: string, artifact: string, key: string, value: string, v?: string, view?: Array, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Array; }> { const localVarPath = this.basePath + '/data/{client}/{project}/{artifact}/rows/{key}/{value}' .replace('{' + 'client' + '}', encodeURIComponent(String(client))) .replace('{' + 'project' + '}', encodeURIComponent(String(project))) .replace('{' + 'artifact' + '}', encodeURIComponent(String(artifact))) .replace('{' + 'key' + '}', encodeURIComponent(String(key))) .replace('{' + 'value' + '}', encodeURIComponent(String(value))); let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); const produces = ['application/json']; // give precedence to 'application/json' if (produces.indexOf('application/json') >= 0) { localVarHeaderParams.Accept = 'application/json'; } else { localVarHeaderParams.Accept = produces.join(','); } let localVarFormParams: any = {}; // verify required parameter 'client' is not null or undefined if (client === null || client === undefined) { throw new Error('Required parameter client was null or undefined when calling listRecordsByKey.'); } // verify required parameter 'project' is not null or undefined if (project === null || project === undefined) { throw new Error('Required parameter project was null or undefined when calling listRecordsByKey.'); } // verify required parameter 'artifact' is not null or undefined if (artifact === null || artifact === undefined) { throw new Error('Required parameter artifact was null or undefined when calling listRecordsByKey.'); } // verify required parameter 'key' is not null or undefined if (key === null || key === undefined) { throw new Error('Required parameter key was null or undefined when calling listRecordsByKey.'); } // verify required parameter 'value' is not null or undefined if (value === null || value === undefined) { throw new Error('Required parameter value was null or undefined when calling listRecordsByKey.'); } if (v !== undefined) { localVarQueryParameters['v'] = ObjectSerializer.serialize(v, "string"); } if (view !== undefined) { localVarQueryParameters['view'] = ObjectSerializer.serialize(view, "Array"); } (Object).assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; let localVarRequestOptions: localVarRequest.Options = { method: 'GET', qs: localVarQueryParameters, headers: localVarHeaderParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, }; let authenticationPromise = Promise.resolve(); authenticationPromise = authenticationPromise.then(async () => await this.authentications.oauth2.applyToRequest(localVarRequestOptions)); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); return authenticationPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; } else { localVarRequestOptions.form = localVarFormParams; } } return new Promise<{ response: http.ClientResponse; body: Array; }>((resolve, reject) => { localVarRequest(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { body = ObjectSerializer.deserialize(body, "Array"); if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject(new HttpError(response, body, response.statusCode)); } } }); }); }); } /** * Get available external sources or check if a source exists * @summary List external sources * @param client Client name * @param check Check if source name exists? */ public async listSources (client: string, check?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Array; }> { const localVarPath = this.basePath + '/data/{client}/sources' .replace('{' + 'client' + '}', encodeURIComponent(String(client))); let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); const produces = ['application/json']; // give precedence to 'application/json' if (produces.indexOf('application/json') >= 0) { localVarHeaderParams.Accept = 'application/json'; } else { localVarHeaderParams.Accept = produces.join(','); } let localVarFormParams: any = {}; // verify required parameter 'client' is not null or undefined if (client === null || client === undefined) { throw new Error('Required parameter client was null or undefined when calling listSources.'); } if (check !== undefined) { localVarQueryParameters['check'] = ObjectSerializer.serialize(check, "string"); } (Object).assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; let localVarRequestOptions: localVarRequest.Options = { method: 'GET', qs: localVarQueryParameters, headers: localVarHeaderParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, }; let authenticationPromise = Promise.resolve(); authenticationPromise = authenticationPromise.then(async () => await this.authentications.oauth2.applyToRequest(localVarRequestOptions)); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); return authenticationPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; } else { localVarRequestOptions.form = localVarFormParams; } } return new Promise<{ response: http.ClientResponse; body: Array; }>((resolve, reject) => { localVarRequest(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { body = ObjectSerializer.deserialize(body, "Array"); if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject(new HttpError(response, body, response.statusCode)); } } }); }); }); } /** * Saves or creates an dataset (overwrite) * @summary Save dataset * @param client Client name * @param project Project name * @param dataset Dataset to persist */ public async saveDataset (client: string, project: string, dataset: Dataset, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: Dataset; }> { const localVarPath = this.basePath + '/data/{client}/{project}' .replace('{' + 'client' + '}', encodeURIComponent(String(client))) .replace('{' + 'project' + '}', encodeURIComponent(String(project))); let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); const produces = ['application/json']; // give precedence to 'application/json' if (produces.indexOf('application/json') >= 0) { localVarHeaderParams.Accept = 'application/json'; } else { localVarHeaderParams.Accept = produces.join(','); } let localVarFormParams: any = {}; // verify required parameter 'client' is not null or undefined if (client === null || client === undefined) { throw new Error('Required parameter client was null or undefined when calling saveDataset.'); } // verify required parameter 'project' is not null or undefined if (project === null || project === undefined) { throw new Error('Required parameter project was null or undefined when calling saveDataset.'); } // verify required parameter 'dataset' is not null or undefined if (dataset === null || dataset === undefined) { throw new Error('Required parameter dataset was null or undefined when calling saveDataset.'); } (Object).assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; let localVarRequestOptions: localVarRequest.Options = { method: 'PUT', qs: localVarQueryParameters, headers: localVarHeaderParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, body: ObjectSerializer.serialize(dataset, "Dataset") }; let authenticationPromise = Promise.resolve(); authenticationPromise = authenticationPromise.then(async () => await this.authentications.oauth2.applyToRequest(localVarRequestOptions)); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); return authenticationPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; } else { localVarRequestOptions.form = localVarFormParams; } } return new Promise<{ response: http.ClientResponse; body: Dataset; }>((resolve, reject) => { localVarRequest(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { body = ObjectSerializer.deserialize(body, "Dataset"); if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject(new HttpError(response, body, response.statusCode)); } } }); }); }); } /** * Save dataset content * @summary Save content * @param client Client name * @param project Project name * @param artifact Dataset name * @param saveContentRequest Content to persist * @param v Dataset version */ public async saveDatasetContent (client: string, project: string, artifact: string, saveContentRequest: SaveContentRequest, v?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: object; }> { const localVarPath = this.basePath + '/data/{client}/{project}/{artifact}/content' .replace('{' + 'client' + '}', encodeURIComponent(String(client))) .replace('{' + 'project' + '}', encodeURIComponent(String(project))) .replace('{' + 'artifact' + '}', encodeURIComponent(String(artifact))); let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); const produces = ['application/json']; // give precedence to 'application/json' if (produces.indexOf('application/json') >= 0) { localVarHeaderParams.Accept = 'application/json'; } else { localVarHeaderParams.Accept = produces.join(','); } let localVarFormParams: any = {}; // verify required parameter 'client' is not null or undefined if (client === null || client === undefined) { throw new Error('Required parameter client was null or undefined when calling saveDatasetContent.'); } // verify required parameter 'project' is not null or undefined if (project === null || project === undefined) { throw new Error('Required parameter project was null or undefined when calling saveDatasetContent.'); } // verify required parameter 'artifact' is not null or undefined if (artifact === null || artifact === undefined) { throw new Error('Required parameter artifact was null or undefined when calling saveDatasetContent.'); } // verify required parameter 'saveContentRequest' is not null or undefined if (saveContentRequest === null || saveContentRequest === undefined) { throw new Error('Required parameter saveContentRequest was null or undefined when calling saveDatasetContent.'); } if (v !== undefined) { localVarQueryParameters['v'] = ObjectSerializer.serialize(v, "string"); } (Object).assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; let localVarRequestOptions: localVarRequest.Options = { method: 'PUT', qs: localVarQueryParameters, headers: localVarHeaderParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, body: ObjectSerializer.serialize(saveContentRequest, "SaveContentRequest") }; let authenticationPromise = Promise.resolve(); authenticationPromise = authenticationPromise.then(async () => await this.authentications.oauth2.applyToRequest(localVarRequestOptions)); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); return authenticationPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; } else { localVarRequestOptions.form = localVarFormParams; } } return new Promise<{ response: http.ClientResponse; body: object; }>((resolve, reject) => { localVarRequest(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { body = ObjectSerializer.deserialize(body, "object"); if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject(new HttpError(response, body, response.statusCode)); } } }); }); }); } /** * Saves or create a record (overwrite) * @summary Save record * @param client Client name * @param project Project name * @param artifact Dataset name * @param requestBody Record to persist * @param v Dataset version */ public async saveRecord (client: string, project: string, artifact: string, requestBody: { [key: string]: object; }, v?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: UserData; }> { const localVarPath = this.basePath + '/data/{client}/{project}/{artifact}/rows' .replace('{' + 'client' + '}', encodeURIComponent(String(client))) .replace('{' + 'project' + '}', encodeURIComponent(String(project))) .replace('{' + 'artifact' + '}', encodeURIComponent(String(artifact))); let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); const produces = ['application/json']; // give precedence to 'application/json' if (produces.indexOf('application/json') >= 0) { localVarHeaderParams.Accept = 'application/json'; } else { localVarHeaderParams.Accept = produces.join(','); } let localVarFormParams: any = {}; // verify required parameter 'client' is not null or undefined if (client === null || client === undefined) { throw new Error('Required parameter client was null or undefined when calling saveRecord.'); } // verify required parameter 'project' is not null or undefined if (project === null || project === undefined) { throw new Error('Required parameter project was null or undefined when calling saveRecord.'); } // verify required parameter 'artifact' is not null or undefined if (artifact === null || artifact === undefined) { throw new Error('Required parameter artifact was null or undefined when calling saveRecord.'); } // verify required parameter 'requestBody' is not null or undefined if (requestBody === null || requestBody === undefined) { throw new Error('Required parameter requestBody was null or undefined when calling saveRecord.'); } if (v !== undefined) { localVarQueryParameters['v'] = ObjectSerializer.serialize(v, "string"); } (Object).assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; let localVarRequestOptions: localVarRequest.Options = { method: 'PUT', qs: localVarQueryParameters, headers: localVarHeaderParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, body: ObjectSerializer.serialize(requestBody, "{ [key: string]: object; }") }; let authenticationPromise = Promise.resolve(); authenticationPromise = authenticationPromise.then(async () => await this.authentications.oauth2.applyToRequest(localVarRequestOptions)); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); return authenticationPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; } else { localVarRequestOptions.form = localVarFormParams; } } return new Promise<{ response: http.ClientResponse; body: UserData; }>((resolve, reject) => { localVarRequest(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { body = ObjectSerializer.deserialize(body, "UserData"); if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject(new HttpError(response, body, response.statusCode)); } } }); }); }); } /** * Updates one dataset * @summary Update dataset * @param client Client name * @param project Project name * @param updateArtifactRequest Dataset to update */ public async updateDataset (client: string, project: string, updateArtifactRequest: UpdateArtifactRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: ArtifactResponse; }> { const localVarPath = this.basePath + '/data/{client}/{project}' .replace('{' + 'client' + '}', encodeURIComponent(String(client))) .replace('{' + 'project' + '}', encodeURIComponent(String(project))); let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); const produces = ['application/json']; // give precedence to 'application/json' if (produces.indexOf('application/json') >= 0) { localVarHeaderParams.Accept = 'application/json'; } else { localVarHeaderParams.Accept = produces.join(','); } let localVarFormParams: any = {}; // verify required parameter 'client' is not null or undefined if (client === null || client === undefined) { throw new Error('Required parameter client was null or undefined when calling updateDataset.'); } // verify required parameter 'project' is not null or undefined if (project === null || project === undefined) { throw new Error('Required parameter project was null or undefined when calling updateDataset.'); } // verify required parameter 'updateArtifactRequest' is not null or undefined if (updateArtifactRequest === null || updateArtifactRequest === undefined) { throw new Error('Required parameter updateArtifactRequest was null or undefined when calling updateDataset.'); } (Object).assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; let localVarRequestOptions: localVarRequest.Options = { method: 'PATCH', qs: localVarQueryParameters, headers: localVarHeaderParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, body: ObjectSerializer.serialize(updateArtifactRequest, "UpdateArtifactRequest") }; let authenticationPromise = Promise.resolve(); authenticationPromise = authenticationPromise.then(async () => await this.authentications.oauth2.applyToRequest(localVarRequestOptions)); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); return authenticationPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; } else { localVarRequestOptions.form = localVarFormParams; } } return new Promise<{ response: http.ClientResponse; body: ArtifactResponse; }>((resolve, reject) => { localVarRequest(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { body = ObjectSerializer.deserialize(body, "ArtifactResponse"); if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject(new HttpError(response, body, response.statusCode)); } } }); }); }); } /** * Update dataset content * @summary Update content * @param client Client name * @param project Project name * @param artifact Dataset name * @param updateDataRequest Records to transform * @param v Dataset version */ public async updateDatasetContent (client: string, project: string, artifact: string, updateDataRequest: UpdateDataRequest, v?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: object; }> { const localVarPath = this.basePath + '/data/{client}/{project}/{artifact}/content' .replace('{' + 'client' + '}', encodeURIComponent(String(client))) .replace('{' + 'project' + '}', encodeURIComponent(String(project))) .replace('{' + 'artifact' + '}', encodeURIComponent(String(artifact))); let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); const produces = ['application/json']; // give precedence to 'application/json' if (produces.indexOf('application/json') >= 0) { localVarHeaderParams.Accept = 'application/json'; } else { localVarHeaderParams.Accept = produces.join(','); } let localVarFormParams: any = {}; // verify required parameter 'client' is not null or undefined if (client === null || client === undefined) { throw new Error('Required parameter client was null or undefined when calling updateDatasetContent.'); } // verify required parameter 'project' is not null or undefined if (project === null || project === undefined) { throw new Error('Required parameter project was null or undefined when calling updateDatasetContent.'); } // verify required parameter 'artifact' is not null or undefined if (artifact === null || artifact === undefined) { throw new Error('Required parameter artifact was null or undefined when calling updateDatasetContent.'); } // verify required parameter 'updateDataRequest' is not null or undefined if (updateDataRequest === null || updateDataRequest === undefined) { throw new Error('Required parameter updateDataRequest was null or undefined when calling updateDatasetContent.'); } if (v !== undefined) { localVarQueryParameters['v'] = ObjectSerializer.serialize(v, "string"); } (Object).assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; let localVarRequestOptions: localVarRequest.Options = { method: 'PATCH', qs: localVarQueryParameters, headers: localVarHeaderParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, body: ObjectSerializer.serialize(updateDataRequest, "UpdateDataRequest") }; let authenticationPromise = Promise.resolve(); authenticationPromise = authenticationPromise.then(async () => await this.authentications.oauth2.applyToRequest(localVarRequestOptions)); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); return authenticationPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; } else { localVarRequestOptions.form = localVarFormParams; } } return new Promise<{ response: http.ClientResponse; body: object; }>((resolve, reject) => { localVarRequest(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { body = ObjectSerializer.deserialize(body, "object"); if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject(new HttpError(response, body, response.statusCode)); } } }); }); }); } /** * Update dataset content item * @summary Update content item * @param client Client name * @param project Project name * @param artifact Dataset name * @param index Index or property to save at * @param updateDataRequest Content to persist at key * @param v Dataset version */ public async updateDatasetContentAt (client: string, project: string, artifact: string, index: string, updateDataRequest: UpdateDataRequest, v?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: object; }> { const localVarPath = this.basePath + '/data/{client}/{project}/{artifact}/content/{index}' .replace('{' + 'client' + '}', encodeURIComponent(String(client))) .replace('{' + 'project' + '}', encodeURIComponent(String(project))) .replace('{' + 'artifact' + '}', encodeURIComponent(String(artifact))) .replace('{' + 'index' + '}', encodeURIComponent(String(index))); let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); const produces = ['application/json']; // give precedence to 'application/json' if (produces.indexOf('application/json') >= 0) { localVarHeaderParams.Accept = 'application/json'; } else { localVarHeaderParams.Accept = produces.join(','); } let localVarFormParams: any = {}; // verify required parameter 'client' is not null or undefined if (client === null || client === undefined) { throw new Error('Required parameter client was null or undefined when calling updateDatasetContentAt.'); } // verify required parameter 'project' is not null or undefined if (project === null || project === undefined) { throw new Error('Required parameter project was null or undefined when calling updateDatasetContentAt.'); } // verify required parameter 'artifact' is not null or undefined if (artifact === null || artifact === undefined) { throw new Error('Required parameter artifact was null or undefined when calling updateDatasetContentAt.'); } // verify required parameter 'index' is not null or undefined if (index === null || index === undefined) { throw new Error('Required parameter index was null or undefined when calling updateDatasetContentAt.'); } // verify required parameter 'updateDataRequest' is not null or undefined if (updateDataRequest === null || updateDataRequest === undefined) { throw new Error('Required parameter updateDataRequest was null or undefined when calling updateDatasetContentAt.'); } if (v !== undefined) { localVarQueryParameters['v'] = ObjectSerializer.serialize(v, "string"); } (Object).assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; let localVarRequestOptions: localVarRequest.Options = { method: 'PATCH', qs: localVarQueryParameters, headers: localVarHeaderParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, body: ObjectSerializer.serialize(updateDataRequest, "UpdateDataRequest") }; let authenticationPromise = Promise.resolve(); authenticationPromise = authenticationPromise.then(async () => await this.authentications.oauth2.applyToRequest(localVarRequestOptions)); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); return authenticationPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; } else { localVarRequestOptions.form = localVarFormParams; } } return new Promise<{ response: http.ClientResponse; body: object; }>((resolve, reject) => { localVarRequest(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { body = ObjectSerializer.deserialize(body, "object"); if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject(new HttpError(response, body, response.statusCode)); } } }); }); }); } /** * Updates multiple datasets * @summary Update datasets * @param client Client name * @param project Project name * @param updateArtifactRequest Datasets to update */ public async updateDatasets (client: string, project: string, updateArtifactRequest: UpdateArtifactRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: ArtifactResponse; }> { const localVarPath = this.basePath + '/data/{client}/{project}' .replace('{' + 'client' + '}', encodeURIComponent(String(client))) .replace('{' + 'project' + '}', encodeURIComponent(String(project))); let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); const produces = ['application/json']; // give precedence to 'application/json' if (produces.indexOf('application/json') >= 0) { localVarHeaderParams.Accept = 'application/json'; } else { localVarHeaderParams.Accept = produces.join(','); } let localVarFormParams: any = {}; // verify required parameter 'client' is not null or undefined if (client === null || client === undefined) { throw new Error('Required parameter client was null or undefined when calling updateDatasets.'); } // verify required parameter 'project' is not null or undefined if (project === null || project === undefined) { throw new Error('Required parameter project was null or undefined when calling updateDatasets.'); } // verify required parameter 'updateArtifactRequest' is not null or undefined if (updateArtifactRequest === null || updateArtifactRequest === undefined) { throw new Error('Required parameter updateArtifactRequest was null or undefined when calling updateDatasets.'); } (Object).assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; let localVarRequestOptions: localVarRequest.Options = { method: 'POST', qs: localVarQueryParameters, headers: localVarHeaderParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, body: ObjectSerializer.serialize(updateArtifactRequest, "UpdateArtifactRequest") }; let authenticationPromise = Promise.resolve(); authenticationPromise = authenticationPromise.then(async () => await this.authentications.oauth2.applyToRequest(localVarRequestOptions)); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); return authenticationPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; } else { localVarRequestOptions.form = localVarFormParams; } } return new Promise<{ response: http.ClientResponse; body: ArtifactResponse; }>((resolve, reject) => { localVarRequest(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { body = ObjectSerializer.deserialize(body, "ArtifactResponse"); if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject(new HttpError(response, body, response.statusCode)); } } }); }); }); } /** * Updates existing records (overwrite) * @summary Update records * @param client Client name * @param project Project name * @param artifact Dataset name * @param updateDataRequest Records to update * @param v Dataset version */ public async updateRecords (client: string, project: string, artifact: string, updateDataRequest: UpdateDataRequest, v?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: DataResponse; }> { const localVarPath = this.basePath + '/data/{client}/{project}/{artifact}/rows' .replace('{' + 'client' + '}', encodeURIComponent(String(client))) .replace('{' + 'project' + '}', encodeURIComponent(String(project))) .replace('{' + 'artifact' + '}', encodeURIComponent(String(artifact))); let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); const produces = ['application/json']; // give precedence to 'application/json' if (produces.indexOf('application/json') >= 0) { localVarHeaderParams.Accept = 'application/json'; } else { localVarHeaderParams.Accept = produces.join(','); } let localVarFormParams: any = {}; // verify required parameter 'client' is not null or undefined if (client === null || client === undefined) { throw new Error('Required parameter client was null or undefined when calling updateRecords.'); } // verify required parameter 'project' is not null or undefined if (project === null || project === undefined) { throw new Error('Required parameter project was null or undefined when calling updateRecords.'); } // verify required parameter 'artifact' is not null or undefined if (artifact === null || artifact === undefined) { throw new Error('Required parameter artifact was null or undefined when calling updateRecords.'); } // verify required parameter 'updateDataRequest' is not null or undefined if (updateDataRequest === null || updateDataRequest === undefined) { throw new Error('Required parameter updateDataRequest was null or undefined when calling updateRecords.'); } if (v !== undefined) { localVarQueryParameters['v'] = ObjectSerializer.serialize(v, "string"); } (Object).assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; let localVarRequestOptions: localVarRequest.Options = { method: 'PATCH', qs: localVarQueryParameters, headers: localVarHeaderParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, body: ObjectSerializer.serialize(updateDataRequest, "UpdateDataRequest") }; let authenticationPromise = Promise.resolve(); authenticationPromise = authenticationPromise.then(async () => await this.authentications.oauth2.applyToRequest(localVarRequestOptions)); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); return authenticationPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; } else { localVarRequestOptions.form = localVarFormParams; } } return new Promise<{ response: http.ClientResponse; body: DataResponse; }>((resolve, reject) => { localVarRequest(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { body = ObjectSerializer.deserialize(body, "DataResponse"); if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject(new HttpError(response, body, response.statusCode)); } } }); }); }); } /** * Import datasets * @summary Import datasets * @param client Client name * @param project Project name * @param artifact Dataset name * @param identity Unique row identifier (key) * @param v Dataset version * @param external Document or collection * @param file File */ public async uploadDataset (client: string, project: string, artifact: string, identity: string, v?: string, external?: string, file?: RequestFile, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.ClientResponse; body: UploadResponse; }> { const localVarPath = this.basePath + '/data/{client}/{project}/{artifact}/import' .replace('{' + 'client' + '}', encodeURIComponent(String(client))) .replace('{' + 'project' + '}', encodeURIComponent(String(project))) .replace('{' + 'artifact' + '}', encodeURIComponent(String(artifact))); let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); const produces = ['application/json']; // give precedence to 'application/json' if (produces.indexOf('application/json') >= 0) { localVarHeaderParams.Accept = 'application/json'; } else { localVarHeaderParams.Accept = produces.join(','); } let localVarFormParams: any = {}; // verify required parameter 'client' is not null or undefined if (client === null || client === undefined) { throw new Error('Required parameter client was null or undefined when calling uploadDataset.'); } // verify required parameter 'project' is not null or undefined if (project === null || project === undefined) { throw new Error('Required parameter project was null or undefined when calling uploadDataset.'); } // verify required parameter 'artifact' is not null or undefined if (artifact === null || artifact === undefined) { throw new Error('Required parameter artifact was null or undefined when calling uploadDataset.'); } // verify required parameter 'identity' is not null or undefined if (identity === null || identity === undefined) { throw new Error('Required parameter identity was null or undefined when calling uploadDataset.'); } if (v !== undefined) { localVarQueryParameters['v'] = ObjectSerializer.serialize(v, "string"); } if (identity !== undefined) { localVarQueryParameters['identity'] = ObjectSerializer.serialize(identity, "string"); } if (external !== undefined) { localVarQueryParameters['external'] = ObjectSerializer.serialize(external, "string"); } (Object).assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; if (file !== undefined) { const newfile: any = file; localVarFormParams['file'] = { value: newfile.buffer, options: { filename: newfile.originalname, contentType: newfile.mimetype, encoding: newfile.encoding } }; } localVarUseFormData = true; let localVarRequestOptions: localVarRequest.Options = { method: 'POST', qs: localVarQueryParameters, headers: localVarHeaderParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, }; let authenticationPromise = Promise.resolve(); authenticationPromise = authenticationPromise.then(async () => await this.authentications.oauth2.applyToRequest(localVarRequestOptions)); authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); return authenticationPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { (localVarRequestOptions).formData = localVarFormParams; } else { localVarRequestOptions.form = localVarFormParams; } } return new Promise<{ response: http.ClientResponse; body: UploadResponse; }>((resolve, reject) => { localVarRequest(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { body = ObjectSerializer.deserialize(body, "UploadResponse"); if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject(new HttpError(response, body, response.statusCode)); } } }); }); }); } }