justinmclean opened a new issue, #4613:
URL: https://github.com/apache/iggy/issues/4613

   The C++ SDK can log in with a personal access token, but can't create one. 
The bridge declaration is commented out in `foreign/cpp/src/lib.rs`.
   
   ### Where
   
   The same files as the list and delete issue: `foreign/cpp/src/lib.rs` (the 
commented-out `create_personal_access_token`), `foreign/cpp/src/client.rs`, 
`foreign/cpp/src/client.cpp`, `foreign/cpp/include/iggy.hpp` and 
`foreign/cpp/tests/e2e/client.cpp`.
   
   ### Context
   
   The Rust trait is `create_personal_access_token(name: &str, expiry: 
PersonalAccessTokenExpiry) -> Result<RawPersonalAccessToken, IggyError>`. 
`RawPersonalAccessToken` is a single `token: String`, shown to the user once at 
creation.
   
   `PersonalAccessTokenExpiry` is an alias for `IggyExpiry` 
(`core/common/src/utils/personal_access_token_expiry.rs`), the same type as 
topic message expiry. The C++ SDK already maps that for topics: the `Expiry` 
class in `iggy.hpp`, the `message_expiry_kind` and `message_expiry_value` 
fields on `TopicCreateOptions`, and `parse_message_expiry` in 
`foreign/cpp/src/type_conversion.rs`. Reuse that rather than adding a new 
mapping.
   
   This touches the same bridge region as the list and delete issue, so expect 
a small rebase if both are picked up.
   
   ### Done looks like
   
   - `client.CreatePersonalAccessToken("ci-token", expiry)` returns the token 
string.
   - That token works with `WithPersonalAccessToken` on a new client.
   - Creating a duplicate name throws, and calling before login throws.
   - The e2e suite covers each.
   
   ### Steps
   
   - [ ] Read the commented-out declaration in `lib.rs`, and how `Expiry` 
reaches `parse_message_expiry` for `create_topic`.
   - [ ] Declare `create_personal_access_token` in the bridge taking the name 
and the expiry kind and value, and return the token `String` directly, since 
`RawPersonalAccessToken` has one field.
   - [ ] Implement it in `client.rs` using `parse_message_expiry`, which is 
private to `type_conversion.rs` today, so make it `pub(crate)`.
   - [ ] Add `CreatePersonalAccessToken(name, expiry)` to `IggyBlockingClient` 
in `iggy.hpp` and `client.cpp`, taking an `Expiry` and documenting that the 
token is only returned once.
   - [ ] Add e2e tests: before-login throws, the happy path, a duplicate name, 
and a round trip that logs in with the new token through 
`WithPersonalAccessToken`.
   


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