UNPKG

cwmsjs

Version:

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

278 lines (277 loc) 14.7 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 TextTimeSeriesApi extends runtime.BaseAPI { /** * Deletes requested text timeseries id * Delete timeseries text with name */ deleteTimeSeriesTextWithNameRaw(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 deleteTimeSeriesTextWithName.'); } if (requestParameters.office === null || requestParameters.office === undefined) { throw new runtime.RequiredError('office', 'Required parameter requestParameters.office was null or undefined when calling deleteTimeSeriesTextWithName.'); } if (requestParameters.textMask === null || requestParameters.textMask === undefined) { throw new runtime.RequiredError('textMask', 'Required parameter requestParameters.textMask was null or undefined when calling deleteTimeSeriesTextWithName.'); } if (requestParameters.begin === null || requestParameters.begin === undefined) { throw new runtime.RequiredError('begin', 'Required parameter requestParameters.begin was null or undefined when calling deleteTimeSeriesTextWithName.'); } if (requestParameters.end === null || requestParameters.end === undefined) { throw new runtime.RequiredError('end', 'Required parameter requestParameters.end was null or undefined when calling deleteTimeSeriesTextWithName.'); } const queryParameters = {}; if (requestParameters.office !== undefined) { queryParameters['office'] = requestParameters.office; } if (requestParameters.textMask !== undefined) { queryParameters['text-mask'] = requestParameters.textMask; } if (requestParameters.timezone !== undefined) { queryParameters['timezone'] = requestParameters.timezone; } if (requestParameters.begin !== undefined) { queryParameters['begin'] = requestParameters.begin; } if (requestParameters.end !== undefined) { queryParameters['end'] = requestParameters.end; } if (requestParameters.versionDate !== undefined) { queryParameters['version-date'] = requestParameters.versionDate; } const headerParameters = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication } const response = yield this.request({ path: `/timeseries/text/{name}`.replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))), method: 'DELETE', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.VoidApiResponse(response); }); } /** * Deletes requested text timeseries id * Delete timeseries text with name */ deleteTimeSeriesTextWithName(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { yield this.deleteTimeSeriesTextWithNameRaw(requestParameters, initOverrides); }); } /** * Retrieve text time series values for a provided time window and date version.If individual values exceed 64 kilobytes, a URL to a separate download is provided instead of being included in the returned payload from this request. */ getTimeSeriesTextRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters.office === null || requestParameters.office === undefined) { throw new runtime.RequiredError('office', 'Required parameter requestParameters.office was null or undefined when calling getTimeSeriesText.'); } if (requestParameters.name === null || requestParameters.name === undefined) { throw new runtime.RequiredError('name', 'Required parameter requestParameters.name was null or undefined when calling getTimeSeriesText.'); } if (requestParameters.begin === null || requestParameters.begin === undefined) { throw new runtime.RequiredError('begin', 'Required parameter requestParameters.begin was null or undefined when calling getTimeSeriesText.'); } if (requestParameters.end === null || requestParameters.end === undefined) { throw new runtime.RequiredError('end', 'Required parameter requestParameters.end was null or undefined when calling getTimeSeriesText.'); } const queryParameters = {}; if (requestParameters.office !== undefined) { queryParameters['office'] = requestParameters.office; } if (requestParameters.name !== undefined) { queryParameters['name'] = requestParameters.name; } if (requestParameters.timezone !== undefined) { queryParameters['timezone'] = requestParameters.timezone; } if (requestParameters.begin !== undefined) { queryParameters['begin'] = requestParameters.begin; } if (requestParameters.end !== undefined) { queryParameters['end'] = requestParameters.end; } const headerParameters = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication } const response = yield this.request({ path: `/timeseries/text`, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => models_1.TextTimeSeriesFromJSON(jsonValue)); }); } /** * Retrieve text time series values for a provided time window and date version.If individual values exceed 64 kilobytes, a URL to a separate download is provided instead of being included in the returned payload from this request. */ getTimeSeriesText(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { const response = yield this.getTimeSeriesTextRaw(requestParameters, initOverrides); return yield response.value(); }); } /** * Get timeseries text with name value */ getTimeSeriesTextWithNameValueRaw(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 getTimeSeriesTextWithNameValue.'); } if (requestParameters.office === null || requestParameters.office === undefined) { throw new runtime.RequiredError('office', 'Required parameter requestParameters.office was null or undefined when calling getTimeSeriesTextWithNameValue.'); } if (requestParameters.date === null || requestParameters.date === undefined) { throw new runtime.RequiredError('date', 'Required parameter requestParameters.date was null or undefined when calling getTimeSeriesTextWithNameValue.'); } const queryParameters = {}; if (requestParameters.office !== undefined) { queryParameters['office'] = requestParameters.office; } if (requestParameters.timezone !== undefined) { queryParameters['timezone'] = requestParameters.timezone; } if (requestParameters.date !== undefined) { queryParameters['date'] = requestParameters.date; } if (requestParameters.versionDate !== undefined) { queryParameters['version-date'] = requestParameters.versionDate; } if (requestParameters.clobId !== undefined) { queryParameters['clob-id'] = requestParameters.clobId; } const headerParameters = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication } const response = yield this.request({ path: `/timeseries/text/{name}/value`.replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))), method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.TextApiResponse(response); }); } /** * Get timeseries text with name value */ getTimeSeriesTextWithNameValue(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { const response = yield this.getTimeSeriesTextWithNameValueRaw(requestParameters, initOverrides); return yield response.value(); }); } /** * Updates a text timeseries * Patch timeseries text with name */ patchTimeSeriesTextWithNameRaw(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 patchTimeSeriesTextWithName.'); } if (requestParameters.textTimeSeries === null || requestParameters.textTimeSeries === undefined) { throw new runtime.RequiredError('textTimeSeries', 'Required parameter requestParameters.textTimeSeries was null or undefined when calling patchTimeSeriesTextWithName.'); } const queryParameters = {}; if (requestParameters.replaceAll !== undefined) { queryParameters['replace-all'] = requestParameters.replaceAll; } 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: `/timeseries/text/{name}`.replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))), method: 'PATCH', headers: headerParameters, query: queryParameters, body: models_1.TextTimeSeriesToJSON(requestParameters.textTimeSeries), }, initOverrides); return new runtime.VoidApiResponse(response); }); } /** * Updates a text timeseries * Patch timeseries text with name */ patchTimeSeriesTextWithName(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { yield this.patchTimeSeriesTextWithNameRaw(requestParameters, initOverrides); }); } /** * Create new TextTimeSeries * Post timeseries text */ postTimeSeriesTextRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters.textTimeSeries === null || requestParameters.textTimeSeries === undefined) { throw new runtime.RequiredError('textTimeSeries', 'Required parameter requestParameters.textTimeSeries was null or undefined when calling postTimeSeriesText.'); } const queryParameters = {}; if (requestParameters.replaceAll !== undefined) { queryParameters['replace-all'] = requestParameters.replaceAll; } 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: `/timeseries/text`, method: 'POST', headers: headerParameters, query: queryParameters, body: models_1.TextTimeSeriesToJSON(requestParameters.textTimeSeries), }, initOverrides); return new runtime.VoidApiResponse(response); }); } /** * Create new TextTimeSeries * Post timeseries text */ postTimeSeriesText(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { yield this.postTimeSeriesTextRaw(requestParameters, initOverrides); }); } } exports.TextTimeSeriesApi = TextTimeSeriesApi;