getFromDonation static method

Future<PcoCollection<PcoGivingRefund>> getFromDonation(
  1. String donationId, {
  2. String? id,
  3. PcoGivingRefundQuery? query,
  4. bool getAll = false,
  5. bool includeDesignationRefunds = false,
})

Will get a PcoCollection of PcoGivingRefund objects (expecting many) using a path like this: /giving/v2/donations/$donationId/refund

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<PcoGivingRefund>> getFromDonation(
  String donationId, {
  String? id,
  PcoGivingRefundQuery? query,
  bool getAll = false,
  bool includeDesignationRefunds = false,
}) async {
  query ??= PcoGivingRefundQuery();
  if (getAll) query.getAll = true;

  if (includeDesignationRefunds) query.include.add('designation_refunds');
  var url = '/giving/v2/donations/$donationId/refund';
  if (id != null) url += '/$id';
  return PcoCollection.fromApiCall<PcoGivingRefund>(url,
      query: query, apiVersion: kApiVersion);
}