box-node-sdk
Version:
Official SDK for Box Platform APIs
32 lines • 1.21 kB
JavaScript
import { BoxSdkError } from '../../box/errors.js';
import { sdIsString } from '../../serialization/json.js';
import { sdIsMap } from '../../serialization/json.js';
export function serializeHubDocumentBlockV2025R0(val) {
return { ['id']: val.id, ['parent_id']: val.parentId };
}
export function deserializeHubDocumentBlockV2025R0(val) {
if (!sdIsMap(val)) {
throw new BoxSdkError({
message: 'Expecting a map for "HubDocumentBlockV2025R0"',
});
}
if (val.id == void 0) {
throw new BoxSdkError({
message: 'Expecting "id" of type "HubDocumentBlockV2025R0" to be defined',
});
}
if (!sdIsString(val.id)) {
throw new BoxSdkError({
message: 'Expecting string for "id" of type "HubDocumentBlockV2025R0"',
});
}
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 "HubDocumentBlockV2025R0"',
});
}
const parentId = val.parent_id == void 0 ? void 0 : val.parent_id;
return { id: id, parentId: parentId };
}
//# sourceMappingURL=hubDocumentBlockV2025R0.js.map