UNPKG

box-node-sdk

Version:

Official SDK for Box Platform APIs

45 lines 1.71 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.serializeMetadatas = serializeMetadatas; exports.deserializeMetadatas = deserializeMetadatas; const metadata_1 = require("./metadata"); const metadata_2 = require("./metadata"); const errors_1 = require("../box/errors"); const json_1 = require("../serialization/json"); const json_2 = require("../serialization/json"); const json_3 = require("../serialization/json"); function serializeMetadatas(val) { return { ['entries']: val.entries == void 0 ? val.entries : val.entries.map(function (item) { return (0, metadata_1.serializeMetadata)(item); }), ['limit']: val.limit, }; } function deserializeMetadatas(val) { if (!(0, json_3.sdIsMap)(val)) { throw new errors_1.BoxSdkError({ message: 'Expecting a map for "Metadatas"' }); } if (!(val.entries == void 0) && !(0, json_2.sdIsList)(val.entries)) { throw new errors_1.BoxSdkError({ message: 'Expecting array for "entries" of type "Metadatas"', }); } const entries = val.entries == void 0 ? void 0 : (0, json_2.sdIsList)(val.entries) ? val.entries.map(function (itm) { return (0, metadata_2.deserializeMetadata)(itm); }) : []; if (!(val.limit == void 0) && !(0, json_1.sdIsNumber)(val.limit)) { throw new errors_1.BoxSdkError({ message: 'Expecting number for "limit" of type "Metadatas"', }); } const limit = val.limit == void 0 ? void 0 : val.limit; return { entries: entries, limit: limit }; } //# sourceMappingURL=metadatas.js.map