cwmsjs
Version:
CWMS Data API Library for JavaScript/TypeScript created with OpenAPI generator for use with browser webapps
84 lines (83 loc) • 3.93 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.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.MeasurementToJSON = exports.MeasurementFromJSONTyped = exports.MeasurementFromJSON = exports.instanceOfMeasurement = void 0;
const CwmsId_1 = require("./CwmsId");
const StreamflowMeasurement_1 = require("./StreamflowMeasurement");
const SupplementalStreamflowMeasurement_1 = require("./SupplementalStreamflowMeasurement");
const UsgsMeasurement_1 = require("./UsgsMeasurement");
/**
* Check if a given object implements the Measurement interface.
*/
function instanceOfMeasurement(value) {
if (!('instant' in value))
return false;
if (!('id' in value))
return false;
if (!('number' in value))
return false;
return true;
}
exports.instanceOfMeasurement = instanceOfMeasurement;
function MeasurementFromJSON(json) {
return MeasurementFromJSONTyped(json, false);
}
exports.MeasurementFromJSON = MeasurementFromJSON;
function MeasurementFromJSONTyped(json, ignoreDiscriminator) {
if (json == null) {
return json;
}
return {
'heightUnit': json['height-unit'] == null ? undefined : json['height-unit'],
'flowUnit': json['flow-unit'] == null ? undefined : json['flow-unit'],
'tempUnit': json['temp-unit'] == null ? undefined : json['temp-unit'],
'velocityUnit': json['velocity-unit'] == null ? undefined : json['velocity-unit'],
'areaUnit': json['area-unit'] == null ? undefined : json['area-unit'],
'used': json['used'] == null ? undefined : json['used'],
'agency': json['agency'] == null ? undefined : json['agency'],
'party': json['party'] == null ? undefined : json['party'],
'wmComments': json['wm-comments'] == null ? undefined : json['wm-comments'],
'instant': (new Date(json['instant'])),
'id': (0, CwmsId_1.CwmsIdFromJSON)(json['id']),
'number': json['number'],
'streamflowMeasurement': json['streamflow-measurement'] == null ? undefined : (0, StreamflowMeasurement_1.StreamflowMeasurementFromJSON)(json['streamflow-measurement']),
'supplementalStreamflowMeasurement': json['supplemental-streamflow-measurement'] == null ? undefined : (0, SupplementalStreamflowMeasurement_1.SupplementalStreamflowMeasurementFromJSON)(json['supplemental-streamflow-measurement']),
'usgsMeasurement': json['usgs-measurement'] == null ? undefined : (0, UsgsMeasurement_1.UsgsMeasurementFromJSON)(json['usgs-measurement']),
};
}
exports.MeasurementFromJSONTyped = MeasurementFromJSONTyped;
function MeasurementToJSON(value) {
if (value == null) {
return value;
}
return {
'height-unit': value['heightUnit'],
'flow-unit': value['flowUnit'],
'temp-unit': value['tempUnit'],
'velocity-unit': value['velocityUnit'],
'area-unit': value['areaUnit'],
'used': value['used'],
'agency': value['agency'],
'party': value['party'],
'wm-comments': value['wmComments'],
'instant': ((value['instant']).toISOString()),
'id': (0, CwmsId_1.CwmsIdToJSON)(value['id']),
'number': value['number'],
'streamflow-measurement': (0, StreamflowMeasurement_1.StreamflowMeasurementToJSON)(value['streamflowMeasurement']),
'supplemental-streamflow-measurement': (0, SupplementalStreamflowMeasurement_1.SupplementalStreamflowMeasurementToJSON)(value['supplementalStreamflowMeasurement']),
'usgs-measurement': (0, UsgsMeasurement_1.UsgsMeasurementToJSON)(value['usgsMeasurement']),
};
}
exports.MeasurementToJSON = MeasurementToJSON;