box-node-sdk
Version:
Official SDK for Box Platform APIs
52 lines • 2.1 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.serializeAiOptionsRules = serializeAiOptionsRules;
exports.deserializeAiOptionsRules = deserializeAiOptionsRules;
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");
const json_4 = require("../serialization/json.js");
function serializeAiOptionsRules(val) {
return {
['multi_select']: val.multiSelect,
['selectable_levels']: val.selectableLevels == void 0
? val.selectableLevels
: val.selectableLevels.map(function (item) {
return item;
}),
};
}
function deserializeAiOptionsRules(val) {
if (!(0, json_4.sdIsMap)(val)) {
throw new errors_1.BoxSdkError({ message: 'Expecting a map for "AiOptionsRules"' });
}
if (!(val.multi_select == void 0) && !(0, json_1.sdIsBoolean)(val.multi_select)) {
throw new errors_1.BoxSdkError({
message: 'Expecting boolean for "multi_select" of type "AiOptionsRules"',
});
}
const multiSelect = val.multi_select == void 0 ? void 0 : val.multi_select;
if (!(val.selectable_levels == void 0) && !(0, json_3.sdIsList)(val.selectable_levels)) {
throw new errors_1.BoxSdkError({
message: 'Expecting array for "selectable_levels" of type "AiOptionsRules"',
});
}
const selectableLevels = val.selectable_levels == void 0
? void 0
: (0, json_3.sdIsList)(val.selectable_levels)
? val.selectable_levels.map(function (itm) {
if (!(0, json_2.sdIsNumber)(itm)) {
throw new errors_1.BoxSdkError({
message: 'Expecting number for "AiOptionsRules"',
});
}
return itm;
})
: [];
return {
multiSelect: multiSelect,
selectableLevels: selectableLevels,
};
}
//# sourceMappingURL=aiOptionsRules.js.map