Get Consultation Data
Get Consultation Example
For getting the data of a consultation you need to use the getConsultationInfo and provide the id for that consultation
Check the example:
import AltibbiTelehealth
let consultationId = 123
ApiService.getConsultationInfo(id: consultationId, completion: {consultation, failure, error in
// Handle consultation as a Consultation object
if let error = error {
print("Data Error: \(String(describing: error))")
} else if let failure = failure {
// Handle failure
} else {
if let consultation = consultation {
print("Consultation Status: \(String(describing: consultation.status))")
}
}
})
The
getConsultationInfowill return a consultation data object that could be decoded toConsultationobject
Responses
Status 200
Success
{
"id": 123,
"user_id": 999999999,
"question": "I want to consult a doctor on ...",
"doctor_name": "Altibbi Doctor",
"doctor_avatar": "url...",
"doctor_average_rating": 4,
"medium": "chat",
"status": "closed",
"is_fulfilled": 0,
"parent_consultation_id": null,
"created_at": "2023-12-01 10:00:00",
"updated_at": "2023-12-01 10:30:00",
"user": {
"id": 999999999,
"name": "Altibbi User"
},
"media": [
{
"id": "181",
"type": "image",
"name": "file.jpg",
"path": "path/to/file.jpg",
"extension": "jpg",
"url": "https://altibbi.com/path/to/file.jpg",
"size": 22256
}
],
"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"
}
Status 404
Consultation id invalid or deleted
{
"name": "Not Found",
"message": "Object not found: {id}",
"code": "0",
"status": "404",
"type": "yii\\web\\NotFoundHttpException"
}