getFromRecurringDonation static method

Future<PcoCollection<PcoGivingPaymentMethod>> getFromRecurringDonation(
  1. String recurringDonationId, {
  2. String? id,
  3. PcoGivingPaymentMethodQuery? query,
  4. bool getAll = false,
})

Will get a PcoCollection of PcoGivingPaymentMethod objects (expecting many) using a path like this: /giving/v2/recurring_donations/$recurringDonationId/payment_method

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<PcoGivingPaymentMethod>> getFromRecurringDonation(
  String recurringDonationId, {
  String? id,
  PcoGivingPaymentMethodQuery? query,
  bool getAll = false,
}) async {
  query ??= PcoGivingPaymentMethodQuery();
  if (getAll) query.getAll = true;

  var url =
      '/giving/v2/recurring_donations/$recurringDonationId/payment_method';
  if (id != null) url += '/$id';
  return PcoCollection.fromApiCall<PcoGivingPaymentMethod>(url,
      query: query, apiVersion: kApiVersion);
}