Get Last Consultation
getLastConsultation
You can use the getLastConsultation method to get the ConsultationType data object of the last consultation done for the user.
Returns
Promise<ResponseType<ConsultationType[]>>: A promise that resolves with an array containing one consultation object ofConsultationType, or an empty array if there are no consultations yet.
Example
import { getLastConsultation } from 'react-native-altibbi';
const response = await getLastConsultation();
Responses
Status 200
Success
const response = [
{
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", // 'new','checking_medical_profile','in_progress','closed'
is_fulfilled: 0,
parent_consultation_id: null,
consultation_category_id: null,
created_at: "date...",
updated_at: "date...",
closed_at: "date...",
accepted_at: "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, // VOIP data for voip consultations
videoConfig: null, // Video data for video consultations
chatHistory: {}, // Chat history data for chat consultations
recommendation: {}, // Recommendation data when the doctor fills the recommendation
socketParams: {}, // The data required to initiate the socket
},
];
// 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"
}