UNPKG

cwmsjs

Version:

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

267 lines (266 loc) 14.6 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 LocationGroupsApi extends runtime.BaseAPI { /** * Deletes requested location group * Delete location group with groupId */ deleteLocationGroupWithGroupIdRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters.groupId === null || requestParameters.groupId === undefined) { throw new runtime.RequiredError('groupId', 'Required parameter requestParameters.groupId was null or undefined when calling deleteLocationGroupWithGroupId.'); } if (requestParameters.categoryId === null || requestParameters.categoryId === undefined) { throw new runtime.RequiredError('categoryId', 'Required parameter requestParameters.categoryId was null or undefined when calling deleteLocationGroupWithGroupId.'); } if (requestParameters.office === null || requestParameters.office === undefined) { throw new runtime.RequiredError('office', 'Required parameter requestParameters.office was null or undefined when calling deleteLocationGroupWithGroupId.'); } const queryParameters = {}; if (requestParameters.categoryId !== undefined) { queryParameters['category-id'] = requestParameters.categoryId; } 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/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 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 location group */ getLocationGroupRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters.categoryOfficeId === null || requestParameters.categoryOfficeId === undefined) { throw new runtime.RequiredError('categoryOfficeId', 'Required parameter requestParameters.categoryOfficeId was null or undefined when calling getLocationGroup.'); } if (requestParameters.locationOfficeId === null || requestParameters.locationOfficeId === undefined) { throw new runtime.RequiredError('locationOfficeId', 'Required parameter requestParameters.locationOfficeId was null or undefined when calling getLocationGroup.'); } const queryParameters = {}; if (requestParameters.office !== undefined) { queryParameters['office'] = requestParameters.office; } if (requestParameters.includeAssigned !== undefined) { queryParameters['include-assigned'] = requestParameters.includeAssigned; } if (requestParameters.locationCategoryLike !== undefined) { queryParameters['location-category-like'] = requestParameters.locationCategoryLike; } if (requestParameters.categoryOfficeId !== undefined) { queryParameters['category-office-id'] = requestParameters.categoryOfficeId; } if (requestParameters.locationOfficeId !== undefined) { queryParameters['location-office-id'] = requestParameters.locationOfficeId; } const headerParameters = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = 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(models_1.LocationGroupFromJSON)); }); } /** * Returns CWMS Location Groups Data * Get 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. This endpoint supports GEO JSON responses with application/geo+json.For more information about accept header usage, <a href=\"legacy-format/\">see this page.</a> * Get location group with groupId */ getLocationGroupWithGroupIdRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters.groupId === null || requestParameters.groupId === undefined) { throw new runtime.RequiredError('groupId', 'Required parameter requestParameters.groupId was null or undefined when calling getLocationGroupWithGroupId.'); } if (requestParameters.office === null || requestParameters.office === undefined) { throw new runtime.RequiredError('office', 'Required parameter requestParameters.office was null or undefined when calling getLocationGroupWithGroupId.'); } if (requestParameters.groupOfficeId === null || requestParameters.groupOfficeId === undefined) { throw new runtime.RequiredError('groupOfficeId', 'Required parameter requestParameters.groupOfficeId was null or undefined when calling getLocationGroupWithGroupId.'); } if (requestParameters.categoryOfficeId === null || requestParameters.categoryOfficeId === undefined) { throw new runtime.RequiredError('categoryOfficeId', 'Required parameter requestParameters.categoryOfficeId was null or undefined when calling getLocationGroupWithGroupId.'); } if (requestParameters.categoryId === null || requestParameters.categoryId === undefined) { throw new runtime.RequiredError('categoryId', 'Required parameter requestParameters.categoryId was null or undefined when calling getLocationGroupWithGroupId.'); } const queryParameters = {}; if (requestParameters.office !== undefined) { queryParameters['office'] = requestParameters.office; } if (requestParameters.groupOfficeId !== undefined) { queryParameters['group-office-id'] = requestParameters.groupOfficeId; } if (requestParameters.categoryOfficeId !== undefined) { queryParameters['category-office-id'] = requestParameters.categoryOfficeId; } 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: `/location/group/{group-id}`.replace(`{${"group-id"}}`, encodeURIComponent(String(requestParameters.groupId))), method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => models_1.LocationGroupFromJSON(jsonValue)); }); } /** * Retrieves requested Location Group. This endpoint supports GEO JSON responses with application/geo+json.For more information about accept header usage, <a href=\"legacy-format/\">see this page.</a> * Get 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 location group with groupId */ patchLocationGroupWithGroupIdRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters.groupId === null || requestParameters.groupId === undefined) { throw new runtime.RequiredError('groupId', 'Required parameter requestParameters.groupId was null or undefined when calling patchLocationGroupWithGroupId.'); } if (requestParameters.office === null || requestParameters.office === undefined) { throw new runtime.RequiredError('office', 'Required parameter requestParameters.office was null or undefined when calling patchLocationGroupWithGroupId.'); } if (requestParameters.locationGroup === null || requestParameters.locationGroup === undefined) { throw new runtime.RequiredError('locationGroup', 'Required parameter requestParameters.locationGroup was null or undefined when calling patchLocationGroupWithGroupId.'); } const queryParameters = {}; if (requestParameters.replaceAssignedLocs !== undefined) { queryParameters['replace-assigned-locs'] = requestParameters.replaceAssignedLocs; } if (requestParameters.office !== undefined) { queryParameters['office'] = requestParameters.office; } 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/group/{group-id}`.replace(`{${"group-id"}}`, encodeURIComponent(String(requestParameters.groupId))), method: 'PATCH', headers: headerParameters, query: queryParameters, body: models_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 location group with groupId */ patchLocationGroupWithGroupId(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { yield this.patchLocationGroupWithGroupIdRaw(requestParameters, initOverrides); }); } /** * Create new LocationGroup * Post location group */ postLocationGroupRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters.locationGroup === null || requestParameters.locationGroup === undefined) { throw new runtime.RequiredError('locationGroup', 'Required parameter requestParameters.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"] = this.configuration.apiKey("Authorization"); // ApiKey authentication } const response = yield this.request({ path: `/location/group`, method: 'POST', headers: headerParameters, query: queryParameters, body: models_1.LocationGroupToJSON(requestParameters.locationGroup), }, initOverrides); return new runtime.VoidApiResponse(response); }); } /** * Create new LocationGroup * Post location group */ postLocationGroup(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { yield this.postLocationGroupRaw(requestParameters, initOverrides); }); } } exports.LocationGroupsApi = LocationGroupsApi;