UNPKG

@vrspace/babylonjs

Version:

vrspace.org babylonjs client

171 lines (142 loc) 5.82 kB
/** * OpenAPI definition * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. * */ import {ApiClient} from '../ApiClient.js'; import { Client } from './Client.js'; import { UserGroup } from './UserGroup.js'; /** * The GroupMember model module. * @module model/GroupMember * @version v0 */ export class GroupMember { /** * Constructs a new <code>GroupMember</code>. * Represents a membership of a user in a group * @alias GroupMember */ constructor() { /** id * @type {String} */ this.id = undefined; /** group * @type {UserGroup} */ this.group = undefined; /** client * @type {Client} */ this.client = undefined; /** pendingInvite * Pending invitation, if any * @type {String} */ this.pendingInvite = undefined; /** pendingRequest * Pending request to join, if any * @type {String} */ this.pendingRequest = undefined; /** sponsor * @type {Client} */ this.sponsor = undefined; /** lastUpdate * Time stamp of last membership update, be it invite, request, or joining the group * @type {Date} */ this.lastUpdate = undefined; /** lastRead * @type {Date} */ this.lastRead = undefined; GroupMember.initialize(this); } /** * Initializes the fields of this object. * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins). * Only for internal use. */ static initialize(obj) { } /** * Constructs a <code>GroupMember</code> from a plain JavaScript object, optionally creating a new instance. * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not. * @param {Object} data The plain JavaScript object bearing properties of interest. * @param {GroupMember} obj Optional instance to populate. * @return {GroupMember} The populated <code>GroupMember</code> instance. */ static constructFromObject(data, obj) { if (data) { obj = obj || new GroupMember(); if (data.hasOwnProperty('id')) { obj['id'] = ApiClient.convertToType(data['id'], 'String'); } if (data.hasOwnProperty('group')) { obj['group'] = UserGroup.constructFromObject(data['group']); } if (data.hasOwnProperty('client')) { obj['client'] = Client.constructFromObject(data['client']); } if (data.hasOwnProperty('pendingInvite')) { obj['pendingInvite'] = ApiClient.convertToType(data['pendingInvite'], 'String'); } if (data.hasOwnProperty('pendingRequest')) { obj['pendingRequest'] = ApiClient.convertToType(data['pendingRequest'], 'String'); } if (data.hasOwnProperty('sponsor')) { obj['sponsor'] = Client.constructFromObject(data['sponsor']); } if (data.hasOwnProperty('lastUpdate')) { obj['lastUpdate'] = ApiClient.convertToType(data['lastUpdate'], 'Date'); } if (data.hasOwnProperty('lastRead')) { obj['lastRead'] = ApiClient.convertToType(data['lastRead'], 'Date'); } } return obj; } /** * Validates the JSON data with respect to <code>GroupMember</code>. * @param {Object} data The plain JavaScript object bearing properties of interest. * @return {boolean} to indicate whether the JSON data is valid with respect to <code>GroupMember</code>. */ static validateJSON(data) { // ensure the json data is a string if (data['id'] && !(typeof data['id'] === 'string' || data['id'] instanceof String)) { throw new Error("Expected the field `id` to be a primitive type in the JSON string but got " + data['id']); } // validate the optional field `group` if (data['group']) { // data not null UserGroup.validateJSON(data['group']); } // validate the optional field `client` if (data['client']) { // data not null Client.validateJSON(data['client']); } // ensure the json data is a string if (data['pendingInvite'] && !(typeof data['pendingInvite'] === 'string' || data['pendingInvite'] instanceof String)) { throw new Error("Expected the field `pendingInvite` to be a primitive type in the JSON string but got " + data['pendingInvite']); } // ensure the json data is a string if (data['pendingRequest'] && !(typeof data['pendingRequest'] === 'string' || data['pendingRequest'] instanceof String)) { throw new Error("Expected the field `pendingRequest` to be a primitive type in the JSON string but got " + data['pendingRequest']); } // validate the optional field `sponsor` if (data['sponsor']) { // data not null Client.validateJSON(data['sponsor']); } return true; } } export default GroupMember;