Repository: auth0/auth0-python

Issue:
ClientGrants.all is missing `client_id` parameter supported by the API
https://auth0.com/docs/api/management/v2#!/Client_Grants/get_client_grants

Discussion:
danishprakash: @lbalmaceda could you please review this when you get time? I'm not sure whether it is complete.

Patch:
diff --git a/auth0/v3/management/client_grants.py b/auth0/v3/management/client_grants.py
index 6b37015..719aab3 100644
--- a/auth0/v3/management/client_grants.py
+++ b/auth0/v3/management/client_grants.py
@@ -24,7 +24,7 @@ class ClientGrants(object):
             return url + '/' + id
         return url
 
-    def all(self, audience=None, page=None, per_page=None, include_totals=False):
+    def all(self, audience=None, page=None, per_page=None, include_totals=False, client_id=None):
         """Retrieves all client grants.
 
         Args:
@@ -37,7 +37,9 @@ class ClientGrants(object):
 
             include_totals (bool, optional): True if the query summary is
                 to be included in the result, False otherwise.
-            
+
+            client_id (string, optional): The id of a client to filter
+
         See: https://auth0.com/docs/api/management/v2#!/Client_Grants/get_client_grants
         """
 
@@ -45,7 +47,8 @@ class ClientGrants(object):
             'audience': audience,
             'page': page,
             'per_page': per_page,
-            'include_totals': str(include_totals).lower()
+            'include_totals': str(include_totals).lower(),
+            'client_id': client_id,
         }
 
         return self.client.get(self._url(), params=params)


Test patch:
diff --git a/auth0/v3/test/management/test_client_grants.py b/auth0/v3/test/management/test_client_grants.py
index 3d6b292..1155649 100644
--- a/auth0/v3/test/management/test_client_grants.py
+++ b/auth0/v3/test/management/test_client_grants.py
@@ -21,7 +21,8 @@ class TestClientGrants(unittest.TestCase):
             'audience': None,
             'page': None,
             'per_page': None,
-            'include_totals': 'false'
+            'include_totals': 'false',
+            'client_id': None,
         })
 
         # With audience
@@ -34,7 +35,8 @@ class TestClientGrants(unittest.TestCase):
             'audience': 'http://domain.auth0.com/api/v2/',
             'page': None,
             'per_page': None,
-            'include_totals': 'false'
+            'include_totals': 'false',
+            'client_id': None,
         })
 
         # With pagination params
@@ -47,7 +49,22 @@ class TestClientGrants(unittest.TestCase):
             'audience': None,
             'page': 7,
             'per_page': 23,
-            'include_totals': 'true'
+            'include_totals': 'true',
+            'client_id': None,
+        })
+
+        # With client_id param
+        c.all(client_id='exampleid')
+
+        args, kwargs = mock_instance.get.call_args
+
+        self.assertEqual('https://domain/api/v2/client-grants', args[0])
+        self.assertEqual(kwargs['params'], {
+            'audience': None,
+            'page': None,
+            'per_page': None,
+            'include_totals': 'false',
+            'client_id': 'exampleid',
         })
 
     @mock.patch('auth0.v3.management.client_grants.RestClient')