Skip to content

User Preferences api + fix rust sdk#117

Merged
nikita-seedlabs merged 9 commits intomainfrom
nikita/user_pref
Jun 4, 2025
Merged

User Preferences api + fix rust sdk#117
nikita-seedlabs merged 9 commits intomainfrom
nikita/user_pref

Conversation

@nikita-seedlabs
Copy link
Copy Markdown
Contributor

@nikita-seedlabs nikita-seedlabs commented Jun 4, 2025

User description

  • Adds user account preferences api
  • Fixes rust sdk

PR Type

Enhancement, Tests


Description

  • Add API and SDK support for updating user account preferences

    • Introduce UpdateAccountPreferenceRequest schema in OpenAPI and SDKs
    • Implement PUT /api/v1/account/preferences endpoint in OpenAPI, Python, Rust, and TypeScript SDKs
    • Update documentation and codegen for new endpoint and model
  • Enhance Rust SDK and examples for new preferences API

    • Add Rust example for updating and retrieving account preferences
    • Fix and refactor Rust SDK imports and clippy warnings
  • Improve Python and TypeScript SDKs for account preferences

    • Add model, test, and serialization for UpdateAccountPreferenceRequest in Python SDK
    • Add TypeScript interface and API method for updating preferences
  • Minor dependency and formatting updates


Changes walkthrough 📝

Relevant files
Enhancement
11 files
account-data-api.yaml
Add UpdateAccountPreferenceRequest schema and PUT endpoint
+59/-0   
api.ts
Add update account preferences interface and API method   
+104/-0 
account_data_api.py
Add async put_account_preferences API method                         
+284/-0 
update_account_preference_request.py
Add UpdateAccountPreferenceRequest model                                 
+112/-0 
account_preference.py
Support additional properties in AccountPreference             
+13/-0   
__init__.py
Export UpdateAccountPreferenceRequest model                           
+1/-0     
__init__.py
Export UpdateAccountPreferenceRequest in models                   
+1/-0     
account_data_api.rs
Add put_account_preferences API function and error type   
+40/-0   
update_account_preference_request.rs
Add UpdateAccountPreferenceRequest struct                               
+35/-0   
mod.rs
Export UpdateAccountPreferenceRequest model                           
+2/-0     
account-preferences.rs
Add example for updating and retrieving preferences           
+30/-2   
Documentation
8 files
AccountDataApi.md
Document putAccountPreferences endpoint usage                       
+56/-0   
UpdateAccountPreferenceRequest.md
Add UpdateAccountPreferenceRequest model documentation     
+24/-0   
AccountDataApi.md
Document put_account_preferences endpoint                               
+79/-0   
UpdateAccountPreferenceRequest.md
Add UpdateAccountPreferenceRequest model doc                         
+31/-0   
openapi_client_README.md
Document new API and model in SDK README                                 
+2/-0     
AccountDataApi.md
Document put_account_preferences endpoint                               
+29/-0   
UpdateAccountPreferenceRequest.md
Add UpdateAccountPreferenceRequest model doc                         
+13/-0   
README.md
Document new API and model in crate README                             
+2/-0     
Configuration changes
4 files
FILES
Register UpdateAccountPreferenceRequest model doc               
+1/-0     
FILES
Register new model and test files                                               
+3/-0     
FILES
Register new model doc and source files                                   
+2/-0     
apigen.rs
Update openapi-generator-cli version to 7.13.0                     
+2/-2     
Tests
1 files
test_update_account_preference_request.py
Add test for UpdateAccountPreferenceRequest model               
+57/-0   
Dependencies
2 files
Cargo.toml
Update reqwest dependency features                                             
+1/-1     
Cargo.toml
Bump bluefin_api version and add reqwest dependency           
+2/-1     
Bug fix
1 files
shutdown.rs
Fix clippy warnings and add main function                               
+8/-2     
Formatting
19 files
expanded-usage.rs
Fix import ordering for clippy                                                     
+2/-2     
trade-cancel-order.rs
Fix import ordering for clippy                                                     
+2/-2     
trade-create-order.rs
Fix argument formatting and import order                                 
+6/-14   
trade-withdraw.rs
Fix import ordering for clippy                                                     
+2/-2     
ws-account-update-stream.rs
Fix import ordering for clippy                                                     
+2/-2     
ws-candlestick-stream.rs
Fix import ordering for clippy                                                     
+3/-3     
ws-leverage-update-failure.rs
Fix import ordering for clippy                                                     
+2/-2     
ws-mark-price-stream.rs
Fix import ordering for clippy                                                     
+3/-3     
ws-market-price-stream.rs
Fix import ordering for clippy                                                     
+3/-3     
ws-oracle-price-stream.rs
Fix import ordering for clippy                                                     
+3/-3     
ws-orderbook-diff-depth-stream.rs
Fix import ordering for clippy                                                     
+2/-2     
ws-partial-depth-stream.rs
Fix import ordering for clippy                                                     
+2/-2     
ws-recent-trade-stream.rs
Fix import ordering for clippy                                                     
+2/-2     
ws-ticker-all-stream.rs
Fix import ordering for clippy                                                     
+2/-2     
ws-ticker-stream.rs
Fix import ordering for clippy                                                     
+2/-2     
authenticate.rs
Fix import ordering for clippy                                                     
+6/-6     
env.rs
Remove trailing whitespace and fix formatting                       
+1/-3     
lib.rs
Fix import ordering for clippy                                                     
+1/-1     
signature.rs
Fix import ordering for clippy                                                     
+3/-3     

Need help?
  • Type /help how to ... in the comments thread for any questions about Qodo Merge usage.
  • Check out the documentation for more information.
  • @qodo-code-review
    Copy link
    Copy Markdown

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 PR contains tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Missing Variable

    The shutdown_flag_clone variable is used but not defined in the execute function. This will cause a compilation error.

    tokio::time::sleep(Duration::from_secs(timeout)).await;
    shutdown_flag_clone.store(true, std::sync::atomic::Ordering::SeqCst);
    Unused Parameter

    The is_colocated parameter is defined in the send_request function signature but not used in the function body.

        is_colocated: bool,
    ) -> Result<String> {

    @qodo-code-review
    Copy link
    Copy Markdown

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Impact
    Possible issue
    Fix Arc clone reference

    The Arc::clone method requires a reference to the Arc, not the Arc itself. Pass
    a reference to shutdown_flag to avoid potential ownership issues.

    rust/examples/shutdown.rs [8]

    -let shutdown_flag_clone = Arc::clone(shutdown_flag);
    +let shutdown_flag_clone = Arc::clone(&shutdown_flag);
    • Apply / Chat
    Suggestion importance[1-10]: 9

    __

    Why: Critical correctness issue. Arc::clone requires a reference (&shutdown_flag) but the PR incorrectly uses the owned value, causing compilation errors.

    High
    Add TLS support

    The reqwest crate with default features disabled but without specifying a TLS
    implementation will not be able to make HTTPS requests. Add the rustls-tls
    feature to enable secure connections.

    rust/gen/bluefin_api/Cargo.toml [16]

    -reqwest = { version = "^0.12", default-features = false, features = ["json", "multipart"] }
    +reqwest = { version = "^0.12", default-features = false, features = ["json", "multipart", "rustls-tls"] }

    [To ensure code accuracy, apply this suggestion manually]

    Suggestion importance[1-10]: 8

    __

    Why: Significant functional issue. Disabling default features without adding rustls-tls will prevent HTTPS requests from working, breaking API functionality.

    Medium
    • More

    @jeffs
    Copy link
    Copy Markdown
    Contributor

    jeffs commented Jun 4, 2025

    Missing Variable

    The shutdown_flag_clone variable is used but not defined in the execute function. This will cause a compilation error.

    Unused Parameter

    The is_colocated parameter is defined in the send_request function signature but not used in the function body.

    O for two.

    Comment thread rust/examples/trade-create-order.rs
    @nikita-seedlabs nikita-seedlabs merged commit 477985b into main Jun 4, 2025
    @nikita-seedlabs nikita-seedlabs deleted the nikita/user_pref branch June 4, 2025 19:26
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Projects

    None yet

    Development

    Successfully merging this pull request may close these issues.

    4 participants