diff --git a/auth0/management/organizations.py b/auth0/management/organizations.py index 8e0473a3..2e2414f6 100644 --- a/auth0/management/organizations.py +++ b/auth0/management/organizations.py @@ -329,6 +329,7 @@ def all_organization_member_roles( user_id: str, page: int | None = None, per_page: int | None = None, + include_totals: bool = False, ) -> list[dict[str, Any]]: """Retrieves a list of all the roles from the given organization member. @@ -343,9 +344,17 @@ def all_organization_member_roles( per_page (int, optional): The amount of entries per page. When not set, the default value is up to the server. + include_totals (bool, optional): True if the query summary is + to be included in the result, False otherwise. Defaults to False. + See: https://auth0.com/docs/api/management/v2#!/Organizations/get_organization_member_roles """ - params = {"page": page, "per_page": per_page} + params = { + "page": page, + "per_page": per_page, + "include_totals": str(include_totals).lower() + } + return self.client.get( self._url(id, "members", user_id, "roles"), params=params ) diff --git a/auth0/test/management/test_organizations.py b/auth0/test/management/test_organizations.py index c4b9235a..eca0fcb2 100644 --- a/auth0/test/management/test_organizations.py +++ b/auth0/test/management/test_organizations.py @@ -342,10 +342,19 @@ def test_all_organization_member_roles(self, mock_rc): "https://domain/api/v2/organizations/test-org/members/test-user/roles", args[0], ) - self.assertEqual(kwargs["params"], {"page": None, "per_page": None}) + self.assertEqual( + kwargs["params"], + { + "page": None, + "per_page": None, + "include_totals": "false", + }, + ) # Specific pagination - c.all_organization_member_roles("test-org", "test-user", page=7, per_page=25) + c.all_organization_member_roles( + "test-org", "test-user", page=7, per_page=25, include_totals=True + ) args, kwargs = mock_instance.get.call_args @@ -353,7 +362,14 @@ def test_all_organization_member_roles(self, mock_rc): "https://domain/api/v2/organizations/test-org/members/test-user/roles", args[0], ) - self.assertEqual(kwargs["params"], {"page": 7, "per_page": 25}) + self.assertEqual( + kwargs["params"], + { + "page": 7, + "per_page": 25, + "include_totals": "true", + }, + ) @mock.patch("auth0.management.organizations.RestClient") def test_create_organization_member_roles(self, mock_rc):