UNPKG

cwmsjs

Version:

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

471 lines (470 loc) 22.6 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.LevelsApi = void 0; const runtime = require("../runtime"); const index_1 = require("../models/index"); /** * */ class LevelsApi extends runtime.BaseAPI { /** * Delete CWMS Location Level * Delete cwmsData levels with levelId */ deleteLevelsWithLevelIdRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters['levelId'] == null) { throw new runtime.RequiredError('levelId', 'Required parameter "levelId" was null or undefined when calling deleteLevelsWithLevelId().'); } const queryParameters = {}; if (requestParameters['cascadeDelete'] != null) { queryParameters['cascade-delete'] = requestParameters['cascadeDelete']; } if (requestParameters['office'] != null) { queryParameters['office'] = requestParameters['office']; } if (requestParameters['effectiveDate'] != null) { queryParameters['effective-date'] = requestParameters['effectiveDate']; } if (requestParameters['timezone'] != null) { queryParameters['timezone'] = requestParameters['timezone']; } const headerParameters = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = yield this.configuration.apiKey("Authorization"); // ApiKey authentication } const response = yield this.request({ path: `/levels/{level-id}`.replace(`{${"level-id"}}`, encodeURIComponent(String(requestParameters['levelId']))), method: 'DELETE', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.VoidApiResponse(response); }); } /** * Delete CWMS Location Level * Delete cwmsData levels with levelId */ deleteLevelsWithLevelId(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { yield this.deleteLevelsWithLevelIdRaw(requestParameters, initOverrides); }); } /** * Deletes requested specified level id * Delete cwmsData specifiedLevels with specifiedLevelId */ deleteSpecifiedLevelsWithSpecifiedLevelIdRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters['specifiedLevelId'] == null) { throw new runtime.RequiredError('specifiedLevelId', 'Required parameter "specifiedLevelId" was null or undefined when calling deleteSpecifiedLevelsWithSpecifiedLevelId().'); } if (requestParameters['office'] == null) { throw new runtime.RequiredError('office', 'Required parameter "office" was null or undefined when calling deleteSpecifiedLevelsWithSpecifiedLevelId().'); } 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: `/specified-levels/{specified-level-id}`.replace(`{${"specified-level-id"}}`, encodeURIComponent(String(requestParameters['specifiedLevelId']))), method: 'DELETE', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.VoidApiResponse(response); }); } /** * Deletes requested specified level id * Delete cwmsData specifiedLevels with specifiedLevelId */ deleteSpecifiedLevelsWithSpecifiedLevelId(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { yield this.deleteSpecifiedLevelsWithSpecifiedLevelIdRaw(requestParameters, initOverrides); }); } /** * Get cwmsData levels */ getLevelsRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { const queryParameters = {}; if (requestParameters['levelIdMask'] != null) { queryParameters['level-id-mask'] = requestParameters['levelIdMask']; } if (requestParameters['office'] != null) { queryParameters['office'] = requestParameters['office']; } if (requestParameters['unit'] != null) { queryParameters['unit'] = requestParameters['unit']; } if (requestParameters['datum'] != null) { queryParameters['datum'] = requestParameters['datum']; } if (requestParameters['begin'] != null) { queryParameters['begin'] = requestParameters['begin']; } if (requestParameters['end'] != null) { queryParameters['end'] = requestParameters['end']; } if (requestParameters['timezone'] != null) { queryParameters['timezone'] = requestParameters['timezone']; } if (requestParameters['format'] != null) { queryParameters['format'] = requestParameters['format']; } if (requestParameters['page'] != null) { queryParameters['page'] = requestParameters['page']; } if (requestParameters['pageSize'] != null) { queryParameters['page-size'] = requestParameters['pageSize']; } const headerParameters = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = yield this.configuration.apiKey("Authorization"); // ApiKey authentication } const response = yield this.request({ path: `/levels`, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response); }); } /** * Get cwmsData levels */ getLevels(requestParameters = {}, initOverrides) { return __awaiter(this, void 0, void 0, function* () { const response = yield this.getLevelsRaw(requestParameters, initOverrides); return yield response.value(); }); } /** * Retrieves requested Location Level * Get cwmsData levels with levelId */ getLevelsWithLevelIdRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters['levelId'] == null) { throw new runtime.RequiredError('levelId', 'Required parameter "levelId" was null or undefined when calling getLevelsWithLevelId().'); } if (requestParameters['office'] == null) { throw new runtime.RequiredError('office', 'Required parameter "office" was null or undefined when calling getLevelsWithLevelId().'); } if (requestParameters['effectiveDate'] == null) { throw new runtime.RequiredError('effectiveDate', 'Required parameter "effectiveDate" was null or undefined when calling getLevelsWithLevelId().'); } const queryParameters = {}; if (requestParameters['office'] != null) { queryParameters['office'] = requestParameters['office']; } if (requestParameters['effectiveDate'] != null) { queryParameters['effective-date'] = requestParameters['effectiveDate']; } if (requestParameters['timezone'] != null) { queryParameters['timezone'] = requestParameters['timezone']; } if (requestParameters['unit'] != null) { queryParameters['unit'] = requestParameters['unit']; } const headerParameters = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = yield this.configuration.apiKey("Authorization"); // ApiKey authentication } const response = yield this.request({ path: `/levels/{level-id}`.replace(`{${"level-id"}}`, encodeURIComponent(String(requestParameters['levelId']))), method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.LocationLevelFromJSON)(jsonValue)); }); } /** * Retrieves requested Location Level * Get cwmsData levels with levelId */ getLevelsWithLevelId(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { const response = yield this.getLevelsWithLevelIdRaw(requestParameters, initOverrides); return yield response.value(); }); } /** * Retrieves requested Location Level * Get cwmsData levels with levelId timeseries */ getLevelsWithLevelIdTimeSeriesRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters['levelId'] == null) { throw new runtime.RequiredError('levelId', 'Required parameter "levelId" was null or undefined when calling getLevelsWithLevelIdTimeSeries().'); } if (requestParameters['office'] == null) { throw new runtime.RequiredError('office', 'Required parameter "office" was null or undefined when calling getLevelsWithLevelIdTimeSeries().'); } if (requestParameters['unit'] == null) { throw new runtime.RequiredError('unit', 'Required parameter "unit" was null or undefined when calling getLevelsWithLevelIdTimeSeries().'); } const queryParameters = {}; if (requestParameters['office'] != null) { queryParameters['office'] = requestParameters['office']; } if (requestParameters['interval'] != null) { queryParameters['interval'] = requestParameters['interval']; } if (requestParameters['begin'] != null) { queryParameters['begin'] = requestParameters['begin']; } if (requestParameters['end'] != null) { queryParameters['end'] = requestParameters['end']; } if (requestParameters['timezone'] != null) { queryParameters['timezone'] = requestParameters['timezone']; } if (requestParameters['unit'] != null) { queryParameters['unit'] = requestParameters['unit']; } const headerParameters = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = yield this.configuration.apiKey("Authorization"); // ApiKey authentication } const response = yield this.request({ path: `/levels/{level-id}/timeseries`.replace(`{${"level-id"}}`, encodeURIComponent(String(requestParameters['levelId']))), method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.TimeSeriesFromJSON)(jsonValue)); }); } /** * Retrieves requested Location Level * Get cwmsData levels with levelId timeseries */ getLevelsWithLevelIdTimeSeries(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { const response = yield this.getLevelsWithLevelIdTimeSeriesRaw(requestParameters, initOverrides); return yield response.value(); }); } /** * Get cwmsData specifiedLevels */ getSpecifiedLevelsRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { const queryParameters = {}; if (requestParameters['office'] != null) { queryParameters['office'] = requestParameters['office']; } if (requestParameters['templateIdMask'] != null) { queryParameters['template-id-mask'] = requestParameters['templateIdMask']; } const headerParameters = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = yield this.configuration.apiKey("Authorization"); // ApiKey authentication } const response = yield this.request({ path: `/specified-levels`, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.SpecifiedLevelFromJSON)(jsonValue)); }); } /** * Get cwmsData specifiedLevels */ getSpecifiedLevels(requestParameters = {}, initOverrides) { return __awaiter(this, void 0, void 0, function* () { const response = yield this.getSpecifiedLevelsRaw(requestParameters, initOverrides); return yield response.value(); }); } /** * Update CWMS Location Level * Patch cwmsData levels with levelId */ patchLevelsWithLevelIdRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters['levelId'] == null) { throw new runtime.RequiredError('levelId', 'Required parameter "levelId" was null or undefined when calling patchLevelsWithLevelId().'); } if (requestParameters['locationLevel'] == null) { throw new runtime.RequiredError('locationLevel', 'Required parameter "locationLevel" was null or undefined when calling patchLevelsWithLevelId().'); } const queryParameters = {}; if (requestParameters['effectiveDate'] != null) { queryParameters['effective-date'] = requestParameters['effectiveDate']; } 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: `/levels/{level-id}`.replace(`{${"level-id"}}`, encodeURIComponent(String(requestParameters['levelId']))), method: 'PATCH', headers: headerParameters, query: queryParameters, body: (0, index_1.LocationLevelToJSON)(requestParameters['locationLevel']), }, initOverrides); return new runtime.VoidApiResponse(response); }); } /** * Update CWMS Location Level * Patch cwmsData levels with levelId */ patchLevelsWithLevelId(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { yield this.patchLevelsWithLevelIdRaw(requestParameters, initOverrides); }); } /** * Renames the requested specified level id * Patch cwmsData specifiedLevels with specifiedLevelId */ patchSpecifiedLevelsWithSpecifiedLevelIdRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters['specifiedLevelId'] == null) { throw new runtime.RequiredError('specifiedLevelId', 'Required parameter "specifiedLevelId" was null or undefined when calling patchSpecifiedLevelsWithSpecifiedLevelId().'); } if (requestParameters['specifiedLevelId2'] == null) { throw new runtime.RequiredError('specifiedLevelId2', 'Required parameter "specifiedLevelId2" was null or undefined when calling patchSpecifiedLevelsWithSpecifiedLevelId().'); } if (requestParameters['office'] == null) { throw new runtime.RequiredError('office', 'Required parameter "office" was null or undefined when calling patchSpecifiedLevelsWithSpecifiedLevelId().'); } const queryParameters = {}; if (requestParameters['specifiedLevelId2'] != null) { queryParameters['specified-level-id'] = requestParameters['specifiedLevelId2']; } 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: `/specified-levels/{specified-level-id}`.replace(`{${"specified-level-id"}}`, encodeURIComponent(String(requestParameters['specifiedLevelId']))), method: 'PATCH', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.VoidApiResponse(response); }); } /** * Renames the requested specified level id * Patch cwmsData specifiedLevels with specifiedLevelId */ patchSpecifiedLevelsWithSpecifiedLevelId(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { yield this.patchSpecifiedLevelsWithSpecifiedLevelIdRaw(requestParameters, initOverrides); }); } /** * Create new CWMS Location Level * Post cwmsData levels */ postLevelsRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters['locationLevel'] == null) { throw new runtime.RequiredError('locationLevel', 'Required parameter "locationLevel" was null or undefined when calling postLevels().'); } 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: `/levels`, method: 'POST', headers: headerParameters, query: queryParameters, body: (0, index_1.LocationLevelToJSON)(requestParameters['locationLevel']), }, initOverrides); return new runtime.VoidApiResponse(response); }); } /** * Create new CWMS Location Level * Post cwmsData levels */ postLevels(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { yield this.postLevelsRaw(requestParameters, initOverrides); }); } /** * Create new SpecifiedLevel * Post cwmsData specifiedLevels */ postSpecifiedLevelsRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters['specifiedLevel'] == null) { throw new runtime.RequiredError('specifiedLevel', 'Required parameter "specifiedLevel" was null or undefined when calling postSpecifiedLevels().'); } const queryParameters = {}; if (requestParameters['failIfExists'] != null) { queryParameters['fail-if-exists'] = requestParameters['failIfExists']; } const headerParameters = {}; headerParameters['Content-Type'] = 'application/json;version=2'; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = yield this.configuration.apiKey("Authorization"); // ApiKey authentication } const response = yield this.request({ path: `/specified-levels`, method: 'POST', headers: headerParameters, query: queryParameters, body: (0, index_1.SpecifiedLevelToJSON)(requestParameters['specifiedLevel']), }, initOverrides); return new runtime.VoidApiResponse(response); }); } /** * Create new SpecifiedLevel * Post cwmsData specifiedLevels */ postSpecifiedLevels(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { yield this.postSpecifiedLevelsRaw(requestParameters, initOverrides); }); } } exports.LevelsApi = LevelsApi;