box-node-sdk
Version:
Official SDK for Box Platform APIs
55 lines • 2.25 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.serializeHubItemOperationV2025R0ActionField = serializeHubItemOperationV2025R0ActionField;
exports.deserializeHubItemOperationV2025R0ActionField = deserializeHubItemOperationV2025R0ActionField;
exports.serializeHubItemOperationV2025R0 = serializeHubItemOperationV2025R0;
exports.deserializeHubItemOperationV2025R0 = deserializeHubItemOperationV2025R0;
const hubItemReferenceV2025R0_1 = require("./hubItemReferenceV2025R0");
const hubItemReferenceV2025R0_2 = require("./hubItemReferenceV2025R0");
const errors_1 = require("../../box/errors");
const json_1 = require("../../serialization/json");
const json_2 = require("../../serialization/json");
function serializeHubItemOperationV2025R0ActionField(val) {
return val;
}
function deserializeHubItemOperationV2025R0ActionField(val) {
if (val == 'add') {
return val;
}
if (val == 'remove') {
return val;
}
if ((0, json_1.sdIsString)(val)) {
return val;
}
throw new errors_1.BoxSdkError({
message: "Can't deserialize HubItemOperationV2025R0ActionField",
});
}
function serializeHubItemOperationV2025R0(val) {
return {
['action']: serializeHubItemOperationV2025R0ActionField(val.action),
['item']: (0, hubItemReferenceV2025R0_1.serializeHubItemReferenceV2025R0)(val.item),
};
}
function deserializeHubItemOperationV2025R0(val) {
if (!(0, json_2.sdIsMap)(val)) {
throw new errors_1.BoxSdkError({
message: 'Expecting a map for "HubItemOperationV2025R0"',
});
}
if (val.action == void 0) {
throw new errors_1.BoxSdkError({
message: 'Expecting "action" of type "HubItemOperationV2025R0" to be defined',
});
}
const action = deserializeHubItemOperationV2025R0ActionField(val.action);
if (val.item == void 0) {
throw new errors_1.BoxSdkError({
message: 'Expecting "item" of type "HubItemOperationV2025R0" to be defined',
});
}
const item = (0, hubItemReferenceV2025R0_2.deserializeHubItemReferenceV2025R0)(val.item);
return { action: action, item: item };
}
//# sourceMappingURL=hubItemOperationV2025R0.js.map