# Room List - TapCore

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](/~/changes/FMvVnz8ZkLFBmR0Wx2wq/powertalk-chat-sdk-documentation/powertalk-android/room-list/tapcore.md#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 From Cache](/~/changes/FMvVnz8ZkLFBmR0Wx2wq/powertalk-chat-sdk-documentation/powertalk-android/room-list/tapcore.md#get-room-list-from-cache) | Call this method to retrieve list of room data obtained from the local cache                      |
| [Fetch New Message](#fetch-new-message)                                                                                                                      | Call this method to fetch new/updated messages that have not yet been received by the device      |
| [Search Local Room List](#search-local-room-list)                                                                                                            | Call this method to search room lists from the device's local storage with a keyword              |
| [Mark Chat Room as Unread](#mark-chat-room-as-unread)                                                                                                        | Add the chat room ID to the marked as unread chat room list                                       |
| [Remove Unread Mark from Chat Room](#mark-chat-room-as-unread-1)                                                                                             | Remove chat room ID from the marked as unread chat room list​                                     |
| [Get Marked as Unread Chat Room List](#mark-chat-room-as-unread-1)                                                                                           | Retrieve the list of chat room IDs that has been marked as unread                                 |
| [Mute/Unmute Chat Room](#mute-unmute-chat-room)                                                                                                              | Mute selected chat rooms until a specified time                                                   |
| [Get Muted Chat Rooms](#get-muted-chat-rooms)                                                                                                                | Retrieve the list of muted chat room IDs and their respective mute expiry time                    |
| [Pin/Unpin Chat Room](#pin-unpin-chat-room)                                                                                                                  | Add or remove the chat room ID to pinned chat room list                                           |
| [Get Pinned Chat Rooms](#get-pinned-chat-rooms)                                                                                                              | Retrieve list of pinned chat room IDs from the server                                             |

### Get Updated Room List

Call this method to retrieve the latest room list data from the server and update to the local cache.

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

```java
TapCoreRoomListManager.getInstance().getUpdatedRoomList(new TapCoreGetRoomListListener() {
    @Override
    public void onSuccess(List<TAPRoomListModel> roomLists) {
        // Returns latest updated room lists
    }

    @Override
    public void onError(String errorCode, String errorMessage) {

    }
});
```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
TapCoreRoomListManager.getInstance().getUpdatedRoomList(object : TapCoreGetRoomListListener() {
    override fun onSuccess(roomLists: List<TAPRoomListModel>?) {
        // Returns latest updated room lists
    }

    override fun onError(errorCode: String?, errorMessage: String?) {

    }
})
```

{% endtab %}
{% endtabs %}

### Get Room List From Cache

Call this method to retrieve list of room data obtained from the local cache.

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

```java
TapCoreRoomListManager.getInstance().getRoomListFromCache(new TapCoreGetRoomListListener() {
    @Override
    public void onSuccess(List<TAPRoomListModel> roomLists) {
        // Returns room lists obtained from cache
    }

    @Override
    public void onError(String errorCode, String errorMessage) {

    }
});
```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
TapCoreRoomListManager.getInstance().getRoomListFromCache(object : TapCoreGetRoomListListener() {
    override fun onSuccess(roomLists: List<TAPRoomListModel>?) {
        // Returns room lists obtained from cache
    }

    override fun onError(errorCode: String?, errorMessage: String?) {

    }
})
```

{% endtab %}
{% endtabs %}

### Fetch New Message

Call this method to fetch new/updated messages that have not yet been received by the device. Can be used to retrieve pending messages when the device goes back online after an offline state.

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

```java
TapCoreRoomListManager.getInstance().fetchNewMessage(new TapCoreGetMessageListener() {
    @Override
    public void onSuccess(List<TAPMessageModel> messages) {
        // Returns list of messages received by the user while the device is offline
    }

    @Override
    public void onError(String errorCode, String errorMessage) {

    }
});
```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
TapCoreRoomListManager.getInstance().fetchNewMessage(object : TapCoreGetMessageListener() {
    override fun onSuccess(messages: List<TAPMessageModel>?) {
        // Returns list of messages received by the user while the device is offline
    }

    override fun onError(errorCode: String?, errorMessage: String?) {

    }
})
```

{% endtab %}
{% endtabs %}

### Search Local Room List

Call this method to search room lists from the device's local storage with a keyword. Provided keyword will be used to filter **room name** in the search result.

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

```java
TapCoreRoomListManager.getInstance().searchLocalRoomListWithKeyword(KEYWORD, new TapCoreGetRoomListListener() {
    @Override
    public void onSuccess(List<TAPRoomListModel> roomLists) {
        // Returns filtered room lists obtained from cache
    }

    @Override
    public void onError(String errorCode, String errorMessage) {

    }
});
```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
TapCoreRoomListManager.getInstance().searchLocalRoomListWithKeyword(KEYWORD, object : TapCoreGetRoomListListener() {
    override fun onSuccess(roomLists: List<TAPRoomListModel>?) {
        // Returns filtered room lists obtained from cache
    }

    override fun onError(errorCode: String?, errorMessage: String?) {

    }
})
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Parameters**\
\&#xNAN;**`KEYWORD`**: (String) search keyword to filter room name
{% endhint %}

### Mark Chat Room as Unread

Call this method to add the selected chat room ID to the marked as unread chat room list.

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

```java
// Mark single chat room as unread
TapCoreRoomListManager.getInstance().markChatRoomAsUnread(ROOM_ID, new TapCommonListener() {
    @Override
    public void onSuccess(String successMessage) {
        // Successfully marked chat room as unread
    }

    @Override
    public void onError(String errorCode, String errorMessage) {

    }
});

// Mark multiple chat rooms as unread
TapCoreRoomListManager.getInstance().markChatRoomsAsUnread(ROOM_IDS, new TapCommonListener() {
    @Override
    public void onSuccess(String successMessage) {
        // Successfully marked chat rooms as unread
    }

    @Override
    public void onError(String errorCode, String errorMessage) {

    }
});
```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
// Mark single chat room as unread
TapCoreRoomListManager.getInstance().markChatRoomAsUnread(ROOM_ID, object : TapCommonListener() {
    override fun onSuccess(successMessage: String?) {
        // Successfully marked chat room as unread
    }

    override fun onError(errorCode: String?, errorMessage: String?) {

    }
})

// Mark multiple chat rooms as unread
TapCoreRoomListManager.getInstance().markChatRoomsAsUnread(ROOM_IDS, object : TapCommonListener() {
    override fun onSuccess(successMessage: String?) {
        // Successfully marked chat rooms as unread
    }

    override fun onError(errorCode: String?, errorMessage: String?) {

    }
})
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Parameters**\
\&#xNAN;**`ROOM_ID`**: (String) ID of the target room\
\&#xNAN;**`ROOM_IDS`**: (List\<String>) list containing IDs of target rooms
{% endhint %}

### Remove Unread Mark from Chat Room

Call this method to remove the selected chat room ID from the marked as unread chat room list.

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

```java
// Remove unread mark from single chat room
TapCoreRoomListManager.getInstance().removeUnreadMarkFromChatRoom(ROOM_ID, new TapCommonListener() {
    @Override
    public void onSuccess(String successMessage) {
        // Successfully removed unread mark from chat room
    }

    @Override
    public void onError(String errorCode, String errorMessage) {

    }
});

// Remove unread mark from multiple chat rooms
TapCoreRoomListManager.getInstance().removeUnreadMarkFromChatRooms(ROOM_IDS, new TapCommonListener() {
    @Override
    public void onSuccess(String successMessage) {
        // Successfully removed unread mark from chat rooms
    }

    @Override
    public void onError(String errorCode, String errorMessage) {

    }
});
```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
// Remove unread mark from single chat room
TapCoreRoomListManager.getInstance().removeUnreadMarkFromChatRoom(ROOM_ID, object : TapCommonListener() {
    override fun onSuccess(successMessage: String?) {
        // Successfully removed unread mark from chat room
    }

    override fun onError(errorCode: String?, errorMessage: String?) {

    }
})

// Remove unread mark from multiple chat rooms
TapCoreRoomListManager.getInstance().removeUnreadMarkFromChatRooms(ROOM_IDS, object : TapCommonListener() {
    override fun onSuccess(successMessage: String?) {
        // Successfully removed unread mark from chat rooms
    }

    override fun onError(errorCode: String?, errorMessage: String?) {

    }
})
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Parameters**\
\&#xNAN;**`ROOM_ID`**: (String) ID of the target room\
\&#xNAN;**`ROOM_IDS`**: (List\<String>) list containing IDs of target rooms
{% endhint %}

### Get Marked as Unread Chat Room List

Call this method to retrieve the list of chat room IDs that has been marked as unread.

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

```java
TapCoreRoomListManager.getInstance().getMarkedAsUnreadChatRoomList(new TapCoreGetStringArrayListener() {
    @Override
    public void onSuccess(ArrayList<String> arrayList) {
        // Returns list of roomID that has been marked as unread
    }

    @Override
    public void onError(String errorCode, String errorMessage) {

    }
});
```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
TapCoreRoomListManager.getInstance().getMarkedAsUnreadChatRoomList(object : TapCoreGetStringArrayListener() {
    override fun onSuccess(arrayList: ArrayList<String>) {
        // Returns list of roomID that has been marked as unread
    }

    override fun onError(errorCode: String?, errorMessage: String?) {

    }
});
```

{% endtab %}
{% endtabs %}

### Mute/Unmute Chat Room

Call these methods to mute the selected chat rooms until a specified time. Active user will not receive notifications from muted chat rooms.

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

```java
// Mute a single chat room
TapCoreRoomListManager.getInstance().muteChatRoom(ROOM_ID, EXPIRED_AT, new TapCommonListener() {
    @Override
    public void onSuccess(String successMessage) {
        // Successfully muted chat room
    }

    @Override
    public void onError(String errorCode, String errorMessage) {

    }
});

// Mute multiple chat rooms
TapCoreRoomListManager.getInstance().muteChatRooms(ROOM_IDS, EXPIRED_AT, new TapCommonListener() {
    @Override
    public void onSuccess(String successMessage) {
        // Successfully muted chat rooms
    }

    @Override
    public void onError(String errorCode, String errorMessage) {

    }
});
```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
// Mute a single chat room
TapCoreRoomListManager.getInstance().muteChatRoom(ROOM_ID, EXPIRED_AT, object : TapCommonListener() {
    override fun onSuccess(successMessage: String?) {
        // Successfully muted chat room
    }

    override fun onError(errorCode: String?, errorMessage: String?) {

    }
})

// Mute multiple chat rooms
TapCoreRoomListManager.getInstance().muteChatRooms(ROOM_IDS, EXPIRED_AT, object : TapCommonListener() {
    override fun onSuccess(successMessage: String?) {
        // Successfully muted chat rooms
    }

    override fun onError(errorCode: String?, errorMessage: String?) {

    }
})
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Parameters**\
\&#xNAN;**`ROOM_ID`**: (String) ID of the target room\
\&#xNAN;**`ROOM_IDS`**: (List\<String>) list containing IDs of target rooms\
\&#xNAN;**`EXPIRED_AT`**: (Long) chat room will stay muted until this time, fill with 0L to mute the room forever or until the room is unmuted
{% endhint %}

To return chat rooms to its normal state and continue retrieving notifications, use `unmuteChatRoom()` method.

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

```java
// Unmute a single chat room
TapCoreRoomListManager.getInstance().unmuteChatRoom(ROOM_ID, new TapCommonListener() {
    @Override
    public void onSuccess(String successMessage) {
        // Successfully unmuted chat room
    }

    @Override
    public void onError(String errorCode, String errorMessage) {

    }
});

// Unmute multiple chat rooms
TapCoreRoomListManager.getInstance().unmuteChatRooms(ROOM_IDS, new TapCommonListener() {
    @Override
    public void onSuccess(String successMessage) {
        // Successfully unmuted chat rooms
    }

    @Override
    public void onError(String errorCode, String errorMessage) {

    }
});
```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
// Unmute a single chat room
TapCoreRoomListManager.getInstance().unmuteChatRoom(ROOM_ID, object : TapCommonListener() {
    override fun onSuccess(successMessage: String?) {
        // Successfully unmuted chat room
    }

    override fun onError(errorCode: String?, errorMessage: String?) {

    }
})

// Unmute multiple chat rooms
TapCoreRoomListManager.getInstance().unmuteChatRooms(ROOM_IDS, object : TapCommonListener() {
    override fun onSuccess(successMessage: String?) {
        // Successfully unmuted chat rooms
    }

    override fun onError(errorCode: String?, errorMessage: String?) {

    }
})
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Parameters**\
\&#xNAN;**`ROOM_ID`**: (String) ID of the target room\
\&#xNAN;**`ROOM_IDS`**: (List\<String>) list containing IDs of target rooms
{% endhint %}

### Get Muted Chat Rooms

Retrieve the list of muted chat room IDs and their respective mute expiry time.

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

```java
TapCoreRoomListManager.getInstance().getMutedChatRoomList(new TapCoreGetMutedChatRoomListener() {
    @Override
    public void onSuccess(@NonNull ArrayList<TapMutedRoomListModel> mutedRoomList) {
        // Returns list of TapMutedRoomListModel which contains 
        // roomID and expiry time of the muted chat rooms
    }
    
    @Override
    public void onError(String errorCode, String errorMessage) {

    }
});
```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
TapCoreRoomListManager.getInstance().getMutedChatRoomList(ROOM_ID, object : TapCoreGetMutedChatRoomListener() {
    override fun onSuccess(mutedRoomList: ArrayList<TapMutedRoomListModel>) {
        // Returns list of TapMutedRoomListModel which contains 
        // roomID and expiry time of the muted chat rooms
    }

    override fun onError(errorCode: String?, errorMessage: String?) {

    }
})
```

{% endtab %}
{% endtabs %}

### Pin/Unpin Chat Room

You may call `pinChatRoom()` to add or remove the chat room ID to pinned chat room list. Chat rooms pinned by the user are generally shown on top of the chat room list. You can later retrieve the list of pinned chat room IDs with `getPinnedChatRoomIDs()`.

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

```java
// Pin a single chat room
TapCoreRoomListManager.getInstance().pinChatRoom(ROOM_ID, new TapCommonListener() {
    @Override
    public void onSuccess(String successMessage) {
        // Successfully pinned chat room
    }

    @Override
    public void onError(String errorCode, String errorMessage) {

    }
});

// Pin multiple chat rooms
TapCoreRoomListManager.getInstance().pinChatRooms(ROOM_IDS, new TapCommonListener() {
    @Override
    public void onSuccess(String successMessage) {
        // Successfully pinned chat rooms
    }

    @Override
    public void onError(String errorCode, String errorMessage) {

    }
});
```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
// Pin a single chat room
TapCoreRoomListManager.getInstance().pinChatRoom(ROOM_ID, object : TapCommonListener() {
    override fun onSuccess(successMessage: String?) {
        // Successfully pinned chat room
    }

    override fun onError(errorCode: String?, errorMessage: String?) {

    }
})

// Pin multiple chat rooms
TapCoreRoomListManager.getInstance().pinChatRooms(ROOM_IDS, object : TapCommonListener() {
    override fun onSuccess(successMessage: String?) {
        // Successfully pinned chat rooms
    }

    override fun onError(errorCode: String?, errorMessage: String?) {

    }
})
```

{% endtab %}
{% endtabs %}

Use `unpinChatRoom()` to remove existing pinned chat room ID from the pinned chat room list.

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

```java
// Unpin a single chat room
TapCoreRoomListManager.getInstance().unpinChatRoom(ROOM_ID, new TapCommonListener() {
    @Override
    public void onSuccess(String successMessage) {
        // Successfully unpinned chat room
    }

    @Override
    public void onError(String errorCode, String errorMessage) {

    }
});

// Unpin multiple chat rooms
TapCoreRoomListManager.getInstance().unpinChatRooms(ROOM_IDS, new TapCommonListener() {
    @Override
    public void onSuccess(String successMessage) {
        // Successfully unpinned chat rooms
    }

    @Override
    public void onError(String errorCode, String errorMessage) {

    }
});
```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
// Unpin a single chat room
TapCoreRoomListManager.getInstance().unpinChatRoom(ROOM_ID, object : TapCommonListener() {
    override fun onSuccess(successMessage: String?) {
        // Successfully unpinned chat room
    }

    override fun onError(errorCode: String?, errorMessage: String?) {

    }
})

// Unpin multiple chat rooms
TapCoreRoomListManager.getInstance().unpinChatRooms(ROOM_IDS, object : TapCommonListener() {
    override fun onSuccess(successMessage: String?) {
        // Successfully unpinned chat rooms
    }

    override fun onError(errorCode: String?, errorMessage: String?) {

    }
})
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Parameters**\
\&#xNAN;**`ROOM_ID`**: (String) ID of the target room\
\&#xNAN;**`ROOM_IDS`**: (List\<String>) list containing IDs of target rooms
{% endhint %}

### Get Pinned Chat Rooms

You can retrieve the list of the active user's pinned chat room IDs from the server with `getPinnedChatRoomIDs()`.

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

```java
TapCoreRoomListManager.getInstance().getPinnedChatRoomIDs(new TapCoreGetStringArrayListener() {
    @Override
    public void onSuccess(@NonNull ArrayList<String> pinnedRoomIDs) {
        // Returns list of roomID of the active user's pinned chat rooms
    }
    
    @Override
    public void onError(String errorCode, String errorMessage) {

    }
});
```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
TapCoreRoomListManager.getInstance().getPinnedChatRoomIDs(ROOM_ID, object : TapCoreGetStringArrayListener() {
    override fun onSuccess(pinnedRoomIDs: ArrayList<String>) {
        // Returns list of roomID of the active user's pinned chat rooms
    }

    override fun onError(errorCode: String?, errorMessage: String?) {

    }
})
```

{% endtab %}
{% endtabs %}


---

# 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/~/changes/FMvVnz8ZkLFBmR0Wx2wq/powertalk-chat-sdk-documentation/powertalk-android/room-list/tapcore.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.
