ApiService class
Properties
hashCode
→ int
The hash code for this object.
no setter inherited
runtimeType
→ Type
A representation of the runtime type of the object.
no setter inherited
Methods
callApi ({required String ? endpoint , required String ? method , Map <String , dynamic > body = const {} , File ? file , int ? page , int ? perPage , bool ? isSinaAPI = false })
→ Future <Response >
Makes an API call with the specified endpoint, method, body, and file (optional).
Returns the HTTP response from the API.
cancelConsultation (int consultationID )
→ Future <bool >
Cancels the consultation with the given consultationID
.
Returns true if the API call is successful.
createConsultation ({required String question , required Medium medium , required int userID , List <String > ? mediaIDs , String ? followUpId , String ? forceWhiteLabelingPartnerName })
→ Future <Consultation >
Creates a new consultation with the provided question
, medium
, userID
, and optional mediaIDs
.
Returns the created consultation object if the API call is successful.
createSinaSession ()
→ Future <Chat >
Creates a new chat.
Returns the session ID if the API call is successful.
createUser (User user )
→ Future <User >
Creates a new user using the provided user
object.
Returns the created user object if the API call is successful.
deleteConsultation (int consultationID )
→ Future <bool >
Deletes the consultation with the given consultationID
from the API.
Returns true if the API call is successful.
deleteMedia (int mediaID )
→ Future
Deletes the media with the given mediaID
from the API.
Returns true if the API call is successful.
deleteUser (int userID )
→ Future
Deletes the user with the given userID
from the API.
Returns true if the API call is successful.
getArticlesList ({required List <int > subcategoryIds , int page = 1 , int perPage = 20 })
→ Future <List <Article > >
Retrieves a list of articles from the API.
getConsultationInfo (int consultationID )
→ Future <Consultation >
Retrieves the consultation information for the given consultationID
from the API.
Returns the consultation object if the API call is successful.
getConsultationList ({int page = 1 , int perPage = 20 , int ? userId })
→ Future <List <Consultation > >
Retrieves a list of consultations from the API.
getLastConsultation ()
→ Future <Consultation >
Retrieves the last consultation from the API.
Returns the last consultation object if the API call is successful.
getMediaList ({int page = 1 , int perPage = 20 })
→ Future <List <Media > >
Retrieves a list of media attachments from the API.
getPredictSpecialty (int consultationID )
→ Future <List <PredictSpecialty > >
getPredictSummary (int consultationID )
→ Future <PredictSummary >
getPrescription (int consultationID , String savePath )
→ Future
getSinaChatMessages ({required String sessionId , int page = 1 , int perPage = 20 })
→ Future <List <ChatMessage > >
gets a list of chats based on sessions Id.
Returns the chat messages list if the API call is successful.
getSoapSummary (int consultationID )
→ Future <Soap >
getTranscription (int consultationID )
→ Future <Transcription >
getUser (int userID )
→ Future <User >
Retrieves a user with the given userID
from the API.
Returns the user object if the API call is successful.
getUsers ({int page = 1 , int perPage = 20 })
→ Future <List <User > >
Retrieves a list of users from the API.
noSuchMethod (Invocation invocation )
→ dynamic
Invoked when a nonexistent method or property is accessed.
inherited
rateConsultation (int consultationID , double score )
→ Future <bool >
sendSinaMessage (String text , String sessionId )
→ Future <ChatResponse >
Creates a new chat.
Returns the session ID if the API call is successful.
toString ()
→ String
A string representation of this object.
inherited
updateUser (User userData , int userID )
→ Future <User >
Updates the user with the given userID
using the provided userData
.
Returns the updated user object if the API call is successful.
uploadMedia (File file )
→ Future <Media >
Uploads a media file
to the API.
Returns the uploaded media object if the API call is successful.