UNPKG

box-node-sdk

Version:

Official SDK for Box Platform APIs

85 lines 2.7 kB
import { serializeHubDocumentBlockV2025R0 } from './hubDocumentBlockV2025R0.js'; import { BoxSdkError } from '../../box/errors.js'; import { sdIsString } from '../../serialization/json.js'; import { sdIsMap } from '../../serialization/json.js'; export class HubDividerBlockV2025R0 { id; parentId; rawData; /** * The type of this block. The value is always `divider`. */ type = 'divider'; constructor(fields) { if (fields.id !== undefined) { this.id = fields.id; } if (fields.parentId !== undefined) { this.parentId = fields.parentId; } if (fields.rawData !== undefined) { this.rawData = fields.rawData; } if (fields.type !== undefined) { this.type = fields.type; } } } export function serializeHubDividerBlockV2025R0TypeField(val) { return val; } export function deserializeHubDividerBlockV2025R0TypeField(val) { if (val == 'divider') { return val; } throw new BoxSdkError({ message: "Can't deserialize HubDividerBlockV2025R0TypeField", }); } export function serializeHubDividerBlockV2025R0(val) { const base = serializeHubDocumentBlockV2025R0(val); if (!sdIsMap(base)) { throw new BoxSdkError({ message: 'Expecting a map for "HubDividerBlockV2025R0"', }); } return { ...base, ...{ ['type']: serializeHubDividerBlockV2025R0TypeField(val.type) }, }; } export function deserializeHubDividerBlockV2025R0(val) { if (!sdIsMap(val)) { throw new BoxSdkError({ message: 'Expecting a map for "HubDividerBlockV2025R0"', }); } if (val.type == void 0) { throw new BoxSdkError({ message: 'Expecting "type" of type "HubDividerBlockV2025R0" to be defined', }); } const type = deserializeHubDividerBlockV2025R0TypeField(val.type); if (val.id == void 0) { throw new BoxSdkError({ message: 'Expecting "id" of type "HubDividerBlockV2025R0" to be defined', }); } if (!sdIsString(val.id)) { throw new BoxSdkError({ message: 'Expecting string for "id" of type "HubDividerBlockV2025R0"', }); } const id = val.id; if (!(val.parent_id == void 0) && !sdIsString(val.parent_id)) { throw new BoxSdkError({ message: 'Expecting string for "parent_id" of type "HubDividerBlockV2025R0"', }); } const parentId = val.parent_id == void 0 ? void 0 : val.parent_id; return { type: type, id: id, parentId: parentId, }; } //# sourceMappingURL=hubDividerBlockV2025R0.js.map