UNPKG

box-node-sdk

Version:

Official SDK for Box Platform APIs

70 lines 2.21 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 serializeUploadPartPlanHit(val) { return { ['offset']: val.offset, ['size']: val.size, ['sha512']: val.sha512, ['part_id']: val.partId, }; } export function deserializeUploadPartPlanHit(val) { if (!sdIsMap(val)) { throw new BoxSdkError({ message: 'Expecting a map for "UploadPartPlanHit"', }); } if (val.offset == void 0) { throw new BoxSdkError({ message: 'Expecting "offset" of type "UploadPartPlanHit" to be defined', }); } if (!sdIsNumber(val.offset)) { throw new BoxSdkError({ message: 'Expecting number for "offset" of type "UploadPartPlanHit"', }); } const offset = val.offset; if (val.size == void 0) { throw new BoxSdkError({ message: 'Expecting "size" of type "UploadPartPlanHit" to be defined', }); } if (!sdIsNumber(val.size)) { throw new BoxSdkError({ message: 'Expecting number for "size" of type "UploadPartPlanHit"', }); } const size = val.size; if (val.sha512 == void 0) { throw new BoxSdkError({ message: 'Expecting "sha512" of type "UploadPartPlanHit" to be defined', }); } if (!sdIsString(val.sha512)) { throw new BoxSdkError({ message: 'Expecting string for "sha512" of type "UploadPartPlanHit"', }); } const sha512 = val.sha512; if (val.part_id == void 0) { throw new BoxSdkError({ message: 'Expecting "part_id" of type "UploadPartPlanHit" to be defined', }); } if (!sdIsString(val.part_id)) { throw new BoxSdkError({ message: 'Expecting string for "part_id" of type "UploadPartPlanHit"', }); } const partId = val.part_id; return { offset: offset, size: size, sha512: sha512, partId: partId, }; } //# sourceMappingURL=uploadPartPlanHit.js.map