Skip to content

BREAKING: Modularize client architecture, add Bulk API support#36

Open
tance77 wants to merge 5 commits intotzmfreedom:mainfrom
tance77:modular-client-refactor
Open

BREAKING: Modularize client architecture, add Bulk API support#36
tance77 wants to merge 5 commits intotzmfreedom:mainfrom
tance77:modular-client-refactor

Conversation

@tance77
Copy link

@tance77 tance77 commented Mar 13, 2026

⚠️ Breaking Changes

This is a major refactor that restructures the crate's internals and changes the public API. It is not backwards compatible with the current release.

What breaks

  • Response types removed: All typed response structs (QueryResponse, SearchResponse, DescribeResponse, etc.) have been removed. Methods now return serde_json::Value, giving consumers full flexibility to deserialize as needed.
  • Module structure changed: src/client.rs and src/response.rs have been split into submodules. Anyone importing internals directly will need to update paths.
  • Client constructor changed: Now takes client_id and client_secret directly, with setters for login URL, version, etc.
  • Removed describe_global example (method still exists)
  • Removed old integration tests — they depended on the deleted response types

What's new

  • Modular architecture: Client split into client, rest_api, bulk_api, bulk_api_v2 submodules
  • Bulk API v1 support: XML-based classic Bulk API (bulk_api module)
  • Bulk API v2 support: CSV/JSON-based Bulk API v2 (bulk_api_v2 module)
  • Dedicated response modules: token_response, token_error_response, error_response
  • Access token module: Dedicated access_token module for token management
  • Improved error handling: More granular error variants in errors.rs
  • Updated dependencies: Bumped to edition 2021, updated all deps

Why

The original monolithic client.rs was difficult to extend. Typed response structs broke when Salesforce changed their API payloads. Returning generic JSON is more resilient and lets consumers define their own types if needed.

Test plan

  • Verify existing examples compile and run against a Salesforce instance
  • Test Bulk API v1 job creation, batching, and result retrieval
  • Test Bulk API v2 job lifecycle
  • Verify authentication flows (login, refresh token)

tance77 added 3 commits March 13, 2026 13:58
Split monolithic client.rs into organized submodules (client, rest_api).
Split response.rs into dedicated response types (token, error).
Add access_token module for token management.
Modernize error handling, update dependencies, and remove outdated tests.
Add bulk_api module for Salesforce Bulk API v1 (XML-based).
Add bulk_api_v2 module for Bulk API v2 (CSV/JSON-based).
Add XML utility module for serialization/deserialization.
Rewrite examples to use generic JSON responses (serde_json::Value).
Update README with current API usage and module structure.
@tance77 tance77 force-pushed the modular-client-refactor branch from 46c78d8 to 1730ffd Compare March 13, 2026 20:58
@tance77 tance77 changed the title Modularize client architecture, add Bulk API support BREAKING: Modularize client architecture, add Bulk API support Mar 13, 2026
@tance77 tance77 marked this pull request as ready for review March 13, 2026 21:17
@tance77
Copy link
Author

tance77 commented Mar 16, 2026

Adding Tooling API Support

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.

1 participant