cwmsjs
Version:
CWMS Data API Library for JavaScript/TypeScript created with OpenAPI generator for use with browser webapps
235 lines (234 loc) • 10.9 kB
JavaScript
;
/* tslint:disable */
/* eslint-disable */
/**
* CWMS Data API
* CWMS REST API for Data Retrieval
*
* The version of the OpenAPI document: 2.4.0-2026.3.16
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const runtime = require("../runtime");
const models_1 = require("../models");
/**
*
*/
class BlobApi extends runtime.BaseAPI {
/**
* Deletes requested blob
* Delete blobs with blobId
*/
deleteBlobsWithBlobIdRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters.blobId === null || requestParameters.blobId === undefined) {
throw new runtime.RequiredError('blobId', 'Required parameter requestParameters.blobId was null or undefined when calling deleteBlobsWithBlobId.');
}
if (requestParameters.blobId2 === null || requestParameters.blobId2 === undefined) {
throw new runtime.RequiredError('blobId2', 'Required parameter requestParameters.blobId2 was null or undefined when calling deleteBlobsWithBlobId.');
}
if (requestParameters.office === null || requestParameters.office === undefined) {
throw new runtime.RequiredError('office', 'Required parameter requestParameters.office was null or undefined when calling deleteBlobsWithBlobId.');
}
const queryParameters = {};
if (requestParameters.blobId2 !== undefined) {
queryParameters['blob-id'] = requestParameters.blobId2;
}
if (requestParameters.office !== undefined) {
queryParameters['office'] = requestParameters.office;
}
const headerParameters = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
}
const response = yield this.request({
path: `/blobs/{blob-id}`.replace(`{${"blob-id"}}`, encodeURIComponent(String(requestParameters.blobId))),
method: 'DELETE',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.VoidApiResponse(response);
});
}
/**
* Deletes requested blob
* Delete blobs with blobId
*/
deleteBlobsWithBlobId(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
yield this.deleteBlobsWithBlobIdRaw(requestParameters, initOverrides);
});
}
/**
* Get blobs
*/
getBlobsRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const queryParameters = {};
if (requestParameters.office !== undefined) {
queryParameters['office'] = requestParameters.office;
}
if (requestParameters.page !== undefined) {
queryParameters['page'] = requestParameters.page;
}
if (requestParameters.pageSize !== undefined) {
queryParameters['page-size'] = requestParameters.pageSize;
}
if (requestParameters.like !== undefined) {
queryParameters['like'] = requestParameters.like;
}
const headerParameters = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
}
const response = yield this.request({
path: `/blobs`,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => models_1.BlobsFromJSON(jsonValue));
});
}
/**
* Get blobs
*/
getBlobs(requestParameters = {}, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield this.getBlobsRaw(requestParameters, initOverrides);
return yield response.value();
});
}
/**
* Returns the binary value of the requested blob as a seekable stream with the appropriate media type.
* Get blobs with blobId
*/
getBlobsWithBlobIdRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters.blobId === null || requestParameters.blobId === undefined) {
throw new runtime.RequiredError('blobId', 'Required parameter requestParameters.blobId was null or undefined when calling getBlobsWithBlobId.');
}
const queryParameters = {};
if (requestParameters.office !== undefined) {
queryParameters['office'] = requestParameters.office;
}
if (requestParameters.blobId2 !== undefined) {
queryParameters['blob-id'] = requestParameters.blobId2;
}
const headerParameters = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
}
const response = yield this.request({
path: `/blobs/{blob-id}`.replace(`{${"blob-id"}}`, encodeURIComponent(String(requestParameters.blobId))),
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response);
});
}
/**
* Returns the binary value of the requested blob as a seekable stream with the appropriate media type.
* Get blobs with blobId
*/
getBlobsWithBlobId(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield this.getBlobsWithBlobIdRaw(requestParameters, initOverrides);
return yield response.value();
});
}
/**
* Update an existing Blob
* Patch blobs with blobId
*/
patchBlobsWithBlobIdRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters.blobId === null || requestParameters.blobId === undefined) {
throw new runtime.RequiredError('blobId', 'Required parameter requestParameters.blobId was null or undefined when calling patchBlobsWithBlobId.');
}
if (requestParameters.blobId2 === null || requestParameters.blobId2 === undefined) {
throw new runtime.RequiredError('blobId2', 'Required parameter requestParameters.blobId2 was null or undefined when calling patchBlobsWithBlobId.');
}
if (requestParameters.blob === null || requestParameters.blob === undefined) {
throw new runtime.RequiredError('blob', 'Required parameter requestParameters.blob was null or undefined when calling patchBlobsWithBlobId.');
}
const queryParameters = {};
if (requestParameters.blobId2 !== undefined) {
queryParameters['blob-id'] = requestParameters.blobId2;
}
const headerParameters = {};
headerParameters['Content-Type'] = 'application/json;version=2';
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
}
const response = yield this.request({
path: `/blobs/{blob-id}`.replace(`{${"blob-id"}}`, encodeURIComponent(String(requestParameters.blobId))),
method: 'PATCH',
headers: headerParameters,
query: queryParameters,
body: models_1.BlobToJSON(requestParameters.blob),
}, initOverrides);
return new runtime.VoidApiResponse(response);
});
}
/**
* Update an existing Blob
* Patch blobs with blobId
*/
patchBlobsWithBlobId(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
yield this.patchBlobsWithBlobIdRaw(requestParameters, initOverrides);
});
}
/**
* Create new Blob
* Post blobs
*/
postBlobsRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters.blob === null || requestParameters.blob === undefined) {
throw new runtime.RequiredError('blob', 'Required parameter requestParameters.blob was null or undefined when calling postBlobs.');
}
const queryParameters = {};
if (requestParameters.failIfExists !== undefined) {
queryParameters['fail-if-exists'] = requestParameters.failIfExists;
}
const headerParameters = {};
headerParameters['Content-Type'] = 'application/json;version=2';
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
}
const response = yield this.request({
path: `/blobs`,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: models_1.BlobToJSON(requestParameters.blob),
}, initOverrides);
return new runtime.VoidApiResponse(response);
});
}
/**
* Create new Blob
* Post blobs
*/
postBlobs(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
yield this.postBlobsRaw(requestParameters, initOverrides);
});
}
}
exports.BlobApi = BlobApi;