Search in sources :

Example 46 with Response

use of org.folio.rest.support.Response in project mod-inventory-storage by folio-org.

the class MaterialTypesClient method create.

public String create(String name) throws InterruptedException, ExecutionException, TimeoutException {
    CompletableFuture<Response> completed = new CompletableFuture<>();
    JsonObject materialTypeRequest = new JsonObject().put("name", name);
    client.post(materialTypesUrl, materialTypeRequest, StorageTestSuite.TENANT_ID, ResponseHandler.json(completed));
    Response response = completed.get(5, TimeUnit.SECONDS);
    return response.getJson().getString("id");
}
Also used : Response(org.folio.rest.support.Response) CompletableFuture(java.util.concurrent.CompletableFuture) JsonObject(io.vertx.core.json.JsonObject)

Aggregations

Response (org.folio.rest.support.Response)46 HttpClientResponse (io.vertx.core.http.HttpClientResponse)40 Test (org.junit.Test)34 CompletableFuture (java.util.concurrent.CompletableFuture)25 UUID (java.util.UUID)24 JsonObject (io.vertx.core.json.JsonObject)22 HttpClient (org.folio.rest.support.HttpClient)3 ExecutionException (java.util.concurrent.ExecutionException)2 TimeoutException (java.util.concurrent.TimeoutException)2 DecodeException (io.vertx.core.json.DecodeException)1 MalformedURLException (java.net.MalformedURLException)1