UNPKG

cwmsjs

Version:

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

227 lines (226 loc) 10.5 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.LocationsApi = void 0; const runtime = require("../runtime"); const index_1 = require("../models/index"); /** * */ class LocationsApi extends runtime.BaseAPI { /** * Delete CWMS Location * Delete cwmsData locations with locationId */ deleteLocationsWithLocationIdRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters['locationId'] == null) { throw new runtime.RequiredError('locationId', 'Required parameter "locationId" was null or undefined when calling deleteLocationsWithLocationId().'); } 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: `/locations/{location-id}`.replace(`{${"location-id"}}`, encodeURIComponent(String(requestParameters['locationId']))), method: 'DELETE', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.VoidApiResponse(response); }); } /** * Delete CWMS Location * Delete cwmsData locations with locationId */ deleteLocationsWithLocationId(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { yield this.deleteLocationsWithLocationIdRaw(requestParameters, initOverrides); }); } /** * Returns CWMS Location Data. The Catalog end-point is also capable of retrieving lists of locations and can filter on additional fields. * Get cwmsData locations */ getLocationsRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { const queryParameters = {}; if (requestParameters['names'] != null) { queryParameters['names'] = requestParameters['names']; } 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['format'] != null) { queryParameters['format'] = requestParameters['format']; } const headerParameters = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = yield this.configuration.apiKey("Authorization"); // ApiKey authentication } const response = yield this.request({ path: `/locations`, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(index_1.LocationFromJSON)); }); } /** * Returns CWMS Location Data. The Catalog end-point is also capable of retrieving lists of locations and can filter on additional fields. * Get cwmsData locations */ getLocations(requestParameters = {}, initOverrides) { return __awaiter(this, void 0, void 0, function* () { const response = yield this.getLocationsRaw(requestParameters, initOverrides); return yield response.value(); }); } /** * Returns CWMS Location Data * Get cwmsData locations with locationId */ getLocationsWithLocationIdRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters['locationId'] == null) { throw new runtime.RequiredError('locationId', 'Required parameter "locationId" was null or undefined when calling getLocationsWithLocationId().'); } if (requestParameters['office'] == null) { throw new runtime.RequiredError('office', 'Required parameter "office" was null or undefined when calling getLocationsWithLocationId().'); } const queryParameters = {}; if (requestParameters['office'] != null) { queryParameters['office'] = requestParameters['office']; } 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: `/locations/{location-id}`.replace(`{${"location-id"}}`, encodeURIComponent(String(requestParameters['locationId']))), method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.LocationFromJSON)(jsonValue)); }); } /** * Returns CWMS Location Data * Get cwmsData locations with locationId */ getLocationsWithLocationId(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { const response = yield this.getLocationsWithLocationIdRaw(requestParameters, initOverrides); return yield response.value(); }); } /** * Update CWMS Location * Patch cwmsData locations with locationId */ patchLocationsWithLocationIdRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters['locationId'] == null) { throw new runtime.RequiredError('locationId', 'Required parameter "locationId" was null or undefined when calling patchLocationsWithLocationId().'); } if (requestParameters['location'] == null) { throw new runtime.RequiredError('location', 'Required parameter "location" was null or undefined when calling patchLocationsWithLocationId().'); } const queryParameters = {}; const headerParameters = {}; headerParameters['Content-Type'] = 'application/xml'; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = yield this.configuration.apiKey("Authorization"); // ApiKey authentication } const response = yield this.request({ path: `/locations/{location-id}`.replace(`{${"location-id"}}`, encodeURIComponent(String(requestParameters['locationId']))), method: 'PATCH', headers: headerParameters, query: queryParameters, body: (0, index_1.LocationToJSON)(requestParameters['location']), }, initOverrides); return new runtime.VoidApiResponse(response); }); } /** * Update CWMS Location * Patch cwmsData locations with locationId */ patchLocationsWithLocationId(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { yield this.patchLocationsWithLocationIdRaw(requestParameters, initOverrides); }); } /** * Create new CWMS Location * Post cwmsData locations */ postLocationsRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters['location'] == null) { throw new runtime.RequiredError('location', 'Required parameter "location" was null or undefined when calling postLocations().'); } 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: `/locations`, method: 'POST', headers: headerParameters, query: queryParameters, body: (0, index_1.LocationToJSON)(requestParameters['location']), }, initOverrides); return new runtime.VoidApiResponse(response); }); } /** * Create new CWMS Location * Post cwmsData locations */ postLocations(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { yield this.postLocationsRaw(requestParameters, initOverrides); }); } } exports.LocationsApi = LocationsApi;