Clinic & Room API (Android)
A clinic is a medical facility that provides healthcare services remotely through telecommunication technologies.
Get account
/**
* Interface for getting account details.
*/
interface AccountApi {
/**
* Get account details by code.
*
* @param code The code of the account.
* @return A resource containing the account details.
*/
suspend fun getAccount(code: String): Resource<Account>
}
Example usage
/**
* Launches a coroutine to get account details by code.
*
* @param accountCode The code of the account.
*/
viewModelScope.launch {
val res = VseeApi.accountApi.getAccount(code = accountCode)
when (res) {
is Resource.Success -> {
// Save account data.
}
is Resource.Error -> Timber.e("Get account detail $accountCode error: ${res.message}")
}
}
Get room
A clinic room is a room in a medical facility where healthcare professionals examine and treat patients.
/**
* Interface for getting room details.
*/
interface RoomApi {
/**
* Get room details by code.
*
* @param roomCode The code of the room.
* @param timeZone The time zone of the user.
* @return A resource containing the room details.
*/
suspend fun getRoom(roomCode: String, timeZone: String): Resource<Room>
/**
* Get providers by room code.
*
* @param roomCode The code of the room.
* @return A resource containing a list of providers.
*/
suspend fun getProviders(roomCode: String): Resource<List<User>>
}
Example usage
/**
* Launches a coroutine to get room details.
*
* @param roomCode The code of the room.
*/
viewModelScope.launch {
/**
* Get room details by code.
*
* @param roomCode The code of the room.
* @param timeZone The time zone of the user.
* @return A resource containing the room details.
*/
val res = VseeApi.roomApi.getRoom(roomCode = roomCode, timeZone = TimeZone.getDefault().id)
when (res) {
is Resource.Success -> {
// Save room data.
}
is Resource.Error -> Timber.e("Get room detail $roomCode error: ${res.message}")
}
}
Get providers
Clinic providers are the healthcare professionals who work in the clinic, such as doctors, nurses, and physician assistants.
Example usage
/**
* Launches a coroutine to get providers.
*/
fun getProviders() {
viewModelScope.launch {
/**
* Get providers by room code.
*
* @param roomCode The code of the room.
*/
when (val res = VseeApi.roomApi.getProviders(roomCode)) {
is Resource.Success -> {
// Save providers data.
}
is Resource.Error -> Timber.e("Could not get providers: ${res.message}")
}
}
}