varsitynewsnetwork / wordpress-rest-api-client

A Wordpress API client for PHP
76 stars 65 forks source link

Adding method that returns PSR-7 response object #15

Open fontebasso opened 6 years ago

fontebasso commented 6 years ago

Close # 13

Adding getResponse method that returns a response object that implementsResponseInterface from PSR-7

I have not modified the get method of AbstractWpEndpoint at: https://github.com/varsitynewsnetwork/wordpress-rest-api-client/blob/master/src/Endpoint/AbstractWpEndpoint.php#L46-L49 with the intention of preserving the compatibility as described by @te-online.

te-online commented 6 years ago

Looks very good, thank you! :-)

boboudreau commented 6 years ago

Thanks @fontebasso! There's a lot of duplicated code here, and I'm not sure it's a requirement that the response type be application/json for a client to want to get the full PSR7 Response object, so I may take this PR and update it a bit before merging it.

andyvanee commented 6 years ago

I've taken a different route to solving the same issue in my PR. I needed this feature for pagination purposes, but I wanted to have the original request available as well for generating next/previous links. Anyway, I think this would be a nice feature to have either way! 👍

mysyfy commented 5 years ago

For review: https://github.com/varsitynewsnetwork/wordpress-rest-api-client/pull/26