# Case & Topic

### Get Available Topics

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

{% tabs %}
{% tab title="Java" %}
{% code title="YourActivity.java" %}

```java
import io.taptalk.taptalklive.TapTalkLive;
import io.taptalk.taptalklive.Listener.TTLGetTopicListListener;
import io.taptalk.taptalklive.API.Model.TTLTopicModel;

...

TapTalkLive.getTopicList(new TTLGetTopicListListener() {
    @Override
    public void onSuccess(List<TTLTopicModel> topics) {
        // Successfully fetched topics
    }

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

{% endcode %}
{% endtab %}

{% tab title="Kotlin" %}
{% code title="YourActivity.kt" %}

```kotlin
import io.taptalk.taptalklive.TapTalkLive
import io.taptalk.taptalklive.Listener.TTLGetTopicListListener
import io.taptalk.taptalklive.API.Model.TTLTopicModel

...

TapTalkLive.getTopicList(object : TTLGetTopicListListener() {
    override fun onSuccess(topics: MutableList<TTLTopicModel>?) {
        // Successfully fetched topics
    }
    override fun onError(errorCode: String?, errorMessage: String?) {

    }
})
```

{% endcode %}
{% endtab %}
{% endtabs %}

### Get Active User's Case List

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

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

{% tabs %}
{% tab title="Java" %}
{% code title="YourActivity.java" %}

```java
import io.taptalk.taptalklive.TapTalkLive;
import io.taptalk.taptalklive.Listener.TTLGetCaseListListener;
import io.taptalk.taptalklive.API.Model.TTLCaseModel;

...

TapTalkLive.getUserCaseList(new TTLGetCaseListListener() {
    @Override
    public void onSuccess(List<TTLCaseModel> cases) {
        // Successfully fetched user cases
    }

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

{% endcode %}
{% endtab %}

{% tab title="Kotlin" %}
{% code title="YourActivity.kt" %}

```kotlin
import io.taptalk.taptalklive.TapTalkLive
import io.taptalk.taptalklive.Listener.TTLGetCaseListListener
import io.taptalk.taptalklive.API.Model.TTLCaseModel

...

TapTalkLive.getUserCaseList(object : TTLGetCaseListListener() {
    override fun onSuccess(cases: MutableList<TTLCaseModel>?) {
        // Successfully fetched user cases
    }
    override fun onError(errorCode: String?, errorMessage: String?) {

    }
})
```

{% endcode %}
{% endtab %}
{% endtabs %}

### Create a New Case

To use this method, you need to first finish [authentication](/onetalk-omnichannel-documentation/onetalk-channel-integration/live-chat/onetalk-android/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="Java" %}
{% code title="YourActivity.java" %}

```java
import io.taptalk.taptalklive.TapTalkLive;
import io.taptalk.taptalklive.Listener.TTLCreateCaseListener;
import io.taptalk.taptalklive.API.Model.TTLCaseModel;

...

TapTalkLive.createNewCase(TOPIC_ID, FIRST_MESSAGE, new TTLCreateCaseListener() {
    @Override
    public void onSuccess(TTLCaseModel caseModel) {
        // Successfully created a new case
    }

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

{% endcode %}
{% endtab %}

{% tab title="Kotlin" %}
{% code title="YourActivity.kt" %}

```kotlin
import io.taptalk.taptalklive.TapTalkLive
import io.taptalk.taptalklive.Listener.TTLCreateCaseListener
import io.taptalk.taptalklive.API.Model.TTLCaseModel

...

TapTalkLive.createNewCase(TOPIC_ID, FIRST_MESSAGE, object : TTLCreateCaseListener() {
    override fun onSuccess(caseModel: TTLCaseModel?) {
        // Successfully created a new case
    }
    override fun onError(errorCode: String?, errorMessage: String?) {

    }
})
```

{% endcode %}
{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Parameters**\
\&#xNAN;**`TOPIC_ID`**: (int) ID of the selected topic, can be obtained from [**`getTopicList`**](#get-available-topics)\
\&#xNAN;**`FIRST_MESSAGE`**: (String) message to be sent by the user to start a case
{% 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/onetalk-omnichannel-documentation/onetalk-channel-integration/live-chat/onetalk-android/case-and-topic.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.
