Copilot commented on code in PR #685:
URL: 
https://github.com/apache/incubator-hugegraph-toolchain/pull/685#discussion_r2458826353


##########
hugegraph-client/src/main/java/org/apache/hugegraph/api/graphs/GraphsAPI.java:
##########
@@ -203,6 +203,28 @@ public void mode(String graph, GraphMode mode) {
         this.client.put(joinPath(this.path(), graph, MODE), null, mode);
     }
 
+    public void mode(String graph, String graphSpace, GraphMode mode) {
+        // NOTE: Must provide id for PUT. If you use "graph/mode", "/" will
+        // be encoded to "%2F". So use "mode" here, although inaccurate.
+        this.client.put(joinPath(this.path(), graphSpace, graph, MODE), null, 
mode);
+    }
+
+    public GraphMode mode(String graph, String graphSpace) {
+        RestResult result = this.client.get(joinPath(this.path(), graphSpace, 
graph), MODE);
+        @SuppressWarnings("unchecked")
+        Map<String, String> mode = result.readObject(Map.class);
+        String value = mode.get(MODE);
+        if (value == null) {
+            throw new InvalidResponseException("Invalid response, expect 
'mode' in response");
+        }
+        try {
+            return GraphMode.valueOf(value);
+        } catch (IllegalArgumentException e) {
+            throw new InvalidResponseException("Invalid GraphMode value '%s'", 
value);
+        }
+    }
+
+

Review Comment:
   [nitpick] Remove extra blank line between methods. There should be only one 
blank line between method definitions for consistency.
   ```suggestion
   
   ```



##########
hugegraph-client/src/main/java/org/apache/hugegraph/driver/GraphsManager.java:
##########
@@ -115,19 +115,37 @@ public void mode(String graph, GraphMode mode) {
         this.graphsAPI.mode(graph, mode);
     }
 
+    public void mode(String graph, String graphSpace, GraphMode mode) {
+        this.graphsAPI.mode(graph, graphSpace, mode);
+    }
+
     public GraphMode mode(String graph) {
         return this.graphsAPI.mode(graph);
     }
 
+    public GraphMode mode(String graph, String graphSpace) {
+        return this.graphsAPI.mode(graph, graphSpace);
+    }
+
+    public void readMode(String graph, String graphSpace, GraphReadMode 
readMode) {
+        this.graphsAPI.readMode(graph, graphSpace, readMode);
+    }
+
     public void readMode(String graph, GraphReadMode readMode) {
         this.graphsAPI.readMode(graph, readMode);
     }
 
+    public GraphReadMode readMode(String graph, String graphSpace) {
+        return this.graphsAPI.readMode(graph, graphSpace);
+    }
+
     public GraphReadMode readMode(String graph) {
         return this.graphsAPI.readMode(graph);
     }
 
+

Review Comment:
   [nitpick] Remove extra blank line. There should be only one blank line 
before the next method definition for consistency.
   ```suggestion
   
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to