getFromBatch static method
Will get a PcoCollection of PcoGivingDonation objects (expecting many)
using a path like this: /giving/v2/batches/$batchId/donations
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<PcoGivingDonation>> getFromBatch(
String batchId, {
String? id,
PcoGivingDonationQuery? query,
bool getAll = false,
bool includeAllRelated = false,
bool includeDesignations = false,
bool includeLabels = false,
bool includeNote = false,
bool includeRefund = false,
}) async {
query ??= PcoGivingDonationQuery();
if (getAll) query.getAll = true;
if (includeAllRelated) query.include.addAll(PcoGivingDonation.canInclude);
if (includeDesignations) query.include.add('designations');
if (includeLabels) query.include.add('labels');
if (includeNote) query.include.add('note');
if (includeRefund) query.include.add('refund');
var url = '/giving/v2/batches/$batchId/donations';
if (id != null) url += '/$id';
return PcoCollection.fromApiCall<PcoGivingDonation>(url,
query: query, apiVersion: kApiVersion);
}