Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added filter to short-circuit API calls to Salesforce. Thanks to GitHub user @verygoodplugins for the submission. #512

Conversation

verygoodplugins
Copy link
Contributor

What does this Pull Request do?

This PR adds a filter to the http_request() function in class Object_Sync_Sf_Salesforce to allow short-circuiting the API call and response.

The goal of the PR is to help create a tighter integration with WP Fusion (https://github.com/verygoodplugins/wp-fusion-lite/ and https://wpfusion.com/).

The logic follows what already exists in WP core, for example with update_metadata(): https://github.com/WordPress/WordPress/blob/master/wp-includes/meta.php#L233

With this filter in place, we will be able to:

  • Route outgoing API calls through WP Fusion (and the WordPress HTTP API / wp_remote_request())
  • Use WP Fusion's built in error handling, logging, and token refresh capabilities for Object Sync API calls
  • Detect potential data collision (for example if WP Fusion is about to operate on the same record)
  • Automatically configure Object Sync using the Salesforce client ID and tokens already managed by WP Fusion

We're excited to create a deeper integration between WP Fusion and Object Sync for Salesforce, and this change would allow us to tie the two plugins together much more closely than is currently possible.

Thanks for your consideration :)

@jonathanstegall
Copy link
Member

Thanks for this! There's nothing obvious that looks troubling at all, I just want to have a chance to run it before I merge it, and also add the new hook to the developer hook documentation spots where it belongs.

@jonathanstegall jonathanstegall added feature Pull request that adds a feature minor pull request that requires a minor release, ex v2.2.0. labels Feb 3, 2023
@jonathanstegall jonathanstegall added this to the v2.2.7 milestone Feb 3, 2023
@jonathanstegall jonathanstegall merged commit 8d7ef20 into MinnPost:master Feb 3, 2023
@jonathanstegall jonathanstegall changed the title Added filter to short-circuit API calls to Salesforce Added filter to short-circuit API calls to Salesforce. Thanks to GitHub user @verygoodplugins for the submission. Feb 3, 2023
@jonathanstegall jonathanstegall added patch pull request that requires a patch release, ex v2.1.2. This is the default for new releases. and removed minor pull request that requires a minor release, ex v2.2.0. labels Feb 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Pull request that adds a feature patch pull request that requires a patch release, ex v2.1.2. This is the default for new releases.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants