justinmclean opened a new issue, #4612:
URL: https://github.com/apache/iggy/issues/4612
The C++ SDK can log in with a personal access token, but can't list or
delete tokens. The bridge declarations for these calls are commented out in
`foreign/cpp/src/lib.rs`.
### Where
- `foreign/cpp/src/lib.rs`: the bridge declarations (the commented-out
`get_personal_access_tokens` and `delete_personal_access_token`).
- `foreign/cpp/src/client.rs`: the Rust implementation.
- `foreign/cpp/src/client.cpp` and `foreign/cpp/include/iggy.hpp`: the
public `IggyBlockingClient` methods.
- `foreign/cpp/tests/e2e/client.cpp`: the tests.
### Context
The Rust trait is `PersonalAccessTokenClient`
(`core/common/src/traits/personal_access_token_client.rs`):
`get_personal_access_tokens() -> Vec<PersonalAccessTokenInfo>` and
`delete_personal_access_token(name: &str)`. `PersonalAccessTokenInfo` has a
`name` and an optional `expiry_at`.
`GetUsers` is the closest existing shape: a no-argument call returning a
vector of a small struct. See `get_users` and `ffi::UserInfo::from` in
`client.rs`, `IggyBlockingClient::GetUsers` in `client.cpp`, and its
declaration in `iggy.hpp`.
Out of scope: `create_personal_access_token` (a separate issue) and
`login_with_personal_access_token`, which `WithPersonalAccessToken` on the
builder already covers.
### Done looks like
- `client.GetPersonalAccessTokens()` returns the caller's tokens with name
and optional expiry.
- `client.DeletePersonalAccessToken("name")` removes one.
- Both throw when called before login.
- The e2e suite covers both against a real server.
### Steps
- [ ] Read `get_users` and the `UserInfo` struct in `lib.rs` and
`client.rs`, and `GetUsers` in `client.cpp` and `iggy.hpp`, as the pattern.
- [ ] Add a `PersonalAccessTokenInfo` struct to the `lib.rs` bridge (name,
`has_expiry`, `expiry_at`, following the `has_*` convention used for optional
fields in that file) and its `From` conversion in `client.rs`.
- [ ] Uncomment and wire the two `lib.rs` declarations, and implement them
in `client.rs` with `RUNTIME.block_on` and the usual `map_err(|error|
format!("Could not ...: {error}"))`.
- [ ] Add `GetPersonalAccessTokens()` and `DeletePersonalAccessToken(name)`
to `IggyBlockingClient` in `iggy.hpp` and `client.cpp`, with doc comments in
the style of `GetUsers`.
- [ ] Add e2e tests next to `GetUsersBeforeLoginThrows`: throws before
login, lists a token, and deletes it.
--
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]