box-node-sdk
Version:
Official SDK for Box Platform APIs
92 lines • 2.79 kB
JavaScript
import { BoxSdkError } from '../../box/errors.js';
import { sdIsString } from '../../serialization/json.js';
import { sdIsMap } from '../../serialization/json.js';
export class UserBaseV2026R0 {
/**
* The unique identifier for this user. */
id;
/**
* The value will always be `user`. */
type = 'user';
rawData;
constructor(fields) {
if (fields.id !== undefined) {
this.id = fields.id;
}
if (fields.type !== undefined) {
this.type = fields.type;
}
if (fields.rawData !== undefined) {
this.rawData = fields.rawData;
}
}
}
export function serializeUserBaseV2026R0TypeField(val) {
return val;
}
export function deserializeUserBaseV2026R0TypeField(val) {
if (val == 'user') {
return val;
}
throw new BoxSdkError({
message: "Can't deserialize UserBaseV2026R0TypeField",
});
}
export function serializeUserBaseV2026R0(val) {
return {
['id']: val.id,
['type']: serializeUserBaseV2026R0TypeField(val.type),
};
}
export function deserializeUserBaseV2026R0(val) {
if (!sdIsMap(val)) {
throw new BoxSdkError({ message: 'Expecting a map for "UserBaseV2026R0"' });
}
if (val.id == void 0) {
throw new BoxSdkError({
message: 'Expecting "id" of type "UserBaseV2026R0" to be defined',
});
}
if (!sdIsString(val.id)) {
throw new BoxSdkError({
message: 'Expecting string for "id" of type "UserBaseV2026R0"',
});
}
const id = val.id;
if (val.type == void 0) {
throw new BoxSdkError({
message: 'Expecting "type" of type "UserBaseV2026R0" to be defined',
});
}
const type = deserializeUserBaseV2026R0TypeField(val.type);
return { id: id, type: type };
}
export function serializeUserBaseV2026R0Input(val) {
return {
['id']: val.id,
['type']: val.type == void 0
? val.type
: serializeUserBaseV2026R0TypeField(val.type),
};
}
export function deserializeUserBaseV2026R0Input(val) {
if (!sdIsMap(val)) {
throw new BoxSdkError({
message: 'Expecting a map for "UserBaseV2026R0Input"',
});
}
if (val.id == void 0) {
throw new BoxSdkError({
message: 'Expecting "id" of type "UserBaseV2026R0Input" to be defined',
});
}
if (!sdIsString(val.id)) {
throw new BoxSdkError({
message: 'Expecting string for "id" of type "UserBaseV2026R0Input"',
});
}
const id = val.id;
const type = val.type == void 0 ? void 0 : deserializeUserBaseV2026R0TypeField(val.type);
return { id: id, type: type };
}
//# sourceMappingURL=userBaseV2026R0.js.map