Search in sources :

Example 96 with RestResult

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

the class GroupAPI method update.

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

Example 97 with RestResult

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

the class TargetAPI method list.

public List<Target> 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(), Target.class);
}
Also used : RestResult(com.baidu.hugegraph.rest.RestResult)

Example 98 with RestResult

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

the class UserAPI method update.

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

Example 99 with RestResult

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

the class UserAPI method getUserRole.

public UserRole getUserRole(Object id) {
    String idEncoded = RestClient.encode(formatEntityId(id));
    String path = String.join("/", this.path(), idEncoded, "role");
    RestResult result = this.client.get(path);
    return result.readObject(UserRole.class);
}
Also used : RestResult(com.baidu.hugegraph.rest.RestResult)

Example 100 with RestResult

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

the class AccessAPI method list.

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

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