cwmsjs
Version:
CWMS Data API Library for JavaScript/TypeScript created with OpenAPI generator for use with browser webapps
234 lines (233 loc) • 11.1 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 PropertiesApi extends runtime.BaseAPI {
/**
* Delete CWMS Property
* Delete properties with name
*/
deletePropertiesWithNameRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters.name === null || requestParameters.name === undefined) {
throw new runtime.RequiredError('name', 'Required parameter requestParameters.name was null or undefined when calling deletePropertiesWithName.');
}
if (requestParameters.office === null || requestParameters.office === undefined) {
throw new runtime.RequiredError('office', 'Required parameter requestParameters.office was null or undefined when calling deletePropertiesWithName.');
}
if (requestParameters.categoryId === null || requestParameters.categoryId === undefined) {
throw new runtime.RequiredError('categoryId', 'Required parameter requestParameters.categoryId was null or undefined when calling deletePropertiesWithName.');
}
const queryParameters = {};
if (requestParameters.office !== undefined) {
queryParameters['office'] = requestParameters.office;
}
if (requestParameters.categoryId !== undefined) {
queryParameters['category-id'] = requestParameters.categoryId;
}
const headerParameters = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
}
const response = yield this.request({
path: `/properties/{name}`.replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))),
method: 'DELETE',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.VoidApiResponse(response);
});
}
/**
* Delete CWMS Property
* Delete properties with name
*/
deletePropertiesWithName(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
yield this.deletePropertiesWithNameRaw(requestParameters, initOverrides);
});
}
/**
* Returns matching CWMS Property Data.
* Get properties
*/
getPropertiesRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const queryParameters = {};
if (requestParameters.officeMask !== undefined) {
queryParameters['office-mask'] = requestParameters.officeMask;
}
if (requestParameters.categoryId !== undefined) {
queryParameters['category-id'] = requestParameters.categoryId;
}
if (requestParameters.nameMask !== undefined) {
queryParameters['name-mask'] = requestParameters.nameMask;
}
const headerParameters = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
}
const response = yield this.request({
path: `/properties`,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(models_1.PropertyFromJSON));
});
}
/**
* Returns matching CWMS Property Data.
* Get properties
*/
getProperties(requestParameters = {}, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield this.getPropertiesRaw(requestParameters, initOverrides);
return yield response.value();
});
}
/**
* Returns CWMS Property Data
* Get properties with name
*/
getPropertiesWithNameRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters.name === null || requestParameters.name === undefined) {
throw new runtime.RequiredError('name', 'Required parameter requestParameters.name was null or undefined when calling getPropertiesWithName.');
}
if (requestParameters.office === null || requestParameters.office === undefined) {
throw new runtime.RequiredError('office', 'Required parameter requestParameters.office was null or undefined when calling getPropertiesWithName.');
}
if (requestParameters.categoryId === null || requestParameters.categoryId === undefined) {
throw new runtime.RequiredError('categoryId', 'Required parameter requestParameters.categoryId was null or undefined when calling getPropertiesWithName.');
}
const queryParameters = {};
if (requestParameters.office !== undefined) {
queryParameters['office'] = requestParameters.office;
}
if (requestParameters.categoryId !== undefined) {
queryParameters['category-id'] = requestParameters.categoryId;
}
if (requestParameters.defaultValue !== undefined) {
queryParameters['default-value'] = requestParameters.defaultValue;
}
const headerParameters = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
}
const response = yield this.request({
path: `/properties/{name}`.replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))),
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => models_1.PropertyFromJSON(jsonValue));
});
}
/**
* Returns CWMS Property Data
* Get properties with name
*/
getPropertiesWithName(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield this.getPropertiesWithNameRaw(requestParameters, initOverrides);
return yield response.value();
});
}
/**
* Update CWMS Property
* Patch properties with name
*/
patchPropertiesWithNameRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters.name === null || requestParameters.name === undefined) {
throw new runtime.RequiredError('name', 'Required parameter requestParameters.name was null or undefined when calling patchPropertiesWithName.');
}
if (requestParameters.property === null || requestParameters.property === undefined) {
throw new runtime.RequiredError('property', 'Required parameter requestParameters.property was null or undefined when calling patchPropertiesWithName.');
}
const queryParameters = {};
const headerParameters = {};
headerParameters['Content-Type'] = 'application/json';
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
}
const response = yield this.request({
path: `/properties/{name}`.replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))),
method: 'PATCH',
headers: headerParameters,
query: queryParameters,
body: models_1.PropertyToJSON(requestParameters.property),
}, initOverrides);
return new runtime.VoidApiResponse(response);
});
}
/**
* Update CWMS Property
* Patch properties with name
*/
patchPropertiesWithName(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
yield this.patchPropertiesWithNameRaw(requestParameters, initOverrides);
});
}
/**
* Create CWMS Property
* Post properties
*/
postPropertiesRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters.property === null || requestParameters.property === undefined) {
throw new runtime.RequiredError('property', 'Required parameter requestParameters.property was null or undefined when calling postProperties.');
}
const queryParameters = {};
const headerParameters = {};
headerParameters['Content-Type'] = 'application/json';
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
}
const response = yield this.request({
path: `/properties`,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: models_1.PropertyToJSON(requestParameters.property),
}, initOverrides);
return new runtime.VoidApiResponse(response);
});
}
/**
* Create CWMS Property
* Post properties
*/
postProperties(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
yield this.postPropertiesRaw(requestParameters, initOverrides);
});
}
}
exports.PropertiesApi = PropertiesApi;