box-node-sdk
Version:
Official SDK for Box Platform APIs
76 lines • 3.56 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.serializeCommentFull = serializeCommentFull;
exports.deserializeCommentFull = deserializeCommentFull;
const commentBase_1 = require("./commentBase");
const userMini_1 = require("./userMini");
const utils_1 = require("../internal/utils");
const comment_1 = require("./comment");
const comment_2 = require("./comment");
const errors_1 = require("../box/errors");
const json_1 = require("../serialization/json");
const json_2 = require("../serialization/json");
const json_3 = require("../serialization/json");
function serializeCommentFull(val) {
const base = (0, comment_2.serializeComment)(val);
if (!(0, json_3.sdIsMap)(base)) {
throw new errors_1.BoxSdkError({ message: 'Expecting a map for "CommentFull"' });
}
return Object.assign(Object.assign({}, base), { ['tagged_message']: val.taggedMessage });
}
function deserializeCommentFull(val) {
if (!(0, json_3.sdIsMap)(val)) {
throw new errors_1.BoxSdkError({ message: 'Expecting a map for "CommentFull"' });
}
if (!(val.tagged_message == void 0) && !(0, json_2.sdIsString)(val.tagged_message)) {
throw new errors_1.BoxSdkError({
message: 'Expecting string for "tagged_message" of type "CommentFull"',
});
}
const taggedMessage = val.tagged_message == void 0 ? void 0 : val.tagged_message;
if (!(val.is_reply_comment == void 0) && !(0, json_1.sdIsBoolean)(val.is_reply_comment)) {
throw new errors_1.BoxSdkError({
message: 'Expecting boolean for "is_reply_comment" of type "CommentFull"',
});
}
const isReplyComment = val.is_reply_comment == void 0 ? void 0 : val.is_reply_comment;
if (!(val.message == void 0) && !(0, json_2.sdIsString)(val.message)) {
throw new errors_1.BoxSdkError({
message: 'Expecting string for "message" of type "CommentFull"',
});
}
const message = val.message == void 0 ? void 0 : val.message;
const createdBy = val.created_by == void 0 ? void 0 : (0, userMini_1.deserializeUserMini)(val.created_by);
if (!(val.created_at == void 0) && !(0, json_2.sdIsString)(val.created_at)) {
throw new errors_1.BoxSdkError({
message: 'Expecting string for "created_at" of type "CommentFull"',
});
}
const createdAt = val.created_at == void 0 ? void 0 : (0, utils_1.deserializeDateTime)(val.created_at);
if (!(val.modified_at == void 0) && !(0, json_2.sdIsString)(val.modified_at)) {
throw new errors_1.BoxSdkError({
message: 'Expecting string for "modified_at" of type "CommentFull"',
});
}
const modifiedAt = val.modified_at == void 0 ? void 0 : (0, utils_1.deserializeDateTime)(val.modified_at);
const item = val.item == void 0 ? void 0 : (0, comment_1.deserializeCommentItemField)(val.item);
if (!(val.id == void 0) && !(0, json_2.sdIsString)(val.id)) {
throw new errors_1.BoxSdkError({
message: 'Expecting string for "id" of type "CommentFull"',
});
}
const id = val.id == void 0 ? void 0 : val.id;
const type = val.type == void 0 ? void 0 : (0, commentBase_1.deserializeCommentBaseTypeField)(val.type);
return {
taggedMessage: taggedMessage,
isReplyComment: isReplyComment,
message: message,
createdBy: createdBy,
createdAt: createdAt,
modifiedAt: modifiedAt,
item: item,
id: id,
type: type,
};
}
//# sourceMappingURL=commentFull.js.map