box-node-sdk
Version:
Official SDK for Box Platform APIs
161 lines • 6.53 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.NotesConvertRequestBodyV2026R0 = void 0;
exports.serializeNotesConvertRequestBodyV2026R0ContentFormatField = serializeNotesConvertRequestBodyV2026R0ContentFormatField;
exports.deserializeNotesConvertRequestBodyV2026R0ContentFormatField = deserializeNotesConvertRequestBodyV2026R0ContentFormatField;
exports.serializeNotesConvertRequestBodyV2026R0 = serializeNotesConvertRequestBodyV2026R0;
exports.deserializeNotesConvertRequestBodyV2026R0 = deserializeNotesConvertRequestBodyV2026R0;
exports.serializeNotesConvertRequestBodyV2026R0Input = serializeNotesConvertRequestBodyV2026R0Input;
exports.deserializeNotesConvertRequestBodyV2026R0Input = deserializeNotesConvertRequestBodyV2026R0Input;
const folderReferenceV2026R0_1 = require("./folderReferenceV2026R0.js");
const folderReferenceV2026R0_2 = require("./folderReferenceV2026R0.js");
const errors_1 = require("../../box/errors.js");
const json_1 = require("../../serialization/json.js");
const json_2 = require("../../serialization/json.js");
class NotesConvertRequestBodyV2026R0 {
constructor(fields) {
/**
* Format of the content to convert. */
this.contentFormat = 'markdown';
if (fields.content !== undefined) {
this.content = fields.content;
}
if (fields.contentFormat !== undefined) {
this.contentFormat = fields.contentFormat;
}
if (fields.parent !== undefined) {
this.parent = fields.parent;
}
if (fields.name !== undefined) {
this.name = fields.name;
}
if (fields.rawData !== undefined) {
this.rawData = fields.rawData;
}
}
}
exports.NotesConvertRequestBodyV2026R0 = NotesConvertRequestBodyV2026R0;
function serializeNotesConvertRequestBodyV2026R0ContentFormatField(val) {
return val;
}
function deserializeNotesConvertRequestBodyV2026R0ContentFormatField(val) {
if (val == 'markdown') {
return val;
}
if ((0, json_1.sdIsString)(val)) {
return val;
}
throw new errors_1.BoxSdkError({
message: "Can't deserialize NotesConvertRequestBodyV2026R0ContentFormatField",
});
}
function serializeNotesConvertRequestBodyV2026R0(val) {
return {
['content']: val.content,
['content_format']: serializeNotesConvertRequestBodyV2026R0ContentFormatField(val.contentFormat),
['parent']: (0, folderReferenceV2026R0_1.serializeFolderReferenceV2026R0)(val.parent),
['name']: val.name,
};
}
function deserializeNotesConvertRequestBodyV2026R0(val) {
if (!(0, json_2.sdIsMap)(val)) {
throw new errors_1.BoxSdkError({
message: 'Expecting a map for "NotesConvertRequestBodyV2026R0"',
});
}
if (val.content == void 0) {
throw new errors_1.BoxSdkError({
message: 'Expecting "content" of type "NotesConvertRequestBodyV2026R0" to be defined',
});
}
if (!(0, json_1.sdIsString)(val.content)) {
throw new errors_1.BoxSdkError({
message: 'Expecting string for "content" of type "NotesConvertRequestBodyV2026R0"',
});
}
const content = val.content;
if (val.content_format == void 0) {
throw new errors_1.BoxSdkError({
message: 'Expecting "content_format" of type "NotesConvertRequestBodyV2026R0" to be defined',
});
}
const contentFormat = deserializeNotesConvertRequestBodyV2026R0ContentFormatField(val.content_format);
if (val.parent == void 0) {
throw new errors_1.BoxSdkError({
message: 'Expecting "parent" of type "NotesConvertRequestBodyV2026R0" to be defined',
});
}
const parent = (0, folderReferenceV2026R0_2.deserializeFolderReferenceV2026R0)(val.parent);
if (val.name == void 0) {
throw new errors_1.BoxSdkError({
message: 'Expecting "name" of type "NotesConvertRequestBodyV2026R0" to be defined',
});
}
if (!(0, json_1.sdIsString)(val.name)) {
throw new errors_1.BoxSdkError({
message: 'Expecting string for "name" of type "NotesConvertRequestBodyV2026R0"',
});
}
const name = val.name;
return {
content: content,
contentFormat: contentFormat,
parent: parent,
name: name,
};
}
function serializeNotesConvertRequestBodyV2026R0Input(val) {
return {
['content']: val.content,
['contentFormat']: val.contentFormat == void 0
? val.contentFormat
: serializeNotesConvertRequestBodyV2026R0ContentFormatField(val.contentFormat),
['parent']: (0, folderReferenceV2026R0_1.serializeFolderReferenceV2026R0)(val.parent),
['name']: val.name,
};
}
function deserializeNotesConvertRequestBodyV2026R0Input(val) {
if (!(0, json_2.sdIsMap)(val)) {
throw new errors_1.BoxSdkError({
message: 'Expecting a map for "NotesConvertRequestBodyV2026R0Input"',
});
}
if (val.content == void 0) {
throw new errors_1.BoxSdkError({
message: 'Expecting "content" of type "NotesConvertRequestBodyV2026R0Input" to be defined',
});
}
if (!(0, json_1.sdIsString)(val.content)) {
throw new errors_1.BoxSdkError({
message: 'Expecting string for "content" of type "NotesConvertRequestBodyV2026R0Input"',
});
}
const content = val.content;
const contentFormat = val.contentFormat == void 0
? void 0
: deserializeNotesConvertRequestBodyV2026R0ContentFormatField(val.contentFormat);
if (val.parent == void 0) {
throw new errors_1.BoxSdkError({
message: 'Expecting "parent" of type "NotesConvertRequestBodyV2026R0Input" to be defined',
});
}
const parent = (0, folderReferenceV2026R0_2.deserializeFolderReferenceV2026R0)(val.parent);
if (val.name == void 0) {
throw new errors_1.BoxSdkError({
message: 'Expecting "name" of type "NotesConvertRequestBodyV2026R0Input" to be defined',
});
}
if (!(0, json_1.sdIsString)(val.name)) {
throw new errors_1.BoxSdkError({
message: 'Expecting string for "name" of type "NotesConvertRequestBodyV2026R0Input"',
});
}
const name = val.name;
return {
content: content,
contentFormat: contentFormat,
parent: parent,
name: name,
};
}
//# sourceMappingURL=notesConvertRequestBodyV2026R0.js.map