UNPKG

cwmsjs

Version:

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

87 lines (86 loc) 4.01 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. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.GateChangeToJSON = exports.GateChangeFromJSONTyped = exports.GateChangeFromJSON = exports.instanceOfGateChange = void 0; const CwmsId_1 = require("./CwmsId"); const GateSetting_1 = require("./GateSetting"); const LookupType_1 = require("./LookupType"); /** * Check if a given object implements the GateChange interface. */ function instanceOfGateChange(value) { if (!('projectId' in value)) return false; if (!('changeDate' in value)) return false; if (!('dischargeComputationType' in value)) return false; if (!('reasonType' in value)) return false; return true; } exports.instanceOfGateChange = instanceOfGateChange; function GateChangeFromJSON(json) { return GateChangeFromJSONTyped(json, false); } exports.GateChangeFromJSON = GateChangeFromJSON; function GateChangeFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } if (!ignoreDiscriminator) { } return { 'projectId': (0, CwmsId_1.CwmsIdFromJSON)(json['project-id']), 'changeDate': (new Date(json['change-date'])), 'referenceElevation': json['reference-elevation'] == null ? undefined : json['reference-elevation'], 'poolElevation': json['pool-elevation'] == null ? undefined : json['pool-elevation'], '_protected': json['protected'] == null ? undefined : json['protected'], 'dischargeComputationType': (0, LookupType_1.LookupTypeFromJSON)(json['discharge-computation-type']), 'reasonType': (0, LookupType_1.LookupTypeFromJSON)(json['reason-type']), 'notes': json['notes'] == null ? undefined : json['notes'], 'type': json['type'] == null ? undefined : json['type'], 'newTotalDischargeOverride': json['new-total-discharge-override'] == null ? undefined : json['new-total-discharge-override'], 'oldTotalDischargeOverride': json['old-total-discharge-override'] == null ? undefined : json['old-total-discharge-override'], 'dischargeUnits': json['discharge-units'] == null ? undefined : json['discharge-units'], 'tailwaterElevation': json['tailwater-elevation'] == null ? undefined : json['tailwater-elevation'], 'elevationUnits': json['elevation-units'] == null ? undefined : json['elevation-units'], 'settings': json['settings'] == null ? undefined : (json['settings'].map(GateSetting_1.GateSettingFromJSON)), }; } exports.GateChangeFromJSONTyped = GateChangeFromJSONTyped; function GateChangeToJSON(value) { if (value == null) { return value; } return { 'project-id': (0, CwmsId_1.CwmsIdToJSON)(value['projectId']), 'change-date': ((value['changeDate']).toISOString()), 'reference-elevation': value['referenceElevation'], 'pool-elevation': value['poolElevation'], 'protected': value['_protected'], 'discharge-computation-type': (0, LookupType_1.LookupTypeToJSON)(value['dischargeComputationType']), 'reason-type': (0, LookupType_1.LookupTypeToJSON)(value['reasonType']), 'notes': value['notes'], 'type': value['type'], 'new-total-discharge-override': value['newTotalDischargeOverride'], 'old-total-discharge-override': value['oldTotalDischargeOverride'], 'discharge-units': value['dischargeUnits'], 'tailwater-elevation': value['tailwaterElevation'], 'elevation-units': value['elevationUnits'], 'settings': value['settings'] == null ? undefined : (value['settings'].map(GateSetting_1.GateSettingToJSON)), }; } exports.GateChangeToJSON = GateChangeToJSON;