getDataOwnerApiFor method

Future<DataOwnerApi> getDataOwnerApiFor(
  1. UserDto user
)

Implementation

Future<DataOwnerApi> getDataOwnerApiFor(UserDto user) async {
  if (user.healthcarePartyId != null) {
    return HcpDataOwnerApi(await healthcarePartyApi);

  } else if (user.patientId != null) {
    return PatientDataOwnerApi(await patientApi);

  } else if (user.deviceId != null) {
    return DeviceDataOwnerApi(await deviceApi);

  } else {
    throw FormatException("User ${user.id} is not a data owner");
  }
}