UNPKG

box-node-sdk

Version:

Official SDK for Box Platform APIs

55 lines 1.99 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.serializeUploadPartPlan = serializeUploadPartPlan; exports.deserializeUploadPartPlan = deserializeUploadPartPlan; const errors_1 = require("../box/errors.js"); const json_1 = require("../serialization/json.js"); const json_2 = require("../serialization/json.js"); const json_3 = require("../serialization/json.js"); function serializeUploadPartPlan(val) { return { ['offset']: val.offset, ['size']: val.size, ['sha512']: val.sha512 }; } function deserializeUploadPartPlan(val) { if (!(0, json_3.sdIsMap)(val)) { throw new errors_1.BoxSdkError({ message: 'Expecting a map for "UploadPartPlan"' }); } if (val.offset == void 0) { throw new errors_1.BoxSdkError({ message: 'Expecting "offset" of type "UploadPartPlan" to be defined', }); } if (!(0, json_1.sdIsNumber)(val.offset)) { throw new errors_1.BoxSdkError({ message: 'Expecting number for "offset" of type "UploadPartPlan"', }); } const offset = val.offset; if (val.size == void 0) { throw new errors_1.BoxSdkError({ message: 'Expecting "size" of type "UploadPartPlan" to be defined', }); } if (!(0, json_1.sdIsNumber)(val.size)) { throw new errors_1.BoxSdkError({ message: 'Expecting number for "size" of type "UploadPartPlan"', }); } const size = val.size; if (val.sha512 == void 0) { throw new errors_1.BoxSdkError({ message: 'Expecting "sha512" of type "UploadPartPlan" to be defined', }); } if (!(0, json_2.sdIsString)(val.sha512)) { throw new errors_1.BoxSdkError({ message: 'Expecting string for "sha512" of type "UploadPartPlan"', }); } const sha512 = val.sha512; return { offset: offset, size: size, sha512: sha512, }; } //# sourceMappingURL=uploadPartPlan.js.map