box-node-sdk
Version:
Official SDK for Box Platform APIs
48 lines • 1.83 kB
JavaScript
import { BoxSdkError } from '../box/errors.js';
import { sdIsBoolean } from '../serialization/json.js';
import { sdIsNumber } from '../serialization/json.js';
import { sdIsList } from '../serialization/json.js';
import { sdIsMap } from '../serialization/json.js';
export function serializeAiOptionsRules(val) {
return {
['multi_select']: val.multiSelect,
['selectable_levels']: val.selectableLevels == void 0
? val.selectableLevels
: val.selectableLevels.map(function (item) {
return item;
}),
};
}
export function deserializeAiOptionsRules(val) {
if (!sdIsMap(val)) {
throw new BoxSdkError({ message: 'Expecting a map for "AiOptionsRules"' });
}
if (!(val.multi_select == void 0) && !sdIsBoolean(val.multi_select)) {
throw new 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) && !sdIsList(val.selectable_levels)) {
throw new BoxSdkError({
message: 'Expecting array for "selectable_levels" of type "AiOptionsRules"',
});
}
const selectableLevels = val.selectable_levels == void 0
? void 0
: sdIsList(val.selectable_levels)
? val.selectable_levels.map(function (itm) {
if (!sdIsNumber(itm)) {
throw new BoxSdkError({
message: 'Expecting number for "AiOptionsRules"',
});
}
return itm;
})
: [];
return {
multiSelect: multiSelect,
selectableLevels: selectableLevels,
};
}
//# sourceMappingURL=aiOptionsRules.js.map