cwmsjs
Version:
CWMS Data API Library for JavaScript/TypeScript created with OpenAPI generator for use with browser webapps
279 lines (278 loc) • 14.2 kB
JavaScript
/* 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 { BinaryTimeSeriesFromJSON, BinaryTimeSeriesToJSON, } from '../models/index';
/**
*
*/
export class BinaryTimeSeriesApi extends runtime.BaseAPI {
/**
* Deletes requested binary timeseries id
* Delete cwmsData timeseries binary with name
*/
deleteTimeSeriesBinaryWithNameRaw(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 deleteTimeSeriesBinaryWithName().');
}
if (requestParameters['office'] == null) {
throw new runtime.RequiredError('office', 'Required parameter "office" was null or undefined when calling deleteTimeSeriesBinaryWithName().');
}
if (requestParameters['begin'] == null) {
throw new runtime.RequiredError('begin', 'Required parameter "begin" was null or undefined when calling deleteTimeSeriesBinaryWithName().');
}
if (requestParameters['end'] == null) {
throw new runtime.RequiredError('end', 'Required parameter "end" was null or undefined when calling deleteTimeSeriesBinaryWithName().');
}
const queryParameters = {};
if (requestParameters['office'] != null) {
queryParameters['office'] = requestParameters['office'];
}
if (requestParameters['binaryTypeMask'] != null) {
queryParameters['binary-type-mask'] = requestParameters['binaryTypeMask'];
}
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/binary/{name}`.replace(`{${"name"}}`, encodeURIComponent(String(requestParameters['name']))),
method: 'DELETE',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.VoidApiResponse(response);
});
}
/**
* Deletes requested binary timeseries id
* Delete cwmsData timeseries binary with name
*/
deleteTimeSeriesBinaryWithName(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
yield this.deleteTimeSeriesBinaryWithNameRaw(requestParameters, initOverrides);
});
}
/**
* Retrieve binary 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.
*/
getTimeSeriesBinaryRaw(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 getTimeSeriesBinary().');
}
if (requestParameters['name'] == null) {
throw new runtime.RequiredError('name', 'Required parameter "name" was null or undefined when calling getTimeSeriesBinary().');
}
if (requestParameters['begin'] == null) {
throw new runtime.RequiredError('begin', 'Required parameter "begin" was null or undefined when calling getTimeSeriesBinary().');
}
if (requestParameters['end'] == null) {
throw new runtime.RequiredError('end', 'Required parameter "end" was null or undefined when calling getTimeSeriesBinary().');
}
const queryParameters = {};
if (requestParameters['office'] != null) {
queryParameters['office'] = requestParameters['office'];
}
if (requestParameters['name'] != null) {
queryParameters['name'] = requestParameters['name'];
}
if (requestParameters['binaryTypeMask'] != null) {
queryParameters['binary-type-mask'] = requestParameters['binaryTypeMask'];
}
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/binary`,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => BinaryTimeSeriesFromJSON(jsonValue));
});
}
/**
* Retrieve binary 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.
*/
getTimeSeriesBinary(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield this.getTimeSeriesBinaryRaw(requestParameters, initOverrides);
return yield response.value();
});
}
/**
* Get cwmsData timeseries binary with name value
*/
getTimeSeriesBinaryWithNameValueRaw(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 getTimeSeriesBinaryWithNameValue().');
}
if (requestParameters['office'] == null) {
throw new runtime.RequiredError('office', 'Required parameter "office" was null or undefined when calling getTimeSeriesBinaryWithNameValue().');
}
if (requestParameters['date'] == null) {
throw new runtime.RequiredError('date', 'Required parameter "date" was null or undefined when calling getTimeSeriesBinaryWithNameValue().');
}
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['blobId'] != null) {
queryParameters['blob-id'] = requestParameters['blobId'];
}
const headerParameters = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = yield this.configuration.apiKey("Authorization"); // ApiKey authentication
}
const response = yield this.request({
path: `/timeseries/binary/{name}/value`.replace(`{${"name"}}`, encodeURIComponent(String(requestParameters['name']))),
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.BlobApiResponse(response);
});
}
/**
* Get cwmsData timeseries binary with name value
*/
getTimeSeriesBinaryWithNameValue(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield this.getTimeSeriesBinaryWithNameValueRaw(requestParameters, initOverrides);
return yield response.value();
});
}
/**
* Updates a binary timeseries
* Patch cwmsData timeseries binary with name
*/
patchTimeSeriesBinaryWithNameRaw(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 patchTimeSeriesBinaryWithName().');
}
if (requestParameters['binaryTimeSeries'] == null) {
throw new runtime.RequiredError('binaryTimeSeries', 'Required parameter "binaryTimeSeries" was null or undefined when calling patchTimeSeriesBinaryWithName().');
}
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/binary/{name}`.replace(`{${"name"}}`, encodeURIComponent(String(requestParameters['name']))),
method: 'PATCH',
headers: headerParameters,
query: queryParameters,
body: BinaryTimeSeriesToJSON(requestParameters['binaryTimeSeries']),
}, initOverrides);
return new runtime.VoidApiResponse(response);
});
}
/**
* Updates a binary timeseries
* Patch cwmsData timeseries binary with name
*/
patchTimeSeriesBinaryWithName(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
yield this.patchTimeSeriesBinaryWithNameRaw(requestParameters, initOverrides);
});
}
/**
* Create new BinaryTimeSeries
* Post cwmsData timeseries binary
*/
postTimeSeriesBinaryRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters['binaryTimeSeries'] == null) {
throw new runtime.RequiredError('binaryTimeSeries', 'Required parameter "binaryTimeSeries" was null or undefined when calling postTimeSeriesBinary().');
}
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/binary`,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: BinaryTimeSeriesToJSON(requestParameters['binaryTimeSeries']),
}, initOverrides);
return new runtime.VoidApiResponse(response);
});
}
/**
* Create new BinaryTimeSeries
* Post cwmsData timeseries binary
*/
postTimeSeriesBinary(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
yield this.postTimeSeriesBinaryRaw(requestParameters, initOverrides);
});
}
}