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(1,20,123,callback = consultationCallback)

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

const response = [
{
id: 123,
userId: 999999999,
question: "I want to consult a doctor on ...",
doctorName: "Altibbi Doctor",
doctorAvatar: "url...",
medium: "chat",
status: "closed", // "in_progress" || "new"
isFulfilled: 0,
parentConsultationId: null,
createdAt: "date...",
updatedAt: "date...",
user: {
id: 999999999,
// ...
}, // userData
parentConsultation: null,
media: [],
pusherChannel: "channel", // Socket Channel
pusherAppKey: "key", // Socket Key
chatConfig: {
id: 1,
// ...
}, // Chat config data for chat consultations
voipConfig: null, // GSM data for gsm consultations
videoConfig: null, // Video/Voip data for voip and video consultations
chatHistory: {}, // Chat history data for chat consultations
recommendation: {}, // Recommendation data when the doctor fills the recommendation for the consultation
socketParams: {} // The data required to initiate the socket
},
/... Other consultations ./
]

// The response will be an empty array if there are no consultations done yet
// response = []

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"
}