UNPKG

cwmsjs

Version:

CWMS Data API Library for JavaScript/TypeScript created with OpenAPI generator for use with browser webapps

179 lines (178 loc) 8.54 kB
"use strict"; /* 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 LocationCategoriesApi extends runtime.BaseAPI { /** * Deletes requested location category * Delete location category with categoryId */ deleteLocationCategoryWithCategoryIdRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters.categoryId === null || requestParameters.categoryId === undefined) { throw new runtime.RequiredError('categoryId', 'Required parameter requestParameters.categoryId was null or undefined when calling deleteLocationCategoryWithCategoryId.'); } if (requestParameters.office === null || requestParameters.office === undefined) { throw new runtime.RequiredError('office', 'Required parameter requestParameters.office was null or undefined when calling deleteLocationCategoryWithCategoryId.'); } const queryParameters = {}; if (requestParameters.office !== undefined) { queryParameters['office'] = requestParameters.office; } if (requestParameters.cascadeDelete !== undefined) { queryParameters['cascade-delete'] = requestParameters.cascadeDelete; } const headerParameters = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = 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 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 location category */ getLocationCategoryRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { const queryParameters = {}; 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: `/location/category`, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(models_1.LocationCategoryFromJSON)); }); } /** * Returns CWMS Location Category Data * Get 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 location category with categoryId */ getLocationCategoryWithCategoryIdRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters.categoryId === null || requestParameters.categoryId === undefined) { throw new runtime.RequiredError('categoryId', 'Required parameter requestParameters.categoryId was null or undefined when calling getLocationCategoryWithCategoryId.'); } if (requestParameters.office === null || requestParameters.office === undefined) { throw new runtime.RequiredError('office', 'Required parameter requestParameters.office was null or undefined when calling getLocationCategoryWithCategoryId.'); } const queryParameters = {}; 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: `/location/category/{category-id}`.replace(`{${"category-id"}}`, encodeURIComponent(String(requestParameters.categoryId))), method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => models_1.LocationCategoryFromJSON(jsonValue)); }); } /** * Retrieves requested Location Category * Get 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 location category */ postLocationCategoryRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters.locationCategory === null || requestParameters.locationCategory === undefined) { throw new runtime.RequiredError('locationCategory', 'Required parameter requestParameters.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"] = this.configuration.apiKey("Authorization"); // ApiKey authentication } const response = yield this.request({ path: `/location/category`, method: 'POST', headers: headerParameters, query: queryParameters, body: models_1.LocationCategoryToJSON(requestParameters.locationCategory), }, initOverrides); return new runtime.VoidApiResponse(response); }); } /** * Create new LocationCategory * Post location category */ postLocationCategory(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { yield this.postLocationCategoryRaw(requestParameters, initOverrides); }); } } exports.LocationCategoriesApi = LocationCategoriesApi;