Search in sources :

Example 41 with RestResult

use of com.baidu.hugegraph.rest.RestResult in project incubator-hugegraph-toolchain by apache.

the class BelongAPI method update.

public Belong update(Belong belong) {
    String id = formatRelationId(belong.id());
    RestResult result = this.client.put(this.path(), id, belong);
    return result.readObject(Belong.class);
}
Also used : RestResult(com.baidu.hugegraph.rest.RestResult)

Example 42 with RestResult

use of com.baidu.hugegraph.rest.RestResult in project incubator-hugegraph-toolchain by apache.

the class ProjectAPI method list.

public List<Project> list(long limit) {
    checkLimit(limit, "Limit");
    Map<String, Object> params = ImmutableMap.of("limit", limit);
    RestResult result = this.client.get(this.path(), params);
    return result.readList(this.type(), Project.class);
}
Also used : RestResult(com.baidu.hugegraph.rest.RestResult)

Example 43 with RestResult

use of com.baidu.hugegraph.rest.RestResult in project incubator-hugegraph-toolchain by apache.

the class TargetAPI method update.

public Target update(Target target) {
    String id = formatEntityId(target.id());
    RestResult result = this.client.put(this.path(), id, target);
    return result.readObject(Target.class);
}
Also used : RestResult(com.baidu.hugegraph.rest.RestResult)

Example 44 with RestResult

use of com.baidu.hugegraph.rest.RestResult in project incubator-hugegraph-toolchain by apache.

the class UserAPI method list.

public List<User> list(int limit) {
    checkLimit(limit, "Limit");
    Map<String, Object> params = ImmutableMap.of("limit", limit);
    RestResult result = this.client.get(this.path(), params);
    return result.readList(this.type(), User.class);
}
Also used : RestResult(com.baidu.hugegraph.rest.RestResult)

Example 45 with RestResult

use of com.baidu.hugegraph.rest.RestResult in project incubator-hugegraph-toolchain by apache.

the class CountAPI method post.

public long post(CountRequest request) {
    this.client.checkApiVersion("0.55", "count");
    RestResult result = this.client.post(this.path(), request);
    @SuppressWarnings("unchecked") Map<String, Number> countMap = result.readObject(Map.class);
    E.checkState(countMap.containsKey(COUNT), "The result doesn't have key '%s'", COUNT);
    return countMap.get(COUNT).longValue();
}
Also used : RestResult(com.baidu.hugegraph.rest.RestResult)

Aggregations

RestResult (com.baidu.hugegraph.rest.RestResult)132 Test (org.junit.Test)44 LinkedHashMap (java.util.LinkedHashMap)23 AbstractRestClient (com.baidu.hugegraph.rest.AbstractRestClient)19 RestClient (com.baidu.hugegraph.rest.RestClient)19 MultivaluedHashMap (jakarta.ws.rs.core.MultivaluedHashMap)12 Response (com.baidu.hugegraph.structure.gremlin.Response)6 Result (com.baidu.hugegraph.structure.gremlin.Result)6 PropertyKey (com.baidu.hugegraph.structure.schema.PropertyKey)6 Edge (com.baidu.hugegraph.structure.graph.Edge)5 Vertex (com.baidu.hugegraph.structure.graph.Vertex)5 Map (java.util.Map)5 IndexLabel (com.baidu.hugegraph.structure.schema.IndexLabel)4 InvalidResponseException (com.baidu.hugegraph.exception.InvalidResponseException)3 NotSupportException (com.baidu.hugegraph.exception.NotSupportException)3 EdgeLabel (com.baidu.hugegraph.structure.schema.EdgeLabel)3 VertexLabel (com.baidu.hugegraph.structure.schema.VertexLabel)3 ArrayList (java.util.ArrayList)3 NotAllCreatedException (com.baidu.hugegraph.exception.NotAllCreatedException)2 Project (com.baidu.hugegraph.structure.auth.Project)2