Create Consultation
Create Consultation Example
Creates a new consultation with the provided [question], [medium], [userID], and optional [mediaIDs, followUpId, forceWhiteLabelingPartnerName].
Consider that the required fields are
question
,medium
anduserID
The accepted values for
medium
are:chat
,gsm
,voip
,video
The
followUpId
field is not required and used in case the consultation being created is related to a previous consultation, then you have to add the previous consultation id
forceWhiteLabelingPartnerName
is used to notify doctors to use specific partner name in communication with patients
In some cases the consultation might include some media files (Images or PDFs) so there is a flow of uploading these files and add attach their IDs to the createConsultation method
We have the uploadMedia
method that could be used to upload the files, here is a quick view for this method
import 'package:altibbi/service/api_service.dart';
ApiService apiService = ApiService();
var media ;
if(path != null){
media = await apiService.uploadMedia(File(path!));
}
We have the Class Media
to decode the response of the uploadMedia method
class Media {
String? id;
String? type;
String? name;
String? path;
String? extension;
String? url;
int? size;
Media({this.id, this.type, this.name, this.path, this.extension, this.size,this.url});
}
Creating the consultation
Check the example
var consultation = await apiService.createConsultation(
question: questionBody.text,
medium: selectedMedium,
userID: 1, //Assigning consultation to User ID
mediaIDs: media != null ? [media.id] : [] ,
//forceWhiteLabelingPartnerName: 'Sample partner name'
);
Responses
Status 201
Success
{
"id": 123,
"user_id": 999999999,
"question": "I want to consult a doctor on ...",
"medium": "chat",
"parent_consultation_id": null,
"status": "new"
}
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 403
Duplicate request
{
"name": "Forbidden",
"message": "duplicate request OR Current user cant access this page",
"code": "0",
"status": "403",
"type": "yii\\\\web\\\\ForbiddenHttpException"
}
Status 422
Data Validation Failed
[
{
"field": "string",
"message": "string"
}
]