getFromCampus static method

Future<PcoCollection<PcoGivingDonation>> getFromCampus(
  1. String campusId, {
  2. String? id,
  3. PcoGivingDonationQuery? query,
  4. bool getAll = false,
  5. bool includeAllRelated = false,
  6. bool includeDesignations = false,
  7. bool includeLabels = false,
  8. bool includeNote = false,
  9. bool includeRefund = false,
})

Will get a PcoCollection of PcoGivingDonation objects (expecting many) using a path like this: /giving/v2/campuses/$campusId/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>> getFromCampus(
  String campusId, {
  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/campuses/$campusId/donations';
  if (id != null) url += '/$id';
  return PcoCollection.fromApiCall<PcoGivingDonation>(url,
      query: query, apiVersion: kApiVersion);
}