<commit_before># java-captools 1.1
#### Captricity API client library written in Java

Currently, the Captricity API client library provides methods to accomplish the following:
* create a Batch
* read (get) a Batch
* delete a Batch
* add Batch Files to the Batch
* submit the Batch for processing
* get results for a specific Batch
* show a list of Batches in the account
* get Job status (percent completed)
* get Job results (for Jobs that are 100% complete)
* show a list of Documents (master templates) in the account

I have also provided a number of example programs that demonstrate how the API client library works in a controlled environment.  You can find these programs in the examples folder.

### Instructions for use

This code was built against **Java 1.8.0\_40** and uses **ant 1.9.4** for the build tool.

From the base of the directory, type

```
ant jar
```

A jar file named **captricity-1.1.jar** will be generated in the base directory.

Copy/move the captricity-1.1.jar file into your classpath.

and then in your java program, like is done in the example code-- TestCaptricityClient.java,

```java
import com.captricity.api.CaptricityClient;
```

In order to use this code, you will also need a Captricity API Token.

To instantiate a Captricity API client object, use something like this:

```java
CaptricityClient capClient = new CaptricityClient('6cf43...88b75');
```

where the parameter is your Captricity API token.

You can then use this client object to make method calls against the Captricity API, as is shown in the example below:

```java
JSONObject newBatch = capClient.createBatch("name of new batch", true, false);
```

### Summary of available methods

```java
public JSONArray showBatches() throws Exception {...}
```
* Returns a `JSONArray` of the Batches that exist in your account.
* Parameters:
  - *None*

```java
public JSONObject createBatch(String name) throws Exception {...}
public JSONObject createBatch(String name, ArrayList<Integer> docIds) throws Exception {...}
public JSONObject createBatch(String name, Boolean sortingEnabled, Boolean isSortingOnly, ArrayList<Integer> docIds) throws Exception {...}
```
* Creates a Batch in accordance with the given name and properties.
* Returns a `JSONObject` representing the Batch that was created by the method call.
* Parameters:
  - `String name` - Provide a name for the Batch you are creating
  - `Boolean sortingEnabled` \- Set to true to enable sorting for this Batch.  The default value is `true` if not specified.
  - `Boolean isSortingOnly` \- Set to true if you only want to sort this Batch (as opposed to submit for data extraction).  The default value is `false` if not specified.
  - `ArrayList<Integer> docIds` \- Add an ArrayList of integers representing the Document ID's of the templates that you want to use for sorting.  Your account must have sorting enabled for this to work. If sorting is enabled on your account and you do not specify a list of Document ID's, your Batch will be sorted against all active templates in your account.

```java
public JSONObject readBatch(int batchID) throws Exception {...}
```
* Gets the Batch specified by the batchID parameter.
* Returns a `JSONObject` representing the Batch.
* Parameters:
  - `int batchID` \- Batch ID of the Batch you want to get

```java
public JSONObject deleteBatch(int batchID) throws Exception {...}
```<commit_msg>one more change to README<commit_after># java-captools 1.1
#### Captricity API client library written in Java

Currently, the Captricity API client library provides methods to accomplish the following:
* create a Batch
* read (get) a Batch
* delete a Batch
* add Batch Files to the Batch
* submit the Batch for processing
* get results for a specific Batch
* show a list of Batches in the account
* get Job status (percent completed)
* get Job results (for Jobs that are 100% complete)
* show a list of Documents (master templates) in the account

I have also provided a number of example programs that demonstrate how the API client library works in a controlled environment.  You can find these programs in the examples folder.

### Instructions for use

This code was built against **Java 1.8.0\_40** and uses **ant 1.9.4** for the build tool.

From the base of the directory, type

```
ant jar
```

A jar file named **captricity-1.1.jar** will be generated in the base directory.

Copy/move the captricity-1.1.jar file into your classpath.

and then in your java program, like is done in the example code-- TestCaptricityClient.java,

```java
import com.captricity.api.CaptricityClient;
```

In order to use this code, you will also need a Captricity API Token.

To instantiate a Captricity API client object, use something like this:

```java
CaptricityClient capClient = new CaptricityClient('6cf43...88b75');
```

where the parameter is your Captricity API token.

You can then use this client object to make method calls against the Captricity API, as is shown in the example below:

```java
JSONObject newBatch = capClient.createBatch("name of new batch", true, false);
```

### Summary of available methods

```java
public JSONArray showBatches() throws Exception {...}
```
* Returns a `JSONArray` of the Batches that exist in your account.
* Parameters:
  - *None*

```java
public JSONObject createBatch(String name) throws Exception {...}
public JSONObject createBatch(String name, ArrayList<Integer> docIds) throws Exception {...}
public JSONObject createBatch(String name, Boolean sortingEnabled, Boolean isSortingOnly, ArrayList<Integer> docIds) throws Exception {...}
```
* Creates a Batch in accordance with the given name and properties.
* Returns a `JSONObject` representing the Batch that was created by the method call.
* Parameters:
  - `String name` - Provide a name for the Batch you are creating
  - `Boolean sortingEnabled` \- Set to true to enable sorting for this Batch.  The default value is `true` if not specified.
  - `Boolean isSortingOnly` \- Set to true if you only want to sort this Batch (as opposed to submit for data extraction).  The default value is `false` if not specified.
  - `ArrayList<Integer> docIds` \- Add an `ArrayList` of integers representing the Document ID's of the templates that you want to use for sorting.  Your account must have sorting enabled for this to work. If sorting is enabled on your account and you do not specify a list of Document ID's, your Batch will be sorted against all active templates in your account.

```java
public JSONObject readBatch(int batchID) throws Exception {...}
```
* Gets the Batch specified by the batchID parameter.
* Returns a `JSONObject` representing the Batch.
* Parameters:
  - `int batchID` \- Batch ID of the Batch you want to get

```java
public JSONObject deleteBatch(int batchID) throws Exception {...}
```
{'fraction_non_alphanumeric': 0.07843713278495887, 'fraction_numerical': 0.007050528789659225, 'mean_word_length': 4.323690383111806, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7400131', 'n_tokens_mistral': 1886, 'n_tokens_neox': 1795, 'n_words': 956}