batchGetRevisions method

Future<({List<String> notFound, List<RevisionResponse> revisions})> batchGetRevisions({
  1. List<String>? revisionKrefs,
  2. List<String>? itemKrefs,
  3. String tag = 'latest',
  4. bool allowPartial = true,
})
inherited

Batch-fetches multiple revisions in a single call.

Supports direct revisionKrefs and/or itemKrefs resolved with tag (default "latest"). When allowPartial is true, missing krefs are returned in notFound instead of throwing. Mirrors Python's batch_get_revisions, returning (revisions, notFound).

Implementation

Future<({List<RevisionResponse> revisions, List<String> notFound})>
    batchGetRevisions({
  List<String>? revisionKrefs,
  List<String>? itemKrefs,
  String tag = 'latest',
  bool allowPartial = true,
}) async {
  final request = BatchGetRevisionsRequest()
    ..tag = tag
    ..allowPartial = allowPartial;
  if (revisionKrefs != null) {
    request.revisionKrefs.addAll(revisionKrefs.map((k) => Kref(uri: k)));
  }
  if (itemKrefs != null) {
    request.itemKrefs.addAll(itemKrefs.map((k) => Kref(uri: k)));
  }
  final response =
      await stub.batchGetRevisions(request, options: callOptions);
  return (
    revisions: response.revisions.toList(),
    notFound: response.notFound.toList(),
  );
}