A piece of media
| Property | Value |
|---|---|
| Product | Services (pco.services, API version 2018-11-01) |
| Resource type | Media |
| TypeScript | Services.Media, attributes Services.MediaAttributes, schema Services.MediaSchema |
| Planning Center path | /services/v2/media |
| Planning Center docs | Media |
How to reach it
| Client path | Returns | Filters | Create |
|---|---|---|---|
pco.services.media |
Collection | archived, audio, background_audio, background_image, background_video, countdown, curriculum, document, drama, image, not_archived, powerpoint, song_video, video |
Yes |
pco.services.songs.id(songId).last_scheduled_item.id(itemId).media |
Collection | No |
From a collection, .id(mediaId) addresses one Media: pco.services.media.id(mediaId). Collections support where, include, order, and pagination; single resources have get().
Attributes
On Services.MediaAttributes. Every resource also has id and type ('Media') next to its attributes.
| Name | Type | Description |
|---|---|---|
created_at |
string | null |
|
creator_name |
string | null |
|
image_url |
string | null |
|
length |
number | null |
|
media_type |
string | null |
See details. |
media_type_name |
string | null |
|
preview_content_type |
string | null |
|
preview_file_name |
string | null |
|
preview_file_size |
number | null |
|
preview_updated_at |
string | null |
|
preview_url |
string | null |
|
themes |
string | null |
|
thumbnail_content_type |
string | null |
|
thumbnail_file_name |
string | null |
|
thumbnail_file_size |
number | null |
|
thumbnail_updated_at |
string | null |
|
thumbnail_url |
string | null |
|
title |
string | null |
|
updated_at |
string | null |
Attribute details
media_type
Possible Values:
-
audio -
background_audio -
background_image -
background_video -
countdown -
curriculum -
document -
drama -
image -
powerpoint -
song_video -
video
Relationships and includes
Side-load with include() (or get({ include })) and read with related(resource, name): attachments.
Querying
Where
where(field, value) for equality; where(field, op, value) with the operators listed.
| Field | Value type | Operators |
|---|---|---|
creator_name |
string |
Equality only |
id |
string |
Equality only |
themes |
string |
Equality only |
title |
string |
Equality only |
Order
order(...) accepts these fields, ascending, or descending with a - prefix: created_at, title, updated_at.
Filters
filter(...) names depend on the edge you query through:
| Edge | Filters |
|---|---|
pco.services.media |
archived, audio, background_audio, background_image, background_video, countdown, curriculum, document, drama, image, not_archived, powerpoint, song_video, video |
Edges
Follow these from one Media, ref = pco.services.media.id(mediaId):
| Edge | Leads to | Returns | Filters | Create |
|---|---|---|---|---|
ref.attachments |
Attachment | Collection | Yes | |
ref.media_schedules |
MediaSchedule | Collection | No | |
ref.tags |
Tag | Collection | No |
Writing
| Property | Value |
|---|---|
| Create | Yes, create() on pco.services.media |
| Update | Yes, update() on a reference |
| Delete | Yes, delete() on a reference |
Create attributes
Typed as Services.MediaSchema['create'].
| Attribute | Type |
|---|---|
creator_name |
string | null |
media_type |
string | null |
minutes |
unknown |
seconds |
unknown |
themes |
string | null |
title |
string | null |
Update attributes
Typed as Services.MediaSchema['update'].
| Attribute | Type |
|---|---|
creator_name |
string | null |
media_type |
string | null |
minutes |
unknown |
seconds |
unknown |
themes |
string | null |
title |
string | null |
See Writing data.
Actions
Run with ref.action(name, body?). Bodies are untyped: see Planning Center’s docs for each action.
| Action | Path | Description |
|---|---|---|
archive |
POST /services/v2/media/{media_id}/archive |
Archive a Media. |
assign_tags |
POST /services/v2/media/{media_id}/assign_tags |
Used to assign tags to a media. |
unarchive |
POST /services/v2/media/{media_id}/unarchive |
Restore an archived Media. |
Example
import type { Services } from '@mackenly/planningcenterkit';
const page = await pco.services.media.order('created_at').perPage(25).list();
const items: Services.Media[] = page.data;