getFromPledge static method
Future<PcoCollection<PcoGivingPledgeCampaign> >
getFromPledge(
- String pledgeId, {
- PcoGivingPledgeCampaignQuery? query,
- bool getAll = false,
- bool includeFund = false,
Will get a PcoCollection
of PcoGivingPledgeCampaign objects (expecting one)
using a path like this: /giving/v2/pledges/$pledgeId/pledge_campaign
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<PcoGivingPledgeCampaign>> getFromPledge(
String pledgeId, {
PcoGivingPledgeCampaignQuery? query,
bool getAll = false,
bool includeFund = false,
}) async {
query ??= PcoGivingPledgeCampaignQuery();
if (getAll) query.getAll = true;
if (includeFund) query.include.add('fund');
var url = '/giving/v2/pledges/$pledgeId/pledge_campaign';
return PcoCollection.fromApiCall<PcoGivingPledgeCampaign>(url,
query: query, apiVersion: kApiVersion);
}