feat(examples): add comprehensive API examples#11
Merged
Conversation
lightcap
added a commit
that referenced
this pull request
May 14, 2026
Replace println! calls that print .len() of secrets and passwords with simple success messages, consistent with the examples fix in PR #11.
lightcap
added a commit
that referenced
this pull request
May 14, 2026
Replace println! calls that print .len() of secrets and passwords with simple success messages, consistent with the examples fix in PR #11.
Rust std::env::consts::OS returns "macos" but the 1Password core expects "darwin" (Go runtime.GOOS convention). Map the value at client config construction time.
59b385a to
945eb00
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 945eb00. Configure here.
Adds three example programs demonstrating the full SDK surface: - example.rs: secrets, passwords, item CRUD, batch operations, sharing, SSH keys, documents, file attachments, vault lifecycle - desktop_app.rs: desktop app auth, vault/item operations, group permission management using a temporary vault - service_account.rs: minimal service account authentication All credentials are generated dynamically (SDK password generator, ssh-keygen) to avoid hardcoded secrets. Cleanup is best-effort to prevent leaked resources on partial failures.
945eb00 to
6fd32ed
Compare
lightcap
added a commit
that referenced
this pull request
May 15, 2026
Replace println! calls that print .len() of secrets and passwords with simple success messages, consistent with the examples fix in PR #11.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Adds comprehensive API usage examples matching the 1Password Python SDK's example coverage:
examples/example.rs— Full SDK surface demo: secrets (single, batch, TOTP), password generation (PIN, memorable, random), item CRUD with fields/sections/tags/websites, batch operations, item sharing, SSH key items, document items, file field attachments, and vault lifecycle managementexamples/desktop_app.rs— Expanded to include vault CRUD, batch item operations, and group permission management (grant, update, revoke)examples/README.md— Usage guide with environment variable setup and operations coverage matrixTest plan
cargo fmt --checkpassescargo clippy -- -D warningspassescargo testpasses (23 tests)cargo check --example example --example service_account --example desktop_app --features desktopcompilesexample.rsagainst a live 1Password service accountdesktop_app.rsagainst the 1Password desktop app🤖 Generated with Claude Code
Note
Medium Risk
Mostly adds/expands example code and documentation, but also changes
ClientConfig.system_osserialization (mappingmacostodarwin), which could affect core/API behavior on macOS if consumers rely on the previous value.Overview
Adds a new
examples/example.rsthat exercises most of the Rust SDK surface area (secrets, password generation, item CRUD + batch ops, sharing, SSH keys, documents, file attachments, and vault lifecycle) and introduces anexamples/README.mdwith setup instructions and an operations coverage matrix.Expands
examples/desktop_app.rsfrom a single secret lookup to a broader desktop-auth demo including vault CRUD, item listing, batch item create/get/delete, and group vault permission grant/update/revoke (with best-effort cleanup).examples/service_account.rsis updated to acceptOP_SECRET_REFand avoids printing secret contents.In core,
ClientConfig.system_osnow normalizesmacostodarwinvianormalize_os()and adds tests to lock in the mapping.Reviewed by Cursor Bugbot for commit 6fd32ed. Bugbot is set up for automated code reviews on this repo. Configure here.