UNPKG

cwmsjs

Version:

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

515 lines (514 loc) 26.2 kB
/* 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()); }); }; import * as runtime from '../runtime'; import { ForecastInstanceFromJSON, ForecastInstanceToJSON, ForecastSpecFromJSON, ForecastSpecToJSON, } from '../models/index'; /** * */ export class ForecastApi extends runtime.BaseAPI { /** * Used to delete forecast instance data based on unique fields * Delete cwmsData forecastInstance with name */ deleteForecastInstanceWithNameRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters['name'] == null) { throw new runtime.RequiredError('name', 'Required parameter "name" was null or undefined when calling deleteForecastInstanceWithName().'); } if (requestParameters['forecastDate'] == null) { throw new runtime.RequiredError('forecastDate', 'Required parameter "forecastDate" was null or undefined when calling deleteForecastInstanceWithName().'); } if (requestParameters['issueDate'] == null) { throw new runtime.RequiredError('issueDate', 'Required parameter "issueDate" was null or undefined when calling deleteForecastInstanceWithName().'); } if (requestParameters['office'] == null) { throw new runtime.RequiredError('office', 'Required parameter "office" was null or undefined when calling deleteForecastInstanceWithName().'); } if (requestParameters['designator'] == null) { throw new runtime.RequiredError('designator', 'Required parameter "designator" was null or undefined when calling deleteForecastInstanceWithName().'); } const queryParameters = {}; if (requestParameters['forecastDate'] != null) { queryParameters['forecast-date'] = requestParameters['forecastDate']; } if (requestParameters['issueDate'] != null) { queryParameters['issue-date'] = requestParameters['issueDate']; } if (requestParameters['office'] != null) { queryParameters['office'] = requestParameters['office']; } if (requestParameters['designator'] != null) { queryParameters['designator'] = requestParameters['designator']; } const headerParameters = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = yield 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 cwmsData 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 cwmsData forecastSpec with name */ deleteForecastSpecWithNameRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters['name'] == null) { throw new runtime.RequiredError('name', 'Required parameter "name" was null or undefined when calling deleteForecastSpecWithName().'); } if (requestParameters['office'] == null) { throw new runtime.RequiredError('office', 'Required parameter "office" was null or undefined when calling deleteForecastSpecWithName().'); } if (requestParameters['designator'] == null) { throw new runtime.RequiredError('designator', 'Required parameter "designator" was null or undefined when calling deleteForecastSpecWithName().'); } const queryParameters = {}; if (requestParameters['office'] != null) { queryParameters['office'] = requestParameters['office']; } if (requestParameters['designator'] != null) { queryParameters['designator'] = requestParameters['designator']; } if (requestParameters['method'] != null) { queryParameters['method'] = requestParameters['method']; } const headerParameters = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = yield 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 cwmsData 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 cwmsData forecastInstance */ getForecastInstanceRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { const queryParameters = {}; if (requestParameters['office'] != null) { queryParameters['office'] = requestParameters['office']; } if (requestParameters['name'] != null) { queryParameters['name'] = requestParameters['name']; } if (requestParameters['designator'] != null) { queryParameters['designator'] = requestParameters['designator']; } const headerParameters = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = yield 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) => ForecastInstanceFromJSON(jsonValue)); }); } /** * Used to get all forecast instances for a given forecast spec * Get cwmsData 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 cwmsData forecastInstance with name */ getForecastInstanceWithNameRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters['name'] == null) { throw new runtime.RequiredError('name', 'Required parameter "name" was null or undefined when calling getForecastInstanceWithName().'); } if (requestParameters['forecastDate'] == null) { throw new runtime.RequiredError('forecastDate', 'Required parameter "forecastDate" was null or undefined when calling getForecastInstanceWithName().'); } if (requestParameters['issueDate'] == null) { throw new runtime.RequiredError('issueDate', 'Required parameter "issueDate" was null or undefined when calling getForecastInstanceWithName().'); } if (requestParameters['office'] == null) { throw new runtime.RequiredError('office', 'Required parameter "office" was null or undefined when calling getForecastInstanceWithName().'); } if (requestParameters['designator'] == null) { throw new runtime.RequiredError('designator', 'Required parameter "designator" was null or undefined when calling getForecastInstanceWithName().'); } const queryParameters = {}; if (requestParameters['forecastDate'] != null) { queryParameters['forecast-date'] = requestParameters['forecastDate']; } if (requestParameters['issueDate'] != null) { queryParameters['issue-date'] = requestParameters['issueDate']; } if (requestParameters['office'] != null) { queryParameters['office'] = requestParameters['office']; } if (requestParameters['designator'] != null) { queryParameters['designator'] = requestParameters['designator']; } const headerParameters = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = yield 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) => ForecastInstanceFromJSON(jsonValue)); }); } /** * Used to get all forecast instances for a given forecast spec * Get cwmsData 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 cwmsData forecastInstance with name fileData */ getForecastInstanceWithNameFileDataRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters['name'] == null) { throw new runtime.RequiredError('name', 'Required parameter "name" was null or undefined when calling getForecastInstanceWithNameFileData().'); } if (requestParameters['forecastDate'] == null) { throw new runtime.RequiredError('forecastDate', 'Required parameter "forecastDate" was null or undefined when calling getForecastInstanceWithNameFileData().'); } if (requestParameters['issueDate'] == null) { throw new runtime.RequiredError('issueDate', 'Required parameter "issueDate" was null or undefined when calling getForecastInstanceWithNameFileData().'); } if (requestParameters['office'] == null) { throw new runtime.RequiredError('office', 'Required parameter "office" was null or undefined when calling getForecastInstanceWithNameFileData().'); } if (requestParameters['designator'] == null) { throw new runtime.RequiredError('designator', 'Required parameter "designator" was null or undefined when calling getForecastInstanceWithNameFileData().'); } const queryParameters = {}; if (requestParameters['forecastDate'] != null) { queryParameters['forecast-date'] = requestParameters['forecastDate']; } if (requestParameters['issueDate'] != null) { queryParameters['issue-date'] = requestParameters['issueDate']; } if (requestParameters['office'] != null) { queryParameters['office'] = requestParameters['office']; } if (requestParameters['designator'] != null) { queryParameters['designator'] = requestParameters['designator']; } const headerParameters = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = yield 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 cwmsData 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 cwmsData forecastSpec */ getForecastSpecRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { const queryParameters = {}; if (requestParameters['office'] != null) { queryParameters['office'] = requestParameters['office']; } if (requestParameters['idMask'] != null) { queryParameters['id-mask'] = requestParameters['idMask']; } if (requestParameters['designatorMask'] != null) { queryParameters['designator-mask'] = requestParameters['designatorMask']; } if (requestParameters['sourceEntity'] != null) { queryParameters['source-entity'] = requestParameters['sourceEntity']; } const headerParameters = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = yield 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) => ForecastSpecFromJSON(jsonValue)); }); } /** * Used to query multiple forecast specs * Get cwmsData 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 cwmsData forecastSpec with name */ getForecastSpecWithNameRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters['name'] == null) { throw new runtime.RequiredError('name', 'Required parameter "name" was null or undefined when calling getForecastSpecWithName().'); } if (requestParameters['office'] == null) { throw new runtime.RequiredError('office', 'Required parameter "office" was null or undefined when calling getForecastSpecWithName().'); } if (requestParameters['designator'] == null) { throw new runtime.RequiredError('designator', 'Required parameter "designator" was null or undefined when calling getForecastSpecWithName().'); } const queryParameters = {}; if (requestParameters['office'] != null) { queryParameters['office'] = requestParameters['office']; } if (requestParameters['designator'] != null) { queryParameters['designator'] = requestParameters['designator']; } const headerParameters = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = yield 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) => ForecastSpecFromJSON(jsonValue)); }); } /** * Used to query a single forecast spec record * Get cwmsData 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 cwmsData forecastInstance with name */ patchForecastInstanceWithNameRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters['name'] == null) { throw new runtime.RequiredError('name', 'Required parameter "name" was null or undefined when calling patchForecastInstanceWithName().'); } if (requestParameters['forecastInstance'] == null) { throw new runtime.RequiredError('forecastInstance', 'Required parameter "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"] = yield 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: 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 cwmsData 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 cwmsData forecastSpec with name */ patchForecastSpecWithNameRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters['name'] == null) { throw new runtime.RequiredError('name', 'Required parameter "name" was null or undefined when calling patchForecastSpecWithName().'); } if (requestParameters['forecastSpec'] == null) { throw new runtime.RequiredError('forecastSpec', 'Required parameter "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"] = yield 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: ForecastSpecToJSON(requestParameters['forecastSpec']), }, initOverrides); return new runtime.VoidApiResponse(response); }); } /** * Update a forecast spec with provided values * Patch cwmsData 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 cwmsData forecastInstance */ postForecastInstanceRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters['forecastInstance'] == null) { throw new runtime.RequiredError('forecastInstance', 'Required parameter "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"] = yield this.configuration.apiKey("Authorization"); // ApiKey authentication } const response = yield this.request({ path: `/forecast-instance`, method: 'POST', headers: headerParameters, query: queryParameters, body: ForecastInstanceToJSON(requestParameters['forecastInstance']), }, initOverrides); return new runtime.VoidApiResponse(response); }); } /** * Used to create and save a forecast instance * Post cwmsData 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 cwmsData forecastSpec */ postForecastSpecRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters['forecastSpec'] == null) { throw new runtime.RequiredError('forecastSpec', 'Required parameter "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"] = yield this.configuration.apiKey("Authorization"); // ApiKey authentication } const response = yield this.request({ path: `/forecast-spec`, method: 'POST', headers: headerParameters, query: queryParameters, body: ForecastSpecToJSON(requestParameters['forecastSpec']), }, initOverrides); return new runtime.VoidApiResponse(response); }); } /** * Used to create and save forecast spec data * Post cwmsData forecastSpec */ postForecastSpec(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { yield this.postForecastSpecRaw(requestParameters, initOverrides); }); } }