cwmsjs
Version:
CWMS Data API Library for JavaScript/TypeScript created with OpenAPI generator for use with browser webapps
630 lines (629 loc) • 29.6 kB
JavaScript
"use strict";
/* tslint:disable */
/* eslint-disable */
/**
* CWMS Data API
* CWMS REST API for Data Retrieval
*
* The version of the OpenAPI document: 2.3.2-2025.03.19
*
*
* 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) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
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) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.RatingsApi = void 0;
const runtime = require("../runtime");
const index_1 = require("../models/index");
/**
*
*/
class RatingsApi extends runtime.BaseAPI {
/**
* Deletes requested rating specification
* Delete cwmsData ratings spec with ratingId
*/
deleteRatingsSpecWithRatingIdRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters['ratingId'] == null) {
throw new runtime.RequiredError('ratingId', 'Required parameter "ratingId" was null or undefined when calling deleteRatingsSpecWithRatingId().');
}
if (requestParameters['office'] == null) {
throw new runtime.RequiredError('office', 'Required parameter "office" was null or undefined when calling deleteRatingsSpecWithRatingId().');
}
if (requestParameters['method'] == null) {
throw new runtime.RequiredError('method', 'Required parameter "method" was null or undefined when calling deleteRatingsSpecWithRatingId().');
}
const queryParameters = {};
if (requestParameters['office'] != null) {
queryParameters['office'] = requestParameters['office'];
}
if (requestParameters['method'] != null) {
queryParameters['method'] = requestParameters['method'];
}
const headerParameters = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = yield this.configuration.apiKey("Authorization"); // ApiKey authentication
}
const response = yield this.request({
path: `/ratings/spec/{rating-id}`.replace(`{${"rating-id"}}`, encodeURIComponent(String(requestParameters['ratingId']))),
method: 'DELETE',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.VoidApiResponse(response);
});
}
/**
* Deletes requested rating specification
* Delete cwmsData ratings spec with ratingId
*/
deleteRatingsSpecWithRatingId(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
yield this.deleteRatingsSpecWithRatingIdRaw(requestParameters, initOverrides);
});
}
/**
* Deletes requested rating specification
* Delete cwmsData ratings template with templateId
*/
deleteRatingsTemplateWithTemplateIdRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters['templateId'] == null) {
throw new runtime.RequiredError('templateId', 'Required parameter "templateId" was null or undefined when calling deleteRatingsTemplateWithTemplateId().');
}
if (requestParameters['office'] == null) {
throw new runtime.RequiredError('office', 'Required parameter "office" was null or undefined when calling deleteRatingsTemplateWithTemplateId().');
}
if (requestParameters['method'] == null) {
throw new runtime.RequiredError('method', 'Required parameter "method" was null or undefined when calling deleteRatingsTemplateWithTemplateId().');
}
const queryParameters = {};
if (requestParameters['office'] != null) {
queryParameters['office'] = requestParameters['office'];
}
if (requestParameters['method'] != null) {
queryParameters['method'] = requestParameters['method'];
}
const headerParameters = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = yield this.configuration.apiKey("Authorization"); // ApiKey authentication
}
const response = yield this.request({
path: `/ratings/template/{template-id}`.replace(`{${"template-id"}}`, encodeURIComponent(String(requestParameters['templateId']))),
method: 'DELETE',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.VoidApiResponse(response);
});
}
/**
* Deletes requested rating specification
* Delete cwmsData ratings template with templateId
*/
deleteRatingsTemplateWithTemplateId(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
yield this.deleteRatingsTemplateWithTemplateIdRaw(requestParameters, initOverrides);
});
}
/**
* Delete cwmsData ratings with ratingId
*/
deleteRatingsWithRatingIdRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters['ratingId'] == null) {
throw new runtime.RequiredError('ratingId', 'Required parameter "ratingId" was null or undefined when calling deleteRatingsWithRatingId().');
}
if (requestParameters['office'] == null) {
throw new runtime.RequiredError('office', 'Required parameter "office" was null or undefined when calling deleteRatingsWithRatingId().');
}
if (requestParameters['begin'] == null) {
throw new runtime.RequiredError('begin', 'Required parameter "begin" was null or undefined when calling deleteRatingsWithRatingId().');
}
if (requestParameters['end'] == null) {
throw new runtime.RequiredError('end', 'Required parameter "end" was null or undefined when calling deleteRatingsWithRatingId().');
}
const queryParameters = {};
if (requestParameters['office'] != null) {
queryParameters['office'] = requestParameters['office'];
}
if (requestParameters['begin'] != null) {
queryParameters['begin'] = requestParameters['begin'];
}
if (requestParameters['end'] != null) {
queryParameters['end'] = requestParameters['end'];
}
if (requestParameters['timezone'] != null) {
queryParameters['timezone'] = requestParameters['timezone'];
}
const headerParameters = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = yield this.configuration.apiKey("Authorization"); // ApiKey authentication
}
const response = yield this.request({
path: `/ratings/{rating-id}`.replace(`{${"rating-id"}}`, encodeURIComponent(String(requestParameters['ratingId']))),
method: 'DELETE',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.VoidApiResponse(response);
});
}
/**
* Delete cwmsData ratings with ratingId
*/
deleteRatingsWithRatingId(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
yield this.deleteRatingsWithRatingIdRaw(requestParameters, initOverrides);
});
}
/**
* Get cwmsData ratings
*/
getRatingsRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const queryParameters = {};
if (requestParameters['name'] != null) {
queryParameters['name'] = requestParameters['name'];
}
if (requestParameters['office'] != null) {
queryParameters['office'] = requestParameters['office'];
}
if (requestParameters['unit'] != null) {
queryParameters['unit'] = requestParameters['unit'];
}
if (requestParameters['datum'] != null) {
queryParameters['datum'] = requestParameters['datum'];
}
if (requestParameters['at'] != null) {
queryParameters['at'] = requestParameters['at'];
}
if (requestParameters['end'] != null) {
queryParameters['end'] = requestParameters['end'];
}
if (requestParameters['timezone'] != null) {
queryParameters['timezone'] = requestParameters['timezone'];
}
if (requestParameters['format'] != null) {
queryParameters['format'] = requestParameters['format'];
}
const headerParameters = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = yield this.configuration.apiKey("Authorization"); // ApiKey authentication
}
const response = yield this.request({
path: `/ratings`,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response);
});
}
/**
* Get cwmsData ratings
*/
getRatings(requestParameters = {}, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield this.getRatingsRaw(requestParameters, initOverrides);
return yield response.value();
});
}
/**
* Get cwmsData ratings metadata
*/
getRatingsMetadataRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const queryParameters = {};
if (requestParameters['office'] != null) {
queryParameters['office'] = requestParameters['office'];
}
if (requestParameters['ratingIdMask'] != null) {
queryParameters['rating-id-mask'] = requestParameters['ratingIdMask'];
}
if (requestParameters['start'] != null) {
queryParameters['start'] = requestParameters['start'];
}
if (requestParameters['end'] != null) {
queryParameters['end'] = requestParameters['end'];
}
if (requestParameters['timezone'] != null) {
queryParameters['timezone'] = requestParameters['timezone'];
}
if (requestParameters['page'] != null) {
queryParameters['page'] = requestParameters['page'];
}
if (requestParameters['pageSize'] != null) {
queryParameters['page-size'] = requestParameters['pageSize'];
}
const headerParameters = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = yield this.configuration.apiKey("Authorization"); // ApiKey authentication
}
const response = yield this.request({
path: `/ratings/metadata`,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.RatingMetadataListFromJSON)(jsonValue));
});
}
/**
* Get cwmsData ratings metadata
*/
getRatingsMetadata(requestParameters = {}, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield this.getRatingsMetadataRaw(requestParameters, initOverrides);
return yield response.value();
});
}
/**
* Get cwmsData ratings spec
*/
getRatingsSpecRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const queryParameters = {};
if (requestParameters['office'] != null) {
queryParameters['office'] = requestParameters['office'];
}
if (requestParameters['ratingIdMask'] != null) {
queryParameters['rating-id-mask'] = requestParameters['ratingIdMask'];
}
if (requestParameters['page'] != null) {
queryParameters['page'] = requestParameters['page'];
}
if (requestParameters['pageSize'] != null) {
queryParameters['page-size'] = requestParameters['pageSize'];
}
const headerParameters = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = yield this.configuration.apiKey("Authorization"); // ApiKey authentication
}
const response = yield this.request({
path: `/ratings/spec`,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.RatingSpecsFromJSON)(jsonValue));
});
}
/**
* Get cwmsData ratings spec
*/
getRatingsSpec(requestParameters = {}, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield this.getRatingsSpecRaw(requestParameters, initOverrides);
return yield response.value();
});
}
/**
* Get cwmsData ratings spec with ratingId
*/
getRatingsSpecWithRatingIdRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters['ratingId'] == null) {
throw new runtime.RequiredError('ratingId', 'Required parameter "ratingId" was null or undefined when calling getRatingsSpecWithRatingId().');
}
if (requestParameters['office'] == null) {
throw new runtime.RequiredError('office', 'Required parameter "office" was null or undefined when calling getRatingsSpecWithRatingId().');
}
const queryParameters = {};
if (requestParameters['office'] != null) {
queryParameters['office'] = requestParameters['office'];
}
const headerParameters = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = yield this.configuration.apiKey("Authorization"); // ApiKey authentication
}
const response = yield this.request({
path: `/ratings/spec/{rating-id}`.replace(`{${"rating-id"}}`, encodeURIComponent(String(requestParameters['ratingId']))),
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.RatingSpecFromJSON)(jsonValue));
});
}
/**
* Get cwmsData ratings spec with ratingId
*/
getRatingsSpecWithRatingId(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield this.getRatingsSpecWithRatingIdRaw(requestParameters, initOverrides);
return yield response.value();
});
}
/**
* Get cwmsData ratings template
*/
getRatingsTemplateRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const queryParameters = {};
if (requestParameters['office'] != null) {
queryParameters['office'] = requestParameters['office'];
}
if (requestParameters['templateIdMask'] != null) {
queryParameters['template-id-mask'] = requestParameters['templateIdMask'];
}
if (requestParameters['page'] != null) {
queryParameters['page'] = requestParameters['page'];
}
if (requestParameters['pageSize'] != null) {
queryParameters['page-size'] = requestParameters['pageSize'];
}
const headerParameters = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = yield this.configuration.apiKey("Authorization"); // ApiKey authentication
}
const response = yield this.request({
path: `/ratings/template`,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.RatingTemplatesFromJSON)(jsonValue));
});
}
/**
* Get cwmsData ratings template
*/
getRatingsTemplate(requestParameters = {}, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield this.getRatingsTemplateRaw(requestParameters, initOverrides);
return yield response.value();
});
}
/**
* Get cwmsData ratings template with templateId
*/
getRatingsTemplateWithTemplateIdRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters['templateId'] == null) {
throw new runtime.RequiredError('templateId', 'Required parameter "templateId" was null or undefined when calling getRatingsTemplateWithTemplateId().');
}
if (requestParameters['office'] == null) {
throw new runtime.RequiredError('office', 'Required parameter "office" was null or undefined when calling getRatingsTemplateWithTemplateId().');
}
const queryParameters = {};
if (requestParameters['office'] != null) {
queryParameters['office'] = requestParameters['office'];
}
const headerParameters = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = yield this.configuration.apiKey("Authorization"); // ApiKey authentication
}
const response = yield this.request({
path: `/ratings/template/{template-id}`.replace(`{${"template-id"}}`, encodeURIComponent(String(requestParameters['templateId']))),
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(index_1.RatingTemplateFromJSON));
});
}
/**
* Get cwmsData ratings template with templateId
*/
getRatingsTemplateWithTemplateId(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield this.getRatingsTemplateWithTemplateIdRaw(requestParameters, initOverrides);
return yield response.value();
});
}
/**
* Returns CWMS Rating Data
* Get cwmsData ratings with ratingId
*/
getRatingsWithRatingIdRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters['ratingId'] == null) {
throw new runtime.RequiredError('ratingId', 'Required parameter "ratingId" was null or undefined when calling getRatingsWithRatingId().');
}
if (requestParameters['office'] == null) {
throw new runtime.RequiredError('office', 'Required parameter "office" was null or undefined when calling getRatingsWithRatingId().');
}
const queryParameters = {};
if (requestParameters['office'] != null) {
queryParameters['office'] = requestParameters['office'];
}
if (requestParameters['begin'] != null) {
queryParameters['begin'] = requestParameters['begin'];
}
if (requestParameters['end'] != null) {
queryParameters['end'] = requestParameters['end'];
}
if (requestParameters['timezone'] != null) {
queryParameters['timezone'] = requestParameters['timezone'];
}
if (requestParameters['method'] != null) {
queryParameters['method'] = requestParameters['method'];
}
const headerParameters = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = yield this.configuration.apiKey("Authorization"); // ApiKey authentication
}
const response = yield this.request({
path: `/ratings/{rating-id}`.replace(`{${"rating-id"}}`, encodeURIComponent(String(requestParameters['ratingId']))),
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response);
});
}
/**
* Returns CWMS Rating Data
* Get cwmsData ratings with ratingId
*/
getRatingsWithRatingId(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield this.getRatingsWithRatingIdRaw(requestParameters, initOverrides);
return yield response.value();
});
}
/**
* Update a RatingSet
* Patch cwmsData ratings with ratingId
*/
patchRatingsWithRatingIdRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters['ratingId'] == null) {
throw new runtime.RequiredError('ratingId', 'Required parameter "ratingId" was null or undefined when calling patchRatingsWithRatingId().');
}
if (requestParameters['body'] == null) {
throw new runtime.RequiredError('body', 'Required parameter "body" was null or undefined when calling patchRatingsWithRatingId().');
}
const queryParameters = {};
if (requestParameters['storeTemplate'] != null) {
queryParameters['store-template'] = requestParameters['storeTemplate'];
}
const headerParameters = {};
headerParameters['Content-Type'] = 'application/xml;version=2';
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = yield this.configuration.apiKey("Authorization"); // ApiKey authentication
}
const response = yield this.request({
path: `/ratings/{rating-id}`.replace(`{${"rating-id"}}`, encodeURIComponent(String(requestParameters['ratingId']))),
method: 'PATCH',
headers: headerParameters,
query: queryParameters,
body: requestParameters['body'],
}, initOverrides);
return new runtime.VoidApiResponse(response);
});
}
/**
* Update a RatingSet
* Patch cwmsData ratings with ratingId
*/
patchRatingsWithRatingId(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
yield this.patchRatingsWithRatingIdRaw(requestParameters, initOverrides);
});
}
/**
* Create new RatingSet
* Post cwmsData ratings
*/
postRatingsRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters['body'] == null) {
throw new runtime.RequiredError('body', 'Required parameter "body" was null or undefined when calling postRatings().');
}
const queryParameters = {};
if (requestParameters['storeTemplate'] != null) {
queryParameters['store-template'] = requestParameters['storeTemplate'];
}
const headerParameters = {};
headerParameters['Content-Type'] = 'application/xml;version=2';
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = yield this.configuration.apiKey("Authorization"); // ApiKey authentication
}
const response = yield this.request({
path: `/ratings`,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: requestParameters['body'],
}, initOverrides);
return new runtime.VoidApiResponse(response);
});
}
/**
* Create new RatingSet
* Post cwmsData ratings
*/
postRatings(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
yield this.postRatingsRaw(requestParameters, initOverrides);
});
}
/**
* Create new Rating Specification
* Post cwmsData ratings spec
*/
postRatingsSpecRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters['ratingSpec'] == null) {
throw new runtime.RequiredError('ratingSpec', 'Required parameter "ratingSpec" was null or undefined when calling postRatingsSpec().');
}
const queryParameters = {};
if (requestParameters['failIfExists'] != null) {
queryParameters['fail-if-exists'] = requestParameters['failIfExists'];
}
const headerParameters = {};
headerParameters['Content-Type'] = 'application/xml;version=2';
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = yield this.configuration.apiKey("Authorization"); // ApiKey authentication
}
const response = yield this.request({
path: `/ratings/spec`,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: (0, index_1.RatingSpecToJSON)(requestParameters['ratingSpec']),
}, initOverrides);
return new runtime.VoidApiResponse(response);
});
}
/**
* Create new Rating Specification
* Post cwmsData ratings spec
*/
postRatingsSpec(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
yield this.postRatingsSpecRaw(requestParameters, initOverrides);
});
}
/**
* Create new Rating Template
* Post cwmsData ratings template
*/
postRatingsTemplateRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters['ratingTemplate'] == null) {
throw new runtime.RequiredError('ratingTemplate', 'Required parameter "ratingTemplate" was null or undefined when calling postRatingsTemplate().');
}
const queryParameters = {};
if (requestParameters['failIfExists'] != null) {
queryParameters['fail-if-exists'] = requestParameters['failIfExists'];
}
const headerParameters = {};
headerParameters['Content-Type'] = 'application/xml;version=2';
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = yield this.configuration.apiKey("Authorization"); // ApiKey authentication
}
const response = yield this.request({
path: `/ratings/template`,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: (0, index_1.RatingTemplateToJSON)(requestParameters['ratingTemplate']),
}, initOverrides);
return new runtime.VoidApiResponse(response);
});
}
/**
* Create new Rating Template
* Post cwmsData ratings template
*/
postRatingsTemplate(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
yield this.postRatingsTemplateRaw(requestParameters, initOverrides);
});
}
}
exports.RatingsApi = RatingsApi;