box-node-sdk
Version:
Official SDK for Box Platform APIs
60 lines • 2.16 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.serializeQueryResultEntryV2026R0 = serializeQueryResultEntryV2026R0;
exports.deserializeQueryResultEntryV2026R0 = deserializeQueryResultEntryV2026R0;
const errors_1 = require("../../box/errors.js");
const json_1 = require("../../serialization/json.js");
const json_2 = require("../../serialization/json.js");
function serializeQueryResultEntryV2026R0(val) {
return Object.assign({ ['id']: val.id, ['type']: val.type }, val.extraData);
}
function deserializeQueryResultEntryV2026R0(val) {
if (!(0, json_2.sdIsMap)(val)) {
throw new errors_1.BoxSdkError({
message: 'Expecting a map for "QueryResultEntryV2026R0"',
});
}
if (val.id == void 0) {
throw new errors_1.BoxSdkError({
message: 'Expecting "id" of type "QueryResultEntryV2026R0" to be defined',
});
}
if (!(0, json_1.sdIsString)(val.id)) {
throw new errors_1.BoxSdkError({
message: 'Expecting string for "id" of type "QueryResultEntryV2026R0"',
});
}
const id = val.id;
if (val.type == void 0) {
throw new errors_1.BoxSdkError({
message: 'Expecting "type" of type "QueryResultEntryV2026R0" to be defined',
});
}
if (!(0, json_1.sdIsString)(val.type)) {
throw new errors_1.BoxSdkError({
message: 'Expecting string for "type" of type "QueryResultEntryV2026R0"',
});
}
const type = val.type;
if (!(val == void 0) && !(0, json_2.sdIsMap)(val)) {
throw new errors_1.BoxSdkError({
message: 'Expecting object for "extraData" of type "QueryResultEntryV2026R0"',
});
}
const extraData = val == void 0
? void 0
: (0, json_2.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