box-node-sdk
Version:
Official SDK for Box Platform APIs
74 lines • 2.54 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.serializeUploadPartPlanHit = serializeUploadPartPlanHit;
exports.deserializeUploadPartPlanHit = deserializeUploadPartPlanHit;
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 serializeUploadPartPlanHit(val) {
return {
['offset']: val.offset,
['size']: val.size,
['sha512']: val.sha512,
['part_id']: val.partId,
};
}
function deserializeUploadPartPlanHit(val) {
if (!(0, json_3.sdIsMap)(val)) {
throw new errors_1.BoxSdkError({
message: 'Expecting a map for "UploadPartPlanHit"',
});
}
if (val.offset == void 0) {
throw new errors_1.BoxSdkError({
message: 'Expecting "offset" of type "UploadPartPlanHit" to be defined',
});
}
if (!(0, json_1.sdIsNumber)(val.offset)) {
throw new errors_1.BoxSdkError({
message: 'Expecting number for "offset" of type "UploadPartPlanHit"',
});
}
const offset = val.offset;
if (val.size == void 0) {
throw new errors_1.BoxSdkError({
message: 'Expecting "size" of type "UploadPartPlanHit" to be defined',
});
}
if (!(0, json_1.sdIsNumber)(val.size)) {
throw new errors_1.BoxSdkError({
message: 'Expecting number for "size" of type "UploadPartPlanHit"',
});
}
const size = val.size;
if (val.sha512 == void 0) {
throw new errors_1.BoxSdkError({
message: 'Expecting "sha512" of type "UploadPartPlanHit" to be defined',
});
}
if (!(0, json_2.sdIsString)(val.sha512)) {
throw new errors_1.BoxSdkError({
message: 'Expecting string for "sha512" of type "UploadPartPlanHit"',
});
}
const sha512 = val.sha512;
if (val.part_id == void 0) {
throw new errors_1.BoxSdkError({
message: 'Expecting "part_id" of type "UploadPartPlanHit" to be defined',
});
}
if (!(0, json_2.sdIsString)(val.part_id)) {
throw new errors_1.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