Search in sources :

Example 91 with RestResult

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

the class BelongAPI method list.

public List<Belong> list(Object user, Object group, int limit) {
    checkLimit(limit, "Limit");
    Map<String, Object> params = new LinkedHashMap<>();
    params.put("limit", limit);
    params.put("user", formatEntityId(user));
    params.put("group", formatEntityId(group));
    RestResult result = this.client.get(this.path(), params);
    return result.readList(this.type(), Belong.class);
}
Also used : RestResult(com.baidu.hugegraph.rest.RestResult) LinkedHashMap(java.util.LinkedHashMap)

Example 92 with RestResult

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

the class ProjectAPI method removeGraphs.

public Project removeGraphs(Object projectId, Set<String> graphs) {
    Project project = new Project();
    project.graphs(graphs);
    RestResult result = this.client.put(this.path(), formatEntityId(projectId), project, ImmutableMap.of("action", ACTION_REMOVE_GRAPH));
    return result.readObject(Project.class);
}
Also used : Project(com.baidu.hugegraph.structure.auth.Project) RestResult(com.baidu.hugegraph.rest.RestResult)

Example 93 with RestResult

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

the class ProjectAPI method addGraphs.

public Project addGraphs(Object projectId, Set<String> graphs) {
    Project project = new Project();
    project.graphs(graphs);
    RestResult result = this.client.put(this.path(), formatEntityId(projectId), project, ImmutableMap.of("action", ACTION_ADD_GRAPH));
    return result.readObject(Project.class);
}
Also used : Project(com.baidu.hugegraph.structure.auth.Project) RestResult(com.baidu.hugegraph.rest.RestResult)

Example 94 with RestResult

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

the class ProjectAPI method update.

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

Example 95 with RestResult

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

the class GroupAPI method list.

public List<Group> 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(), Group.class);
}
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