UNPKG

box-node-sdk

Version:

Official SDK for Box Platform APIs

45 lines 1.85 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.serializeTrackingCodeTypeField = serializeTrackingCodeTypeField; exports.deserializeTrackingCodeTypeField = deserializeTrackingCodeTypeField; exports.serializeTrackingCode = serializeTrackingCode; exports.deserializeTrackingCode = deserializeTrackingCode; const errors_1 = require("../box/errors"); const json_1 = require("../serialization/json"); const json_2 = require("../serialization/json"); function serializeTrackingCodeTypeField(val) { return val; } function deserializeTrackingCodeTypeField(val) { if (val == 'tracking_code') { return val; } throw new errors_1.BoxSdkError({ message: "Can't deserialize TrackingCodeTypeField" }); } function serializeTrackingCode(val) { return { ['type']: val.type == void 0 ? val.type : serializeTrackingCodeTypeField(val.type), ['name']: val.name, ['value']: val.value, }; } function deserializeTrackingCode(val) { if (!(0, json_2.sdIsMap)(val)) { throw new errors_1.BoxSdkError({ message: 'Expecting a map for "TrackingCode"' }); } const type = val.type == void 0 ? void 0 : deserializeTrackingCodeTypeField(val.type); if (!(val.name == void 0) && !(0, json_1.sdIsString)(val.name)) { throw new errors_1.BoxSdkError({ message: 'Expecting string for "name" of type "TrackingCode"', }); } const name = val.name == void 0 ? void 0 : val.name; if (!(val.value == void 0) && !(0, json_1.sdIsString)(val.value)) { throw new errors_1.BoxSdkError({ message: 'Expecting string for "value" of type "TrackingCode"', }); } const value = val.value == void 0 ? void 0 : val.value; return { type: type, name: name, value: value }; } //# sourceMappingURL=trackingCode.js.map