> For the complete documentation index, see [llms.txt](https://docs.taptalk.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.taptalk.io/powertalk-chat-sdk-documentation/powertalk-ios/room-list/room-list-tapcore.md). Agents can also search and read this documentation through its [MCP server](https://docs.taptalk.io/~gitbook/mcp).

# Room List - TapCore

If you are using core implementation type, you can manage the application's chat room list with the following methods:

| **TapTalk Room List Method**                                                                                                                               | **Description**                                                                                    |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
| [Get Updated Room List](https://docs.taptalk.io/powertalk-chat-sdk-documentation/powertalk-ios/room-list/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](https://docs.taptalk.io/powertalk-chat-sdk-documentation/powertalk-ios/room-list/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)                                                                                                     | ​Adds the chat room ID to the marked as unread chat room list​                                     |
| [​Remove Unread Mark from Chat Room​](#remove-unread-mark-from-chat-room)                                                                                  | Removes chat room ID from the marked as unread chat room list​                                     |
| [Get Marked as Unread Chat Room List](#get-marked-as-unread-chat-room-list)                                                                                | ​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 fetch the latest room list data from the server and update to the local cache.

{% tabs %}
{% tab title="Objective-C" %}

```objective-c
// For version 3.0.0 and above
#import "PowerTalk.h"

// For versions below 3.0.0
#import <TapTalk/TapCoreRoomListManager.h>
  
[[TAPCoreRoomListManager sharedManager] getUpdatedRoomListWithSuccess:^(NSArray<TAPRoomListModel *> * _Nonnull roomListArray) {
    // Successfully fetched updated room list data
}
failure:^(NSError * _Nonnull error) {
    // Failed to get updated room list data
}];
```

{% endtab %}

{% tab title="Swift" %}

```swift
import PowerTalk

TAPCoreRoomListManager.shared().getUpdatedRoomList { roomListArray in
    // Successfully fetched updated room list data
}
failure: { error in
    // Failed to get updated room list data
}
```

{% endtab %}
{% endtabs %}

### Get Room List From Cache

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

{% tabs %}
{% tab title="Objective-C" %}

```objective-c
// For version 3.0.0 and above
#import "PowerTalk.h"

// For versions below 3.0.0
#import <TapTalk/TapCoreRoomListManager.h>
  
[[TAPCoreRoomListManager sharedManager] getRoomListFromCacheWithSuccess:^(NSArray<TAPRoomListModel *> * _Nonnull roomListResultArray) {
    // Successfully fetched room list data
}
failure:^(NSError * _Nonnull error) {
    // Failed to get room list data
}];
```

{% endtab %}

{% tab title="Swift" %}

```swift
import PowerTalk

TAPCoreRoomListManager.shared().getRoomListFromCache { roomListResultArray in
    // Successfully fetched room list data
}
failure: { error in
    // Failed to get room list data
}
```

{% 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="Objective-C" %}

```objective-c
// For version 3.0.0 and above
#import "PowerTalk.h"

// For versions below 3.0.0
#import <TapTalk/TapCoreRoomListManager.h>
  
[[TAPCoreRoomListManager sharedManager] fetchNewMessagesWithSuccess:^(NSArray<TAPMessageModel *> * _Nonnull messageArray) {
    // Returns list of messages received by the user while the device is offline
}
failure:^(NSError * _Nonnull error) {
    // Failed to get messages
}];
```

{% endtab %}

{% tab title="Swift" %}

```swift
import PowerTalk

TAPCoreRoomListManager.shared().fetchNewMessages { messageArray in
    // Returns list of messages received by the user while the device is offline
}
failure: { error in
    // Failed to get messages
}
```

{% 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="Objective-C" %}

```objective-c
// For version 3.0.0 and above
#import "PowerTalk.h"

// For versions below 3.0.0
#import <TapTalk/TapCoreRoomListManager.h>
  
[[TAPCoreRoomListManager sharedManager] searchLocalRoomListWithKeyword:KEYWORD
success:^(NSArray<TAPRoomListModel *> * _Nonnull roomListResultArray) {
    // Returns filtered room lists obtained from cache
}
failure:^(NSError * _Nonnull error) {
    // Failed to get room list data
}];
```

{% endtab %}

{% tab title="Swift" %}

```swift
import PowerTalk

TAPCoreRoomListManager.shared().searchLocalRoomList(withKeyword: KEYWORD) { roomListResultArray in
    // Returns filtered room lists obtained from cache
}
failure: { error in
    // Failed to get room list data
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Parameters**\
**`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="Objective-C" %}

```objective-c
// For version 3.0.0 and above
#import "PowerTalk.h"

// For versions below 3.0.0
#import <TapTalk/TapCoreRoomListManager.h>

// Mark single chat room as unread
[[TAPCoreRoomListManager sharedManager] markChatRoomAsUnreadWithRoomID:ROOM_ID 
success:^{
    // Successfully marked chat room as unread
} 
failure:^(NSError * _Nonnull error) {
        
}];

// Mark multiple chat rooms as unread
[[TAPCoreRoomListManager sharedManager] markChatRoomsAsUnreadWithRoomID:ROOM_IDS 
success:^{
    // Successfully marked chat rooms as unread
} 
failure:^(NSError * _Nonnull error) {
        
}];
```

{% endtab %}

{% tab title="Swift" %}

```swift
import PowerTalk

// Mark single chat room as unread
TAPCoreRoomListManager.shared().markChatRoomAsUnread(withRoomID: ROOM_ID) {
    // Successfully marked chat room as unread
}
failure: { error in
    
}

// Mark multiple chat rooms as unread
TAPCoreRoomListManager.shared().markChatRoomsAsUnread(withRoomID: ROOM_IDS) {
    // Successfully marked chat rooms as unread
}
failure: { error in
    
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Parameters**\
**`ROOM_ID`**: (String) ID of the target room\
**`ROOM_IDS`**: (Array\<String>) array 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="Objective-C" %}

```objective-c
// For version 3.0.0 and above
#import "PowerTalk.h"

// For versions below 3.0.0
#import <TapTalk/TapCoreRoomListManager.h>

// Remove unread mark from single chat room
[[TAPCoreRoomListManager sharedManager] removeUnreadMarkFromChatRoom:ROOM_ID 
success:^{
    // Successfully removed unread mark from chat room
} 
failure:^(NSError * _Nonnull error) {
        
}];

// Remove unread mark from multiple chat rooms
[[TAPCoreRoomListManager sharedManager] removeUnreadMarkFromChatRooms:ROOM_IDS 
success:^{
    // Successfully removed unread mark from chat rooms
} 
failure:^(NSError * _Nonnull error) {
        
}];
```

{% endtab %}

{% tab title="Swift" %}

```swift
import PowerTalk

// Remove unread mark from single chat room
TAPCoreRoomListManager.shared().removeUnreadMark(fromChatRoom: ROOM_ID) {
    // Successfully removed unread mark from chat room
}
failure: { error in
    
}

// Remove unread mark from multiple chat rooms
TAPCoreRoomListManager.shared().removeUnreadMark(fromChatRooms: ROOM_IDS) {
    // Successfully removed unread mark from chat rooms
}
failure: { error in
    
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Parameters**\
**`ROOM_ID`**: (String) ID of the target room\
**`ROOM_IDS`**: (Array\<String>) array 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="Objective-C" %}

```objective-c
// For version 3.0.0 and above
#import "PowerTalk.h"

// For versions below 3.0.0
#import <TapTalk/TapCoreRoomListManager.h>

[[TAPCoreRoomListManager sharedManager] getMarkedAsUnreadChatRoomListWithSuccess:^(NSArray * _Nonnull unreadRoomIDs) {
    // Returns list of roomID that has been marked as unread
} 
failure:^(NSError * _Nonnull error) {
    
}];
```

{% endtab %}

{% tab title="Swift" %}

```swift
import PowerTalk

TAPCoreRoomListManager.shared().getMarkedAsUnreadChatRoomList { unreadRoomIDs in
    // Returns list of roomID that has been marked as unread
}
failure: { error in
    
}
```

{% 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="Objective-C" %}

```objective-c
// For version 3.0.0 and above
#import "PowerTalk.h"

// For versions below 3.0.0
#import <TapTalk/TapCoreRoomListManager.h>

// Mute a single chat room
[[TAPCoreRoomListManager sharedManager] muteChatRoomWithRoomID:ROOM_ID 
                                                     expiredAt:EXPIRED_AT
success:^(NSArray *roomIDs) {
    // Successfully muted chat room
} 
failure:^(NSError * _Nonnull error) {
        
}];

// Mute multiple chat rooms
[[TAPCoreRoomListManager sharedManager] muteChatRoomsWithRoomIDs:ROOM_IDS
                                                       expiredAt:EXPIRED_AT
success:^(NSArray *roomIDs) {
    // Successfully muted chat rooms
} 
failure:^(NSError * _Nonnull error) {
        
}];
```

{% endtab %}

{% tab title="Swift" %}

```swift
import PowerTalk

// Mute a single chat room
TAPCoreRoomListManager.shared().muteChatRoom(
    withRoomID: ROOM_ID,
    expiredAt: EXPIRED_AT
) { roomIDs in
    // Successfully muted chat room
}
failure: { error in
    
}

// Mute multiple chat rooms
TAPCoreRoomListManager.shared().muteChatRooms(
    withRoomIDs: ROOM_IDS,
    expiredAt: EXPIRED_AT
) { roomIDs in
    // Successfully muted chat rooms
}
failure: { error in
    
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Parameters**\
**`ROOM_ID`**: (String) ID of the target room\
**`ROOM_IDS`**: (Array\<String>) array containing IDs of target rooms\
**`EXPIRED_AT`**: (Number) chat room will stay muted until this time, fill with 0 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 `unmuteChatRoomWithRoomID:` method.

{% tabs %}
{% tab title="Objective-C" %}

```objective-c
// For version 3.0.0 and above
#import "PowerTalk.h"

// For versions below 3.0.0
#import <TapTalk/TapCoreRoomListManager.h>

// Unmute a single chat room
[[TAPCoreRoomListManager sharedManager] unmuteChatRoomWithRoomID:ROOM_ID 
success:^(NSArray *roomIDs) {
    // Successfully unmuted chat room
} 
failure:^(NSError * _Nonnull error) {
        
}];

// Unmute multiple chat rooms
[[TAPCoreRoomListManager sharedManager] unmuteChatRoomsWithRoomIDs:ROOM_IDS
success:^(NSArray *roomIDs) {
    // Successfully unmuted chat rooms
} 
failure:^(NSError * _Nonnull error) {
        
}];
```

{% endtab %}

{% tab title="Swift" %}

```swift
import PowerTalk

// Unmute a single chat room
TAPCoreRoomListManager.shared().unmuteChatRoom(withRoomID: ROOM_ID) { roomIDs in
    // Successfully unmuted chat room
}
failure: { error in
    
}

// Unmute multiple chat rooms
TAPCoreRoomListManager.shared().unmuteChatRooms(withRoomIDs: ROOM_IDS) { roomIDs in
    // Successfully unmuted chat rooms
}
failure: { error in
    
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Parameters**\
**`ROOM_ID`**: (String) ID of the target room\
**`ROOM_IDS`**: (Array\<String>) array 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="Objective-C" %}

```objective-c
// For version 3.0.0 and above
#import "PowerTalk.h"

// For versions below 3.0.0
#import <TapTalk/TapCoreRoomListManager.h>

[[TAPCoreRoomListManager sharedManager] getMutedChatRoomListWithSuccess:^(NSMutableArray<TAPMutedRoomModel *> *mutedRoomListArray) {
    // Returns list of TAPMutedRoomModel which contains roomID and expiry time of the muted chat rooms
} 
failure:^(NSError * _Nonnull error) {
    
}];
```

{% endtab %}

{% tab title="Swift" %}

```swift
import PowerTalk

TAPCoreRoomListManager.shared().getMutedChatRoomList { mutedRoomListArray in
    // Returns list of TAPMutedRoomModel which contains roomID and expiry time of the muted chat rooms
}
failure: { error in
    
}
```

{% endtab %}
{% endtabs %}

### Pin/Unpin Chat Room

You may call `pinChatRoomWithRoomID:` 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="Objective-C" %}

```objective-c
// For version 3.0.0 and above
#import "PowerTalk.h"

// For versions below 3.0.0
#import <TapTalk/TapCoreRoomListManager.h>

// Pin a single chat room
[[TAPCoreRoomListManager sharedManager] pinChatRoomWithRoomID:ROOM_ID 
success:^(NSArray *roomIDs) {
    // Successfully pinned chat room
} 
failure:^(NSError * _Nonnull error) {
        
}];

// Pin multiple chat rooms
[[TAPCoreRoomListManager sharedManager] pinChatRoomsWithRoomIDs:ROOM_IDS
success:^(NSArray *roomIDs) {
    // Successfully pinned chat rooms
} 
failure:^(NSError * _Nonnull error) {
        
}];
```

{% endtab %}

{% tab title="Swift" %}

```swift
import PowerTalk

// Pin a single chat room
TAPCoreRoomListManager.shared().pinChatRoom(withRoomID: ROOM_ID) { roomIDs in
    // Successfully pinned chat room
}
failure: { error in
    
}

// Pin multiple chat rooms
TAPCoreRoomListManager.shared().pinChatRooms(withRoomIDs: ROOM_IDS) { roomIDs in
    // Successfully pinned chat rooms
}
failure: { error in
    
}
```

{% endtab %}
{% endtabs %}

Use `unpinChatRoomWithRoomID:` to remove existing pinned chat room ID from the pinned chat room list.

{% tabs %}
{% tab title="Objective-C" %}

```objective-c
// For version 3.0.0 and above
#import "PowerTalk.h"

// For versions below 3.0.0
#import <TapTalk/TapCoreRoomListManager.h>

// Unpin a single chat room
[[TAPCoreRoomListManager sharedManager] unpinChatRoomWithRoomID:ROOM_ID 
success:^(NSArray *roomIDs) {
    // Successfully unpinned chat room
} 
failure:^(NSError * _Nonnull error) {
        
}];

// Unpin multiple chat rooms
[[TAPCoreRoomListManager sharedManager] unpinChatRoomsWithRoomIDs:ROOM_IDS
success:^(NSArray *roomIDs) {
    // Successfully unpinned chat rooms
} 
failure:^(NSError * _Nonnull error) {
        
}];
```

{% endtab %}

{% tab title="Swift" %}

```swift
import PowerTalk

// Unpin a single chat room
TAPCoreRoomListManager.shared().unpinChatRoom(withRoomID: ROOM_ID) { roomIDs in
    // Successfully unpinned chat room
}
failure: { error in
    
}

// Unpin multiple chat rooms
TAPCoreRoomListManager.shared().unpinChatRooms(withRoomIDs: ROOM_IDS) { roomIDs in
    // Successfully unpinned chat rooms
}
failure: { error in
    
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Parameters**\
**`ROOM_ID`**: (String) ID of the target room\
**`ROOM_IDS`**: (Array\<String>) array 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="Objective-C" %}

```objective-c
// For version 3.0.0 and above
#import "PowerTalk.h"

// For versions below 3.0.0
#import <TapTalk/TapCoreRoomListManager.h>

[[TAPCoreRoomListManager sharedManager] getPinnedChatRoomIDsWithSuccess:^(NSArray *pinnedRoomIDs) {
    // Returns list of roomID of the active user's pinned chat rooms
} 
failure:^(NSError * _Nonnull error) {
    
}];
```

{% endtab %}

{% tab title="Swift" %}

```swift
import PowerTalk

TAPCoreRoomListManager.shared().getPinnedChatRoomIDs { pinnedRoomIDs in
    // Returns list of roomID of the active user's pinned chat rooms
}
failure: { error in
    
}
```

{% endtab %}
{% endtabs %}
