box-node-sdk
Version:
Official SDK for Box Platform APIs
57 lines • 2.23 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.serializeQueryInsightMetricResultV2026R0 = serializeQueryInsightMetricResultV2026R0;
exports.deserializeQueryInsightMetricResultV2026R0 = deserializeQueryInsightMetricResultV2026R0;
const errors_1 = require("../../box/errors.js");
const json_1 = require("../../serialization/json.js");
const json_2 = require("../../serialization/json.js");
const json_3 = require("../../serialization/json.js");
function serializeQueryInsightMetricResultV2026R0(val) {
return { ['type']: val.type, ['values']: val.values };
}
function deserializeQueryInsightMetricResultV2026R0(val) {
if (!(0, json_3.sdIsMap)(val)) {
throw new errors_1.BoxSdkError({
message: 'Expecting a map for "QueryInsightMetricResultV2026R0"',
});
}
if (val.type == void 0) {
throw new errors_1.BoxSdkError({
message: 'Expecting "type" of type "QueryInsightMetricResultV2026R0" to be defined',
});
}
if (!(0, json_2.sdIsString)(val.type)) {
throw new errors_1.BoxSdkError({
message: 'Expecting string for "type" of type "QueryInsightMetricResultV2026R0"',
});
}
const type = val.type;
if (val.values == void 0) {
throw new errors_1.BoxSdkError({
message: 'Expecting "values" of type "QueryInsightMetricResultV2026R0" to be defined',
});
}
if (!(0, json_3.sdIsMap)(val.values)) {
throw new errors_1.BoxSdkError({
message: 'Expecting object for "values" of type "QueryInsightMetricResultV2026R0"',
});
}
const values = (0, json_3.sdIsMap)(val.values)
? Object.fromEntries(Object.entries(val.values).map(([k, v]) => [
k,
(function (v) {
if (!(0, json_1.sdIsNumber)(v)) {
throw new errors_1.BoxSdkError({
message: 'Expecting number for "QueryInsightMetricResultV2026R0"',
});
}
return v;
})(v),
]))
: {};
return {
type: type,
values: values,
};
}
//# sourceMappingURL=queryInsightMetricResultV2026R0.js.map