Skip to content

feat(cpp): add functions related to user management, and initial high-level client - #3733

Open
slbotbm wants to merge 11 commits into
apache:masterfrom
slbotbm:cpp-more-3-functions
Open

feat(cpp): add functions related to user management, and initial high-level client#3733
slbotbm wants to merge 11 commits into
apache:masterfrom
slbotbm:cpp-more-3-functions

Conversation

@slbotbm

@slbotbm slbotbm commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Which issue does this PR address?

Closes #
Relates to #2100

Rationale

Works towards completion of cpp client.

What changed?

Adds the following:

  • create_user
  • get_user
  • get_users
  • update_user
  • delete_user
    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

  • Passed
  • Pre-commit hooks ran

AI Usage

If AI tools were used, please answer:

  1. Which tools? codex
  2. Scope of usage? code generation
  3. How did you verify the generated code works correctly? read through it
  4. Can you explain every line of the code if asked? yes

@slbotbm
slbotbm marked this pull request as draft July 22, 2026 20:01
@github-actions github-actions Bot added S-waiting-on-review PR is waiting on a reviewer and removed S-waiting-on-review PR is waiting on a reviewer labels Jul 22, 2026
@slbotbm
slbotbm marked this pull request as ready for review August 1, 2026 15:21
@github-actions github-actions Bot added the S-waiting-on-review PR is waiting on a reviewer label Aug 1, 2026

@ethanlin01x ethanlin01x left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few suggestions

Comment thread foreign/cpp/src/client.rs
})
}

pub fn update_user(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment thread foreign/cpp/include/iggy.hpp Outdated
* @return Information about the authenticated session.
* @throws IggyException if authentication fails.
*/
LoginInfo Login(std::string username, std::string password) const;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread foreign/cpp/include/iggy.hpp Outdated
* @throws IggyException if the connection or automatic authentication
* fails.
*/
void Connect() const;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@slbotbm
slbotbm requested a review from ethanlin01x August 3, 2026 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review PR is waiting on a reviewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants