diff --git a/CHANGELOG.md b/CHANGELOG.md index 82a9b18..251a2ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ This project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased][unreleased] +## [v4.7.0] - 2023-07-31 + +Add pagination attributes for accounts API + ## [v4.6.0] - 2023-07-24 Adds support for Accounts API diff --git a/setup.py b/setup.py index 8dcea6f..a38391b 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name="trycourier", - version="4.6.0", + version="4.7.0", author="Courier", author_email="support@courier.com", description="A Python Package for communicating with the Courier REST API.", diff --git a/tests/test_accounts.py b/tests/test_accounts.py index 64fe793..95a8d69 100644 --- a/tests/test_accounts.py +++ b/tests/test_accounts.py @@ -35,7 +35,7 @@ def test_success_get_accounts(): 'https://api.courier.com/accounts', status=200, content_type='application/json', - body='{"items":[{"id":"ACME", "name":"ACME Inc", "properties":{}, "default_preferences":{}, "user_profile":{}}], "has_more": false}' + body='{"items":[{"id":"ACME", "name":"ACME Inc", "properties":{}, "default_preferences":{}, "user_profile":{}}], "has_more": false, "next_url": null, "url": "/accounts"}' ) c = Courier(auth_token='123456789ABCDF') @@ -49,7 +49,9 @@ def test_success_get_accounts(): "default_preferences":{}, "user_profile":{} }], - "has_more": False + "has_more": False, + "next_url": None, + "url": "/accounts", } @responses.activate diff --git a/trycourier/accounts.py b/trycourier/accounts.py index 498f5cb..af2bfb8 100644 --- a/trycourier/accounts.py +++ b/trycourier/accounts.py @@ -33,13 +33,13 @@ def get_account(self, account_id): return resp.json() - def get_accounts(self, limit=None, starting_after=None): + def get_accounts(self, limit=None, cursor=None): """ Lists accounts Args: limit: The number of accounts to return (default 20, max 100) - starting_after: Value of next_page from previous response + cursor: Value of next_page from previous response Raises: CourierAPIException: Any error returned by the Courier API @@ -53,8 +53,8 @@ def get_accounts(self, limit=None, starting_after=None): if limit: params['limit'] = limit - if starting_after: - params['starting_after'] = starting_after + if cursor: + params['cursor'] = cursor resp = self.session.get(self.uri, params=params) diff --git a/trycourier/client.py b/trycourier/client.py index a351be5..00b18d2 100644 --- a/trycourier/client.py +++ b/trycourier/client.py @@ -12,7 +12,7 @@ from .notifications import Notifications from .profiles import Profiles -__version__ = '4.6.0' +__version__ = '4.7.0' class Courier(object):