cwmsjs
Version:
CWMS Data API Library for JavaScript/TypeScript created with OpenAPI generator for use with browser webapps
181 lines (180 loc) • 8.49 kB
JavaScript
;
/* 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.LocationCategoriesApi = void 0;
const runtime = require("../runtime");
const index_1 = require("../models/index");
/**
*
*/
class LocationCategoriesApi extends runtime.BaseAPI {
/**
* Deletes requested location category
* Delete cwmsData location category with categoryId
*/
deleteLocationCategoryWithCategoryIdRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters['categoryId'] == null) {
throw new runtime.RequiredError('categoryId', 'Required parameter "categoryId" was null or undefined when calling deleteLocationCategoryWithCategoryId().');
}
if (requestParameters['office'] == null) {
throw new runtime.RequiredError('office', 'Required parameter "office" was null or undefined when calling deleteLocationCategoryWithCategoryId().');
}
const queryParameters = {};
if (requestParameters['office'] != null) {
queryParameters['office'] = requestParameters['office'];
}
if (requestParameters['cascadeDelete'] != null) {
queryParameters['cascade-delete'] = requestParameters['cascadeDelete'];
}
const headerParameters = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = yield this.configuration.apiKey("Authorization"); // ApiKey authentication
}
const response = yield this.request({
path: `/location/category/{category-id}`.replace(`{${"category-id"}}`, encodeURIComponent(String(requestParameters['categoryId']))),
method: 'DELETE',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.VoidApiResponse(response);
});
}
/**
* Deletes requested location category
* Delete cwmsData location category with categoryId
*/
deleteLocationCategoryWithCategoryId(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
yield this.deleteLocationCategoryWithCategoryIdRaw(requestParameters, initOverrides);
});
}
/**
* Returns CWMS Location Category Data
* Get cwmsData location category
*/
getLocationCategoryRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
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: `/location/category`,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(index_1.LocationCategoryFromJSON));
});
}
/**
* Returns CWMS Location Category Data
* Get cwmsData location category
*/
getLocationCategory(requestParameters = {}, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield this.getLocationCategoryRaw(requestParameters, initOverrides);
return yield response.value();
});
}
/**
* Retrieves requested Location Category
* Get cwmsData location category with categoryId
*/
getLocationCategoryWithCategoryIdRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters['categoryId'] == null) {
throw new runtime.RequiredError('categoryId', 'Required parameter "categoryId" was null or undefined when calling getLocationCategoryWithCategoryId().');
}
if (requestParameters['office'] == null) {
throw new runtime.RequiredError('office', 'Required parameter "office" was null or undefined when calling getLocationCategoryWithCategoryId().');
}
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: `/location/category/{category-id}`.replace(`{${"category-id"}}`, encodeURIComponent(String(requestParameters['categoryId']))),
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.LocationCategoryFromJSON)(jsonValue));
});
}
/**
* Retrieves requested Location Category
* Get cwmsData location category with categoryId
*/
getLocationCategoryWithCategoryId(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield this.getLocationCategoryWithCategoryIdRaw(requestParameters, initOverrides);
return yield response.value();
});
}
/**
* Create new LocationCategory
* Post cwmsData location category
*/
postLocationCategoryRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters['locationCategory'] == null) {
throw new runtime.RequiredError('locationCategory', 'Required parameter "locationCategory" was null or undefined when calling postLocationCategory().');
}
const queryParameters = {};
const headerParameters = {};
headerParameters['Content-Type'] = 'application/json';
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = yield this.configuration.apiKey("Authorization"); // ApiKey authentication
}
const response = yield this.request({
path: `/location/category`,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: (0, index_1.LocationCategoryToJSON)(requestParameters['locationCategory']),
}, initOverrides);
return new runtime.VoidApiResponse(response);
});
}
/**
* Create new LocationCategory
* Post cwmsData location category
*/
postLocationCategory(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
yield this.postLocationCategoryRaw(requestParameters, initOverrides);
});
}
}
exports.LocationCategoriesApi = LocationCategoriesApi;