UNPKG

box-node-sdk

Version:

Official SDK for Box Platform APIs

164 lines 5.75 kB
import { serializeHubDocumentPageV2025R0 } from './hubDocumentPageV2025R0.js'; import { deserializeHubDocumentPageV2025R0 } from './hubDocumentPageV2025R0.js'; import { BoxSdkError } from '../../box/errors.js'; import { sdIsNumber } from '../../serialization/json.js'; import { sdIsString } from '../../serialization/json.js'; import { sdIsList } from '../../serialization/json.js'; import { sdIsMap } from '../../serialization/json.js'; export class HubDocumentPagesV2025R0 { /** * Ordered list of pages. */ entries; /** * The value will always be `document_pages`. */ type = 'document_pages'; /** * The limit that was used for these entries. This will be the same as the * `limit` query parameter unless that value exceeded the maximum value * allowed. The maximum value varies by API. */ limit; /** * The marker for the start of the next page of results. */ nextMarker; rawData; constructor(fields) { 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; } } } export function serializeHubDocumentPagesV2025R0TypeField(val) { return val; } export function deserializeHubDocumentPagesV2025R0TypeField(val) { if (val == 'document_pages') { return val; } throw new BoxSdkError({ message: "Can't deserialize HubDocumentPagesV2025R0TypeField", }); } export function serializeHubDocumentPagesV2025R0(val) { return { ['entries']: val.entries.map(function (item) { return serializeHubDocumentPageV2025R0(item); }), ['type']: serializeHubDocumentPagesV2025R0TypeField(val.type), ['limit']: val.limit, ['next_marker']: val.nextMarker, }; } export function deserializeHubDocumentPagesV2025R0(val) { if (!sdIsMap(val)) { throw new BoxSdkError({ message: 'Expecting a map for "HubDocumentPagesV2025R0"', }); } if (val.entries == void 0) { throw new BoxSdkError({ message: 'Expecting "entries" of type "HubDocumentPagesV2025R0" to be defined', }); } if (!sdIsList(val.entries)) { throw new BoxSdkError({ message: 'Expecting array for "entries" of type "HubDocumentPagesV2025R0"', }); } const entries = sdIsList(val.entries) ? val.entries.map(function (itm) { return deserializeHubDocumentPageV2025R0(itm); }) : []; if (val.type == void 0) { throw new BoxSdkError({ message: 'Expecting "type" of type "HubDocumentPagesV2025R0" to be defined', }); } const type = deserializeHubDocumentPagesV2025R0TypeField(val.type); if (!(val.limit == void 0) && !sdIsNumber(val.limit)) { throw new 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) && !sdIsString(val.next_marker)) { throw new 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, }; } export function serializeHubDocumentPagesV2025R0Input(val) { return { ['entries']: val.entries.map(function (item) { return serializeHubDocumentPageV2025R0(item); }), ['type']: val.type == void 0 ? val.type : serializeHubDocumentPagesV2025R0TypeField(val.type), ['limit']: val.limit, ['next_marker']: val.nextMarker, }; } export function deserializeHubDocumentPagesV2025R0Input(val) { if (!sdIsMap(val)) { throw new BoxSdkError({ message: 'Expecting a map for "HubDocumentPagesV2025R0Input"', }); } if (val.entries == void 0) { throw new BoxSdkError({ message: 'Expecting "entries" of type "HubDocumentPagesV2025R0Input" to be defined', }); } if (!sdIsList(val.entries)) { throw new BoxSdkError({ message: 'Expecting array for "entries" of type "HubDocumentPagesV2025R0Input"', }); } const entries = sdIsList(val.entries) ? val.entries.map(function (itm) { return deserializeHubDocumentPageV2025R0(itm); }) : []; const type = val.type == void 0 ? void 0 : deserializeHubDocumentPagesV2025R0TypeField(val.type); if (!(val.limit == void 0) && !sdIsNumber(val.limit)) { throw new 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) && !sdIsString(val.next_marker)) { throw new 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