EpicFhirClient.fromLaunchParameters constructor
EpicFhirClient.fromLaunchParameters({})
Implementation
factory EpicFhirClient.fromLaunchParameters({
required Uri base,
required Map<String, String> queryParameters,
FhirUri? fhirUri,
String? clientId,
FhirUri? redirectUri,
String? customUriScheme,
List<String>? scopes,
String? authorizeUrl,
String? tokenUrl,
String? launch,
String? secret,
String redirectPath = '/redirect.html',
}) {
launch ??= queryParameters['launch'];
final launchParameters = launch == null ? null : JwtDecoder.decode(launch);
fhirUri ??= queryParameters['iss'] == null
? throw Exception('no fhirUri was passed for SMART launch')
: FhirUri(queryParameters['iss']);
clientId ??= queryParameters['clientId'] ??
(launchParameters == null ? null : launchParameters['client_id']);
redirectUri ??= FhirUri(Uri(
host: base.host,
scheme: base.scheme,
port: base.port,
path: redirectPath,
));
if (clientId == null) {
throw Exception('no clientId was passed for SMART launch');
}
return EpicFhirClient(
fhirUri: fhirUri,
clientId: clientId,
redirectUri: redirectUri,
customUriScheme: customUriScheme,
scopes: scopes,
authorizeUrl: authorizeUrl == null ? null : FhirUri(authorizeUrl),
tokenUrl: tokenUrl == null ? null : FhirUri(tokenUrl),
launch: launch,
secret: secret,
contactSerialNumber: queryParameters['csn'],
dob: queryParameters['dob'],
encounterDate: queryParameters['encdate'],
patientFirstName: queryParameters['fname'],
patientLastName: queryParameters['lname'],
patientMiddleName: queryParameters['mname'],
sysLogin: queryParameters['syslogin'],
userEpicId: queryParameters['epicuserid'],
userProviderNumber: queryParameters['userprovfhirid'],
);
}