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


##########
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.

Review Comment:
    I've documented that `client_id: u32` gets converted before the coroutine 
executes, so `get_client(-1)` raises `OverflowError`, not `RuntimeError`. I've 
added a parametrized test similar to `tests/test_permissions.py:148` that tests 
the overflow case explicitly.



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