PcoServicesServiceType constructor

PcoServicesServiceType(
  1. {String? id,
  2. DateTime? archivedAt,
  3. DateTime? createdAt,
  4. DateTime? deletedAt,
  5. String? name,
  6. int? sequence,
  7. DateTime? updatedAt,
  8. bool? isAttachmentTypesEnabled,
  9. String? backgroundCheckPermissions,
  10. String? commentPermissions,
  11. String? customItemTypes,
  12. String? frequency,
  13. String? lastPlanFrom,
  14. String? permissions,
  15. String? standardItemTypes,
  16. String? parentId,
  17. Map<String, List<PcoResource>>? withRelationships,
  18. List<PcoResource>? withIncluded}
)

Create a new PcoServicesServiceType object using this endpoint: https://api.planningcenteronline.com/services/v2/service_types

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: isAttachmentTypesEnabled, backgroundCheckPermissions, commentPermissions, customItemTypes, frequency, lastPlanFrom, name, parentId, sequence, standardItemTypes
  • FIELDS USED WHEN UPDATING: isAttachmentTypesEnabled, backgroundCheckPermissions, commentPermissions, customItemTypes, frequency, lastPlanFrom, name, parentId, sequence, standardItemTypes

Implementation

factory PcoServicesServiceType(
    {String? id,
    DateTime? archivedAt,
    DateTime? createdAt,
    DateTime? deletedAt,
    String? name,
    int? sequence,
    DateTime? updatedAt,
    bool? isAttachmentTypesEnabled,
    String? backgroundCheckPermissions,
    String? commentPermissions,
    String? customItemTypes,
    String? frequency,
    String? lastPlanFrom,
    String? permissions,
    String? standardItemTypes,
    String? parentId,
    Map<String, List<PcoResource>>? withRelationships,
    List<PcoResource>? withIncluded}) {
  var obj = PcoServicesServiceType.empty();
  obj._id = id;
  obj._apiPathOverride =
      'https://api.planningcenteronline.com/services/v2/service_types';
  if (archivedAt != null)
    obj._attributes['archived_at'] = archivedAt.toIso8601String();
  if (createdAt != null)
    obj._attributes['created_at'] = createdAt.toIso8601String();
  if (deletedAt != null)
    obj._attributes['deleted_at'] = deletedAt.toIso8601String();
  if (name != null) obj._attributes['name'] = name;
  if (sequence != null) obj._attributes['sequence'] = sequence;
  if (updatedAt != null)
    obj._attributes['updated_at'] = updatedAt.toIso8601String();
  if (isAttachmentTypesEnabled != null)
    obj._attributes['attachment_types_enabled'] = isAttachmentTypesEnabled;
  if (backgroundCheckPermissions != null)
    obj._attributes['background_check_permissions'] =
        backgroundCheckPermissions;
  if (commentPermissions != null)
    obj._attributes['comment_permissions'] = commentPermissions;
  if (customItemTypes != null)
    obj._attributes['custom_item_types'] = customItemTypes;
  if (frequency != null) obj._attributes['frequency'] = frequency;
  if (lastPlanFrom != null) obj._attributes['last_plan_from'] = lastPlanFrom;
  if (permissions != null) obj._attributes['permissions'] = permissions;
  if (standardItemTypes != null)
    obj._attributes['standard_item_types'] = standardItemTypes;
  if (parentId != null) obj._attributes['parent_id'] = parentId;

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