getFromPerson static method
Will get a PcoCollection
of PcoGivingPledge objects (expecting many)
using a path like this: /giving/v2/people/$personId/pledges
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<PcoGivingPledge>> getFromPerson(
String personId, {
String? id,
PcoGivingPledgeQuery? query,
bool getAll = false,
bool includeAllRelated = false,
bool includeJointGiver = false,
bool includePledgeCampaign = false,
}) async {
query ??= PcoGivingPledgeQuery();
if (getAll) 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);
}