cwmsjs
Version:
CWMS Data API Library for JavaScript/TypeScript created with OpenAPI generator for use with browser webapps
241 lines (240 loc) • 11.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 ClobApi extends runtime.BaseAPI {
/**
* Delete clob
* Delete clobs with clobId
*/
deleteClobsWithClobIdRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters.clobId === null || requestParameters.clobId === undefined) {
throw new runtime.RequiredError('clobId', 'Required parameter requestParameters.clobId was null or undefined when calling deleteClobsWithClobId.');
}
if (requestParameters.clobId2 === null || requestParameters.clobId2 === undefined) {
throw new runtime.RequiredError('clobId2', 'Required parameter requestParameters.clobId2 was null or undefined when calling deleteClobsWithClobId.');
}
if (requestParameters.office === null || requestParameters.office === undefined) {
throw new runtime.RequiredError('office', 'Required parameter requestParameters.office was null or undefined when calling deleteClobsWithClobId.');
}
const queryParameters = {};
if (requestParameters.clobId2 !== undefined) {
queryParameters['clob-id'] = requestParameters.clobId2;
}
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: `/clobs/{clob-id}`.replace(`{${"clob-id"}}`, encodeURIComponent(String(requestParameters.clobId))),
method: 'DELETE',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.VoidApiResponse(response);
});
}
/**
* Delete clob
* Delete clobs with clobId
*/
deleteClobsWithClobId(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
yield this.deleteClobsWithClobIdRaw(requestParameters, initOverrides);
});
}
/**
* Get clobs
*/
getClobsRaw(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.includeValues !== undefined) {
queryParameters['include-values'] = requestParameters.includeValues;
}
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: `/clobs`,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => models_1.ClobsFromJSON(jsonValue));
});
}
/**
* Get clobs
*/
getClobs(requestParameters = {}, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield this.getClobsRaw(requestParameters, initOverrides);
return yield response.value();
});
}
/**
* Get a single clob. If the accept header is set to text/plain, the raw value is returned as the response body. Responses to text/plain requests are streamed and support the Range header. When the accept header is set to application/json;version=2 the clob will be returned as a serialized Clob object with fields for office-id, id, description and value. For more information about accept header usage, <a href=\"legacy-format/\">see this page.</a>
* Get clobs with clobId
*/
getClobsWithClobIdRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters.clobId === null || requestParameters.clobId === undefined) {
throw new runtime.RequiredError('clobId', 'Required parameter requestParameters.clobId was null or undefined when calling getClobsWithClobId.');
}
const queryParameters = {};
if (requestParameters.office !== undefined) {
queryParameters['office'] = requestParameters.office;
}
if (requestParameters.clobId2 !== undefined) {
queryParameters['clob-id'] = requestParameters.clobId2;
}
const headerParameters = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
}
const response = yield this.request({
path: `/clobs/{clob-id}`.replace(`{${"clob-id"}}`, encodeURIComponent(String(requestParameters.clobId))),
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => models_1.ClobFromJSON(jsonValue));
});
}
/**
* Get a single clob. If the accept header is set to text/plain, the raw value is returned as the response body. Responses to text/plain requests are streamed and support the Range header. When the accept header is set to application/json;version=2 the clob will be returned as a serialized Clob object with fields for office-id, id, description and value. For more information about accept header usage, <a href=\"legacy-format/\">see this page.</a>
* Get clobs with clobId
*/
getClobsWithClobId(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield this.getClobsWithClobIdRaw(requestParameters, initOverrides);
return yield response.value();
});
}
/**
* Update clob
* Patch clobs with clobId
*/
patchClobsWithClobIdRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters.clobId === null || requestParameters.clobId === undefined) {
throw new runtime.RequiredError('clobId', 'Required parameter requestParameters.clobId was null or undefined when calling patchClobsWithClobId.');
}
if (requestParameters.clobId2 === null || requestParameters.clobId2 === undefined) {
throw new runtime.RequiredError('clobId2', 'Required parameter requestParameters.clobId2 was null or undefined when calling patchClobsWithClobId.');
}
if (requestParameters.clob === null || requestParameters.clob === undefined) {
throw new runtime.RequiredError('clob', 'Required parameter requestParameters.clob was null or undefined when calling patchClobsWithClobId.');
}
const queryParameters = {};
if (requestParameters.clobId2 !== undefined) {
queryParameters['clob-id'] = requestParameters.clobId2;
}
if (requestParameters.ignoreNulls !== undefined) {
queryParameters['ignore-nulls'] = requestParameters.ignoreNulls;
}
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: `/clobs/{clob-id}`.replace(`{${"clob-id"}}`, encodeURIComponent(String(requestParameters.clobId))),
method: 'PATCH',
headers: headerParameters,
query: queryParameters,
body: models_1.ClobToJSON(requestParameters.clob),
}, initOverrides);
return new runtime.VoidApiResponse(response);
});
}
/**
* Update clob
* Patch clobs with clobId
*/
patchClobsWithClobId(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
yield this.patchClobsWithClobIdRaw(requestParameters, initOverrides);
});
}
/**
* Create new Clob
* Post clobs
*/
postClobsRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters.clob === null || requestParameters.clob === undefined) {
throw new runtime.RequiredError('clob', 'Required parameter requestParameters.clob was null or undefined when calling postClobs.');
}
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: `/clobs`,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: models_1.ClobToJSON(requestParameters.clob),
}, initOverrides);
return new runtime.VoidApiResponse(response);
});
}
/**
* Create new Clob
* Post clobs
*/
postClobs(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
yield this.postClobsRaw(requestParameters, initOverrides);
});
}
}
exports.ClobApi = ClobApi;