Skip to content

Add the sp_request_response action hook to the SP_API Class#181

Merged
renatonascalves merged 1 commit intorelease/0.5from
feature/sp-request-response-hook
Jan 10, 2024
Merged

Add the sp_request_response action hook to the SP_API Class#181
renatonascalves merged 1 commit intorelease/0.5from
feature/sp-request-response-hook

Conversation

@renatonascalves
Copy link
Copy Markdown
Contributor

Allow devs to fire an action when a SP_API()->get_api_endpoint request is performed.

@renatonascalves renatonascalves self-assigned this Jan 9, 2024
Copy link
Copy Markdown
Member

@srtfisher srtfisher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one thought

* @param string $body The body of the request.
* @param array $request_params Additional parameters.
*/
do_action( 'sp_request_response', $result, $url, $method, $body, $request_params );
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there harm in making this a filter to make it more extendible?

Copy link
Copy Markdown
Contributor Author

@renatonascalves renatonascalves Jan 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No harm but a filter serves a different purpose than an action. Currently, the nypost uses this action to fire something rather than to change the output.

I guess we need both?!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we can ignore this for now then until the need arises

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll introduce it in a separate pr. :)

@renatonascalves renatonascalves merged commit 2c5c399 into release/0.5 Jan 10, 2024
@renatonascalves renatonascalves deleted the feature/sp-request-response-hook branch January 10, 2024 17:05
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.

2 participants