Skip to content

Conversation

@joshrotenberg
Copy link
Collaborator

Summary

This PR addresses issue #35 by updating both library READMEs and adding comprehensive working examples to improve developer experience.

Changes Made

📁 New Examples Added

  • redis-cloud crate: Added examples/ directory with:

    • basic.rs - Basic connection and account information retrieval
    • database_management.rs - Database operations with proper handler usage
  • redis-enterprise crate: Added examples/ directory with:

    • basic.rs - Cluster info, nodes, and database listing
    • database_management.rs - Database operations with statistics

📚 README Updates

  • redis-cloud: Updated with current API patterns using CloudDatabaseHandler
  • redis-enterprise: Updated with current API patterns using BdbHandler
  • Fixed outdated examples that used non-existent methods
  • Added proper environment variable configuration examples

🔧 API Pattern Improvements

  • Cloud API: Showcases both typed methods (create()) and raw methods (create_raw())
  • Enterprise API: Demonstrates proper use of typed structs vs raw JSON access
  • Builder patterns: Shows correct client configuration using builders
  • Handler usage: Examples use proper handler instantiation patterns

🏗️ Developer Experience Improvements

  • All examples compile without warnings
  • Environment variable based configuration for easy testing
  • Commented-out creation examples to prevent accidental resource creation
  • Proper error handling and type usage throughout

Key Technical Insights Addressed

  1. Redis Cloud uses CloudDatabaseHandler::new(client) pattern with both typed and raw API methods
  2. Redis Enterprise uses BdbHandler::new(client) pattern with fully typed responses
  3. Client builders use different method names: Cloud uses standard methods, Enterprise uses base_url()
  4. Proper distinction between raw JSON access vs typed struct access

Testing

  • ✅ All examples compile cleanly with cargo check
  • ✅ Passes cargo fmt and cargo clippy checks
  • ✅ No unused imports or warnings

This significantly improves the developer onboarding experience for both Redis Cloud and Enterprise API clients.

Closes #35

- Add examples/ directories to both redis-cloud and redis-enterprise crates
- Create basic.rs and database_management.rs examples for each library
- Update README files with current API patterns using handlers
- Show proper usage of CloudDatabaseHandler and BdbHandler
- Demonstrate both raw API calls and typed handler methods
- Fix compilation errors and use correct builder patterns
- Add comprehensive usage examples with environment variable configuration

Resolves #35
- Remove duplicate .mdbook-lint.toml from root (keep only in docs/)
- Remove mdbook-lint preprocessor from book.toml
- Will re-enable after upstream fixes per issue #37
@joshrotenberg joshrotenberg merged commit df282da into main Aug 28, 2025
12 checks passed
@joshrotenberg joshrotenberg deleted the fix/library-readmes-issue-35 branch August 28, 2025 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Documentation: Update library READMEs with current API

2 participants