UNPKG

box-node-sdk

Version:

Official SDK for Box Platform APIs

61 lines 1.94 kB
import { BoxSdkError } from '../../box/errors.js'; import { sdIsString } from '../../serialization/json.js'; import { sdIsMap } from '../../serialization/json.js'; export function serializeQueryInsightsMetricDefinitionV2026R0TypeField(val) { return val; } export function deserializeQueryInsightsMetricDefinitionV2026R0TypeField(val) { if (val == 'sum') { return val; } if (val == 'avg') { return val; } if (val == 'min') { return val; } if (val == 'max') { return val; } if (val == 'count') { return val; } throw new BoxSdkError({ message: "Can't deserialize QueryInsightsMetricDefinitionV2026R0TypeField", }); } export function serializeQueryInsightsMetricDefinitionV2026R0(val) { return { ['type']: serializeQueryInsightsMetricDefinitionV2026R0TypeField(val.type), ['field']: val.field, }; } export function deserializeQueryInsightsMetricDefinitionV2026R0(val) { if (!sdIsMap(val)) { throw new BoxSdkError({ message: 'Expecting a map for "QueryInsightsMetricDefinitionV2026R0"', }); } if (val.type == void 0) { throw new BoxSdkError({ message: 'Expecting "type" of type "QueryInsightsMetricDefinitionV2026R0" to be defined', }); } const type = deserializeQueryInsightsMetricDefinitionV2026R0TypeField(val.type); if (val.field == void 0) { throw new BoxSdkError({ message: 'Expecting "field" of type "QueryInsightsMetricDefinitionV2026R0" to be defined', }); } if (!sdIsString(val.field)) { throw new BoxSdkError({ message: 'Expecting string for "field" of type "QueryInsightsMetricDefinitionV2026R0"', }); } const field = val.field; return { type: type, field: field, }; } //# sourceMappingURL=queryInsightsMetricDefinitionV2026R0.js.map