Skip to content

Documentation / @imvu/client / Room

Class: Room ​

Defined in: packages/client/src/resources/Room.ts:6

Shared state for any remotely addressable node, edge, or collection document.

Extends ​

Constructors ​

Constructor ​

ts
new Room(client, options?): Room;

Defined in: packages/client/src/resources/Resource.ts:23

Parameters ​

ParameterType
clientClient
options?ResourceOptions

Returns ​

Room

Inherited from ​

Resource.constructor

Properties ​

_id ​

ts
_id: string = '';

Defined in: packages/client/src/resources/Resource.ts:21

Inherited from ​

Resource._id


_url ​

ts
protected _url: string = '';

Defined in: packages/client/src/resources/RemoteDocument.ts:13

Inherited from ​

Resource._url


capacity ​

ts
capacity: number = 0;

Defined in: packages/client/src/resources/Room.ts:14


client ​

ts
protected readonly client: Client;

Defined in: packages/client/src/resources/RemoteDocument.ts:16

Inherited from ​

Resource.client


contentRating ​

ts
contentRating: string = '';

Defined in: packages/client/src/resources/Room.ts:18


description ​

ts
description: string = '';

Defined in: packages/client/src/resources/Room.ts:8


fetchedAt ​

ts
fetchedAt: number = 0;

Defined in: packages/client/src/resources/Resource.ts:39

When this instance last received data from the API (ms since epoch); 0 if never.

Inherited from ​

Resource.fetchedAt


isAgeVerified ​

ts
isAgeVerified: boolean = false;

Defined in: packages/client/src/resources/Room.ts:21


isAp ​

ts
isAp: boolean = false;

Defined in: packages/client/src/resources/Room.ts:23


isFriendsOnly ​

ts
isFriendsOnly: boolean = false;

Defined in: packages/client/src/resources/Room.ts:19


isNonGuestOnly ​

ts
isNonGuestOnly: boolean = false;

Defined in: packages/client/src/resources/Room.ts:20


isVip ​

ts
isVip: boolean = false;

Defined in: packages/client/src/resources/Room.ts:22


language ​

ts
language: string = '';

Defined in: packages/client/src/resources/Room.ts:16


name ​

ts
name: string = '';

Defined in: packages/client/src/resources/Room.ts:7


occupancy ​

ts
occupancy: number = 0;

Defined in: packages/client/src/resources/Room.ts:15


options ​

ts
protected options: ResourceOptions = {};

Defined in: packages/client/src/resources/Resource.ts:25

Inherited from ​

Resource.options


ownerUsername ​

ts
ownerUsername: string = '';

Defined in: packages/client/src/resources/Room.ts:17


privacy ​

ts
privacy: string = '';

Defined in: packages/client/src/resources/Room.ts:10

'public' or 'private'.


rating ​

ts
rating: number = 0;

Defined in: packages/client/src/resources/Room.ts:13


relations ​

ts
relations: Partial<TRelations> = {};

Defined in: packages/client/src/resources/Resource.ts:44

Internal

Inherited from ​

Resource.relations


revision ​

ts
revision: number = 0;

Defined in: packages/client/src/resources/RemoteDocument.ts:8

Inherited from ​

Resource.revision


stale ​

ts
stale: boolean = false;

Defined in: packages/client/src/resources/RemoteDocument.ts:9

Inherited from ​

Resource.stale


supportsAudience ​

ts
supportsAudience: boolean = false;

Defined in: packages/client/src/resources/Room.ts:25

Live (audience) rooms use hangouts instead of a classic chat; chat returns null for them.


type ​

ts
type: string = '';

Defined in: packages/client/src/resources/Room.ts:12

listed, marriage, shared, shop_together, closed, …


updates ​

ts
updates: Partial<TUpdates> = {};

Defined in: packages/client/src/resources/Resource.ts:49

Internal

Inherited from ​

Resource.updates


updateTarget ​

ts
updateTarget: 
  | APIUpdateTarget
  | null
  | undefined;

Defined in: packages/client/src/resources/RemoteDocument.ts:11

Undefined until metadata is loaded; null means the API explicitly provides no update target.

Inherited from ​

Resource.updateTarget

Accessors ​

id ​

Get Signature ​

ts
get id(): string;

Defined in: packages/client/src/resources/Resource.ts:34

Returns ​

string

Inherited from ​

Resource.id


url ​

Get Signature ​

ts
get url(): string;

Defined in: packages/client/src/resources/RemoteDocument.ts:28

Canonical REST URL and cache identity for this document.

Returns ​

string

Inherited from ​

Resource.url

Methods ​

_applyRemoteMetadata() ​

ts
_applyRemoteMetadata(url, updateTarget): void;

Defined in: packages/client/src/resources/RemoteDocument.ts:33

Internal

Apply address/update metadata from an authoritative REST response.

Parameters ​

ParameterType
urlstring
updateTargetAPIUpdateTarget | null

Returns ​

void

Inherited from ​

Resource._applyRemoteMetadata


_hydrate() ​

ts
_hydrate(node): void;

Defined in: packages/client/src/resources/Resource.ts:69

Internal

Refresh this canonical instance from an authoritative REST document.

Parameters ​

ParameterType
nodeAPIResource

Returns ​

void

Inherited from ​

Resource._hydrate


_invalidate() ​

ts
_invalidate(): void;

Defined in: packages/client/src/resources/RemoteDocument.ts:40

Internal

Mark this document stale after an IMQ invalidation.

Returns ​

void

Inherited from ​

Resource._invalidate


_patch() ​

ts
_patch(data): void;

Defined in: packages/client/src/resources/Room.ts:27

Internal

Assign fields from a raw (possibly partial) API payload. Used by build for the initial data and, later, by IMQ for in-place live updates — hence the in guards, so a partial payload only touches the fields it carries. Subclasses override this and call super._patch(data).

Parameters ​

ParameterType
dataRecord<string, any>

Returns ​

void

Overrides ​

Resource._patch


authenticated() ​

ts
protected authenticated(): void;

Defined in: packages/client/src/resources/Resource.ts:104

Returns ​

void

Inherited from ​

Resource.authenticated


chat() ​

ts
chat(): Promise<Chat | null>;

Defined in: packages/client/src/resources/Room.ts:52

The room's classic chat, or null for live (audience) rooms.

Returns ​

Promise<Chat | null>


collectionRelationship() ​

ts
protected collectionRelationship<T, K>(
   relation, 
   cls, 
   options?
): Collection<T>;

Defined in: packages/client/src/resources/Resource.ts:122

Type Parameters ​

Type Parameter
T extends Resource<APIRelations, APIUpdateTarget>
K extends keyof RoomRelations

Parameters ​

ParameterType
relationK
clsConstructor<T>
options?CollectionOptions

Returns ​

Collection<T>

Inherited from ​

Resource.collectionRelationship


join() ​

ts
join(options?): Promise<ChatSession>;

Defined in: packages/client/src/resources/Room.ts:57

Join this room's chat. Shorthand for (await room.chat()).join().

Parameters ​

ParameterType
options?JoinOptions

Returns ​

Promise<ChatSession>


moderators() ​

ts
moderators(): Promise<User<UserRelations>[]>;

Defined in: packages/client/src/resources/Room.ts:47

Returns ​

Promise<User<UserRelations>[]>


refresh() ​

ts
refresh(): Promise<Room>;

Defined in: packages/client/src/resources/Resource.ts:95

Re-read this resource from REST and update it in place. Resolves to the same instance, so references held elsewhere see the fresh data and stale clears.

Returns ​

Promise<Room>

Inherited from ​

Resource.refresh


relationship() ​

ts
protected relationship<T, K>(
   relation, 
   cls, 
   options?
): Promise<T | null>;

Defined in: packages/client/src/resources/Resource.ts:110

Type Parameters ​

Type Parameter
T extends Resource<APIRelations, APIUpdateTarget>
K extends keyof RoomRelations

Parameters ​

ParameterType
relationK
clsConstructor<T>
options?FetchOptions

Returns ​

Promise<T | null>

Inherited from ​

Resource.relationship


watch() ​

ts
watch(): Promise<DocumentWatch<Room>>;

Defined in: packages/client/src/resources/RemoteDocument.ts:46

Observe explicit IMQ invalidations for this document.

Returns ​

Promise<DocumentWatch<Room>>

Inherited from ​

Resource.watch


build() ​

ts
static build<T>(
   this, 
   client, 
   node
): T;

Defined in: packages/client/src/resources/Resource.ts:57

Construct a resource from a raw API node, then populate it via _patch. No validation — we trust the wire types and rely on tests for API drift (see MODERNIZATION.md). Fields keep their defaults until _patch overwrites them, so an instance is never in an unset state.

Type Parameters ​

Type Parameter
T extends Resource<any, APIUpdateTarget>

Parameters ​

ParameterType
thisnew (client, options?) => T
clientClient
nodeAPIResource

Returns ​

T

Inherited from ​

Resource.build

Released under the MIT License.