PcoGivingPledgeCampaign constructor

PcoGivingPledgeCampaign({
  1. String? id,
  2. DateTime? createdAt,
  3. DateTime? updatedAt,
  4. String? name,
  5. String? description,
  6. DateTime? startsAt,
  7. DateTime? endsAt,
  8. int? goalCents,
  9. String? goalCurrency,
  10. bool? isShowGoalInChurchCenter,
  11. int? receivedTotalFromPledgesCents,
  12. int? receivedTotalOutsideOfPledgesCents,
  13. String? fundId,
  14. Map<String, List<PcoResource>>? withRelationships,
  15. List<PcoResource>? withIncluded,
})

Create a new PcoGivingPledgeCampaign 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: name, description, startsAt, endsAt, goalCents, isShowGoalInChurchCenter, fundId
  • FIELDS USED WHEN UPDATING: name, description, startsAt, endsAt, goalCents, isShowGoalInChurchCenter, fundId

Implementation

factory PcoGivingPledgeCampaign(
    {String? id,
    DateTime? createdAt,
    DateTime? updatedAt,
    String? name,
    String? description,
    DateTime? startsAt,
    DateTime? endsAt,
    int? goalCents,
    String? goalCurrency,
    bool? isShowGoalInChurchCenter,
    int? receivedTotalFromPledgesCents,
    int? receivedTotalOutsideOfPledgesCents,
    String? fundId,
    Map<String, List<PcoResource>>? withRelationships,
    List<PcoResource>? withIncluded}) {
  var obj = PcoGivingPledgeCampaign.empty();
  obj._id = id;
  if (createdAt != null)
    obj._attributes['created_at'] = createdAt.toIso8601String();
  if (updatedAt != null)
    obj._attributes['updated_at'] = updatedAt.toIso8601String();
  if (name != null) obj._attributes['name'] = name;
  if (description != null) obj._attributes['description'] = description;
  if (startsAt != null)
    obj._attributes['starts_at'] = startsAt.toIso8601String();
  if (endsAt != null) obj._attributes['ends_at'] = endsAt.toIso8601String();
  if (goalCents != null) obj._attributes['goal_cents'] = goalCents;
  if (goalCurrency != null) obj._attributes['goal_currency'] = goalCurrency;
  if (isShowGoalInChurchCenter != null)
    obj._attributes['show_goal_in_church_center'] = isShowGoalInChurchCenter;
  if (receivedTotalFromPledgesCents != null)
    obj._attributes['received_total_from_pledges_cents'] =
        receivedTotalFromPledgesCents;
  if (receivedTotalOutsideOfPledgesCents != null)
    obj._attributes['received_total_outside_of_pledges_cents'] =
        receivedTotalOutsideOfPledgesCents;
  if (fundId != null) obj._attributes['fund_id'] = fundId;

  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;
}