PcoPeopleWorkflowCard constructor

PcoPeopleWorkflowCard({
  1. required String workflowId,
  2. String? id,
  3. DateTime? snoozeUntil,
  4. bool? isOverdue,
  5. String? stage,
  6. int? calculatedDueAtInDaysAgo,
  7. bool? isStickyAssignment,
  8. DateTime? createdAt,
  9. DateTime? updatedAt,
  10. DateTime? completedAt,
  11. DateTime? flaggedForNotificationAt,
  12. DateTime? removedAt,
  13. DateTime? movedToStepAt,
  14. String? assigneeId,
  15. String? personId,
  16. Map<String, List<PcoResource>>? withRelationships,
  17. List<PcoResource>? withIncluded,
})

Create a new PcoPeopleWorkflowCard object using this endpoint: https://api.planningcenteronline.com/people/v2/workflows/$workflowId/cards

NOTES:

  • Creating an instance of a class this way does not save it on the server.
  • Call save() on the object to save it 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: isStickyAssignment, assigneeId, personId
  • FIELDS USED WHEN UPDATING: isStickyAssignment, assigneeId, personId

Implementation

factory PcoPeopleWorkflowCard(
    {required String workflowId,
    String? id,
    DateTime? snoozeUntil,
    bool? isOverdue,
    String? stage,
    int? calculatedDueAtInDaysAgo,
    bool? isStickyAssignment,
    DateTime? createdAt,
    DateTime? updatedAt,
    DateTime? completedAt,
    DateTime? flaggedForNotificationAt,
    DateTime? removedAt,
    DateTime? movedToStepAt,
    String? assigneeId,
    String? personId,
    Map<String, List<PcoResource>>? withRelationships,
    List<PcoResource>? withIncluded}) {
  var obj = PcoPeopleWorkflowCard.empty();
  obj._id = id;
  obj._apiPathOverride =
      'https://api.planningcenteronline.com/people/v2/workflows/$workflowId/cards';
  if (snoozeUntil != null)
    obj._attributes['snooze_until'] = snoozeUntil.toIso8601String();
  if (isOverdue != null) obj._attributes['overdue'] = isOverdue;
  if (stage != null) obj._attributes['stage'] = stage;
  if (calculatedDueAtInDaysAgo != null)
    obj._attributes['calculated_due_at_in_days_ago'] =
        calculatedDueAtInDaysAgo;
  if (isStickyAssignment != null)
    obj._attributes['sticky_assignment'] = isStickyAssignment;
  if (createdAt != null)
    obj._attributes['created_at'] = createdAt.toIso8601String();
  if (updatedAt != null)
    obj._attributes['updated_at'] = updatedAt.toIso8601String();
  if (completedAt != null)
    obj._attributes['completed_at'] = completedAt.toIso8601String();
  if (flaggedForNotificationAt != null)
    obj._attributes['flagged_for_notification_at'] =
        flaggedForNotificationAt.toIso8601String();
  if (removedAt != null)
    obj._attributes['removed_at'] = removedAt.toIso8601String();
  if (movedToStepAt != null)
    obj._attributes['moved_to_step_at'] = movedToStepAt.toIso8601String();
  if (assigneeId != null) obj._attributes['assignee_id'] = assigneeId;
  if (personId != null) obj._attributes['person_id'] = personId;

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