Skip to content

v4 API: Expose Response interface #78

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

Merged
merged 4 commits into from
Mar 25, 2024

Conversation

n7studios
Copy link
Contributor

Summary

Exposes the GuzzleHttp\Psr7\Response object via using getResponseInterface(), allowing the consumer to check e.g. a 2xx HTTP status code, header or other properties:

$result = $api->add_subscriber_to_form(12345, '[email protected]');
$code = $api->getResponseInterface()->getStatusCode(); // 200 OK if e.g. a subscriber already added to the specified form, 201 Created if the subscriber added to the specified form for the first time.

Testing

  • testGetResponseInterface: Test that a valid PSR-7 response object is returned by getResponseInterface and can be interacted with.
  • testClientInterfaceInjection: Test that a valid PSR-7 response object is returned by getResponseInterface when set_http_client is used (PR).

Checklist

@n7studios n7studios added this to the 2.0 milestone Mar 21, 2024
@n7studios n7studios self-assigned this Mar 21, 2024
This was referenced Mar 21, 2024
@n7studios n7studios requested review from a team, noelherrick and corydhmiller and removed request for a team March 21, 2024 16:11
@n7studios n7studios marked this pull request as ready for review March 21, 2024 16:11
Copy link

@noelherrick noelherrick left a comment

Choose a reason for hiding this comment

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

Makes sense!

@n7studios n7studios merged commit b07a92f into v4-api-oauth Mar 25, 2024
@n7studios n7studios mentioned this pull request Mar 26, 2024
5 tasks
@n7studios n7studios deleted the v4-api-get-response-interface branch June 26, 2024 03:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants