box-node-sdk
Version:
Official SDK for Box Platform APIs
45 lines • 1.87 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.serializeTermsOfServices = serializeTermsOfServices;
exports.deserializeTermsOfServices = deserializeTermsOfServices;
const termsOfService_1 = require("./termsOfService");
const termsOfService_2 = require("./termsOfService");
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 serializeTermsOfServices(val) {
return {
['total_count']: val.totalCount,
['entries']: val.entries == void 0
? val.entries
: val.entries.map(function (item) {
return (0, termsOfService_1.serializeTermsOfService)(item);
}),
};
}
function deserializeTermsOfServices(val) {
if (!(0, json_3.sdIsMap)(val)) {
throw new errors_1.BoxSdkError({ message: 'Expecting a map for "TermsOfServices"' });
}
if (!(val.total_count == void 0) && !(0, json_1.sdIsNumber)(val.total_count)) {
throw new errors_1.BoxSdkError({
message: 'Expecting number for "total_count" of type "TermsOfServices"',
});
}
const totalCount = val.total_count == void 0 ? void 0 : val.total_count;
if (!(val.entries == void 0) && !(0, json_2.sdIsList)(val.entries)) {
throw new errors_1.BoxSdkError({
message: 'Expecting array for "entries" of type "TermsOfServices"',
});
}
const entries = val.entries == void 0
? void 0
: (0, json_2.sdIsList)(val.entries)
? val.entries.map(function (itm) {
return (0, termsOfService_2.deserializeTermsOfService)(itm);
})
: [];
return { totalCount: totalCount, entries: entries };
}
//# sourceMappingURL=termsOfServices.js.map