PcoServicesPlanPerson constructor

PcoServicesPlanPerson({
  1. required String serviceTypeId,
  2. required String planId,
  3. String? id,
  4. String? status,
  5. DateTime? createdAt,
  6. DateTime? updatedAt,
  7. String? notes,
  8. String? declineReason,
  9. String? name,
  10. String? notificationChangedByName,
  11. String? notificationSenderName,
  12. String? teamPositionName,
  13. String? photoThumbnail,
  14. String? scheduledByName,
  15. DateTime? statusUpdatedAt,
  16. DateTime? notificationChangedAt,
  17. DateTime? notificationPreparedAt,
  18. DateTime? notificationReadAt,
  19. DateTime? notificationSentAt,
  20. bool? isPrepareNotification,
  21. bool? isCanAcceptPartial,
  22. String? personId,
  23. String? respondsToId,
  24. Map<String, List<PcoResource>>? withRelationships,
  25. List<PcoResource>? withIncluded,
})

Create a new PcoServicesPlanPerson object using this endpoint: https://api.planningcenteronline.com/services/v2/service_types/$serviceTypeId/plans/$planId/team_members

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: personId, status, declineReason, notes, teamPositionName, respondsToId, isPrepareNotification, notificationPreparedAt
  • FIELDS USED WHEN UPDATING: personId, status, declineReason, notes, teamPositionName, respondsToId, isPrepareNotification, notificationPreparedAt

Implementation

factory PcoServicesPlanPerson(
    {required String serviceTypeId,
    required String planId,
    String? id,
    String? status,
    DateTime? createdAt,
    DateTime? updatedAt,
    String? notes,
    String? declineReason,
    String? name,
    String? notificationChangedByName,
    String? notificationSenderName,
    String? teamPositionName,
    String? photoThumbnail,
    String? scheduledByName,
    DateTime? statusUpdatedAt,
    DateTime? notificationChangedAt,
    DateTime? notificationPreparedAt,
    DateTime? notificationReadAt,
    DateTime? notificationSentAt,
    bool? isPrepareNotification,
    bool? isCanAcceptPartial,
    String? personId,
    String? respondsToId,
    Map<String, List<PcoResource>>? withRelationships,
    List<PcoResource>? withIncluded}) {
  var obj = PcoServicesPlanPerson.empty();
  obj._id = id;
  obj._apiPathOverride =
      'https://api.planningcenteronline.com/services/v2/service_types/$serviceTypeId/plans/$planId/team_members';
  if (status != null) obj._attributes['status'] = status;
  if (createdAt != null)
    obj._attributes['created_at'] = createdAt.toIso8601String();
  if (updatedAt != null)
    obj._attributes['updated_at'] = updatedAt.toIso8601String();
  if (notes != null) obj._attributes['notes'] = notes;
  if (declineReason != null)
    obj._attributes['decline_reason'] = declineReason;
  if (name != null) obj._attributes['name'] = name;
  if (notificationChangedByName != null)
    obj._attributes['notification_changed_by_name'] =
        notificationChangedByName;
  if (notificationSenderName != null)
    obj._attributes['notification_sender_name'] = notificationSenderName;
  if (teamPositionName != null)
    obj._attributes['team_position_name'] = teamPositionName;
  if (photoThumbnail != null)
    obj._attributes['photo_thumbnail'] = photoThumbnail;
  if (scheduledByName != null)
    obj._attributes['scheduled_by_name'] = scheduledByName;
  if (statusUpdatedAt != null)
    obj._attributes['status_updated_at'] = statusUpdatedAt.toIso8601String();
  if (notificationChangedAt != null)
    obj._attributes['notification_changed_at'] =
        notificationChangedAt.toIso8601String();
  if (notificationPreparedAt != null)
    obj._attributes['notification_prepared_at'] =
        notificationPreparedAt.toIso8601String();
  if (notificationReadAt != null)
    obj._attributes['notification_read_at'] =
        notificationReadAt.toIso8601String();
  if (notificationSentAt != null)
    obj._attributes['notification_sent_at'] =
        notificationSentAt.toIso8601String();
  if (isPrepareNotification != null)
    obj._attributes['prepare_notification'] = isPrepareNotification;
  if (isCanAcceptPartial != null)
    obj._attributes['can_accept_partial'] = isCanAcceptPartial;
  if (personId != null) obj._attributes['person_id'] = personId;
  if (respondsToId != null) obj._attributes['responds_to_id'] = respondsToId;

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