PcoServicesMedia constructor

PcoServicesMedia({
  1. String? id,
  2. DateTime? createdAt,
  3. DateTime? updatedAt,
  4. String? themes,
  5. String? title,
  6. String? thumbnailFileName,
  7. String? thumbnailContentType,
  8. int? thumbnailFileSize,
  9. DateTime? thumbnailUpdatedAt,
  10. String? previewFileName,
  11. String? previewContentType,
  12. int? previewFileSize,
  13. DateTime? previewUpdatedAt,
  14. int? length,
  15. String? mediaType,
  16. String? mediaTypeName,
  17. String? thumbnailUrl,
  18. String? creatorName,
  19. String? previewUrl,
  20. String? imageUrl,
  21. Map<String, List<PcoResource>>? withRelationships,
  22. List<PcoResource>? withIncluded,
})

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

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: mediaType, title, creatorName, themes
  • FIELDS USED WHEN UPDATING: mediaType, title, creatorName, themes

Implementation

factory PcoServicesMedia(
    {String? id,
    DateTime? createdAt,
    DateTime? updatedAt,
    String? themes,
    String? title,
    String? thumbnailFileName,
    String? thumbnailContentType,
    int? thumbnailFileSize,
    DateTime? thumbnailUpdatedAt,
    String? previewFileName,
    String? previewContentType,
    int? previewFileSize,
    DateTime? previewUpdatedAt,
    int? length,
    String? mediaType,
    String? mediaTypeName,
    String? thumbnailUrl,
    String? creatorName,
    String? previewUrl,
    String? imageUrl,
    Map<String, List<PcoResource>>? withRelationships,
    List<PcoResource>? withIncluded}) {
  var obj = PcoServicesMedia.empty();
  obj._id = id;
  obj._apiPathOverride =
      'https://api.planningcenteronline.com/services/v2/media';
  if (createdAt != null)
    obj._attributes['created_at'] = createdAt.toIso8601String();
  if (updatedAt != null)
    obj._attributes['updated_at'] = updatedAt.toIso8601String();
  if (themes != null) obj._attributes['themes'] = themes;
  if (title != null) obj._attributes['title'] = title;
  if (thumbnailFileName != null)
    obj._attributes['thumbnail_file_name'] = thumbnailFileName;
  if (thumbnailContentType != null)
    obj._attributes['thumbnail_content_type'] = thumbnailContentType;
  if (thumbnailFileSize != null)
    obj._attributes['thumbnail_file_size'] = thumbnailFileSize;
  if (thumbnailUpdatedAt != null)
    obj._attributes['thumbnail_updated_at'] =
        thumbnailUpdatedAt.toIso8601String();
  if (previewFileName != null)
    obj._attributes['preview_file_name'] = previewFileName;
  if (previewContentType != null)
    obj._attributes['preview_content_type'] = previewContentType;
  if (previewFileSize != null)
    obj._attributes['preview_file_size'] = previewFileSize;
  if (previewUpdatedAt != null)
    obj._attributes['preview_updated_at'] =
        previewUpdatedAt.toIso8601String();
  if (length != null) obj._attributes['length'] = length;
  if (mediaType != null) obj._attributes['media_type'] = mediaType;
  if (mediaTypeName != null)
    obj._attributes['media_type_name'] = mediaTypeName;
  if (thumbnailUrl != null) obj._attributes['thumbnail_url'] = thumbnailUrl;
  if (creatorName != null) obj._attributes['creator_name'] = creatorName;
  if (previewUrl != null) obj._attributes['preview_url'] = previewUrl;
  if (imageUrl != null) obj._attributes['image_url'] = imageUrl;

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