From 4016e88a2cd1b534e641f3b2463d1b9208bc88f9 Mon Sep 17 00:00:00 2001 From: Nate Harris Date: Thu, 8 Aug 2024 15:54:40 -0600 Subject: [PATCH] - Fix parameters for child user pagination --- CHANGELOG.md | 1 + lib/EasyPost/Service/UserService.php | 2 +- .../cassettes/users/getNextPageOfChildren.yml | 129 ++++++++++++++---- 3 files changed, 105 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 77077774..36345033 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## v7.4.0 (2024-07-24) - Adds new `Claim` service for filing claims on EasyPost shipments and insurances +- Fix parameters for retrieving next page of child users ## v7.3.0 (2024-07-12) diff --git a/lib/EasyPost/Service/UserService.php b/lib/EasyPost/Service/UserService.php index c19bba6a..8a4c5746 100644 --- a/lib/EasyPost/Service/UserService.php +++ b/lib/EasyPost/Service/UserService.php @@ -179,7 +179,7 @@ public function getNextPageOfChildren(mixed $children, ?int $pageSize = null): m $params = [ 'page_size' => $pageSize, - 'before_id' => $userArray[count($userArray) - 1]['id'] + 'after_id' => $userArray[count($userArray) - 1]['id'] ]; if (isset($userParams)) { diff --git a/test/cassettes/users/getNextPageOfChildren.yml b/test/cassettes/users/getNextPageOfChildren.yml index 2e78efa3..2d839ea0 100644 --- a/test/cassettes/users/getNextPageOfChildren.yml +++ b/test/cassettes/users/getNextPageOfChildren.yml @@ -21,57 +21,134 @@ x-download-options: noopen x-permitted-cross-domain-policies: none referrer-policy: strict-origin-when-cross-origin - x-ep-request-uuid: 3c78c40b6597056bf0221b62000d5ffb + x-ep-request-uuid: 84cd602966b53e86f45025710008a00e cache-control: 'private, no-cache, no-store' pragma: no-cache expires: '0' content-type: 'application/json; charset=utf-8' - content-length: '887' - x-runtime: '0.035511' - x-node: bigweb36nuq - x-version-label: easypost-202401041812-437974c716-master + content-length: '1100' + x-runtime: '0.030293' + x-node: bigweb38nuq + x-version-label: easypost-202408082122-d71f4bb148-master x-backend: easypost - x-proxied: ['intlb1nuq 2c48984abf', 'extlb2nuq 003ad9bca0'] + x-proxied: ['intlb4nuq c0f5e722d1', 'extlb1nuq b6e1b5034c'] strict-transport-security: 'max-age=31536000; includeSubDomains; preload' - body: '{"children":[{"id":"user_3c44214dcf744d169c3f2db034fd965e","object":"User","parent_id":"user_465eab8bb86844108100be2d4d5288ab","name":"Test User","phone_number":"","verified":true,"created_at":"2022-11-23T21:03:03Z"},{"id":"user_78019b89199646358298fd311435458f","object":"User","parent_id":"user_465eab8bb86844108100be2d4d5288ab","name":"Test User","phone_number":"","verified":true,"created_at":"2022-12-02T22:41:09Z"},{"id":"user_1a2e9fb7903c4a08b2da7d7f57150370","object":"User","parent_id":"user_465eab8bb86844108100be2d4d5288ab","name":"Test User","phone_number":"","verified":true,"created_at":"2022-12-02T22:43:07Z"},{"id":"user_f01890d357374ac3837ff556a957b9b4","object":"User","parent_id":"user_465eab8bb86844108100be2d4d5288ab","name":"Test User","phone_number":"","verified":true,"created_at":"2022-12-05T17:00:14Z"}],"has_more":false}' + body: '{"children":[{"id":"user_3c44214dcf744d169c3f2db034fd965e","object":"User","parent_id":"user_465eab8bb86844108100be2d4d5288ab","name":"Test User","phone_number":"","verified":true,"created_at":"2022-11-23T21:03:03Z"},{"id":"user_78019b89199646358298fd311435458f","object":"User","parent_id":"user_465eab8bb86844108100be2d4d5288ab","name":"Test User","phone_number":"","verified":true,"created_at":"2022-12-02T22:41:09Z"},{"id":"user_1a2e9fb7903c4a08b2da7d7f57150370","object":"User","parent_id":"user_465eab8bb86844108100be2d4d5288ab","name":"Test User","phone_number":"","verified":true,"created_at":"2022-12-02T22:43:07Z"},{"id":"user_f01890d357374ac3837ff556a957b9b4","object":"User","parent_id":"user_465eab8bb86844108100be2d4d5288ab","name":"Test User","phone_number":"","verified":true,"created_at":"2022-12-05T17:00:14Z"},{"id":"user_4f3642aa792a49d1bbf723956cccdb9f","object":"User","parent_id":"user_465eab8bb86844108100be2d4d5288ab","name":"Test User","phone_number":"","verified":true,"created_at":"2024-03-22T19:40:51Z"}],"has_more":true}' curl_info: url: 'https://api.easypost.com/v2/users/children?page_size=5' content_type: 'application/json; charset=utf-8' http_code: 200 + header_size: 689 + request_size: 304 + filetime: -1 + ssl_verify_result: 0 + redirect_count: 0 + total_time: 0.294465 + namelookup_time: 0.147742 + connect_time: 0.186162 + pretransfer_time: 0.227856 + size_upload: 0.0 + size_download: 1100.0 + speed_download: 3735.0 + speed_upload: 0.0 + download_content_length: 1100.0 + upload_content_length: 0.0 + starttransfer_time: 0.294443 + redirect_time: 0.0 + redirect_url: '' + primary_ip: 169.62.110.131 + certinfo: { } + primary_port: 443 + local_ip: 172.168.1.100 + local_port: 49450 + http_version: 2 + protocol: 2 + ssl_verifyresult: 0 + scheme: https + appconnect_time_us: 227792 + connect_time_us: 186162 + namelookup_time_us: 147742 + pretransfer_time_us: 227856 + redirect_time_us: 0 + starttransfer_time_us: 294443 + total_time_us: 294465 + effective_method: GET + capath: '' + cainfo: '' + index: 0 +- + request: + method: GET + url: 'https://api.easypost.com/v2/users/children?page_size=5&after_id=user_4f3642aa792a49d1bbf723956cccdb9f' + headers: + Host: api.easypost.com + Accept-Encoding: '' + Accept: application/json + Authorization: '' + Content-Type: application/json + User-Agent: '' + response: + status: + code: 200 + message: OK + headers: + x-frame-options: SAMEORIGIN + x-xss-protection: '1; mode=block' + x-content-type-options: nosniff + x-download-options: noopen + x-permitted-cross-domain-policies: none + referrer-policy: strict-origin-when-cross-origin + x-ep-request-uuid: 84cd602a66b53e86f42eb1af0008a02c + cache-control: 'private, no-cache, no-store' + pragma: no-cache + expires: '0' + content-type: 'application/json; charset=utf-8' + content-length: '245' + x-runtime: '0.034322' + x-node: bigweb38nuq + x-version-label: easypost-202408082122-d71f4bb148-master + x-backend: easypost + x-proxied: ['intlb4nuq c0f5e722d1', 'extlb1nuq b6e1b5034c'] + strict-transport-security: 'max-age=31536000; includeSubDomains; preload' + body: '{"children":[{"id":"user_38e8f37bca2d4b8aa932cb39af02ce58","object":"User","parent_id":"user_465eab8bb86844108100be2d4d5288ab","name":"Test User","phone_number":"","verified":true,"created_at":"2024-03-26T23:01:59Z"}],"has_more":false}' + curl_info: + url: 'https://api.easypost.com/v2/users/children?page_size=5&after_id=user_4f3642aa792a49d1bbf723956cccdb9f' + content_type: 'application/json; charset=utf-8' + http_code: 200 header_size: 688 - request_size: 303 + request_size: 351 filetime: -1 ssl_verify_result: 0 redirect_count: 0 - total_time: 0.15691 - namelookup_time: 0.001169 - connect_time: 0.042299 - pretransfer_time: 0.081692 + total_time: 0.162861 + namelookup_time: 0.001316 + connect_time: 0.038 + pretransfer_time: 0.079785 size_upload: 0.0 - size_download: 887.0 - speed_download: 5652.0 + size_download: 245.0 + speed_download: 1504.0 speed_upload: 0.0 - download_content_length: 887.0 + download_content_length: 245.0 upload_content_length: 0.0 - starttransfer_time: 0.156866 + starttransfer_time: 0.162837 redirect_time: 0.0 redirect_url: '' - primary_ip: 169.62.110.130 + primary_ip: 169.62.110.131 certinfo: { } primary_port: 443 - local_ip: 172.168.100.149 - local_port: 57059 + local_ip: 172.168.1.100 + local_port: 49451 http_version: 2 protocol: 2 ssl_verifyresult: 0 - scheme: HTTPS - appconnect_time_us: 81617 - connect_time_us: 42299 - namelookup_time_us: 1169 - pretransfer_time_us: 81692 + scheme: https + appconnect_time_us: 79729 + connect_time_us: 38000 + namelookup_time_us: 1316 + pretransfer_time_us: 79785 redirect_time_us: 0 - starttransfer_time_us: 156866 - total_time_us: 156910 + starttransfer_time_us: 162837 + total_time_us: 162861 effective_method: GET capath: '' cainfo: ''