box-node-sdk
Version:
Official SDK for Box Platform APIs
54 lines • 2.25 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.serializeDevicePinnerTypeField = serializeDevicePinnerTypeField;
exports.deserializeDevicePinnerTypeField = deserializeDevicePinnerTypeField;
exports.serializeDevicePinner = serializeDevicePinner;
exports.deserializeDevicePinner = deserializeDevicePinner;
const userMini_1 = require("./userMini");
const userMini_2 = require("./userMini");
const errors_1 = require("../box/errors");
const json_1 = require("../serialization/json");
const json_2 = require("../serialization/json");
function serializeDevicePinnerTypeField(val) {
return val;
}
function deserializeDevicePinnerTypeField(val) {
if (val == 'device_pinner') {
return val;
}
throw new errors_1.BoxSdkError({ message: "Can't deserialize DevicePinnerTypeField" });
}
function serializeDevicePinner(val) {
return {
['id']: val.id,
['type']: val.type == void 0 ? val.type : serializeDevicePinnerTypeField(val.type),
['owned_by']: val.ownedBy == void 0 ? val.ownedBy : (0, userMini_1.serializeUserMini)(val.ownedBy),
['product_name']: val.productName,
};
}
function deserializeDevicePinner(val) {
if (!(0, json_2.sdIsMap)(val)) {
throw new errors_1.BoxSdkError({ message: 'Expecting a map for "DevicePinner"' });
}
if (!(val.id == void 0) && !(0, json_1.sdIsString)(val.id)) {
throw new errors_1.BoxSdkError({
message: 'Expecting string for "id" of type "DevicePinner"',
});
}
const id = val.id == void 0 ? void 0 : val.id;
const type = val.type == void 0 ? void 0 : deserializeDevicePinnerTypeField(val.type);
const ownedBy = val.owned_by == void 0 ? void 0 : (0, userMini_2.deserializeUserMini)(val.owned_by);
if (!(val.product_name == void 0) && !(0, json_1.sdIsString)(val.product_name)) {
throw new errors_1.BoxSdkError({
message: 'Expecting string for "product_name" of type "DevicePinner"',
});
}
const productName = val.product_name == void 0 ? void 0 : val.product_name;
return {
id: id,
type: type,
ownedBy: ownedBy,
productName: productName,
};
}
//# sourceMappingURL=devicePinner.js.map