Python SDK: expose get_me, get_client and get_clients
- Dominant language
- Rust
- Stars
- 4.9k
- Forks
- 432
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 173
Description
### Description
The Rust client can report the currently connected client and enumerate all connected clients (`core/common/src/traits/system_client.rs`). The Python SDK exposes none of it, so a Python operator cannot see connection state that every other SDK can. Part of the parity work tracked in #3893.
```rust
async fn get_me(&self) -> Result;
async fn get_client(&self, client_id: u32) -> Result, IggyError>;
async fn get_clients(&self) -> Result, IggyError>;
```
`get_client` and `get_clients` require permission to read server info; `get_me` requires authentication only.
### Affected area / component
Python SDK
### Proposed solution
- Add `foreign/python/src/client_info.rs` wrapping `ClientInfo` and `ClientInfoDetails`, following `src/user.rs` (pyclass + `From` conversions + `gen_stub_pyclass`), and register it in `src/lib.rs`.
- Add the three methods to `src/client.rs`. `get_client` returns `None` when the id is unknown rather than raising.
- Add the stub entries to `foreign/python/apache_iggy.pyi`.
- Add `foreign/python/tests/test_client_info.py`: assert `get_me()` returns the connected client, that its id appears in `get_clients()`, and that `get_client()` on an unknown id returns `None`.
### Alternatives considered
_No response_
### Contribution
- [ ] I'm willing to submit a pull request to implement this feature
### Good first issue
- [x] I think this could be a good first issue for a new contributor
Contributor guide
Assessment
This issue has not been assessed yet.