getRevision method

Future<GetRevisionResponse> getRevision({
  1. required ValueHolder blockAddress,
  2. required String documentId,
  3. required String name,
  4. ValueHolder? digestTipAddress,
})

Returns a revision data object for a specified document ID and block address. Also returns a proof of the specified revision for verification if DigestTipAddress is provided.

May throw InvalidParameterException. May throw ResourceNotFoundException. May throw ResourcePreconditionNotMetException.

Parameter blockAddress : The block location of the document revision to be verified. An address is an Amazon Ion structure that has two fields: strandId and sequenceNo.

For example: {strandId:"BlFTjlSXze9BIh1KOszcE3",sequenceNo:14}

Parameter documentId : The unique ID of the document to be verified.

Parameter name : The name of the ledger.

Parameter digestTipAddress : The latest block location covered by the digest for which to request a proof. An address is an Amazon Ion structure that has two fields: strandId and sequenceNo.

For example: {strandId:"BlFTjlSXze9BIh1KOszcE3",sequenceNo:49}

Implementation

Future<GetRevisionResponse> getRevision({
  required ValueHolder blockAddress,
  required String documentId,
  required String name,
  ValueHolder? digestTipAddress,
}) async {
  ArgumentError.checkNotNull(blockAddress, 'blockAddress');
  ArgumentError.checkNotNull(documentId, 'documentId');
  _s.validateStringLength(
    'documentId',
    documentId,
    22,
    22,
    isRequired: true,
  );
  ArgumentError.checkNotNull(name, 'name');
  _s.validateStringLength(
    'name',
    name,
    1,
    32,
    isRequired: true,
  );
  final $payload = <String, dynamic>{
    'BlockAddress': blockAddress,
    'DocumentId': documentId,
    if (digestTipAddress != null) 'DigestTipAddress': digestTipAddress,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/ledgers/${Uri.encodeComponent(name)}/revision',
    exceptionFnMap: _exceptionFns,
  );
  return GetRevisionResponse.fromJson(response);
}