accept method

ACTION: accept

Accept a Schedule using a path like this: https://api.planningcenteronline.com/services/v2/people/1/schedules/1/accept

data can be a JSON String, or JSON serializable Object that follows the JSON:API specifications. The PlanningCenterApiData helper class has been provided for just such a purpose.

Details: 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...

{
	"data": {
		"type": "ScheduleAccept",
		"attributes": {
			"reason": "Because reasons"
		},
		"relationships": {
			"declined_plan_times": {
				"data": [
          {
					  "type": "PlanTime",
					  "id": "1"
				  }
        ]
			}
		}
	}
}

Implementation

Future<PlanningCenterApiResponse> accept(Object data) async {
  if (id == null) {
    return PlanningCenterApiError.messageOnly(
      'Actions must be called on items that already exist on the remote server',
    );
  }
  var url = '$apiEndpoint/accept';
  return api.call(url, verb: 'post', data: data, apiVersion: apiVersion);
}