UNPKG

box-node-sdk

Version:

Official SDK for Box Platform APIs

162 lines 6.47 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.serializeQueryRequestBodyV2026R0QueryField = serializeQueryRequestBodyV2026R0QueryField; exports.deserializeQueryRequestBodyV2026R0QueryField = deserializeQueryRequestBodyV2026R0QueryField; exports.serializeQueryRequestBodyV2026R0 = serializeQueryRequestBodyV2026R0; exports.deserializeQueryRequestBodyV2026R0 = deserializeQueryRequestBodyV2026R0; const queryAncestorReferenceV2026R0_1 = require("./queryAncestorReferenceV2026R0.js"); const queryAncestorReferenceV2026R0_2 = require("./queryAncestorReferenceV2026R0.js"); const queryOrderByV2026R0_1 = require("./queryOrderByV2026R0.js"); const queryOrderByV2026R0_2 = require("./queryOrderByV2026R0.js"); const errors_1 = require("../../box/errors.js"); const json_1 = require("../../serialization/json.js"); const json_2 = require("../../serialization/json.js"); const json_3 = require("../../serialization/json.js"); const json_4 = require("../../serialization/json.js"); function serializeQueryRequestBodyV2026R0QueryField(val) { return { ['predicate']: val.predicate, ['params']: val.params == void 0 ? val.params : Object.fromEntries(Object.entries(val.params).map(([k, v]) => [ k, (function (v) { return v; })(v), ])), ['ancestors']: val.ancestors == void 0 ? val.ancestors : val.ancestors.map(function (item) { return (0, queryAncestorReferenceV2026R0_1.serializeQueryAncestorReferenceV2026R0)(item); }), }; } function deserializeQueryRequestBodyV2026R0QueryField(val) { if (!(0, json_4.sdIsMap)(val)) { throw new errors_1.BoxSdkError({ message: 'Expecting a map for "QueryRequestBodyV2026R0QueryField"', }); } if (val.predicate == void 0) { throw new errors_1.BoxSdkError({ message: 'Expecting "predicate" of type "QueryRequestBodyV2026R0QueryField" to be defined', }); } if (!(0, json_2.sdIsString)(val.predicate)) { throw new errors_1.BoxSdkError({ message: 'Expecting string for "predicate" of type "QueryRequestBodyV2026R0QueryField"', }); } const predicate = val.predicate; if (!(val.params == void 0) && !(0, json_4.sdIsMap)(val.params)) { throw new errors_1.BoxSdkError({ message: 'Expecting object for "params" of type "QueryRequestBodyV2026R0QueryField"', }); } const params = val.params == void 0 ? void 0 : (0, json_4.sdIsMap)(val.params) ? Object.fromEntries(Object.entries(val.params).map(([k, v]) => [ k, (function (v) { return v; })(v), ])) : {}; if (!(val.ancestors == void 0) && !(0, json_3.sdIsList)(val.ancestors)) { throw new errors_1.BoxSdkError({ message: 'Expecting array for "ancestors" of type "QueryRequestBodyV2026R0QueryField"', }); } const ancestors = val.ancestors == void 0 ? void 0 : (0, json_3.sdIsList)(val.ancestors) ? val.ancestors.map(function (itm) { return (0, queryAncestorReferenceV2026R0_2.deserializeQueryAncestorReferenceV2026R0)(itm); }) : []; return { predicate: predicate, params: params, ancestors: ancestors, }; } function serializeQueryRequestBodyV2026R0(val) { return { ['query']: serializeQueryRequestBodyV2026R0QueryField(val.query), ['order_by']: val.orderBy == void 0 ? val.orderBy : val.orderBy.map(function (item) { return (0, queryOrderByV2026R0_1.serializeQueryOrderByV2026R0)(item); }), ['limit']: val.limit, ['fields']: val.fields == void 0 ? val.fields : val.fields.map(function (item) { return item; }), ['marker']: val.marker, }; } function deserializeQueryRequestBodyV2026R0(val) { if (!(0, json_4.sdIsMap)(val)) { throw new errors_1.BoxSdkError({ message: 'Expecting a map for "QueryRequestBodyV2026R0"', }); } if (val.query == void 0) { throw new errors_1.BoxSdkError({ message: 'Expecting "query" of type "QueryRequestBodyV2026R0" to be defined', }); } const query = deserializeQueryRequestBodyV2026R0QueryField(val.query); if (!(val.order_by == void 0) && !(0, json_3.sdIsList)(val.order_by)) { throw new errors_1.BoxSdkError({ message: 'Expecting array for "order_by" of type "QueryRequestBodyV2026R0"', }); } const orderBy = val.order_by == void 0 ? void 0 : (0, json_3.sdIsList)(val.order_by) ? val.order_by.map(function (itm) { return (0, queryOrderByV2026R0_2.deserializeQueryOrderByV2026R0)(itm); }) : []; if (!(val.limit == void 0) && !(0, json_1.sdIsNumber)(val.limit)) { throw new errors_1.BoxSdkError({ message: 'Expecting number for "limit" of type "QueryRequestBodyV2026R0"', }); } const limit = val.limit == void 0 ? void 0 : val.limit; if (!(val.fields == void 0) && !(0, json_3.sdIsList)(val.fields)) { throw new errors_1.BoxSdkError({ message: 'Expecting array for "fields" of type "QueryRequestBodyV2026R0"', }); } const fields = val.fields == void 0 ? void 0 : (0, json_3.sdIsList)(val.fields) ? val.fields.map(function (itm) { if (!(0, json_2.sdIsString)(itm)) { throw new errors_1.BoxSdkError({ message: 'Expecting string for "QueryRequestBodyV2026R0"', }); } return itm; }) : []; if (!(val.marker == void 0) && !(0, json_2.sdIsString)(val.marker)) { throw new errors_1.BoxSdkError({ message: 'Expecting string for "marker" of type "QueryRequestBodyV2026R0"', }); } const marker = val.marker == void 0 ? void 0 : val.marker; return { query: query, orderBy: orderBy, limit: limit, fields: fields, marker: marker, }; } //# sourceMappingURL=queryRequestBodyV2026R0.js.map