assignTags method

ACTION: assign_tags

Used to assign tags to a person. using a path like this: https://api.planningcenteronline.com/services/v2/people/1/assign_tags

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: All tags will be replaced so the full data set must be sent.

It expects a body that looks like:

{
	"data": {
		"type": "TagAssignment",
		"attributes": {},
		"relationships": {
			"tags": {
				"data": [
					{
						"type": "Tag",
						"id": "5"
					}
				]
			}
		}
	}
}

On success you will get back a 204 No Content.

Implementation

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