PcoPeopleWorkflowStep constructor

PcoPeopleWorkflowStep({
  1. required String workflowId,
  2. String? id,
  3. String? name,
  4. DateTime? createdAt,
  5. DateTime? updatedAt,
  6. int? sequence,
  7. String? description,
  8. int? autoSnoozeDays,
  9. int? autoSnoozeValue,
  10. String? autoSnoozeInterval,
  11. int? expectedResponseTimeInDays,
  12. int? myReadyCardCount,
  13. int? totalReadyCardCount,
  14. String? defaultAssigneeId,
  15. Map<String, List<PcoResource>>? withRelationships,
  16. List<PcoResource>? withIncluded,
})

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

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: sequence, name
  • FIELDS USED WHEN UPDATING: sequence, name

Implementation

factory PcoPeopleWorkflowStep(
    {required String workflowId,
    String? id,
    String? name,
    DateTime? createdAt,
    DateTime? updatedAt,
    int? sequence,
    String? description,
    int? autoSnoozeDays,
    int? autoSnoozeValue,
    String? autoSnoozeInterval,
    int? expectedResponseTimeInDays,
    int? myReadyCardCount,
    int? totalReadyCardCount,
    String? defaultAssigneeId,
    Map<String, List<PcoResource>>? withRelationships,
    List<PcoResource>? withIncluded}) {
  var obj = PcoPeopleWorkflowStep.empty();
  obj._id = id;
  obj._apiPathOverride =
      'https://api.planningcenteronline.com/people/v2/workflows/$workflowId/steps';
  if (name != null) obj._attributes['name'] = name;
  if (createdAt != null)
    obj._attributes['created_at'] = createdAt.toIso8601String();
  if (updatedAt != null)
    obj._attributes['updated_at'] = updatedAt.toIso8601String();
  if (sequence != null) obj._attributes['sequence'] = sequence;
  if (description != null) obj._attributes['description'] = description;
  if (autoSnoozeDays != null)
    obj._attributes['auto_snooze_days'] = autoSnoozeDays;
  if (autoSnoozeValue != null)
    obj._attributes['auto_snooze_value'] = autoSnoozeValue;
  if (autoSnoozeInterval != null)
    obj._attributes['auto_snooze_interval'] = autoSnoozeInterval;
  if (expectedResponseTimeInDays != null)
    obj._attributes['expected_response_time_in_days'] =
        expectedResponseTimeInDays;
  if (myReadyCardCount != null)
    obj._attributes['my_ready_card_count'] = myReadyCardCount;
  if (totalReadyCardCount != null)
    obj._attributes['total_ready_card_count'] = totalReadyCardCount;
  if (defaultAssigneeId != null)
    obj._attributes['default_assignee_id'] = defaultAssigneeId;

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