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,
    super.replyUrl,
    super.replyTo,
    super.parentThreadId,
    super.threadId,
    super.from,
    List<String>? super.to,
    super.createdTime,
    super.expiresTime,
    super.pleaseAck,
    super.fromPrior,
    super.additionalHeaders,
    super.webRedirect,
    super.returnRoute,
    super.typ})
    : super(
          type: DidcommMessages.requestCredential,
          id: id ?? Uuid().v4(),
          body: {}) {
  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,
          mediaType: 'application/json'));
    }
  }
  if (credentialApplication != null) {
    attachments ??= [];
    attachments!.add(Attachment(
        data: AttachmentData(json: credentialApplication!.toJson()),
        id: Uuid().v4(),
        format: AttachmentFormat.credentialApplication,
        mediaType: 'application/json'));
  }
}