RequestCredential constructor

RequestCredential({
  1. String? id,
  2. String? goalCode,
  3. String? comment,
  4. List<LdProofVcDetail>? detail,
  5. VerifiablePresentation? credentialApplication,
  6. String? replyUrl,
  7. List<String>? replyTo,
  8. String? parentThreadId,
  9. String? threadId,
  10. String? from,
  11. List<String>? to,
  12. DateTime? createdTime,
  13. DateTime? expiresTime,
  14. bool pleaseAck = false,
  15. FromPriorJWT? fromPrior,
  16. Map<String, dynamic>? additionalHeaders,
  17. WebRedirect? webRedirect,
  18. ReturnRouteValue? returnRoute,
  19. DidcommMessageTyp? typ,
})

Implementation

RequestCredential(
    {String? id,
    this.goalCode,
    this.comment,
    this.detail,
    this.credentialApplication,
    String? replyUrl,
    List<String>? replyTo,
    String? parentThreadId,
    String? threadId,
    String? from,
    List<String>? to,
    DateTime? createdTime,
    DateTime? expiresTime,
    bool pleaseAck = false,
    FromPriorJWT? fromPrior,
    Map<String, dynamic>? additionalHeaders,
    WebRedirect? webRedirect,
    ReturnRouteValue? returnRoute,
    DidcommMessageTyp? typ})
    : super(
          type: DidcommMessages.requestCredential.value,
          id: id ?? Uuid().v4(),
          body: {},
          replyUrl: replyUrl,
          replyTo: replyTo,
          threadId: threadId,
          parentThreadId: parentThreadId,
          from: from,
          to: to,
          createdTime: createdTime,
          expiresTime: expiresTime,
          pleaseAck: pleaseAck,
          fromPrior: fromPrior,
          additionalHeaders: additionalHeaders,
          webRedirect: webRedirect,
          returnRoute: returnRoute,
          typ: typ) {
  if (comment != null) body['comment'] = comment;
  if (goalCode != null) body['goal_code'] = goalCode;
  if (detail != null) {
    attachments = [];
    for (var a in detail!) {
      attachments!.add(Attachment(
          data: AttachmentData(json: a.toJson()),
          id: Uuid().v4(),
          format: AttachmentFormat.ldProofVcDetail.value,
          mediaType: 'application/json'));
    }
  }
  if (credentialApplication != null) {
    attachments ??= [];
    attachments!.add(Attachment(
        data: AttachmentData(json: credentialApplication!.toJson()),
        id: Uuid().v4(),
        format: AttachmentFormat.credentialApplication.value,
        mediaType: 'application/json'));
  }
}