Class PlanTemplateClient
- Namespace
- Crews.PlanningCenter.Api.Services.V2018_08_01
- Assembly
- Crews.PlanningCenter.Api.dll
Client for interacting with the PlanTemplate resource.
public class PlanTemplateClient : SingletonResourceClient<PlanTemplate, PlanTemplateResource, PlanTemplateResponse>
- Inheritance
-
PlanTemplateClient
- Inherited Members
Constructors
PlanTemplateClient(HttpClient, Uri)
Client for interacting with the PlanTemplate resource.
public PlanTemplateClient(HttpClient httpClient, Uri uri)
Parameters
httpClientHttpClienturiUri
Properties
Items
Associated Items.
public PaginatedItemClient Items { get; }
Property Value
Notes
Associated Notes.
public PaginatedPlanNoteClient Notes { get; }
Property Value
TeamMembers
Associated TeamMembers.
public PaginatedPlanPersonClient TeamMembers { get; }
Property Value
Methods
AddCustomParameter(string, string)
Adds a custom query parameter to the request URI.
public PlanTemplateClient AddCustomParameter(string parameter, string value)
Parameters
Returns
- PlanTemplateClient
The current PlanTemplateClient instance.
ClearParameters()
Removes the entire query string from the request URI.
public PlanTemplateClient ClearParameters()
Returns
- PlanTemplateClient
The current PlanTemplateClient instance.
DeleteAsync(CancellationToken)
Deletes the PlanTemplate 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 PlanTemplate resource asynchronously.
public Task<PlanTemplateResponse> GetAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenA token to monitor for cancellation requests.
Returns
- Task<PlanTemplateResponse>
A task representing the asynchronous operation, containing the PlanTemplate resource.
Exceptions
- JsonApiException
Thrown when the HTTP response indicates a failure status code.
ImportAsync(CancellationToken)
Apply a Plan or PlanTemplate to this PlanTemplate
This action copies the team members, needed positions, items, and notes from a
source Plan or PlanTemplate into this (already existing) PlanTemplate.
Accepted attributes:
- source_id (Integer) ID of the PlanTemplate or Plan to copy from.
- copy_items (Boolean) Copy Items from the source. Requires editor permissions. (default false)
- copy_people (Boolean) Copy team members and needed positions from the source. (default false)
- copy_notes (Boolean) Copy Notes from the source. Requires editor permissions. (default false)
- team_ids (Array[Integer]) IDs of teams to copy people from when copy_people is set to true. If nil, copy_people copies from all teams. (default nil)
Permissions: requires scheduler on the target template's service type. Schedulers
may only copy people for teams they lead; copy_items and copy_notes require
editor permissions.
Returns a PlanImportMetadata resource describing the outcome (e.g. whether any
copied people were missing required background checks).
public Task ImportAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationToken
Returns
ItemReorderAsync(CancellationToken)
Reorder plan template items in one request.
This can be used to reorder all items in a plan template in one request.
It expects a POST body with a sequence of Item ids in order. E.G.
``json
{
"data": {
"type": "PlanItemReorder",
"attributes": {
"sequence": [
"5",
"1",
"3"
]
}
}
}<code><br /><br />On success you will get back a </code>204 No Content.
public Task ItemReorderAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationToken
Returns
PatchAsync(PlanTemplate, CancellationToken)
Updates an existing PlanTemplate resource asynchronously.
public Task<PlanTemplateResponse> PatchAsync(PlanTemplate resource, CancellationToken cancellationToken = default)
Parameters
resourcePlanTemplateThe resource data to be sent in the patch request.
cancellationTokenCancellationTokenA token to monitor for cancellation requests.
Returns
- Task<PlanTemplateResponse>
A task representing the asynchronous operation, containing the updated PlanTemplate resource.
Exceptions
- JsonApiException
Thrown when the HTTP response indicates a failure status code.
PatchAsync(JsonApiDocument<PlanTemplateResource>, CancellationToken)
Updates an existing PlanTemplate resource asynchronously.
public Task<PlanTemplateResponse> PatchAsync(JsonApiDocument<PlanTemplateResource> document, CancellationToken cancellationToken = default)
Parameters
documentJsonApiDocument<PlanTemplateResource>The JSON:API document to be sent in the patch request.
cancellationTokenCancellationTokenA token to monitor for cancellation requests.
Returns
- Task<PlanTemplateResponse>
A task representing the asynchronous operation, containing the updated PlanTemplate resource.
Exceptions
- JsonApiException
Thrown when the HTTP response indicates a failure status code.