BREAKING: Modularize client architecture; add Bulk, Tooling, and Metadata API support - #36
BREAKING: Modularize client architecture; add Bulk, Tooling, and Metadata API support#36tance77 wants to merge 8 commits into
Conversation
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.
46c78d8 to
1730ffd
Compare
feat: adding support for tooling api
|
Adding Tooling API Support |
|
Hi @tance77 , I plan to add support for the metadata api, which I require for my project. Let me know what you think, maybe we can work together in getting rustforce to the next level. |
|
@wimvelzeboer feel free to take the reins my times very limited when it comes to open source projects. Ill contribute from time to time but that's about it. I'm glad to see there are some active members out there wanting to see this one through. |
SOAP deleteMetadata with chunking at the 10-component cap. Tooling API's CustomField exposes no delete, so field teardown has no other path.
Pin the fullName-first, otherwise-alphabetical element order the WSDL sequence requires, plus null omission, escaping, nesting, and per-type component caps.
|
@wimvelzeboer added Metadata cause i needed it. |
Thanks! Let me see if I can copy it over to my Rustsf crate |
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
QueryResponse,SearchResponse,DescribeResponse, etc.) have been removed. Methods now returnserde_json::Value, giving consumers full flexibility to deserialize as needed.src/client.rsandsrc/response.rshave been split into submodules. Anyone importing internals directly will need to update paths.Clientconstructor changed: Now takesclient_idandclient_secretdirectly, with setters for login URL, version, etc.describe_globalexample (method still exists)What's new
Modular architecture
Client split into focused submodules —
client,rest_api,bulk_api,bulk_api_v2,tooling_api,metadata_api— each wrapping a sharedClientthat owns auth and token refresh.Bulk API v1 (
bulk_api)XML-based classic Bulk API: job create/close/abort, batch submission, status polling, result retrieval.
Bulk API v2 (
bulk_api_v2)CSV/JSON-based Bulk API v2 job lifecycle.
Tooling API (
tooling_api)execute_anonymousfor running Apex, returning a typedExecuteAnonymousResult(compile/run success, line/column, stack trace)get_latest_apex_logs,get_apex_log_bodycreate_trace_flag,update_trace_flag,delete_trace_flag,get_trace_flags,get_debug_level,create_debug_level,get_current_user_idquery,find_by_id,create,update,destroyMetadata API (
metadata_api)CRUD-based (not file-based) Metadata API over SOAP — the Metadata API has no REST binding for these calls.
create_metadata/delete_metadata/delete_metadata_chunked, returning per-componentMetadataResultwithsuccessand structuredMetadataErrorsCustomField, which the Tooling API does not support at all (that object exposes only Query/GET/POST/PATCH)CustomMetadata/CustomApplication);delete_metadata_chunkedsplits oversized input automaticallyfullNamefirst, then alphabetical), since Salesforce rejects out-of-order elementsShared XML support (
src/xml.rs)Common XML escaping/serialisation used by the Bulk and Metadata clients.
Other
token_response,token_error_response,error_response,execute_anonymous_responseaccess_tokenmodule for token managementerrors.rsexecute_anonymous,debug_logs,trace_flags,versionsWhy
The original monolithic
client.rswas 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. Splitting per-API keeps each surface independently testable, which is what made adding the Tooling and Metadata clients cheap.Test plan
execute_anonymous, debug log retrieval, and trace flag lifecycleCustomFieldcreate and delete against a scratch orgcargo test)