diff --git a/CHANGELOG.md b/CHANGELOG.md index f0ac2a029..c241116d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # CHANGELOG +## Next Release + +- Fix pagination parameters for `getNextPage` in `User` service + ## v7.4.1 (2024-07-24) - Fix bug where response hooks were not being called if an API request failed diff --git a/src/main/java/com/easypost/model/ChildUserCollection.java b/src/main/java/com/easypost/model/ChildUserCollection.java index 0d99d67ac..f0e5027bb 100644 --- a/src/main/java/com/easypost/model/ChildUserCollection.java +++ b/src/main/java/com/easypost/model/ChildUserCollection.java @@ -14,7 +14,7 @@ protected Map buildNextPageParameters(List children, Integ String lastId = children.get(children.size() - 1).getId(); Map parameters = new java.util.HashMap<>(); - parameters.put("before_id", lastId); + parameters.put("after_id", lastId); if (pageSize != null) { parameters.put("page_size", pageSize); diff --git a/src/test/cassettes/user/get_next_page.json b/src/test/cassettes/user/get_next_page.json index 68dfc51cb..ab7671323 100644 --- a/src/test/cassettes/user/get_next_page.json +++ b/src/test/cassettes/user/get_next_page.json @@ -1,6 +1,6 @@ [ { - "recordedAt": 1704394017, + "recordedAt": 1722553209, "request": { "body": "", "method": "GET", @@ -15,66 +15,63 @@ "uri": "https://api.easypost.com/v2/users/children?%70%61%67%65%5F%73%69%7A%65\u003d%35" }, "response": { - "body": "{\n \"children\": [\n {\n \"parent_id\": \"user_0f6b83e3530b401cb1e8aeaa6a250d4d\",\n \"name\": \"Test User\",\n \"verified\": true,\n \"created_at\": \"2023-05-16T22:01:20Z\",\n \"phone_number\": \"REDACTED\",\n \"id\": \"user_484dd58db70a4f31b4bb862998cf0e04\",\n \"object\": \"User\"\n },\n {\n \"parent_id\": \"user_0f6b83e3530b401cb1e8aeaa6a250d4d\",\n \"name\": \"Test User\",\n \"verified\": true,\n \"created_at\": \"2023-09-27T22:05:26Z\",\n \"phone_number\": \"REDACTED\",\n \"id\": \"user_14e894c0d541459395f4456e7cf4f175\",\n \"object\": \"User\"\n },\n {\n \"parent_id\": \"user_0f6b83e3530b401cb1e8aeaa6a250d4d\",\n \"name\": \"Test User\",\n \"verified\": true,\n \"created_at\": \"2023-11-30T19:23:22Z\",\n \"phone_number\": \"REDACTED\",\n \"id\": \"user_f04df3dad13848339a7975d295d6629f\",\n \"object\": \"User\"\n }\n ],\n \"has_more\": false\n}", + "body": "{\n \"children\": [\n {\n \"parent_id\": \"user_04ad194774a54f6c97d1385715721091\",\n \"name\": \"test user\",\n \"verified\": true,\n \"created_at\": \"2023-12-07T17:46:08Z\",\n \"phone_number\": \"REDACTED\",\n \"id\": \"user_af930e9bd27a4445bc2741fac37850cc\",\n \"object\": \"User\"\n }\n ],\n \"has_more\": false\n}", "httpVersion": null, "headers": { "null": [ "HTTP/1.1 200 OK" ], "content-length": [ - "673" + "245" ], "expires": [ "0" ], "x-node": [ - "bigweb32nuq" + "bigweb53nuq" ], "x-frame-options": [ "SAMEORIGIN" ], - "x-backend": [ - "easypost" + "x-download-options": [ + "noopen" ], "x-permitted-cross-domain-policies": [ "none" ], - "x-download-options": [ - "noopen" - ], - "strict-transport-security": [ - "max-age\u003d31536000; includeSubDomains; preload" + "x-backend": [ + "easypost" ], "pragma": [ "no-cache" ], - "x-canary": [ - "direct" - ], - "x-content-type-options": [ - "nosniff" + "strict-transport-security": [ + "max-age\u003d31536000; includeSubDomains; preload" ], "x-xss-protection": [ "1; mode\u003dblock" ], + "x-content-type-options": [ + "nosniff" + ], "x-ep-request-uuid": [ - "3c78c4086596fd20e799fac90006528a" + "0af7a3d266ac1379f3f6c7ce003825ec" ], "x-proxied": [ - "extlb2nuq 003ad9bca0", - "intlb2nuq 2c48984abf" + "intlb3nuq c0f5e722d1", + "extlb2nuq fa152d4755" ], "referrer-policy": [ "strict-origin-when-cross-origin" ], "x-runtime": [ - "0.193572" + "0.027442" ], "content-type": [ "application/json; charset\u003dutf-8" ], "x-version-label": [ - "easypost-202401041812-437974c716-master" + "easypost-202408012128-41ee7f299e-master" ], "cache-control": [ "private, no-cache, no-store" @@ -86,6 +83,6 @@ }, "uri": "https://api.easypost.com/v2/users/children?%70%61%67%65%5F%73%69%7A%65\u003d%35" }, - "duration": 594 + "duration": 1030 } ] \ No newline at end of file