box-node-sdk
Version:
Official SDK for Box Platform APIs
49 lines • 1.91 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.serializeUserOrGroupReferenceV2025R0TypeField = serializeUserOrGroupReferenceV2025R0TypeField;
exports.deserializeUserOrGroupReferenceV2025R0TypeField = deserializeUserOrGroupReferenceV2025R0TypeField;
exports.serializeUserOrGroupReferenceV2025R0 = serializeUserOrGroupReferenceV2025R0;
exports.deserializeUserOrGroupReferenceV2025R0 = deserializeUserOrGroupReferenceV2025R0;
const errors_1 = require("../../box/errors");
const json_1 = require("../../serialization/json");
const json_2 = require("../../serialization/json");
function serializeUserOrGroupReferenceV2025R0TypeField(val) {
return val;
}
function deserializeUserOrGroupReferenceV2025R0TypeField(val) {
if (val == 'user') {
return val;
}
if (val == 'group') {
return val;
}
throw new errors_1.BoxSdkError({
message: "Can't deserialize UserOrGroupReferenceV2025R0TypeField",
});
}
function serializeUserOrGroupReferenceV2025R0(val) {
return {
['type']: val.type == void 0
? val.type
: serializeUserOrGroupReferenceV2025R0TypeField(val.type),
['id']: val.id,
};
}
function deserializeUserOrGroupReferenceV2025R0(val) {
if (!(0, json_2.sdIsMap)(val)) {
throw new errors_1.BoxSdkError({
message: 'Expecting a map for "UserOrGroupReferenceV2025R0"',
});
}
const type = val.type == void 0
? void 0
: deserializeUserOrGroupReferenceV2025R0TypeField(val.type);
if (!(val.id == void 0) && !(0, json_1.sdIsString)(val.id)) {
throw new errors_1.BoxSdkError({
message: 'Expecting string for "id" of type "UserOrGroupReferenceV2025R0"',
});
}
const id = val.id == void 0 ? void 0 : val.id;
return { type: type, id: id };
}
//# sourceMappingURL=userOrGroupReferenceV2025R0.js.map