feat(cpp): add functions related to user management, and initial high-level client - #3733
feat(cpp): add functions related to user management, and initial high-level client#3733slbotbm wants to merge 11 commits into
Conversation
| }) | ||
| } | ||
|
|
||
| pub fn update_user( |
There was a problem hiding this comment.
Rust SDK allows updating username and status independently (Option params), but this forces both. Consider has_username / has_status flags like the existing has_permissions pattern
| * @return Information about the authenticated session. | ||
| * @throws IggyException if authentication fails. | ||
| */ | ||
| LoginInfo Login(std::string username, std::string password) const; |
There was a problem hiding this comment.
Login() returning ffi::LoginInfo leaks the FFI's has_access_token bool-flag workaround into the high-level API. Since this is meant to be the primary API, a dedicated type with std::optional for the token would be cleaner, and avoids a breaking change later.
There was a problem hiding this comment.
tbh this is currently a workaround for cxx's limitations. I eventually plan to convert all structs defined in rust to cpp structs/enums and call them from rust. That'll give the users a better experience as compared to now. I'll remember this, and implement this when I make that change.
| * @throws IggyException if the connection or automatic authentication | ||
| * fails. | ||
| */ | ||
| void Connect() const; |
There was a problem hiding this comment.
Nit: These methods are const but clearly mutate connection state (it only compiles because the state lives behind client_). Marking them non-const would better communicate the semantics, since const usually implies no observable state change and often thread-safety.
Applies to:
Connect()Disconnect()Shutdown()Login()Logout()
Which issue does this PR address?
Closes #
Relates to #2100
Rationale
Works towards completion of cpp client.
What changed?
Adds the following:
and their tests.
Adds high level client that will function as primary API with documentation. The diff looks big since a lot of the public api was changed and aligned to PascalCase. I have not rewritten the tests using the high level client since I would like to do that at once instead of a gradual approach.
Local Execution
AI Usage
If AI tools were used, please answer: