UNPKG

cwmsjs

Version:

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

285 lines (284 loc) 14.3 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.TextTimeSeriesApi = void 0; const runtime = require("../runtime"); const index_1 = require("../models/index"); /** * */ class TextTimeSeriesApi extends runtime.BaseAPI { /** * Deletes requested text timeseries id * Delete cwmsData timeseries text with name */ deleteTimeSeriesTextWithNameRaw(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 deleteTimeSeriesTextWithName().'); } if (requestParameters['office'] == null) { throw new runtime.RequiredError('office', 'Required parameter "office" was null or undefined when calling deleteTimeSeriesTextWithName().'); } if (requestParameters['textMask'] == null) { throw new runtime.RequiredError('textMask', 'Required parameter "textMask" was null or undefined when calling deleteTimeSeriesTextWithName().'); } if (requestParameters['begin'] == null) { throw new runtime.RequiredError('begin', 'Required parameter "begin" was null or undefined when calling deleteTimeSeriesTextWithName().'); } if (requestParameters['end'] == null) { throw new runtime.RequiredError('end', 'Required parameter "end" was null or undefined when calling deleteTimeSeriesTextWithName().'); } const queryParameters = {}; if (requestParameters['office'] != null) { queryParameters['office'] = requestParameters['office']; } if (requestParameters['textMask'] != null) { queryParameters['text-mask'] = requestParameters['textMask']; } if (requestParameters['timezone'] != null) { queryParameters['timezone'] = requestParameters['timezone']; } if (requestParameters['begin'] != null) { queryParameters['begin'] = requestParameters['begin']; } if (requestParameters['end'] != null) { queryParameters['end'] = requestParameters['end']; } if (requestParameters['versionDate'] != null) { queryParameters['version-date'] = requestParameters['versionDate']; } const headerParameters = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = yield 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 cwmsData 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) { throw new runtime.RequiredError('office', 'Required parameter "office" was null or undefined when calling getTimeSeriesText().'); } if (requestParameters['name'] == null) { throw new runtime.RequiredError('name', 'Required parameter "name" was null or undefined when calling getTimeSeriesText().'); } if (requestParameters['begin'] == null) { throw new runtime.RequiredError('begin', 'Required parameter "begin" was null or undefined when calling getTimeSeriesText().'); } if (requestParameters['end'] == null) { throw new runtime.RequiredError('end', 'Required parameter "end" was null or undefined when calling getTimeSeriesText().'); } const queryParameters = {}; if (requestParameters['office'] != null) { queryParameters['office'] = requestParameters['office']; } if (requestParameters['name'] != null) { queryParameters['name'] = requestParameters['name']; } if (requestParameters['timezone'] != null) { queryParameters['timezone'] = requestParameters['timezone']; } if (requestParameters['begin'] != null) { queryParameters['begin'] = requestParameters['begin']; } if (requestParameters['end'] != null) { queryParameters['end'] = requestParameters['end']; } const headerParameters = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = yield 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) => (0, index_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 cwmsData timeseries text with name value */ getTimeSeriesTextWithNameValueRaw(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 getTimeSeriesTextWithNameValue().'); } if (requestParameters['office'] == null) { throw new runtime.RequiredError('office', 'Required parameter "office" was null or undefined when calling getTimeSeriesTextWithNameValue().'); } if (requestParameters['date'] == null) { throw new runtime.RequiredError('date', 'Required parameter "date" was null or undefined when calling getTimeSeriesTextWithNameValue().'); } const queryParameters = {}; if (requestParameters['office'] != null) { queryParameters['office'] = requestParameters['office']; } if (requestParameters['timezone'] != null) { queryParameters['timezone'] = requestParameters['timezone']; } if (requestParameters['date'] != null) { queryParameters['date'] = requestParameters['date']; } if (requestParameters['versionDate'] != null) { queryParameters['version-date'] = requestParameters['versionDate']; } if (requestParameters['clobId'] != null) { queryParameters['clob-id'] = requestParameters['clobId']; } const headerParameters = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = yield 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); if (this.isJsonMime(response.headers.get('content-type'))) { return new runtime.JSONApiResponse(response); } else { return new runtime.TextApiResponse(response); } }); } /** * Get cwmsData 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 cwmsData timeseries text with name */ patchTimeSeriesTextWithNameRaw(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 patchTimeSeriesTextWithName().'); } if (requestParameters['textTimeSeries'] == null) { throw new runtime.RequiredError('textTimeSeries', 'Required parameter "textTimeSeries" was null or undefined when calling patchTimeSeriesTextWithName().'); } const queryParameters = {}; if (requestParameters['replaceAll'] != null) { queryParameters['replace-all'] = requestParameters['replaceAll']; } 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: `/timeseries/text/{name}`.replace(`{${"name"}}`, encodeURIComponent(String(requestParameters['name']))), method: 'PATCH', headers: headerParameters, query: queryParameters, body: (0, index_1.TextTimeSeriesToJSON)(requestParameters['textTimeSeries']), }, initOverrides); return new runtime.VoidApiResponse(response); }); } /** * Updates a text timeseries * Patch cwmsData timeseries text with name */ patchTimeSeriesTextWithName(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { yield this.patchTimeSeriesTextWithNameRaw(requestParameters, initOverrides); }); } /** * Create new TextTimeSeries * Post cwmsData timeseries text */ postTimeSeriesTextRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters['textTimeSeries'] == null) { throw new runtime.RequiredError('textTimeSeries', 'Required parameter "textTimeSeries" was null or undefined when calling postTimeSeriesText().'); } const queryParameters = {}; if (requestParameters['replaceAll'] != null) { queryParameters['replace-all'] = requestParameters['replaceAll']; } 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: `/timeseries/text`, method: 'POST', headers: headerParameters, query: queryParameters, body: (0, index_1.TextTimeSeriesToJSON)(requestParameters['textTimeSeries']), }, initOverrides); return new runtime.VoidApiResponse(response); }); } /** * Create new TextTimeSeries * Post cwmsData timeseries text */ postTimeSeriesText(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { yield this.postTimeSeriesTextRaw(requestParameters, initOverrides); }); } } exports.TextTimeSeriesApi = TextTimeSeriesApi;