PcoServicesTeam constructor

PcoServicesTeam({
  1. required String serviceTypeId,
  2. String? id,
  3. String? name,
  4. bool? isRehearsalTeam,
  5. int? sequence,
  6. String? scheduleTo,
  7. String? defaultStatus,
  8. bool? isDefaultPrepareNotifications,
  9. DateTime? createdAt,
  10. DateTime? updatedAt,
  11. DateTime? archivedAt,
  12. bool? isAssignedDirectly,
  13. bool? isSecureTeam,
  14. String? lastPlanFrom,
  15. String? stageColor,
  16. String? stageVariant,
  17. Map<String, List<PcoResource>>? withRelationships,
  18. List<PcoResource>? withIncluded,
})

Create a new PcoServicesTeam object using this endpoint: https://api.planningcenteronline.com/services/v2/service_types/$serviceTypeId/teams

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: name, archivedAt, isAssignedDirectly, isRehearsalTeam, scheduleTo, stageColor, stageVariant
  • FIELDS USED WHEN UPDATING: none

Implementation

factory PcoServicesTeam(
    {required String serviceTypeId,
    String? id,
    String? name,
    bool? isRehearsalTeam,
    int? sequence,
    String? scheduleTo,
    String? defaultStatus,
    bool? isDefaultPrepareNotifications,
    DateTime? createdAt,
    DateTime? updatedAt,
    DateTime? archivedAt,
    bool? isAssignedDirectly,
    bool? isSecureTeam,
    String? lastPlanFrom,
    String? stageColor,
    String? stageVariant,
    Map<String, List<PcoResource>>? withRelationships,
    List<PcoResource>? withIncluded}) {
  var obj = PcoServicesTeam.empty();
  obj._id = id;
  obj._apiPathOverride =
      'https://api.planningcenteronline.com/services/v2/service_types/$serviceTypeId/teams';
  if (name != null) obj._attributes['name'] = name;
  if (isRehearsalTeam != null)
    obj._attributes['rehearsal_team'] = isRehearsalTeam;
  if (sequence != null) obj._attributes['sequence'] = sequence;
  if (scheduleTo != null) obj._attributes['schedule_to'] = scheduleTo;
  if (defaultStatus != null)
    obj._attributes['default_status'] = defaultStatus;
  if (isDefaultPrepareNotifications != null)
    obj._attributes['default_prepare_notifications'] =
        isDefaultPrepareNotifications;
  if (createdAt != null)
    obj._attributes['created_at'] = createdAt.toIso8601String();
  if (updatedAt != null)
    obj._attributes['updated_at'] = updatedAt.toIso8601String();
  if (archivedAt != null)
    obj._attributes['archived_at'] = archivedAt.toIso8601String();
  if (isAssignedDirectly != null)
    obj._attributes['assigned_directly'] = isAssignedDirectly;
  if (isSecureTeam != null) obj._attributes['secure_team'] = isSecureTeam;
  if (lastPlanFrom != null) obj._attributes['last_plan_from'] = lastPlanFrom;
  if (stageColor != null) obj._attributes['stage_color'] = stageColor;
  if (stageVariant != null) obj._attributes['stage_variant'] = stageVariant;

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