public Future<Role> loadRole(String id, Callback<Role> callback) { require(id, "id is a required parameter."); final RestAsyncClient client = newAsyncClient("GET", "/roles/{id}") // .accepts("application/json") // .setPath("id", id); signRequest(client); AsyncFuture<Role> future = client.future(callback); client.send(callbackAdapter(future, Role.class)); return future; }
public Future<Role> createRole(RoleUpdate body, Callback<Role> callback) { require(body, "body is a required parameter."); final RestAsyncClient client = newAsyncClient("POST", "/roles") // .accepts("application/json") // .contentType("application/json") // .setBody(toJson(body)); signRequest(client); AsyncFuture<Role> future = client.future(callback); client.send(callbackAdapter(future, Role.class)); return future; }
public Future<RoleList> queryRoles(RolesQuery query, Callback<RoleList> callback) { final RestAsyncClient client = newAsyncClient("GET", "/roles") // .accepts("application/json") // .addQuery("offset", query.getOffset()) // .addQuery("limit", query.getLimit()) // .addQueryCollection("id", query.getIds(), CollectionFormat.PIPES) // .addQueryCollection("roleName", query.getRoleNames(), CollectionFormat.PIPES) // .addQueryCollection("displayName", query.getDisplayNames(), CollectionFormat.PIPES) // .addQueryCollection("description", query.getDescriptions(), CollectionFormat.PIPES); signRequest(client); AsyncFuture<RoleList> future = client.future(callback); client.send(callbackAdapter(future, RoleList.class)); return future; }