getFromBatchGroup static method

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

Will get a PcoCollection of PcoGivingBatch objects (expecting many) using a path like this: /giving/v2/batch_groups/$batchGroupId/batches

Available Query Filters:

  • committed
  • in_progress

Getting a PcoCollection is useful even when retrieving a single object because it contains error data and helper functions.

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<PcoCollection<PcoGivingBatch>> getFromBatchGroup(
  String batchGroupId, {
  String? id,
  PcoGivingBatchQuery? query,
  bool getAll = false,
  bool includeAllRelated = false,
  bool includeBatchGroup = false,
  bool includeOwner = false,
}) async {
  query ??= PcoGivingBatchQuery();
  if (getAll) query.getAll = true;
  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';
  if (id != null) url += '/$id';
  return PcoCollection.fromApiCall<PcoGivingBatch>(url,
      query: query, apiVersion: kApiVersion);
}