getSingleFromPledgeCampaign static method
Will get a single PcoGivingPledge
object
using a path like this: /giving/v2/pledge_campaigns/$pledgeCampaignId/pledges/[id]
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<PcoGivingPledge?> getSingleFromPledgeCampaign(
String pledgeCampaignId,
String id, {
PcoGivingPledgeQuery? query,
bool includeAllRelated = false,
bool includeJointGiver = false,
bool includePledgeCampaign = false,
}) async {
query ??= PcoGivingPledgeQuery();
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/pledge_campaigns/$pledgeCampaignId/pledges/$id';
var retval = await PcoCollection.fromApiCall<PcoGivingPledge>(url,
query: query, apiVersion: kApiVersion);
return retval.items.isEmpty ? null : retval.items.first;
}