PcoGivingPledge constructor

PcoGivingPledge({
  1. String? id,
  2. DateTime? createdAt,
  3. DateTime? updatedAt,
  4. int? amountCents,
  5. String? amountCurrency,
  6. int? jointGiverAmountCents,
  7. int? donatedTotalCents,
  8. int? jointGiverDonatedTotalCents,
  9. String? personId,
  10. String? pledgeCampaignId,
  11. Map<String, List<PcoResource>>? withRelationships,
  12. List<PcoResource>? withIncluded,
})

Create a new PcoGivingPledge object. This object cannot be created with the API

NOTES:

  • Creating an instance of a class this way does not save it on the server.
  • This object cannot be saved directly to the server.
  • Only set the id field if you know what you are doing. Save operations will overwrite data when the id is set.
  • Dummy data can be supplied for a required parameter, but if so, .save() should not be called on the object
  • FIELDS USED WHEN CREATING: amountCents, personId, pledgeCampaignId
  • FIELDS USED WHEN UPDATING: amountCents

Implementation

factory PcoGivingPledge(
    {String? id,
    DateTime? createdAt,
    DateTime? updatedAt,
    int? amountCents,
    String? amountCurrency,
    int? jointGiverAmountCents,
    int? donatedTotalCents,
    int? jointGiverDonatedTotalCents,
    String? personId,
    String? pledgeCampaignId,
    Map<String, List<PcoResource>>? withRelationships,
    List<PcoResource>? withIncluded}) {
  var obj = PcoGivingPledge.empty();
  obj._id = id;
  if (createdAt != null)
    obj._attributes['created_at'] = createdAt.toIso8601String();
  if (updatedAt != null)
    obj._attributes['updated_at'] = updatedAt.toIso8601String();
  if (amountCents != null) obj._attributes['amount_cents'] = amountCents;
  if (amountCurrency != null)
    obj._attributes['amount_currency'] = amountCurrency;
  if (jointGiverAmountCents != null)
    obj._attributes['joint_giver_amount_cents'] = jointGiverAmountCents;
  if (donatedTotalCents != null)
    obj._attributes['donated_total_cents'] = donatedTotalCents;
  if (jointGiverDonatedTotalCents != null)
    obj._attributes['joint_giver_donated_total_cents'] =
        jointGiverDonatedTotalCents;
  if (personId != null) obj._attributes['person_id'] = personId;
  if (pledgeCampaignId != null)
    obj._attributes['pledge_campaign_id'] = pledgeCampaignId;

  if (withRelationships != null) {
    for (var r in withRelationships.entries) {
      obj._relationships[r.key] = r.value;
    }
    obj._hasManualRelationships = true;
  }

  if (withIncluded != null) {
    obj._included.addAll(withIncluded);
    obj._hasManualIncluded = true;
  }

  return obj;
}