UNPKG

cwmsjs

Version:

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

502 lines (501 loc) 25.9 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 ForecastApi extends runtime.BaseAPI { /** * Used to delete forecast instance data based on unique fields * Delete forecastInstance with name */ deleteForecastInstanceWithNameRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters.name === null || requestParameters.name === undefined) { throw new runtime.RequiredError('name', 'Required parameter requestParameters.name was null or undefined when calling deleteForecastInstanceWithName.'); } if (requestParameters.forecastDate === null || requestParameters.forecastDate === undefined) { throw new runtime.RequiredError('forecastDate', 'Required parameter requestParameters.forecastDate was null or undefined when calling deleteForecastInstanceWithName.'); } if (requestParameters.issueDate === null || requestParameters.issueDate === undefined) { throw new runtime.RequiredError('issueDate', 'Required parameter requestParameters.issueDate was null or undefined when calling deleteForecastInstanceWithName.'); } if (requestParameters.office === null || requestParameters.office === undefined) { throw new runtime.RequiredError('office', 'Required parameter requestParameters.office was null or undefined when calling deleteForecastInstanceWithName.'); } const queryParameters = {}; if (requestParameters.forecastDate !== undefined) { queryParameters['forecast-date'] = requestParameters.forecastDate; } if (requestParameters.issueDate !== undefined) { queryParameters['issue-date'] = requestParameters.issueDate; } if (requestParameters.office !== undefined) { queryParameters['office'] = requestParameters.office; } if (requestParameters.designator !== undefined) { queryParameters['designator'] = requestParameters.designator; } const headerParameters = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication } const response = yield this.request({ path: `/forecast-instance/{name}`.replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))), method: 'DELETE', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.VoidApiResponse(response); }); } /** * Used to delete forecast instance data based on unique fields * Delete forecastInstance with name */ deleteForecastInstanceWithName(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { yield this.deleteForecastInstanceWithNameRaw(requestParameters, initOverrides); }); } /** * Used to delete forecast spec data based on unique fields * Delete forecastSpec with name */ deleteForecastSpecWithNameRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters.name === null || requestParameters.name === undefined) { throw new runtime.RequiredError('name', 'Required parameter requestParameters.name was null or undefined when calling deleteForecastSpecWithName.'); } if (requestParameters.office === null || requestParameters.office === undefined) { throw new runtime.RequiredError('office', 'Required parameter requestParameters.office was null or undefined when calling deleteForecastSpecWithName.'); } const queryParameters = {}; if (requestParameters.office !== undefined) { queryParameters['office'] = requestParameters.office; } if (requestParameters.designator !== undefined) { queryParameters['designator'] = requestParameters.designator; } if (requestParameters.method !== undefined) { queryParameters['method'] = requestParameters.method; } const headerParameters = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication } const response = yield this.request({ path: `/forecast-spec/{name}`.replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))), method: 'DELETE', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.VoidApiResponse(response); }); } /** * Used to delete forecast spec data based on unique fields * Delete forecastSpec with name */ deleteForecastSpecWithName(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { yield this.deleteForecastSpecWithNameRaw(requestParameters, initOverrides); }); } /** * Used to get all forecast instances for a given forecast spec * Get forecastInstance */ getForecastInstanceRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { const queryParameters = {}; if (requestParameters.office !== undefined) { queryParameters['office'] = requestParameters.office; } if (requestParameters.name !== undefined) { queryParameters['name'] = requestParameters.name; } if (requestParameters.designator !== undefined) { queryParameters['designator'] = requestParameters.designator; } const headerParameters = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication } const response = yield this.request({ path: `/forecast-instance`, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => models_1.ForecastInstanceFromJSON(jsonValue)); }); } /** * Used to get all forecast instances for a given forecast spec * Get forecastInstance */ getForecastInstance(requestParameters = {}, initOverrides) { return __awaiter(this, void 0, void 0, function* () { const response = yield this.getForecastInstanceRaw(requestParameters, initOverrides); return yield response.value(); }); } /** * Used to get all forecast instances for a given forecast spec * Get forecastInstance with name */ getForecastInstanceWithNameRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters.name === null || requestParameters.name === undefined) { throw new runtime.RequiredError('name', 'Required parameter requestParameters.name was null or undefined when calling getForecastInstanceWithName.'); } if (requestParameters.forecastDate === null || requestParameters.forecastDate === undefined) { throw new runtime.RequiredError('forecastDate', 'Required parameter requestParameters.forecastDate was null or undefined when calling getForecastInstanceWithName.'); } if (requestParameters.issueDate === null || requestParameters.issueDate === undefined) { throw new runtime.RequiredError('issueDate', 'Required parameter requestParameters.issueDate was null or undefined when calling getForecastInstanceWithName.'); } if (requestParameters.office === null || requestParameters.office === undefined) { throw new runtime.RequiredError('office', 'Required parameter requestParameters.office was null or undefined when calling getForecastInstanceWithName.'); } const queryParameters = {}; if (requestParameters.forecastDate !== undefined) { queryParameters['forecast-date'] = requestParameters.forecastDate; } if (requestParameters.issueDate !== undefined) { queryParameters['issue-date'] = requestParameters.issueDate; } if (requestParameters.office !== undefined) { queryParameters['office'] = requestParameters.office; } if (requestParameters.designator !== undefined) { queryParameters['designator'] = requestParameters.designator; } const headerParameters = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication } const response = yield this.request({ path: `/forecast-instance/{name}`.replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))), method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => models_1.ForecastInstanceFromJSON(jsonValue)); }); } /** * Used to get all forecast instances for a given forecast spec * Get forecastInstance with name */ getForecastInstanceWithName(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { const response = yield this.getForecastInstanceWithNameRaw(requestParameters, initOverrides); return yield response.value(); }); } /** * Used to download forecast file for the given parameters * Get forecastInstance with name fileData */ getForecastInstanceWithNameFileDataRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters.name === null || requestParameters.name === undefined) { throw new runtime.RequiredError('name', 'Required parameter requestParameters.name was null or undefined when calling getForecastInstanceWithNameFileData.'); } if (requestParameters.forecastDate === null || requestParameters.forecastDate === undefined) { throw new runtime.RequiredError('forecastDate', 'Required parameter requestParameters.forecastDate was null or undefined when calling getForecastInstanceWithNameFileData.'); } if (requestParameters.issueDate === null || requestParameters.issueDate === undefined) { throw new runtime.RequiredError('issueDate', 'Required parameter requestParameters.issueDate was null or undefined when calling getForecastInstanceWithNameFileData.'); } if (requestParameters.office === null || requestParameters.office === undefined) { throw new runtime.RequiredError('office', 'Required parameter requestParameters.office was null or undefined when calling getForecastInstanceWithNameFileData.'); } const queryParameters = {}; if (requestParameters.forecastDate !== undefined) { queryParameters['forecast-date'] = requestParameters.forecastDate; } if (requestParameters.issueDate !== undefined) { queryParameters['issue-date'] = requestParameters.issueDate; } if (requestParameters.office !== undefined) { queryParameters['office'] = requestParameters.office; } if (requestParameters.designator !== undefined) { queryParameters['designator'] = requestParameters.designator; } const headerParameters = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication } const response = yield this.request({ path: `/forecast-instance/{name}/file-data`.replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))), method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.BlobApiResponse(response); }); } /** * Used to download forecast file for the given parameters * Get forecastInstance with name fileData */ getForecastInstanceWithNameFileData(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { const response = yield this.getForecastInstanceWithNameFileDataRaw(requestParameters, initOverrides); return yield response.value(); }); } /** * Used to query multiple forecast specs * Get forecastSpec */ getForecastSpecRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { const queryParameters = {}; if (requestParameters.office !== undefined) { queryParameters['office'] = requestParameters.office; } if (requestParameters.idMask !== undefined) { queryParameters['id-mask'] = requestParameters.idMask; } if (requestParameters.designatorMask !== undefined) { queryParameters['designator-mask'] = requestParameters.designatorMask; } if (requestParameters.sourceEntity !== undefined) { queryParameters['source-entity'] = requestParameters.sourceEntity; } const headerParameters = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication } const response = yield this.request({ path: `/forecast-spec`, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => models_1.ForecastSpecFromJSON(jsonValue)); }); } /** * Used to query multiple forecast specs * Get forecastSpec */ getForecastSpec(requestParameters = {}, initOverrides) { return __awaiter(this, void 0, void 0, function* () { const response = yield this.getForecastSpecRaw(requestParameters, initOverrides); return yield response.value(); }); } /** * Used to query a single forecast spec record * Get forecastSpec with name */ getForecastSpecWithNameRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters.name === null || requestParameters.name === undefined) { throw new runtime.RequiredError('name', 'Required parameter requestParameters.name was null or undefined when calling getForecastSpecWithName.'); } if (requestParameters.office === null || requestParameters.office === undefined) { throw new runtime.RequiredError('office', 'Required parameter requestParameters.office was null or undefined when calling getForecastSpecWithName.'); } const queryParameters = {}; if (requestParameters.office !== undefined) { queryParameters['office'] = requestParameters.office; } if (requestParameters.designator !== undefined) { queryParameters['designator'] = requestParameters.designator; } const headerParameters = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication } const response = yield this.request({ path: `/forecast-spec/{name}`.replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))), method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => models_1.ForecastSpecFromJSON(jsonValue)); }); } /** * Used to query a single forecast spec record * Get forecastSpec with name */ getForecastSpecWithName(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { const response = yield this.getForecastSpecWithNameRaw(requestParameters, initOverrides); return yield response.value(); }); } /** * Update a forecast instance with new max age, notes, forecast fileand forecast info key/value pairs. * Patch forecastInstance with name */ patchForecastInstanceWithNameRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters.name === null || requestParameters.name === undefined) { throw new runtime.RequiredError('name', 'Required parameter requestParameters.name was null or undefined when calling patchForecastInstanceWithName.'); } if (requestParameters.forecastInstance === null || requestParameters.forecastInstance === undefined) { throw new runtime.RequiredError('forecastInstance', 'Required parameter requestParameters.forecastInstance was null or undefined when calling patchForecastInstanceWithName.'); } const queryParameters = {}; const headerParameters = {}; headerParameters['Content-Type'] = 'application/json;version=2'; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication } const response = yield this.request({ path: `/forecast-instance/{name}`.replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))), method: 'PATCH', headers: headerParameters, query: queryParameters, body: models_1.ForecastInstanceToJSON(requestParameters.forecastInstance), }, initOverrides); return new runtime.VoidApiResponse(response); }); } /** * Update a forecast instance with new max age, notes, forecast fileand forecast info key/value pairs. * Patch forecastInstance with name */ patchForecastInstanceWithName(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { yield this.patchForecastInstanceWithNameRaw(requestParameters, initOverrides); }); } /** * Update a forecast spec with provided values * Patch forecastSpec with name */ patchForecastSpecWithNameRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters.name === null || requestParameters.name === undefined) { throw new runtime.RequiredError('name', 'Required parameter requestParameters.name was null or undefined when calling patchForecastSpecWithName.'); } if (requestParameters.forecastSpec === null || requestParameters.forecastSpec === undefined) { throw new runtime.RequiredError('forecastSpec', 'Required parameter requestParameters.forecastSpec was null or undefined when calling patchForecastSpecWithName.'); } const queryParameters = {}; const headerParameters = {}; headerParameters['Content-Type'] = 'application/json;version=2'; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication } const response = yield this.request({ path: `/forecast-spec/{name}`.replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))), method: 'PATCH', headers: headerParameters, query: queryParameters, body: models_1.ForecastSpecToJSON(requestParameters.forecastSpec), }, initOverrides); return new runtime.VoidApiResponse(response); }); } /** * Update a forecast spec with provided values * Patch forecastSpec with name */ patchForecastSpecWithName(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { yield this.patchForecastSpecWithNameRaw(requestParameters, initOverrides); }); } /** * Used to create and save a forecast instance * Post forecastInstance */ postForecastInstanceRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters.forecastInstance === null || requestParameters.forecastInstance === undefined) { throw new runtime.RequiredError('forecastInstance', 'Required parameter requestParameters.forecastInstance was null or undefined when calling postForecastInstance.'); } const queryParameters = {}; const headerParameters = {}; headerParameters['Content-Type'] = 'application/json;version=2'; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication } const response = yield this.request({ path: `/forecast-instance`, method: 'POST', headers: headerParameters, query: queryParameters, body: models_1.ForecastInstanceToJSON(requestParameters.forecastInstance), }, initOverrides); return new runtime.VoidApiResponse(response); }); } /** * Used to create and save a forecast instance * Post forecastInstance */ postForecastInstance(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { yield this.postForecastInstanceRaw(requestParameters, initOverrides); }); } /** * Used to create and save forecast spec data * Post forecastSpec */ postForecastSpecRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters.forecastSpec === null || requestParameters.forecastSpec === undefined) { throw new runtime.RequiredError('forecastSpec', 'Required parameter requestParameters.forecastSpec was null or undefined when calling postForecastSpec.'); } const queryParameters = {}; const headerParameters = {}; headerParameters['Content-Type'] = 'application/json;version=2'; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication } const response = yield this.request({ path: `/forecast-spec`, method: 'POST', headers: headerParameters, query: queryParameters, body: models_1.ForecastSpecToJSON(requestParameters.forecastSpec), }, initOverrides); return new runtime.VoidApiResponse(response); }); } /** * Used to create and save forecast spec data * Post forecastSpec */ postForecastSpec(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { yield this.postForecastSpecRaw(requestParameters, initOverrides); }); } } exports.ForecastApi = ForecastApi;