getAllFromPerson static method

Future<PcoCollection<PcoGivingPledge>> getAllFromPerson(
  1. String personId,
  2. {String? id,
  3. PcoGivingPledgeQuery? query,
  4. bool includeAllRelated = false,
  5. bool includeJointGiver = false,
  6. bool includePledgeCampaign = false}
)

Will get a PcoCollection containing ALL PcoGivingPledge objects (expecting many) using a path like this: /giving/v2/people/$personId/pledges

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.

This function forces the query.getAll to be true.

Implementation

static Future<PcoCollection<PcoGivingPledge>> getAllFromPerson(
  String personId, {
  String? id,
  PcoGivingPledgeQuery? query,
  bool includeAllRelated = false,
  bool includeJointGiver = false,
  bool includePledgeCampaign = false,
}) async {
  query ??= PcoGivingPledgeQuery();
  query.getAll = true;
  if (includeAllRelated) query.include.addAll(PcoGivingPledge.canInclude);
  if (includeJointGiver) query.include.add('joint_giver');
  if (includePledgeCampaign) query.include.add('pledge_campaign');
  var url = '/giving/v2/people/$personId/pledges';
  if (id != null) url += '/$id';
  return PcoCollection.fromApiCall<PcoGivingPledge>(url,
      query: query, apiVersion: kApiVersion);
}