box-node-sdk
Version:
Official SDK for Box Platform APIs
98 lines • 3.02 kB
JavaScript
import { BoxSdkError } from '../../box/errors.js';
import { sdIsString } from '../../serialization/json.js';
import { sdIsMap } from '../../serialization/json.js';
export class HubBaseV2025R0 {
/**
* The unique identifier that represent a Box Hub.
*
* The ID for any Box Hub can be determined
* by visiting a Box Hub in the web application
* and copying the ID from the URL. For example,
* for the URL `https://*.app.box.com/hubs/123`
* the `hub_id` is `123`. */
id;
/**
* The value will always be `hubs`. */
type = 'hubs';
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 serializeHubBaseV2025R0TypeField(val) {
return val;
}
export function deserializeHubBaseV2025R0TypeField(val) {
if (val == 'hubs') {
return val;
}
throw new BoxSdkError({
message: "Can't deserialize HubBaseV2025R0TypeField",
});
}
export function serializeHubBaseV2025R0(val) {
return {
['id']: val.id,
['type']: serializeHubBaseV2025R0TypeField(val.type),
};
}
export function deserializeHubBaseV2025R0(val) {
if (!sdIsMap(val)) {
throw new BoxSdkError({ message: 'Expecting a map for "HubBaseV2025R0"' });
}
if (val.id == void 0) {
throw new BoxSdkError({
message: 'Expecting "id" of type "HubBaseV2025R0" to be defined',
});
}
if (!sdIsString(val.id)) {
throw new BoxSdkError({
message: 'Expecting string for "id" of type "HubBaseV2025R0"',
});
}
const id = val.id;
if (val.type == void 0) {
throw new BoxSdkError({
message: 'Expecting "type" of type "HubBaseV2025R0" to be defined',
});
}
const type = deserializeHubBaseV2025R0TypeField(val.type);
return { id: id, type: type };
}
export function serializeHubBaseV2025R0Input(val) {
return {
['id']: val.id,
['type']: val.type == void 0
? val.type
: serializeHubBaseV2025R0TypeField(val.type),
};
}
export function deserializeHubBaseV2025R0Input(val) {
if (!sdIsMap(val)) {
throw new BoxSdkError({
message: 'Expecting a map for "HubBaseV2025R0Input"',
});
}
if (val.id == void 0) {
throw new BoxSdkError({
message: 'Expecting "id" of type "HubBaseV2025R0Input" to be defined',
});
}
if (!sdIsString(val.id)) {
throw new BoxSdkError({
message: 'Expecting string for "id" of type "HubBaseV2025R0Input"',
});
}
const id = val.id;
const type = val.type == void 0 ? void 0 : deserializeHubBaseV2025R0TypeField(val.type);
return { id: id, type: type };
}
//# sourceMappingURL=hubBaseV2025R0.js.map