box-node-sdk
Version:
Official SDK for Box Platform APIs
34 lines • 1.51 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.serializeAiTaxonomySource = serializeAiTaxonomySource;
exports.deserializeAiTaxonomySource = deserializeAiTaxonomySource;
const aiTaxonomyReference_1 = require("./aiTaxonomyReference.js");
const aiTaxonomyReference_2 = require("./aiTaxonomyReference.js");
const aiTaxonomyFileReference_1 = require("./aiTaxonomyFileReference.js");
const aiTaxonomyFileReference_2 = require("./aiTaxonomyFileReference.js");
const errors_1 = require("../box/errors.js");
const json_1 = require("../serialization/json.js");
function serializeAiTaxonomySource(val) {
if (val.type == 'taxonomy') {
return (0, aiTaxonomyReference_1.serializeAiTaxonomyReference)(val);
}
if (val.type == 'file') {
return (0, aiTaxonomyFileReference_1.serializeAiTaxonomyFileReference)(val);
}
throw new errors_1.BoxSdkError({ message: 'unknown type' });
}
function deserializeAiTaxonomySource(val) {
if (!(0, json_1.sdIsMap)(val)) {
throw new errors_1.BoxSdkError({
message: 'Expecting a map for "AiTaxonomySource"',
});
}
if (val.type == 'taxonomy') {
return (0, aiTaxonomyReference_2.deserializeAiTaxonomyReference)(val);
}
if (val.type == 'file') {
return (0, aiTaxonomyFileReference_2.deserializeAiTaxonomyFileReference)(val);
}
throw new errors_1.BoxSdkError({ message: "Can't deserialize AiTaxonomySource" });
}
//# sourceMappingURL=aiTaxonomySource.js.map