Class ScheduleClient
- Namespace
- Crews.PlanningCenter.Api.Services.V2018_11_01
- Assembly
- Crews.PlanningCenter.Api.dll
Client for interacting with the Schedule resource.
public class ScheduleClient : SingletonResourceClient<Schedule, ScheduleResource, ScheduleResponse>
- Inheritance
-
ScheduleClient
- Inherited Members
Constructors
ScheduleClient(HttpClient, Uri)
Client for interacting with the Schedule resource.
public ScheduleClient(HttpClient httpClient, Uri uri)
Parameters
httpClientHttpClienturiUri
Properties
DeclinedPlanTimes
Associated DeclinedPlanTimes.
public PaginatedPlanTimeClient DeclinedPlanTimes { get; }
Property Value
PlanTimes
Associated PlanTimes.
public PaginatedPlanTimeClient PlanTimes { get; }
Property Value
RespondTo
Associated RespondTo.
public PersonClient RespondTo { get; }
Property Value
Team
Associated Team.
public TeamClient Team { get; }
Property Value
Methods
AcceptAsync(CancellationToken)
Accept a Schedule
If this isn't a split time schedule, or you want to accept all times, an empty JSON body is accepted.
If the user wants to decline specific times you'll need to send the declined time IDs & a reason.
A POST body should be formated...
``json
{
"data": {
"type": "ScheduleAccept",
"attributes": {
"reason": "Because reasons"
},
"relationships": {
"declined_plan_times": {
"data": [
{
"type": "PlanTime",
"id": "1"
}
]
}
}
}
}<code><br /><br />### Proposing a replacement<br /><br />When every time is declined the request falls through to the decline flow, and the optional </code>replacement_id<code> and </code>replacement_confirmed<code> attributes may be included. When the team is configured to reschedule declines with a volunteer replacement and </code>replacement_id<code> is present, the decline initiates the replacement workflow (contacting the chosen person). </code>replacement_confirmed<code> indicates whether the replacement has already agreed to fill in — skipping the confirmation step when true.<br /><br /></code>replacement_id<code> is the </code>account_center_id<code> of the proposed replacement.<br /><br /></code>json
{
"data": {
"type": "ScheduleAccept",
"attributes": {
"reason": "Because reasons",
"replacement_id": "123",
"replacement_confirmed": true
},
"relationships": {
"declined_plan_times": {
"data": [
{
"type": "PlanTime",
"id": "1"
}
]
}
}
}
}<code><br /><br />Note: </code>replacement_id is not validated against a list of eligible replacements; any person in the organization may be submitted. The calling UI is responsible for presenting an appropriate list, matching the existing volunteer-chooses-their-own-replacement flow.
public Task AcceptAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationToken
Returns
AddCustomParameter(string, string)
Adds a custom query parameter to the request URI.
public ScheduleClient AddCustomParameter(string parameter, string value)
Parameters
Returns
- ScheduleClient
The current ScheduleClient instance.
ClearParameters()
Removes the entire query string from the request URI.
public ScheduleClient ClearParameters()
Returns
- ScheduleClient
The current ScheduleClient instance.
DeclineAsync(CancellationToken)
Decline a Schedule
If this is a split time request, all times will be declined.
If you want to decline specific times see ScheduleAcceptAction.
A POST body should be formated...
``json
{
"data": {
"type": "ScheduleDecline",
"attributes": {
"reason": "A user supplied reason for declining the request or an empty string."
},
"relationships": null
}
}<code><br /><br />### Proposing a replacement<br /><br />The optional </code>replacement_id<code> and </code>replacement_confirmed<code> attributes may be included on a decline. When the team is configured to reschedule declines with a volunteer replacement and </code>replacement_id<code> is present, the decline initiates the replacement workflow (contacting the chosen person). </code>replacement_confirmed<code> indicates whether the replacement has already agreed to fill in — skipping the confirmation step when true.<br /><br /></code>replacement_id<code> is the </code>account_center_id<code> of the proposed replacement.<br /><br /></code>json
{
"data": {
"type": "ScheduleDecline",
"attributes": {
"reason": "A user supplied reason for declining the request or an empty string.",
"replacement_id": "123",
"replacement_confirmed": true
},
"relationships": null
}
}<code><br /><br />Note: </code>replacement_id is not validated against a list of eligible replacements; any person in the organization may be submitted. The calling UI is responsible for presenting an appropriate list, matching the existing volunteer-chooses-their-own-replacement flow.
public Task DeclineAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationToken
Returns
GetAsync(CancellationToken)
Fetches the Schedule resource asynchronously.
public Task<ScheduleResponse> GetAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenA token to monitor for cancellation requests.
Returns
- Task<ScheduleResponse>
A task representing the asynchronous operation, containing the Schedule resource.
Exceptions
- JsonApiException
Thrown when the HTTP response indicates a failure status code.
IncludePlanTimes()
Include related PlanTimes resources in the response.
public ScheduleClient IncludePlanTimes()