PcoServicesSong constructor

PcoServicesSong({
  1. String? id,
  2. String? title,
  3. DateTime? createdAt,
  4. DateTime? updatedAt,
  5. String? admin,
  6. String? author,
  7. String? copyright,
  8. bool? isHidden,
  9. String? notes,
  10. String? themes,
  11. String? lastScheduledShortDates,
  12. DateTime? lastScheduledAt,
  13. int? ccliNumber,
  14. Map<String, List<PcoResource>>? withRelationships,
  15. List<PcoResource>? withIncluded,
})

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

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: title, admin, author, copyright, ccliNumber, isHidden, themes
  • FIELDS USED WHEN UPDATING: title, admin, author, copyright, ccliNumber, isHidden, themes

Implementation

factory PcoServicesSong(
    {String? id,
    String? title,
    DateTime? createdAt,
    DateTime? updatedAt,
    String? admin,
    String? author,
    String? copyright,
    bool? isHidden,
    String? notes,
    String? themes,
    String? lastScheduledShortDates,
    DateTime? lastScheduledAt,
    int? ccliNumber,
    Map<String, List<PcoResource>>? withRelationships,
    List<PcoResource>? withIncluded}) {
  var obj = PcoServicesSong.empty();
  obj._id = id;
  obj._apiPathOverride =
      'https://api.planningcenteronline.com/services/v2/songs';
  if (title != null) obj._attributes['title'] = title;
  if (createdAt != null)
    obj._attributes['created_at'] = createdAt.toIso8601String();
  if (updatedAt != null)
    obj._attributes['updated_at'] = updatedAt.toIso8601String();
  if (admin != null) obj._attributes['admin'] = admin;
  if (author != null) obj._attributes['author'] = author;
  if (copyright != null) obj._attributes['copyright'] = copyright;
  if (isHidden != null) obj._attributes['hidden'] = isHidden;
  if (notes != null) obj._attributes['notes'] = notes;
  if (themes != null) obj._attributes['themes'] = themes;
  if (lastScheduledShortDates != null)
    obj._attributes['last_scheduled_short_dates'] = lastScheduledShortDates;
  if (lastScheduledAt != null)
    obj._attributes['last_scheduled_at'] = lastScheduledAt.toIso8601String();
  if (ccliNumber != null) obj._attributes['ccli_number'] = ccliNumber;

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