Class MediaClient
- Namespace
- Crews.PlanningCenter.Api.Services.V2018_11_01
- Assembly
- Crews.PlanningCenter.Api.dll
Client for interacting with the Media resource.
public class MediaClient : SingletonResourceClient<Media, MediaResource, MediaResponse>
- Inheritance
-
MediaClient
- Inherited Members
Constructors
MediaClient(HttpClient, Uri)
Client for interacting with the Media resource.
public MediaClient(HttpClient httpClient, Uri uri)
Parameters
httpClientHttpClienturiUri
Properties
Attachments
Associated Attachments.
public PaginatedAttachmentClient Attachments { get; }
Property Value
MediaSchedules
Associated MediaSchedules.
public PaginatedMediaScheduleClient MediaSchedules { get; }
Property Value
Tags
Associated Tags.
public PaginatedTagClient Tags { get; }
Property Value
Methods
ArchiveAsync(CancellationToken)
Archive a Media.
Accepts an optional time attribute (ISO 8601) for scheduling archival for a future time.<code>json<br />{<br /> "data": {<br /> "type": "MediaArchive",<br /> "attributes": {<br /> "time": "2026-06-16T00:00:00Z"<br /> }<br /> }<br />}<br /></code>
public Task ArchiveAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationToken
Returns
AssignTagsAsync(CancellationToken)
Used to assign tags to a media.
All tags will be replaced so the full data set must be sent.
It expects a body that looks like:
``json
{
"data": {
"type": "TagAssignment",
"attributes": {},
"relationships": {
"tags": {
"data": [
{
"type": "Tag",
"id": "5"
}
]
}
}
}
}<code><br /><br />On success you will get back a </code>204 No Content.
public Task AssignTagsAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationToken
Returns
DeleteAsync(CancellationToken)
Deletes the Media resource asynchronously.
public Task DeleteAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenA token to monitor for cancellation requests.
Returns
- Task
A task representing the asynchronous delete operation.
Exceptions
- JsonApiException
Thrown when the HTTP response indicates a failure status code.
GetAsync(CancellationToken)
Fetches the Media resource asynchronously.
public Task<MediaResponse> GetAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenA token to monitor for cancellation requests.
Returns
- Task<MediaResponse>
A task representing the asynchronous operation, containing the Media resource.
Exceptions
- JsonApiException
Thrown when the HTTP response indicates a failure status code.
IncludeAttachments()
Include related Attachments resources in the response.
public MediaClient IncludeAttachments()
Returns
PatchAsync(Media, CancellationToken)
Updates an existing Media resource asynchronously.
public Task<MediaResponse> PatchAsync(Media resource, CancellationToken cancellationToken = default)
Parameters
resourceMediaThe resource data to be sent in the patch request.
cancellationTokenCancellationTokenA token to monitor for cancellation requests.
Returns
- Task<MediaResponse>
A task representing the asynchronous operation, containing the updated Media resource.
Exceptions
- JsonApiException
Thrown when the HTTP response indicates a failure status code.
PatchAsync(JsonApiDocument<MediaResource>, CancellationToken)
Updates an existing Media resource asynchronously.
public Task<MediaResponse> PatchAsync(JsonApiDocument<MediaResource> document, CancellationToken cancellationToken = default)
Parameters
documentJsonApiDocument<MediaResource>The JSON:API document to be sent in the patch request.
cancellationTokenCancellationTokenA token to monitor for cancellation requests.
Returns
- Task<MediaResponse>
A task representing the asynchronous operation, containing the updated Media resource.
Exceptions
- JsonApiException
Thrown when the HTTP response indicates a failure status code.
UnarchiveAsync(CancellationToken)
Restore an archived Media.
public Task UnarchiveAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationToken