UNPKG

@vrspace/babylonjs

Version:

vrspace.org babylonjs client

163 lines (134 loc) 5.28 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 GroupMessage model module. * @module model/GroupMessage * @version v0 */ export class GroupMessage { /** * Constructs a new <code>GroupMessage</code>. * @alias GroupMessage */ constructor() { /** id * @type {Number} */ this.id = undefined; /** from * @type {Client} */ this.from = undefined; /** group * @type {UserGroup} */ this.group = undefined; /** content * Message content (text) * @type {String} */ this.content = undefined; /** link * URL shared, only one for the time being. May be relative (e.g. for local worlds) or absolute (external) * @type {String} */ this.link = undefined; /** worldId * World ID, used only for world invitations/shares * @type {Number} */ this.worldId = undefined; /** timestamp * @type {Date} */ this.timestamp = undefined; /** local * Used along the link, true if the link points to a world on this server * @type {Boolean} */ this.local = undefined; GroupMessage.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>GroupMessage</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 {GroupMessage} obj Optional instance to populate. * @return {GroupMessage} The populated <code>GroupMessage</code> instance. */ static constructFromObject(data, obj) { if (data) { obj = obj || new GroupMessage(); if (data.hasOwnProperty('id')) { obj['id'] = ApiClient.convertToType(data['id'], 'Number'); } if (data.hasOwnProperty('from')) { obj['from'] = Client.constructFromObject(data['from']); } if (data.hasOwnProperty('group')) { obj['group'] = UserGroup.constructFromObject(data['group']); } if (data.hasOwnProperty('content')) { obj['content'] = ApiClient.convertToType(data['content'], 'String'); } if (data.hasOwnProperty('link')) { obj['link'] = ApiClient.convertToType(data['link'], 'String'); } if (data.hasOwnProperty('worldId')) { obj['worldId'] = ApiClient.convertToType(data['worldId'], 'Number'); } if (data.hasOwnProperty('timestamp')) { obj['timestamp'] = ApiClient.convertToType(data['timestamp'], 'Date'); } if (data.hasOwnProperty('local')) { obj['local'] = ApiClient.convertToType(data['local'], 'Boolean'); } } return obj; } /** * Validates the JSON data with respect to <code>GroupMessage</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>GroupMessage</code>. */ static validateJSON(data) { // validate the optional field `from` if (data['from']) { // data not null Client.validateJSON(data['from']); } // validate the optional field `group` if (data['group']) { // data not null UserGroup.validateJSON(data['group']); } // ensure the json data is a string if (data['content'] && !(typeof data['content'] === 'string' || data['content'] instanceof String)) { throw new Error("Expected the field `content` to be a primitive type in the JSON string but got " + data['content']); } // ensure the json data is a string if (data['link'] && !(typeof data['link'] === 'string' || data['link'] instanceof String)) { throw new Error("Expected the field `link` to be a primitive type in the JSON string but got " + data['link']); } return true; } } export default GroupMessage;