getConsentDocument method
- @Deprecated('The Informed Consent endpoints are deprecated in CAWS. ' 'Informed Consent is uploaded as [InformedConsentInput] participant input ' 'data using a [ParticipationReference].')
Get a previously uploaded (signed) consent document with document id
.
If studyDeploymentId
is specified use this, otherwise use the study
deployment id from CarpService.study.
Implementation
@Deprecated('The Informed Consent endpoints are deprecated in CAWS. '
'Informed Consent is uploaded as [InformedConsentInput] participant input '
'data using a [ParticipationReference].')
Future<ConsentDocument> getConsentDocument(
int id, {
String? studyDeploymentId,
}) async {
String url = "${getConsentDocumentEndpointUri(studyDeploymentId)}/$id";
// GET the consent document from the CARP web service
http.Response response = await _get(Uri.encodeFull(url));
debug('RESPONSE: ${response.statusCode}\n${response.body}');
int httpStatusCode = response.statusCode;
Map<String, dynamic> responseJson =
json.decode(response.body) as Map<String, dynamic>;
if (httpStatusCode == HttpStatus.ok) return ConsentDocument._(responseJson);
// All other cases are treated as an error.
throw CarpServiceException.fromMap(httpStatusCode, responseJson);
}