getSingleFromBatchGroup static method

Future<PcoGivingBatch?> getSingleFromBatchGroup(
  1. String batchGroupId,
  2. String id, {
  3. PcoGivingBatchQuery? query,
  4. bool includeAllRelated = false,
  5. bool includeBatchGroup = false,
  6. bool includeOwner = false,
})

Will get a single PcoGivingBatch object using a path like this: /giving/v2/batch_groups/$batchGroupId/batches/[id]

Available Query Filters:

  • committed
  • in_progress

Additional options may be specified by using the query argument, but some query options are also available as boolean flags in this function call too.

Implementation

static Future<PcoGivingBatch?> getSingleFromBatchGroup(
  String batchGroupId,
  String id, {
  PcoGivingBatchQuery? query,
  bool includeAllRelated = false,
  bool includeBatchGroup = false,
  bool includeOwner = false,
}) async {
  query ??= PcoGivingBatchQuery();
  if (includeAllRelated) query.include.addAll(PcoGivingBatch.canInclude);
  if (includeBatchGroup) query.include.add('batch_group');
  if (includeOwner) query.include.add('owner');
  var url = '/giving/v2/batch_groups/$batchGroupId/batches/$id';
  var retval = await PcoCollection.fromApiCall<PcoGivingBatch>(url,
      query: query, apiVersion: kApiVersion);
  return retval.items.isEmpty ? null : retval.items.first;
}