UNPKG

box-node-sdk

Version:

Official SDK for Box Platform APIs

51 lines 1.7 kB
import { BoxSdkError } from '../box/errors.js'; import { sdIsNumber } from '../serialization/json.js'; import { sdIsString } from '../serialization/json.js'; import { sdIsMap } from '../serialization/json.js'; export function serializeUploadPartPlan(val) { return { ['offset']: val.offset, ['size']: val.size, ['sha512']: val.sha512 }; } export function deserializeUploadPartPlan(val) { if (!sdIsMap(val)) { throw new BoxSdkError({ message: 'Expecting a map for "UploadPartPlan"' }); } if (val.offset == void 0) { throw new BoxSdkError({ message: 'Expecting "offset" of type "UploadPartPlan" to be defined', }); } if (!sdIsNumber(val.offset)) { throw new BoxSdkError({ message: 'Expecting number for "offset" of type "UploadPartPlan"', }); } const offset = val.offset; if (val.size == void 0) { throw new BoxSdkError({ message: 'Expecting "size" of type "UploadPartPlan" to be defined', }); } if (!sdIsNumber(val.size)) { throw new BoxSdkError({ message: 'Expecting number for "size" of type "UploadPartPlan"', }); } const size = val.size; if (val.sha512 == void 0) { throw new BoxSdkError({ message: 'Expecting "sha512" of type "UploadPartPlan" to be defined', }); } if (!sdIsString(val.sha512)) { throw new BoxSdkError({ message: 'Expecting string for "sha512" of type "UploadPartPlan"', }); } const sha512 = val.sha512; return { offset: offset, size: size, sha512: sha512, }; } //# sourceMappingURL=uploadPartPlan.js.map