collapseServiceTypes method

ACTION: collapse_service_types

Used to set Service Types as collapsed for the Person using a path like this: https://api.planningcenteronline.com/services/v2/people/1/collapse_service_types

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: It expects a body that looks like:

{
	"data": {
		"type": "CollapseServiceTypes",
		"attributes": {},
		"relationships": {
			"service_type": {
				"data": [
					{
						"type": "ServiceType",
						"id": "1"
					},
					{
						"type": "ServiceType",
						"id": "2"
					}
				]
			}
		}
	}
}

On success you will get back a 204 No Content.

Implementation

Future<PlanningCenterApiResponse> collapseServiceTypes(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/collapse_service_types';
  return api.call(url, verb: 'post', data: data, apiVersion: apiVersion);
}