> 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/onetalk-omnichannel-documentation/onetalk-channel-integration/live-chat/onetalk-ios/case-and-topic.md).

# Case & Topic

### Get Available Topics

You can get the list of available topics by calling **`getTopicList`**.

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

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

// For versions below 3.0.0
#import <TapTalkLive/TapTalkLive.h>

[[TapTalkLive sharedInstance] getTopicListWithSuccess:^(NSArray<TTLTopicModel *> *topicListArray) {
    // Successfully fetched topics
}
failure:^(NSError *error) {
    
}];
```

{% endtab %}

{% tab title="Swift" %}

```swift
import OneTalkLiveChat

TapTalkLive.sharedInstance().getTopicList { topicListArray in
    // Successfully fetched topics
}
failure: { error in
    
}
```

{% endtab %}
{% endtabs %}

### Get Active User's Case List

To use this method, you need to first finish [authentication](https://docs.taptalk.io/onetalk-omnichannel-documentation/onetalk-channel-integration/live-chat/onetalk-ios/authentication.md#authenticate-user-optional) process.

Once authenticated, you can obtain the active user's case list by calling **`getUserCaseList`**.

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

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

// For versions below 3.0.0
#import <TapTalkLive/TapTalkLive.h>

[[TapTalkLive sharedInstance] getUserCaseListListWithSuccess:^(NSArray<TTLCaseModel *> *caseListArray) {
    // Successfully fetched user cases
}
failure:^(NSError *error) {
    
}];
```

{% endtab %}

{% tab title="Swift" %}

```swift
import OneTalkLiveChat

TapTalkLive.sharedInstance().getUserCaseListList { caseListArray in
    // Successfully fetched user cases
}
failure: { error in
    
}
```

{% endtab %}
{% endtabs %}

### Create a New Case

To use this method, you need to first finish [authentication](https://docs.taptalk.io/onetalk-omnichannel-documentation/onetalk-channel-integration/live-chat/onetalk-ios/authentication.md#authenticate-user-optional) process.

Once authenticated, you can create a new case for the user by calling **`createNewCase`**, providing the **topic ID** and **first message**.

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

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

// For versions below 3.0.0
#import <TapTalkLive/TapTalkLive.h>

[[TapTalkLive sharedInstance] createNewCaseWithTopicID:TOPIC_ID
                                          firstMessage:FIRST_MESSAGE
success:^(TTLCaseModel *caseModel) {
    // Successfully created a new case
}
failure:^(NSError *error) {
    
}];
```

{% endtab %}

{% tab title="Swift" %}

```swift
import OneTalkLiveChat

TapTalkLive.sharedInstance().createNewCase(
    withTopicID: TOPIC_ID,
    firstMessage: FIRST_MESSAGE
) { caseModel in
    // Successfully created a new case
}
failure: { error in
    
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Parameters**\
**`TOPIC_ID`**: (String) ID of the selected topic, can be obtained from [**`getTopicList`**](#get-available-topics)\
**`FIRST_MESSAGE`**: (String) message to be sent by the user to start a case
{% endhint %}
