Skip to main content

Get Consultation List

Get Consultations List Example

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

Check the example:

import AltibbiTelehealth

// With filtering on specific user
let userIdFilter = 999999999
ApiService.getConsultationList(userId: userIdFilter, page: 1, perPage: 20, completion: {list, failure, error in
// Handle list as an array of Consultation object
if let error = error {
print("Data Error: \(String(describing: error))")
} else if let failure = failure {
// Handle failure
} else {
if let list = list {
print("Consultations count: \(list.count)")
}
}
})

// Without filtering
ApiService.getConsultationList(page: 1, perPage: 20, completion: {list, failure, error in
// Handle list as an array of Consultation object
})

The getConsultationList will return an array of consultation data object that could be decoded to an array of Consultation objects.

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,
"created_at": "date...",
"updated_at": "date...",
"user": {
"id": 999999999
},
"parentConsultation": null,
"media": [],
"pusherChannel": "channel",
"pusherAppKey": "key",
"chatConfig": {
"id": 1
},
"voipConfig": null,
"videoConfig": null,
"chatHistory": {},
"recommendation": {}
}
]

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