cwmsjs
Version:
CWMS Data API Library for JavaScript/TypeScript created with OpenAPI generator for use with browser webapps
60 lines (59 loc) • 2.61 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 { ExpressionRatingFromJSONTyped, ExpressionRatingToJSON, } from './ExpressionRating';
import { TableRatingFromJSONTyped, TableRatingToJSON, } from './TableRating';
import { TransitionalRatingFromJSONTyped, TransitionalRatingToJSON, } from './TransitionalRating';
import { UsgsStreamRatingFromJSONTyped, UsgsStreamRatingToJSON, } from './UsgsStreamRating';
import { VirtualRatingFromJSONTyped, VirtualRatingToJSON, } from './VirtualRating';
export function AbstractRatingMetadataFromJSON(json) {
return AbstractRatingMetadataFromJSONTyped(json, false);
}
export function AbstractRatingMetadataFromJSONTyped(json, ignoreDiscriminator) {
if (json == null) {
return json;
}
switch (json['rating-type']) {
case 'expression-rating':
return Object.assign(Object.assign({}, ExpressionRatingFromJSONTyped(json, true)), { ratingType: 'expression-rating' });
case 'table':
return Object.assign(Object.assign({}, TableRatingFromJSONTyped(json, true)), { ratingType: 'table' });
case 'transitional':
return Object.assign(Object.assign({}, TransitionalRatingFromJSONTyped(json, true)), { ratingType: 'transitional' });
case 'usgs':
return Object.assign(Object.assign({}, UsgsStreamRatingFromJSONTyped(json, true)), { ratingType: 'usgs' });
case 'virtual':
return Object.assign(Object.assign({}, VirtualRatingFromJSONTyped(json, true)), { ratingType: 'virtual' });
default:
throw new Error(`No variant of AbstractRatingMetadata exists with 'ratingType=${json['ratingType']}'`);
}
}
export function AbstractRatingMetadataToJSON(value) {
if (value == null) {
return value;
}
switch (value['ratingType']) {
case 'expression-rating':
return ExpressionRatingToJSON(value);
case 'table':
return TableRatingToJSON(value);
case 'transitional':
return TransitionalRatingToJSON(value);
case 'usgs':
return UsgsStreamRatingToJSON(value);
case 'virtual':
return VirtualRatingToJSON(value);
default:
throw new Error(`No variant of AbstractRatingMetadata exists with 'ratingType=${value['ratingType']}'`);
}
}