UNPKG

cwmsjs

Version:

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

245 lines (244 loc) 12.1 kB
"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.LocationGroupsApi = void 0; const runtime = require("../runtime"); const index_1 = require("../models/index"); /** * */ class LocationGroupsApi extends runtime.BaseAPI { /** * Deletes requested location group * Delete cwmsData location group with groupId */ deleteLocationGroupWithGroupIdRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters['groupId'] == null) { throw new runtime.RequiredError('groupId', 'Required parameter "groupId" was null or undefined when calling deleteLocationGroupWithGroupId().'); } if (requestParameters['categoryId'] == null) { throw new runtime.RequiredError('categoryId', 'Required parameter "categoryId" was null or undefined when calling deleteLocationGroupWithGroupId().'); } if (requestParameters['office'] == null) { throw new runtime.RequiredError('office', 'Required parameter "office" was null or undefined when calling deleteLocationGroupWithGroupId().'); } const queryParameters = {}; if (requestParameters['categoryId'] != null) { queryParameters['category-id'] = requestParameters['categoryId']; } 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/group/{group-id}`.replace(`{${"group-id"}}`, encodeURIComponent(String(requestParameters['groupId']))), method: 'DELETE', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.VoidApiResponse(response); }); } /** * Deletes requested location group * Delete cwmsData location group with groupId */ deleteLocationGroupWithGroupId(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { yield this.deleteLocationGroupWithGroupIdRaw(requestParameters, initOverrides); }); } /** * Returns CWMS Location Groups Data * Get cwmsData location group */ getLocationGroupRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { const queryParameters = {}; if (requestParameters['office'] != null) { queryParameters['office'] = requestParameters['office']; } if (requestParameters['includeAssigned'] != null) { queryParameters['include-assigned'] = requestParameters['includeAssigned']; } if (requestParameters['locationCategoryLike'] != null) { queryParameters['location-category-like'] = requestParameters['locationCategoryLike']; } const headerParameters = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = yield this.configuration.apiKey("Authorization"); // ApiKey authentication } const response = yield this.request({ path: `/location/group`, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(index_1.LocationGroupFromJSON)); }); } /** * Returns CWMS Location Groups Data * Get cwmsData location group */ getLocationGroup(requestParameters = {}, initOverrides) { return __awaiter(this, void 0, void 0, function* () { const response = yield this.getLocationGroupRaw(requestParameters, initOverrides); return yield response.value(); }); } /** * Retrieves requested Location Group * Get cwmsData location group with groupId */ getLocationGroupWithGroupIdRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters['groupId'] == null) { throw new runtime.RequiredError('groupId', 'Required parameter "groupId" was null or undefined when calling getLocationGroupWithGroupId().'); } if (requestParameters['office'] == null) { throw new runtime.RequiredError('office', 'Required parameter "office" was null or undefined when calling getLocationGroupWithGroupId().'); } if (requestParameters['categoryId'] == null) { throw new runtime.RequiredError('categoryId', 'Required parameter "categoryId" was null or undefined when calling getLocationGroupWithGroupId().'); } const queryParameters = {}; if (requestParameters['office'] != null) { queryParameters['office'] = requestParameters['office']; } if (requestParameters['categoryId'] != null) { queryParameters['category-id'] = requestParameters['categoryId']; } const headerParameters = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = yield this.configuration.apiKey("Authorization"); // ApiKey authentication } const response = yield this.request({ path: `/location/group/{group-id}`.replace(`{${"group-id"}}`, encodeURIComponent(String(requestParameters['groupId']))), method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.LocationGroupFromJSON)(jsonValue)); }); } /** * Retrieves requested Location Group * Get cwmsData location group with groupId */ getLocationGroupWithGroupId(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { const response = yield this.getLocationGroupWithGroupIdRaw(requestParameters, initOverrides); return yield response.value(); }); } /** * Update existing LocationGroup. Allows for renaming group, assigning new locations, and unassigning all locations from the group. * Patch cwmsData location group with groupId */ patchLocationGroupWithGroupIdRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters['groupId'] == null) { throw new runtime.RequiredError('groupId', 'Required parameter "groupId" was null or undefined when calling patchLocationGroupWithGroupId().'); } if (requestParameters['office'] == null) { throw new runtime.RequiredError('office', 'Required parameter "office" was null or undefined when calling patchLocationGroupWithGroupId().'); } if (requestParameters['locationGroup'] == null) { throw new runtime.RequiredError('locationGroup', 'Required parameter "locationGroup" was null or undefined when calling patchLocationGroupWithGroupId().'); } const queryParameters = {}; if (requestParameters['replaceAssignedLocs'] != null) { queryParameters['replace-assigned-locs'] = requestParameters['replaceAssignedLocs']; } if (requestParameters['office'] != null) { queryParameters['office'] = requestParameters['office']; } 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/group/{group-id}`.replace(`{${"group-id"}}`, encodeURIComponent(String(requestParameters['groupId']))), method: 'PATCH', headers: headerParameters, query: queryParameters, body: (0, index_1.LocationGroupToJSON)(requestParameters['locationGroup']), }, initOverrides); return new runtime.VoidApiResponse(response); }); } /** * Update existing LocationGroup. Allows for renaming group, assigning new locations, and unassigning all locations from the group. * Patch cwmsData location group with groupId */ patchLocationGroupWithGroupId(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { yield this.patchLocationGroupWithGroupIdRaw(requestParameters, initOverrides); }); } /** * Create new LocationGroup * Post cwmsData location group */ postLocationGroupRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters['locationGroup'] == null) { throw new runtime.RequiredError('locationGroup', 'Required parameter "locationGroup" was null or undefined when calling postLocationGroup().'); } 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/group`, method: 'POST', headers: headerParameters, query: queryParameters, body: (0, index_1.LocationGroupToJSON)(requestParameters['locationGroup']), }, initOverrides); return new runtime.VoidApiResponse(response); }); } /** * Create new LocationGroup * Post cwmsData location group */ postLocationGroup(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { yield this.postLocationGroupRaw(requestParameters, initOverrides); }); } } exports.LocationGroupsApi = LocationGroupsApi;