yummyPancake2607 commented on code in PR #4020:
URL: https://github.com/apache/iggy/pull/4020#discussion_r3939283641


##########
foreign/python/src/client.rs:
##########
@@ -450,6 +451,70 @@ impl IggyClient {
         })
     }
 
+    /// Returns information about the currently connected client.
+    ///
+    /// Returns:
+    ///     An awaitable that resolves to `ClientInfoDetails`.
+    ///
+    /// Raises:
+    ///     RuntimeError: If the request fails.
+    
#[gen_stub(override_return_type(type_repr="collections.abc.Awaitable[ClientInfoDetails]",
 imports=("collections.abc")))]
+    fn get_me<'a>(&self, py: Python<'a>) -> PyResult<Bound<'a, PyAny>> {
+        let inner = self.inner.clone();
+        future_into_py(py, async move {
+            let client = inner
+                .get_me()
+                .await
+                .map_err(|e| PyErr::new::<pyo3::exceptions::PyRuntimeError, 
_>(e.to_string()))?;
+            Ok(PyClientInfoDetails::from(client))
+        })
+    }
+
+    /// Returns information about a specific client by its ID.
+    ///
+    /// Args:
+    ///     client_id: The unique identifier of the client.
+    ///
+    /// Returns:
+    ///     An awaitable that resolves to `ClientInfoDetails | None`.
+    ///     Returns `None` when the id is unknown.
+    ///
+    /// Raises:
+    ///     RuntimeError: If the request fails.
+    
#[gen_stub(override_return_type(type_repr="collections.abc.Awaitable[ClientInfoDetails
 | None]", imports=("collections.abc")))]
+    fn get_client<'a>(&self, py: Python<'a>, client_id: u32) -> 
PyResult<Bound<'a, PyAny>> {
+        let inner = self.inner.clone();
+        future_into_py(py, async move {
+            let client = inner
+                .get_client(client_id)
+                .await
+                .map_err(|e| PyErr::new::<pyo3::exceptions::PyRuntimeError, 
_>(e.to_string()))?;
+            Ok(client.map(PyClientInfoDetails::from))
+        })
+    }
+
+    /// Returns information about all connected clients.
+    ///
+    /// Returns:
+    ///     An awaitable that resolves to `list[ClientInfo]`.
+    ///
+    /// Raises:
+    ///     RuntimeError: If the request fails.

Review Comment:
   I've updated the docstrings for both `get_clients` and `get_client` to 
specifically name the required permissions (`manage_servers` or `read_servers`) 
and added a note that missing these permissions returns `Unauthorized`. I also 
added a test case referencing `tests/test_permissions.py:267`.



-- 
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]

Reply via email to