itemReorder method

ACTION: item_reorder

Reorder plan items in one request. using a path like this: https://api.planningcenteronline.com/services/v2/service_types/1/plans/1/item_reorder

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: This can be used to reorder all items in a plan in one request.

It expects a POST body with a sequence of Item ids in order. E.G.

{
  "data": {
    "type": "PlanItemReorder",
    "attributes": {
      "sequence": [
        "5",
        "1",
        "3"
      ]
    }
  }
}

On success you will get back a 204 No Content.

Implementation

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