cwmsjs
Version:
CWMS Data API Library for JavaScript/TypeScript created with OpenAPI generator for use with browser webapps
77 lines (76 loc) • 3.45 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.
*/
import { CwmsIdFromJSON, CwmsIdToJSON, } from './CwmsId';
import { StreamflowMeasurementFromJSON, StreamflowMeasurementToJSON, } from './StreamflowMeasurement';
import { SupplementalStreamflowMeasurementFromJSON, SupplementalStreamflowMeasurementToJSON, } from './SupplementalStreamflowMeasurement';
import { UsgsMeasurementFromJSON, UsgsMeasurementToJSON, } from './UsgsMeasurement';
/**
* Check if a given object implements the Measurement interface.
*/
export function instanceOfMeasurement(value) {
if (!('instant' in value))
return false;
if (!('id' in value))
return false;
if (!('number' in value))
return false;
return true;
}
export function MeasurementFromJSON(json) {
return MeasurementFromJSONTyped(json, false);
}
export 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': CwmsIdFromJSON(json['id']),
'number': json['number'],
'streamflowMeasurement': json['streamflow-measurement'] == null ? undefined : StreamflowMeasurementFromJSON(json['streamflow-measurement']),
'supplementalStreamflowMeasurement': json['supplemental-streamflow-measurement'] == null ? undefined : SupplementalStreamflowMeasurementFromJSON(json['supplemental-streamflow-measurement']),
'usgsMeasurement': json['usgs-measurement'] == null ? undefined : UsgsMeasurementFromJSON(json['usgs-measurement']),
};
}
export 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': CwmsIdToJSON(value['id']),
'number': value['number'],
'streamflow-measurement': StreamflowMeasurementToJSON(value['streamflowMeasurement']),
'supplemental-streamflow-measurement': SupplementalStreamflowMeasurementToJSON(value['supplementalStreamflowMeasurement']),
'usgs-measurement': UsgsMeasurementToJSON(value['usgsMeasurement']),
};
}