box-node-sdk
Version:
Official SDK for Box Platform APIs
56 lines • 1.83 kB
JavaScript
import { BoxSdkError } from '../../box/errors.js';
import { sdIsString } from '../../serialization/json.js';
import { sdIsMap } from '../../serialization/json.js';
export function serializeQueryResultEntryV2026R0(val) {
return { ...{ ['id']: val.id, ['type']: val.type }, ...val.extraData };
}
export function deserializeQueryResultEntryV2026R0(val) {
if (!sdIsMap(val)) {
throw new BoxSdkError({
message: 'Expecting a map for "QueryResultEntryV2026R0"',
});
}
if (val.id == void 0) {
throw new BoxSdkError({
message: 'Expecting "id" of type "QueryResultEntryV2026R0" to be defined',
});
}
if (!sdIsString(val.id)) {
throw new BoxSdkError({
message: 'Expecting string for "id" of type "QueryResultEntryV2026R0"',
});
}
const id = val.id;
if (val.type == void 0) {
throw new BoxSdkError({
message: 'Expecting "type" of type "QueryResultEntryV2026R0" to be defined',
});
}
if (!sdIsString(val.type)) {
throw new BoxSdkError({
message: 'Expecting string for "type" of type "QueryResultEntryV2026R0"',
});
}
const type = val.type;
if (!(val == void 0) && !sdIsMap(val)) {
throw new BoxSdkError({
message: 'Expecting object for "extraData" of type "QueryResultEntryV2026R0"',
});
}
const extraData = val == void 0
? void 0
: sdIsMap(val)
? Object.fromEntries(Object.entries(val).map(([k, v]) => [
k,
(function (v) {
return v;
})(v),
]))
: {};
return {
id: id,
type: type,
extraData: extraData,
};
}
//# sourceMappingURL=queryResultEntryV2026R0.js.map