UNPKG

box-node-sdk

Version:

Official SDK for Box Platform APIs

234 lines 8.2 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ArchiveV2025R0 = void 0; exports.serializeArchiveV2025R0TypeField = serializeArchiveV2025R0TypeField; exports.deserializeArchiveV2025R0TypeField = deserializeArchiveV2025R0TypeField; exports.serializeArchiveV2025R0OwnedByField = serializeArchiveV2025R0OwnedByField; exports.deserializeArchiveV2025R0OwnedByField = deserializeArchiveV2025R0OwnedByField; exports.serializeArchiveV2025R0 = serializeArchiveV2025R0; exports.deserializeArchiveV2025R0 = deserializeArchiveV2025R0; exports.serializeArchiveV2025R0Input = serializeArchiveV2025R0Input; exports.deserializeArchiveV2025R0Input = deserializeArchiveV2025R0Input; const errors_1 = require("../../box/errors"); const json_1 = require("../../serialization/json"); const json_2 = require("../../serialization/json"); const json_3 = require("../../serialization/json"); class ArchiveV2025R0 { constructor(fields) { /** * The value is always `archive`. */ this.type = 'archive'; if (fields.id !== undefined) { this.id = fields.id; } if (fields.type !== undefined) { this.type = fields.type; } if (fields.name !== undefined) { this.name = fields.name; } if (fields.size !== undefined) { this.size = fields.size; } if (fields.description !== undefined) { this.description = fields.description; } if (fields.ownedBy !== undefined) { this.ownedBy = fields.ownedBy; } if (fields.rawData !== undefined) { this.rawData = fields.rawData; } } } exports.ArchiveV2025R0 = ArchiveV2025R0; function serializeArchiveV2025R0TypeField(val) { return val; } function deserializeArchiveV2025R0TypeField(val) { if (val == 'archive') { return val; } throw new errors_1.BoxSdkError({ message: "Can't deserialize ArchiveV2025R0TypeField", }); } function serializeArchiveV2025R0OwnedByField(val) { return { ['id']: val.id, ['type']: val.type }; } function deserializeArchiveV2025R0OwnedByField(val) { if (!(0, json_3.sdIsMap)(val)) { throw new errors_1.BoxSdkError({ message: 'Expecting a map for "ArchiveV2025R0OwnedByField"', }); } if (val.id == void 0) { throw new errors_1.BoxSdkError({ message: 'Expecting "id" of type "ArchiveV2025R0OwnedByField" to be defined', }); } if (!(0, json_2.sdIsString)(val.id)) { throw new errors_1.BoxSdkError({ message: 'Expecting string for "id" of type "ArchiveV2025R0OwnedByField"', }); } const id = val.id; if (val.type == void 0) { throw new errors_1.BoxSdkError({ message: 'Expecting "type" of type "ArchiveV2025R0OwnedByField" to be defined', }); } if (!(0, json_2.sdIsString)(val.type)) { throw new errors_1.BoxSdkError({ message: 'Expecting string for "type" of type "ArchiveV2025R0OwnedByField"', }); } const type = val.type; return { id: id, type: type }; } function serializeArchiveV2025R0(val) { return { ['id']: val.id, ['type']: serializeArchiveV2025R0TypeField(val.type), ['name']: val.name, ['size']: val.size, ['description']: val.description, ['owned_by']: val.ownedBy == void 0 ? val.ownedBy : serializeArchiveV2025R0OwnedByField(val.ownedBy), }; } function deserializeArchiveV2025R0(val) { if (!(0, json_3.sdIsMap)(val)) { throw new errors_1.BoxSdkError({ message: 'Expecting a map for "ArchiveV2025R0"' }); } if (val.id == void 0) { throw new errors_1.BoxSdkError({ message: 'Expecting "id" of type "ArchiveV2025R0" to be defined', }); } if (!(0, json_2.sdIsString)(val.id)) { throw new errors_1.BoxSdkError({ message: 'Expecting string for "id" of type "ArchiveV2025R0"', }); } const id = val.id; if (val.type == void 0) { throw new errors_1.BoxSdkError({ message: 'Expecting "type" of type "ArchiveV2025R0" to be defined', }); } const type = deserializeArchiveV2025R0TypeField(val.type); if (val.name == void 0) { throw new errors_1.BoxSdkError({ message: 'Expecting "name" of type "ArchiveV2025R0" to be defined', }); } if (!(0, json_2.sdIsString)(val.name)) { throw new errors_1.BoxSdkError({ message: 'Expecting string for "name" of type "ArchiveV2025R0"', }); } const name = val.name; if (val.size == void 0) { throw new errors_1.BoxSdkError({ message: 'Expecting "size" of type "ArchiveV2025R0" to be defined', }); } if (!(0, json_1.sdIsNumber)(val.size)) { throw new errors_1.BoxSdkError({ message: 'Expecting number for "size" of type "ArchiveV2025R0"', }); } const size = val.size; if (!(val.description == void 0) && !(0, json_2.sdIsString)(val.description)) { throw new errors_1.BoxSdkError({ message: 'Expecting string for "description" of type "ArchiveV2025R0"', }); } const description = val.description == void 0 ? void 0 : val.description; const ownedBy = val.owned_by == void 0 ? void 0 : deserializeArchiveV2025R0OwnedByField(val.owned_by); return { id: id, type: type, name: name, size: size, description: description, ownedBy: ownedBy, }; } function serializeArchiveV2025R0Input(val) { return { ['id']: val.id, ['type']: val.type == void 0 ? val.type : serializeArchiveV2025R0TypeField(val.type), ['name']: val.name, ['size']: val.size, ['description']: val.description, ['owned_by']: val.ownedBy == void 0 ? val.ownedBy : serializeArchiveV2025R0OwnedByField(val.ownedBy), }; } function deserializeArchiveV2025R0Input(val) { if (!(0, json_3.sdIsMap)(val)) { throw new errors_1.BoxSdkError({ message: 'Expecting a map for "ArchiveV2025R0Input"', }); } if (val.id == void 0) { throw new errors_1.BoxSdkError({ message: 'Expecting "id" of type "ArchiveV2025R0Input" to be defined', }); } if (!(0, json_2.sdIsString)(val.id)) { throw new errors_1.BoxSdkError({ message: 'Expecting string for "id" of type "ArchiveV2025R0Input"', }); } const id = val.id; const type = val.type == void 0 ? void 0 : deserializeArchiveV2025R0TypeField(val.type); if (val.name == void 0) { throw new errors_1.BoxSdkError({ message: 'Expecting "name" of type "ArchiveV2025R0Input" to be defined', }); } if (!(0, json_2.sdIsString)(val.name)) { throw new errors_1.BoxSdkError({ message: 'Expecting string for "name" of type "ArchiveV2025R0Input"', }); } const name = val.name; if (val.size == void 0) { throw new errors_1.BoxSdkError({ message: 'Expecting "size" of type "ArchiveV2025R0Input" to be defined', }); } if (!(0, json_1.sdIsNumber)(val.size)) { throw new errors_1.BoxSdkError({ message: 'Expecting number for "size" of type "ArchiveV2025R0Input"', }); } const size = val.size; if (!(val.description == void 0) && !(0, json_2.sdIsString)(val.description)) { throw new errors_1.BoxSdkError({ message: 'Expecting string for "description" of type "ArchiveV2025R0Input"', }); } const description = val.description == void 0 ? void 0 : val.description; const ownedBy = val.owned_by == void 0 ? void 0 : deserializeArchiveV2025R0OwnedByField(val.owned_by); return { id: id, type: type, name: name, size: size, description: description, ownedBy: ownedBy, }; } //# sourceMappingURL=archiveV2025R0.js.map