UNPKG

box-node-sdk

Version:

Official SDK for Box Platform APIs

43 lines 1.44 kB
import { BoxSdkError } from '../../box/errors.js'; import { sdIsString } from '../../serialization/json.js'; import { sdIsMap } from '../../serialization/json.js'; export function serializeUserOrGroupReferenceV2025R0TypeField(val) { return val; } export function deserializeUserOrGroupReferenceV2025R0TypeField(val) { if (val == 'user') { return val; } if (val == 'group') { return val; } throw new BoxSdkError({ message: "Can't deserialize UserOrGroupReferenceV2025R0TypeField", }); } export function serializeUserOrGroupReferenceV2025R0(val) { return { ['type']: val.type == void 0 ? val.type : serializeUserOrGroupReferenceV2025R0TypeField(val.type), ['id']: val.id, }; } export function deserializeUserOrGroupReferenceV2025R0(val) { if (!sdIsMap(val)) { throw new BoxSdkError({ message: 'Expecting a map for "UserOrGroupReferenceV2025R0"', }); } const type = val.type == void 0 ? void 0 : deserializeUserOrGroupReferenceV2025R0TypeField(val.type); if (!(val.id == void 0) && !sdIsString(val.id)) { throw new BoxSdkError({ message: 'Expecting string for "id" of type "UserOrGroupReferenceV2025R0"', }); } const id = val.id == void 0 ? void 0 : val.id; return { type: type, id: id }; } //# sourceMappingURL=userOrGroupReferenceV2025R0.js.map