UNPKG

box-node-sdk

Version:

Official SDK for Box Platform APIs

53 lines 1.87 kB
import { BoxSdkError } from '../../box/errors.js'; import { sdIsNumber } from '../../serialization/json.js'; import { sdIsString } from '../../serialization/json.js'; import { sdIsMap } from '../../serialization/json.js'; export function serializeQueryInsightMetricResultV2026R0(val) { return { ['type']: val.type, ['values']: val.values }; } export function deserializeQueryInsightMetricResultV2026R0(val) { if (!sdIsMap(val)) { throw new BoxSdkError({ message: 'Expecting a map for "QueryInsightMetricResultV2026R0"', }); } if (val.type == void 0) { throw new BoxSdkError({ message: 'Expecting "type" of type "QueryInsightMetricResultV2026R0" to be defined', }); } if (!sdIsString(val.type)) { throw new BoxSdkError({ message: 'Expecting string for "type" of type "QueryInsightMetricResultV2026R0"', }); } const type = val.type; if (val.values == void 0) { throw new BoxSdkError({ message: 'Expecting "values" of type "QueryInsightMetricResultV2026R0" to be defined', }); } if (!sdIsMap(val.values)) { throw new BoxSdkError({ message: 'Expecting object for "values" of type "QueryInsightMetricResultV2026R0"', }); } const values = sdIsMap(val.values) ? Object.fromEntries(Object.entries(val.values).map(([k, v]) => [ k, (function (v) { if (!sdIsNumber(v)) { throw new BoxSdkError({ message: 'Expecting number for "QueryInsightMetricResultV2026R0"', }); } return v; })(v), ])) : {}; return { type: type, values: values, }; } //# sourceMappingURL=queryInsightMetricResultV2026R0.js.map