UNPKG

cwmsjs

Version:

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

75 lines (74 loc) 3.63 kB
"use strict"; /* tslint:disable */ /* eslint-disable */ /** * CWMS Data API * CWMS REST API for Data Retrieval * * The version of the OpenAPI document: 2.4.0-2026.3.16 * * * 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 }); const runtime_1 = require("../runtime"); const CwmsId_1 = require("./CwmsId"); const GateSetting_1 = require("./GateSetting"); const LookupType_1 = require("./LookupType"); function GateChangeFromJSON(json) { return GateChangeFromJSONTyped(json, false); } exports.GateChangeFromJSON = GateChangeFromJSON; function GateChangeFromJSONTyped(json, ignoreDiscriminator) { if ((json === undefined) || (json === null)) { return json; } if (!ignoreDiscriminator) { } return { 'projectId': CwmsId_1.CwmsIdFromJSON(json['project-id']), 'changeDate': (new Date(json['change-date'])), 'referenceElevation': !runtime_1.exists(json, 'reference-elevation') ? undefined : json['reference-elevation'], 'poolElevation': !runtime_1.exists(json, 'pool-elevation') ? undefined : json['pool-elevation'], '_protected': !runtime_1.exists(json, 'protected') ? undefined : json['protected'], 'dischargeComputationType': LookupType_1.LookupTypeFromJSON(json['discharge-computation-type']), 'reasonType': LookupType_1.LookupTypeFromJSON(json['reason-type']), 'notes': !runtime_1.exists(json, 'notes') ? undefined : json['notes'], 'type': !runtime_1.exists(json, 'type') ? undefined : json['type'], 'newTotalDischargeOverride': !runtime_1.exists(json, 'new-total-discharge-override') ? undefined : json['new-total-discharge-override'], 'oldTotalDischargeOverride': !runtime_1.exists(json, 'old-total-discharge-override') ? undefined : json['old-total-discharge-override'], 'dischargeUnits': !runtime_1.exists(json, 'discharge-units') ? undefined : json['discharge-units'], 'tailwaterElevation': !runtime_1.exists(json, 'tailwater-elevation') ? undefined : json['tailwater-elevation'], 'elevationUnits': !runtime_1.exists(json, 'elevation-units') ? undefined : json['elevation-units'], 'settings': !runtime_1.exists(json, 'settings') ? undefined : (json['settings'].map(GateSetting_1.GateSettingFromJSON)), }; } exports.GateChangeFromJSONTyped = GateChangeFromJSONTyped; function GateChangeToJSON(value) { if (value === undefined) { return undefined; } if (value === null) { return null; } return { 'project-id': CwmsId_1.CwmsIdToJSON(value.projectId), 'change-date': (value.changeDate.toISOString()), 'reference-elevation': value.referenceElevation, 'pool-elevation': value.poolElevation, 'protected': value._protected, 'discharge-computation-type': LookupType_1.LookupTypeToJSON(value.dischargeComputationType), 'reason-type': 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 === undefined ? undefined : (value.settings.map(GateSetting_1.GateSettingToJSON)), }; } exports.GateChangeToJSON = GateChangeToJSON;