PcoServicesMedia class

This class represents a PCO Services Media Object

Instantiation

  • Create a new instance using the PcoServicesMedia() constructor
  • Instantiate from existing JSON data using the PcoServicesMedia.fromJson() constructor.
  • Load an instance from the API using one of the static methods defined on this class.

Usage

  • Fields exposed by the API are readable through getter methods.
  • Fields writable by the API are exposed through setter methods.
  • Original json data is exposed through the read-only attributes map.
  • Additional data is available through the read-only links and relationships maps.
  • Available relationships / includes are exposed through typed getters.

Description

A piece of media

Attributes (and permissions)

  • id (ro) -> PCO: id
  • createdAt (ro) -> PCO: created_at
  • updatedAt (ro) -> PCO: updated_at
  • themes (rw) -> PCO: themes
  • title (rw) -> PCO: title
  • thumbnailFileName (ro) -> PCO: thumbnail_file_name
  • thumbnailContentType (ro) -> PCO: thumbnail_content_type
  • thumbnailFileSize (ro) -> PCO: thumbnail_file_size
  • thumbnailUpdatedAt (ro) -> PCO: thumbnail_updated_at
  • previewFileName (ro) -> PCO: preview_file_name
  • previewContentType (ro) -> PCO: preview_content_type
  • previewFileSize (ro) -> PCO: preview_file_size
  • previewUpdatedAt (ro) -> PCO: preview_updated_at
  • length (ro) -> PCO: length
  • mediaType (rw) -> PCO: media_type
  • mediaTypeName (ro) -> PCO: media_type_name
  • thumbnailUrl (ro) -> PCO: thumbnail_url
  • creatorName (rw) -> PCO: creator_name
  • previewUrl (ro) -> PCO: preview_url
  • imageUrl (ro) -> PCO: image_url

Edges and Actions

Outbound Edges:

Inbound Edges:

Actions:

Raw Data Object Example

{
  "type": "Media",
  "id": "1",
  "attributes": {
    "created_at": "2000-01-01T12:00:00Z",
    "updated_at": "2000-01-01T12:00:00Z",
    "themes": "string",
    "title": "string",
    "thumbnail_file_name": "string",
    "thumbnail_content_type": "string",
    "thumbnail_file_size": 1,
    "thumbnail_updated_at": "2000-01-01T12:00:00Z",
    "preview_file_name": "string",
    "preview_content_type": "string",
    "preview_file_size": 1,
    "preview_updated_at": "2000-01-01T12:00:00Z",
    "length": 1,
    "media_type": "string",
    "media_type_name": "string",
    "thumbnail_url": "string",
    "creator_name": "string",
    "preview_url": "string",
    "image_url": "string"
  },
  "relationships": {}
}
Inheritance

Constructors

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})
Create a new PcoServicesMedia object using this endpoint: https://api.planningcenteronline.com/services/v2/media
factory
PcoServicesMedia.empty()
Create an empty instance of this class. This is only useful when an endpoint requires related or included data.
PcoServicesMedia.fromJson(Map<String, dynamic> data, {List<Map<String, dynamic>>? withIncluded})

Properties

api PlanningCenter
planning center resources must be tied to an api
no setterinherited
apiEndpoint String
no setterinherited
apiPath String
PcoResources include their own path as a link object but this might be null if we haven't created/fetched the object yet Child classes should redefine this getter to allow for manual path overrides
no setteroverride
apiVersion String
child classes can override these getters which will allow methods in this class to see static variables from child classes
no setteroverride
attributes ReadOnlyMapView<String, dynamic>
contains the underlying attributes returned by the api and allows a user to access arbitrary data in the attributes by actual api name
no setterinherited
canCreate bool
no setteroverride
canDestroy bool
no setteroverride
canUpdate bool
no setteroverride
createAllowed List<String>
no setteroverride
createdAt DateTime
no setterinherited
createPathTemplate String
no setteroverride
creatorName String
pass null to remove key from attributes
getter/setter pair
defaultPathTemplate String
no setteroverride
fetched bool
indicate whether an item is full or partial
getter/setter pairinherited
hashCode int
The hash code for this object.
no setterinherited
id String?
no setterinherited
imageUrl String
no setter
included List<PcoResource>
contains included items parsed into objects
no setterinherited
includedAttachments List<PcoServicesAttachment>
no setter
length int
no setter
contains the links data returned by the api if present
no setterinherited
mediaType String
Possible Values:
getter/setter pair
mediaTypeName String
no setter
needsSave bool
no setterinherited
pcoApplication String
latefinalinherited
previewContentType String
no setter
previewFileName String
no setter
previewFileSize int
no setter
previewUpdatedAt DateTime
no setter
previewUrl String
no setter
relationships ReadOnlyMapView<String, List<PcoResource>>
contains relationships parsed into objects even though the api sends relationship objects as Maps or Lists we always put them into lists for consistency
no setterinherited
resourceType String
all planning center resources must have a type
latefinalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
slug String
no setterinherited
themes String
pass null to remove key from attributes
getter/setter pair
thumbnailContentType String
no setter
thumbnailFileName String
no setter
thumbnailFileSize int
no setter
thumbnailUpdatedAt DateTime
no setter
thumbnailUrl String
no setter
title String
pass null to remove key from attributes
getter/setter pair
updateAllowed List<String>
no setteroverride
updatedAt DateTime
no setterinherited

Methods

archive(Object data) Future<PlanningCenterApiResponse<PlanningCenterApiData>>
ACTION: archive
assignTags(Object data) Future<PlanningCenterApiResponse<PlanningCenterApiData>>
ACTION: assign_tags
coerceDouble(dynamic a) double
inherited
coerceInt(dynamic a) int
inherited
delete() Future<PlanningCenterApiResponse<PlanningCenterApiData>>
inherited
filteredAttributes(List<String> allowedKeys) Map<String, dynamic>
inherited
fromJson(Map<String, dynamic> data, {List<Map<String, dynamic>>? withIncluded}) → dynamic
Takes a full JSON:API Response Object (the contents of a "data" field) will clear and update id, apiPath, attributes and _relationships
inherited
getAttachments({PcoServicesAttachmentQuery? query}) Future<PcoCollection<PcoServicesAttachment>>
Will get a collection of PcoServicesAttachment objects (expecting many) using a path like this: https://api.planningcenteronline.com/services/v2/media/1/attachments
getMediaSchedules({PcoServicesMediaScheduleQuery? query}) Future<PcoCollection<PcoServicesMediaSchedule>>
Will get a collection of PcoServicesMediaSchedule objects (expecting many) using a path like this: https://api.planningcenteronline.com/services/v2/media/1/media_schedules
getTags({PcoServicesTagQuery? query}) Future<PcoCollection<PcoServicesTag>>
Will get a collection of PcoServicesTag objects (expecting many) using a path like this: https://api.planningcenteronline.com/services/v2/media/1/tags
handleIncludes(List<Map<String, dynamic>> included) → void
This function populates the relationships with typed resource objects based on the data in the included map of the json.
inherited
handleItem(Map<String, dynamic> data) PcoResource?
inherited
handleRelationships(Map<String, dynamic> items, [List<Map<String, dynamic>> included = const []]) Map<String, List<PcoResource>>
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
save({Map<String, PcoResource>? withRelated, List<PcoResource>? withIncluded}) Future<PlanningCenterApiResponse<PlanningCenterApiData>>
Many Planning Center endpoints allow or require additional relationships and/or included items to be sent with a create/update operation. Since these cannot always be determined by the automatic code generation, they may be included as arguments to the save operation.
inherited
toCreateResource() Map<String, dynamic>
create the attributes Map for this object without the id field using only the attributes allowed in create (post) operations
inherited
toDataMap({Map<String, PcoResource>? withRelated, List<PcoResource>? withIncluded}) Map<String, dynamic>
create a json-api Map for this object automatically selecting create or update based on the existence of the id field. Will result in something like this:
inherited
toIdResource() Map<String, dynamic>
returns the simplest representation of this resource with only the type and the id:
inherited
toJson({dynamic includeAttributes = true, dynamic includeRelationships = false}) Map<String, dynamic>
Some api requests only want the type and id of an object. In those cases, set includeAttributes to false or call toIdResource instead.
inherited
toString() String
A string representation of this object.
inherited
toUpdateResource() Map<String, dynamic>
create the attributes Map for this object using only the attributes allowed in update (patch) operations
inherited
unarchive(Object data) Future<PlanningCenterApiResponse<PlanningCenterApiData>>
ACTION: unarchive

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

canInclude List<String>
possible includes with parameter ?include=a,b
no setter
canOrderBy List<String>
possible orderings with parameter ?order=
no setter
canQuery List<String>
possible queries using parameters like ?wherekey=value or ?wheregt|lt=value
no setter

Static Methods

get({String? id, PcoServicesMediaQuery? query, bool getAll = false, bool includeAttachments = false}) Future<PcoCollection<PcoServicesMedia>>
Will get a PcoCollection of PcoServicesMedia objects (expecting many) using a path like this: /services/v2/media
getAll({String? id, PcoServicesMediaQuery? query, bool includeAttachments = false}) Future<PcoCollection<PcoServicesMedia>>
Will get a PcoCollection containing ALL PcoServicesMedia objects (expecting many) using a path like this: /services/v2/media
getAllFromServiceTypeAndPlanAndItem(String serviceTypeId, String planId, String itemId, {String? id, PcoServicesMediaQuery? query, bool includeAttachments = false}) Future<PcoCollection<PcoServicesMedia>>
Will get a PcoCollection containing ALL PcoServicesMedia objects (expecting many) using a path like this: /services/v2/service_types/$serviceTypeId/plans/$planId/items/$itemId/media
getFromServiceTypeAndPlanAndItem(String serviceTypeId, String planId, String itemId, {String? id, PcoServicesMediaQuery? query, bool getAll = false, bool includeAttachments = false}) Future<PcoCollection<PcoServicesMedia>>
Will get a PcoCollection of PcoServicesMedia objects (expecting many) using a path like this: /services/v2/service_types/$serviceTypeId/plans/$planId/items/$itemId/media
getSingle(String id, {PcoServicesMediaQuery? query, bool includeAttachments = false}) Future<PcoServicesMedia?>
Will get a single PcoServicesMedia object using a path like this: /services/v2/media/[id]
getSingleFromServiceTypeAndPlanAndItem(String serviceTypeId, String planId, String itemId, String id, {PcoServicesMediaQuery? query, bool includeAttachments = false}) Future<PcoServicesMedia?>
Will get a single PcoServicesMedia object using a path like this: /services/v2/service_types/$serviceTypeId/plans/$planId/items/$itemId/media/[id]