use of com.ibm.watson.developer_cloud.speech_to_text.v1.model.RecognitionJobs in project java-sdk by watson-developer-cloud.
the class SpeechToText method checkJobs.
/**
* Checks the status of all asynchronous jobs.
*
* Returns the ID and status of the latest 100 outstanding jobs associated with the service credentials with which it
* is called. The method also returns the creation and update times of each job, and, if a job was created with a
* callback URL and a user token, the user token for the job. To obtain the results for a job whose status is
* `completed` or not one of the latest 100 outstanding jobs, use the `GET /v1/recognitions/{id}` method. A job and
* its results remain available until you delete them with the `DELETE /v1/recognitions/{id}` method or until the
* job's time to live expires, whichever comes first.
*
* @param checkJobsOptions the {@link CheckJobsOptions} containing the options for the call
* @return a {@link ServiceCall} with a response type of {@link RecognitionJobs}
*/
public ServiceCall<RecognitionJobs> checkJobs(CheckJobsOptions checkJobsOptions) {
String[] pathSegments = { "v1/recognitions" };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
if (checkJobsOptions != null) {
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(RecognitionJobs.class));
}
use of com.ibm.watson.developer_cloud.speech_to_text.v1.model.RecognitionJobs in project java-sdk by watson-developer-cloud.
the class SpeechToTextIT method testCheckJobs.
/**
* Test check jobs.
*/
@Test
public void testCheckJobs() {
RecognitionJobs jobs = service.checkJobs().execute();
assertNotNull(jobs);
}
use of com.ibm.watson.developer_cloud.speech_to_text.v1.model.RecognitionJobs in project java-sdk by watson-developer-cloud.
the class SpeechToTextTest method testCheckJobs.
/**
* Test check jobs.
*
* @throws InterruptedException the interrupted exception
* @throws FileNotFoundException the file not found exception
*/
@Test
public void testCheckJobs() throws InterruptedException, FileNotFoundException {
String jobsAsString = getStringFromInputStream(new FileInputStream("src/test/resources/speech_to_text/jobs.json"));
JsonObject jobsAsJson = new JsonParser().parse(jobsAsString).getAsJsonObject();
server.enqueue(new MockResponse().addHeader(CONTENT_TYPE, HttpMediaType.APPLICATION_JSON).setBody(jobsAsString));
RecognitionJobs result = service.checkJobs().execute();
final RecordedRequest request = server.takeRequest();
assertEquals("GET", request.getMethod());
assertEquals(PATH_RECOGNITIONS, request.getPath());
assertEquals(jobsAsJson.get("recognitions"), GSON.toJsonTree(result.getRecognitions()));
}
Aggregations