commit method

ACTION: commit

Used to commit an in progress batch. using a path like this: https://api.planningcenteronline.com/giving/v2/batches/1/commit

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 action takes an uncommitted Batch and commits it. It will respond with unprocessable_entity if the Batch cannot be committed.

It does not expect a body.

Committing a Batch happens asyncronously, so initially the Batch's status will be updating. You can poll that Batch's endpoint to see whether it's changed from updating to committed.

Implementation

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