box-node-sdk
Version:
Official SDK for Box Platform APIs
162 lines • 6.37 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.HubDocumentPagesV2025R0 = void 0;
exports.serializeHubDocumentPagesV2025R0TypeField = serializeHubDocumentPagesV2025R0TypeField;
exports.deserializeHubDocumentPagesV2025R0TypeField = deserializeHubDocumentPagesV2025R0TypeField;
exports.serializeHubDocumentPagesV2025R0 = serializeHubDocumentPagesV2025R0;
exports.deserializeHubDocumentPagesV2025R0 = deserializeHubDocumentPagesV2025R0;
exports.serializeHubDocumentPagesV2025R0Input = serializeHubDocumentPagesV2025R0Input;
exports.deserializeHubDocumentPagesV2025R0Input = deserializeHubDocumentPagesV2025R0Input;
const hubDocumentPageV2025R0_1 = require("./hubDocumentPageV2025R0.js");
const hubDocumentPageV2025R0_2 = require("./hubDocumentPageV2025R0.js");
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");
const json_4 = require("../../serialization/json.js");
class HubDocumentPagesV2025R0 {
constructor(fields) {
/**
* The value will always be `document_pages`. */
this.type = 'document_pages';
if (fields.entries !== undefined) {
this.entries = fields.entries;
}
if (fields.type !== undefined) {
this.type = fields.type;
}
if (fields.limit !== undefined) {
this.limit = fields.limit;
}
if (fields.nextMarker !== undefined) {
this.nextMarker = fields.nextMarker;
}
if (fields.rawData !== undefined) {
this.rawData = fields.rawData;
}
}
}
exports.HubDocumentPagesV2025R0 = HubDocumentPagesV2025R0;
function serializeHubDocumentPagesV2025R0TypeField(val) {
return val;
}
function deserializeHubDocumentPagesV2025R0TypeField(val) {
if (val == 'document_pages') {
return val;
}
throw new errors_1.BoxSdkError({
message: "Can't deserialize HubDocumentPagesV2025R0TypeField",
});
}
function serializeHubDocumentPagesV2025R0(val) {
return {
['entries']: val.entries.map(function (item) {
return (0, hubDocumentPageV2025R0_1.serializeHubDocumentPageV2025R0)(item);
}),
['type']: serializeHubDocumentPagesV2025R0TypeField(val.type),
['limit']: val.limit,
['next_marker']: val.nextMarker,
};
}
function deserializeHubDocumentPagesV2025R0(val) {
if (!(0, json_4.sdIsMap)(val)) {
throw new errors_1.BoxSdkError({
message: 'Expecting a map for "HubDocumentPagesV2025R0"',
});
}
if (val.entries == void 0) {
throw new errors_1.BoxSdkError({
message: 'Expecting "entries" of type "HubDocumentPagesV2025R0" to be defined',
});
}
if (!(0, json_3.sdIsList)(val.entries)) {
throw new errors_1.BoxSdkError({
message: 'Expecting array for "entries" of type "HubDocumentPagesV2025R0"',
});
}
const entries = (0, json_3.sdIsList)(val.entries)
? val.entries.map(function (itm) {
return (0, hubDocumentPageV2025R0_2.deserializeHubDocumentPageV2025R0)(itm);
})
: [];
if (val.type == void 0) {
throw new errors_1.BoxSdkError({
message: 'Expecting "type" of type "HubDocumentPagesV2025R0" to be defined',
});
}
const type = deserializeHubDocumentPagesV2025R0TypeField(val.type);
if (!(val.limit == void 0) && !(0, json_1.sdIsNumber)(val.limit)) {
throw new errors_1.BoxSdkError({
message: 'Expecting number for "limit" of type "HubDocumentPagesV2025R0"',
});
}
const limit = val.limit == void 0 ? void 0 : val.limit;
if (!(val.next_marker == void 0) && !(0, json_2.sdIsString)(val.next_marker)) {
throw new errors_1.BoxSdkError({
message: 'Expecting string for "next_marker" of type "HubDocumentPagesV2025R0"',
});
}
const nextMarker = val.next_marker == void 0 ? void 0 : val.next_marker;
return {
entries: entries,
type: type,
limit: limit,
nextMarker: nextMarker,
};
}
function serializeHubDocumentPagesV2025R0Input(val) {
return {
['entries']: val.entries.map(function (item) {
return (0, hubDocumentPageV2025R0_1.serializeHubDocumentPageV2025R0)(item);
}),
['type']: val.type == void 0
? val.type
: serializeHubDocumentPagesV2025R0TypeField(val.type),
['limit']: val.limit,
['next_marker']: val.nextMarker,
};
}
function deserializeHubDocumentPagesV2025R0Input(val) {
if (!(0, json_4.sdIsMap)(val)) {
throw new errors_1.BoxSdkError({
message: 'Expecting a map for "HubDocumentPagesV2025R0Input"',
});
}
if (val.entries == void 0) {
throw new errors_1.BoxSdkError({
message: 'Expecting "entries" of type "HubDocumentPagesV2025R0Input" to be defined',
});
}
if (!(0, json_3.sdIsList)(val.entries)) {
throw new errors_1.BoxSdkError({
message: 'Expecting array for "entries" of type "HubDocumentPagesV2025R0Input"',
});
}
const entries = (0, json_3.sdIsList)(val.entries)
? val.entries.map(function (itm) {
return (0, hubDocumentPageV2025R0_2.deserializeHubDocumentPageV2025R0)(itm);
})
: [];
const type = val.type == void 0
? void 0
: deserializeHubDocumentPagesV2025R0TypeField(val.type);
if (!(val.limit == void 0) && !(0, json_1.sdIsNumber)(val.limit)) {
throw new errors_1.BoxSdkError({
message: 'Expecting number for "limit" of type "HubDocumentPagesV2025R0Input"',
});
}
const limit = val.limit == void 0 ? void 0 : val.limit;
if (!(val.next_marker == void 0) && !(0, json_2.sdIsString)(val.next_marker)) {
throw new errors_1.BoxSdkError({
message: 'Expecting string for "next_marker" of type "HubDocumentPagesV2025R0Input"',
});
}
const nextMarker = val.next_marker == void 0 ? void 0 : val.next_marker;
return {
entries: entries,
type: type,
limit: limit,
nextMarker: nextMarker,
};
}
//# sourceMappingURL=hubDocumentPagesV2025R0.js.map