box-node-sdk
Version:
Official SDK for Box Platform APIs
64 lines • 2.17 kB
JavaScript
import { BoxSdkError } from '../../box/errors.js';
import { sdIsString } from '../../serialization/json.js';
import { sdIsMap } from '../../serialization/json.js';
export function serializeHubDocumentPageV2025R0(val) {
return {
['id']: val.id,
['type']: val.type,
['parent_id']: val.parentId,
['title_fragment']: val.titleFragment,
};
}
export function deserializeHubDocumentPageV2025R0(val) {
if (!sdIsMap(val)) {
throw new BoxSdkError({
message: 'Expecting a map for "HubDocumentPageV2025R0"',
});
}
if (val.id == void 0) {
throw new BoxSdkError({
message: 'Expecting "id" of type "HubDocumentPageV2025R0" to be defined',
});
}
if (!sdIsString(val.id)) {
throw new BoxSdkError({
message: 'Expecting string for "id" of type "HubDocumentPageV2025R0"',
});
}
const id = val.id;
if (val.type == void 0) {
throw new BoxSdkError({
message: 'Expecting "type" of type "HubDocumentPageV2025R0" to be defined',
});
}
if (!sdIsString(val.type)) {
throw new BoxSdkError({
message: 'Expecting string for "type" of type "HubDocumentPageV2025R0"',
});
}
const type = val.type;
if (!(val.parent_id == void 0) && !sdIsString(val.parent_id)) {
throw new BoxSdkError({
message: 'Expecting string for "parent_id" of type "HubDocumentPageV2025R0"',
});
}
const parentId = val.parent_id == void 0 ? void 0 : val.parent_id;
if (val.title_fragment == void 0) {
throw new BoxSdkError({
message: 'Expecting "title_fragment" of type "HubDocumentPageV2025R0" to be defined',
});
}
if (!sdIsString(val.title_fragment)) {
throw new BoxSdkError({
message: 'Expecting string for "title_fragment" of type "HubDocumentPageV2025R0"',
});
}
const titleFragment = val.title_fragment;
return {
id: id,
type: type,
parentId: parentId,
titleFragment: titleFragment,
};
}
//# sourceMappingURL=hubDocumentPageV2025R0.js.map