listActions method

Future<List<ActionDoc>> listActions({
  1. required String operator,
  2. required String name,
  3. String? accountId,
  4. Uint8List? contextId,
  5. int minTxId = 0,
  6. int maxTxId = 0,
  7. int limit = 10,
})

Implementation

Future<List<ActionDoc>> listActions({
  required String operator,
  required String name,
  String? accountId,
  Uint8List? contextId,
  int minTxId = 0,
  int maxTxId = 0,
  int limit = 10,
}) async {
  final request = ListActionsRequest()
    ..name = name
    ..minTxId = Int64(minTxId)
    ..maxTxId = Int64(maxTxId)
    ..limit = Int64(limit);
  if (accountId != null) {
    request.accountId = hex.decode(accountId);
  } else if (contextId != null) {
    request.contextId = contextId;
  } else {
    throw Exception(
      'Missing filter, one of `accountId` or `contextId` must be non-null',
    );
  }

  final envelop = await requestEnvelope(request: request);
  final response =
      await getServiceClient(operator).query.listActions(envelop);

  return response.actions.map(ActionDoc.new).toList();
}