# Room List

If you are using core implementation type, the application's chat room list can be managed with the **TapCoreRoomListManager** class using the following methods:

| TapTalk Room List Method               | Description                                                                                       |
| -------------------------------------- | ------------------------------------------------------------------------------------------------- |
| ​Get Updated Room List​                | Call this method to fetch the latest room list data from the server and update to the local cache |
| Get Room List by XC User ID            | Call this method to get room list by XC User ID                                                   |
| Get Personal Chat Room with User Model | Call this method to get personal chat room model with user model.                                 |
| Get User by ID                         | Call this method to get user data by ID                                                           |
| Remove Chat Room by Room ID            | Call this method to remove single room from room list                                             |

### Get Updated Room List <a href="#get-updated-room-list" id="get-updated-room-list"></a>

Call this method to retrieve the latest room list data from the server.

{% tabs %}
{% tab title="JavaScript" %}

```javascript
tapCoreRoomListManager.getUpdatedRoomList({ 
      onSuccess: (roomLists) => {
           // do action here
      },  
 })

```

{% endtab %}
{% endtabs %}

### Get Room List by XC User ID <a href="#get-updated-room-list" id="get-updated-room-list"></a>

Call this method to get room list by XC User ID

{% tabs %}
{% tab title="JavaScript" %}

```javascript
tapCoreRoomListManager.getRoomByXcID(xcRoomID, { 
      onSuccess: (response) => {
           // do action here
      },
      onError: (errorCode, errorMessage) => {
           // do action here
      }  
 })
```

{% endtab %}
{% endtabs %}

### Get Personal Chat Room with User Model <a href="#get-updated-room-list" id="get-updated-room-list"></a>

Call this method to get personal chat room model with user model.

{% tabs %}
{% tab title="JavaScript" %}

```javascript
var roomModel = tapCoreRoomListManager.getPersonalChatRoomWithUser(userModel)
```

{% endtab %}
{% endtabs %}

### Get User by ID <a href="#get-updated-room-list" id="get-updated-room-list"></a>

Call this method to get user data by ID

{% tabs %}
{% tab title="JavaScript" %}

```javascript
tapCoreRoomListManager.getUserByIdFromApi(userID, { 
      onSuccess: (response) => {
           // do action here
      },
      onError: (errorCode, errorMessage) => {
           // do action here
      }  
 })
```

{% endtab %}
{% endtabs %}

### Remove Chat Room by Room ID <a href="#get-updated-room-list" id="get-updated-room-list"></a>

Call this method to remove single room from room list

{% tabs %}
{% tab title="JavaScript" %}

```javascript
tapCoreRoomListManager.removeChatRoomByRoomID(roomID)
```

{% endtab %}
{% endtabs %}

### Get Muted Room <a href="#get-muted-room" id="get-muted-room"></a>

Fetch all muted rooms

{% tabs %}
{% tab title="JavaScript" %}

```javascript
tapCoreRoomListManager.getMutedRooms((res) => 
   // do action here
})
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Parameters**&#x20;

**`CALLBACK`**: (Method) callback method
{% endhint %}

### Set Muted Room <a href="#set-muted-room" id="set-muted-room"></a>

Set mute rooms

{% tabs %}
{% tab title="JavaScript" %}

```javascript
tapCoreRoomListManager.setMutedRooms(ROOM_ID, EXPIRED_AT, (res) => 
   // do action here
})
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Parameters**&#x20;

&#x20;ROOM\_I&#x44;**`:`** (Array) array of roomID\
&#x20;EXPIRED\_AT : (Number) timestamp of expired time\
\&#xNAN;**`CALLBACK`**: (Method) callback method
{% endhint %}

### Unset Muted Room <a href="#unset-muted-room" id="unset-muted-room"></a>

Unset muted rooms

{% tabs %}
{% tab title="JavaScript" %}

```javascript
tapCoreRoomListManager.unsetMutedRooms(ROOM_ID, (res) => 
   // do action here
})
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Parameters**&#x20;

ROOM\_I&#x44;**`:`** (Array) array of roomID\
**`CALLBACK`**: (Method) callback method
{% endhint %}

### Get Pinned Room <a href="#get-pinned-room" id="get-pinned-room"></a>

Fetch all pinned rooms

{% tabs %}
{% tab title="JavaScript" %}

```javascript
tapCoreRoomListManager.getPinnedRoomID((res) => 
   // do action here
})
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Parameters**&#x20;

**`CALLBACK`**: (Method) callback method
{% endhint %}

### Set Pin Room <a href="#set-pin-room" id="set-pin-room"></a>

Set pin rooms

{% tabs %}
{% tab title="JavaScript" %}

```javascript
tapCoreRoomListManager.pinRoom(ROOM_ID, (res) => 
   // do action here
})
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Parameters**&#x20;

&#x20;ROOM\_I&#x44;**`:`** (Array) array of roomID\
\&#xNAN;**`CALLBACK`**: (Method) callback method
{% endhint %}

### Unset Pinned Room <a href="#unset-pinned-room" id="unset-pinned-room"></a>

Unset  pinned rooms

{% tabs %}
{% tab title="JavaScript" %}

```javascript
tapCoreRoomListManager.unpinRoom(ROOM_ID, (res) => 
   // do action here
})
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Parameters**&#x20;

ROOM\_I&#x44;**`:`** (Array) array of roomID\
**`CALLBACK`**: (Method) callback method
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.taptalk.io/powertalk-chat-sdk-documentation/powertalk-javascript-sdk/room-list.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
