X Tutup
Skip to content

Commit 72e036f

Browse files
authored
Add files via upload
1 parent 3a19831 commit 72e036f

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

src/co/writepath/Client.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,33 @@ public Reply getStatus(int jobId, int format) throws IOException {
292292

293293
return reply;
294294
}
295+
296+
/**
297+
* Retrieves a set of batched jobs.
298+
*
299+
* @param batchId
300+
* id of the batched jobs you want to fetch. It's the orderId
301+
* you get returned if you post a job.
302+
* @param format
303+
* The format of the returned content. 1 = as a file, 2 = as
304+
* plain text
305+
* @return server reply with wordsUsed, status, dueDate, wordsBalance,
306+
* commentFinished and document set
307+
* @throws IOException
308+
* in case of network or json mapping issues
309+
*/
310+
public BatchReply getBatchedStatus(int batchId, int format) throws IOException {
311+
Data data = new Data();
312+
data.setFormat(format);
313+
HttpClient httpClient = HttpClients.createDefault();
314+
HttpPost httpPost = preparePost("/bjobs/" + batchId, data);
315+
HttpResponse response = httpClient.execute(httpPost);
316+
HttpEntity responseEntity = response.getEntity();
317+
String returnString = EntityUtils.toString(responseEntity);
318+
BatchReply reply = objectMapper.readValue(returnString, BatchReply.class);
319+
320+
return reply;
321+
}
295322

296323
/**
297324
* Post a comment on a job

0 commit comments

Comments
 (0)
X Tutup