You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,9 @@
1
1
# CHANGELOG
2
2
3
+
## Next Release
4
+
5
+
- Adds new `RequestHook` and `ResponseHook` events. (un)subscribe to them with the new `subscribeToRequestHook`, `subscribeToResponseHook`, `unsubscribeFromRequestHook`, or `unsubscribeFromResponseHook` methods of an `EasyPostClient`
6
+
3
7
## v6.7.0 (2023-06-06)
4
8
5
9
- Migrates carrier metadata to GA (now available via `client.carrierMetadata.retrieve`)
Users can subscribe to HTTP requests and responses via the `RequestHook` and `ResponseHook` objects. To do so, pass a function to the `subscribeToRequestHook` or `subscribeToResponseHook` methods of an `EasyPostClient` object:
69
+
70
+
```php
71
+
function customFunction($args)
72
+
{
73
+
// Pass your code here, data about the request/response is contained within `$args`.
74
+
echo "Received a request with the status code of: " . $args['http_status'];
75
+
}
76
+
77
+
$client = new \EasyPost\EasyPostClient(getenv('EASYPOST_API_KEY'));
// Make your API calls here, your customFunction will trigger once a response is received
82
+
```
83
+
84
+
You can also unsubscribe your functions in a similar manner by using the `unsubscribeFromRequestHook` and `unsubscribeFromResponseHook` methods of a client object.
85
+
66
86
## Documentation
67
87
68
88
API documentation can be found at: <https://easypost.com/docs/api>.
0 commit comments