getFromDonationAndRefund static method

Future<PcoCollection<PcoGivingDesignationRefund>> getFromDonationAndRefund(
  1. String donationId,
  2. String refundId, {
  3. String? id,
  4. PcoGivingDesignationRefundQuery? query,
  5. bool getAll = false,
  6. bool includeDesignation = false,
})

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

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<PcoGivingDesignationRefund>>
    getFromDonationAndRefund(
  String donationId,
  String refundId, {
  String? id,
  PcoGivingDesignationRefundQuery? query,
  bool getAll = false,
  bool includeDesignation = false,
}) async {
  query ??= PcoGivingDesignationRefundQuery();
  if (getAll) query.getAll = true;

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