Skip to main content

Get List of Consultations

Get Consultations List Example​

For the list of all consultations for a specific user you can use the getConsultationList with pagination attributes page and perPage, and with userId

Check the example:

import com.altibbi.telehealth.ApiService

val consultationCallback = object : ApiCallback<List<Consultation>> {
override fun onSuccess(response: List<Consultation>) {
}

override fun onFailure(error: String?) {
}

override fun onRequestError(error: String?) {
}
}
ApiService.getConsultationList(page = 1, perPage = 20, userId = 123, sort = "-id", callback = consultationCallback)

sort is optional. Use -id to get the newest consultations first, id for the oldest first

The getConsultationList will return an array of consultation data object that could be decoded to an array of Consultation object or an empty array if there are no consultations yet

Responses​

Status 200​

Success

[
{
"id": 123,
"user_id": 999999999,
"question": "I want to consult a doctor on ...",
"doctor_name": "Altibbi Doctor",
"doctor_avatar": "url...",
"medium": "chat",
"status": "closed",
"is_fulfilled": 0,
"parent_consultation_id": null,
"scheduled_to": null,
"consultation_category_id": 1,
"created_at": "2024-01-30 10:00:00",
"updated_at": "2024-01-30 10:00:00",
"user": {
"id": "999999999",
"name": "Altibbi User"
},
"parentConsultation": null,
"media": [],
"pusherChannel": "channel",
"pusherAppKey": "key",
"chatConfig": {
"id": 1,
"consultation_id": 123,
"group_id": "group_1",
"app_id": "app_1",
"chat_user_id": "user_1",
"chat_user_token": "token_1"
},
"voipConfig": null,
"videoConfig": null,
"chatHistory": null,
"recommendation": null
}
]

Status 401​

UnauthorizedHttpException represents an Unauthorized HTTP exception with status code 401.

{
"name": "Unauthorized",
"message": "Your request was made with invalid credentials",
"code": "0",
"status": "401",
"type": "yii\\\\web\\\\UnauthorizedHttpException"
}