Repository: auth0/auth0-python

Issue:
`get_all_organization_members` should support `fields`
### Checklist

- [X] I have looked into the [Readme](https://github.com/auth0/auth0-python#readme) and [Examples](https://github.com/auth0/auth0-python/blob/master/EXAMPLES.md), and have not found a suitable solution or answer.
- [X] I have looked into the [API documentation](https://auth0-python.readthedocs.io/en/latest/) and have not found a suitable solution or answer.
- [X] I have searched the [issues](https://github.com/auth0/auth0-python/issues) and have not found a suitable solution or answer.
- [X] I have searched the [Auth0 Community](https://community.auth0.com) forums and have not found a suitable solution or answer.
- [X] I agree to the terms within the [Auth0 Code of Conduct](https://github.com/auth0/open-source-template/blob/master/CODE-OF-CONDUCT.md).

### Describe the problem you'd like to have solved

The endpoint for fetching all Organization members allows us to pass a `fields` parameter, specifically to include all member's roles in the response. The python library hides this option, and it would be much more performant to allow us to get all roles attached in one request instead of n^2 requests to fetch all users and then each user's roles in a separate request for each.

### Describe the ideal solution

There are two ways it could play out, either by adding a `include_roles` flag, or by providing access to add more paramters via ** args to this and other functions.

### Alternatives and current workarounds

The current way we have to do this is to do the following;
1. Fetch all users in an organization
2. Iterate over each user, sending a new request to fetch that user's roles specifically

### Additional context

_No response_

Comments:

Patch:
diff --git a/auth0/management/organizations.py b/auth0/management/organizations.py
index 940aef7..dabaf6c 100644
--- a/auth0/management/organizations.py
+++ b/auth0/management/organizations.py
@@ -246,9 +246,14 @@ class Organizations:
         include_totals: bool = True,
         from_param: str | None = None,
         take: int | None = None,
+        fields: list[str] | None = None,
+        include_fields: bool = True,
     ):
         """Retrieves a list of all the organization members.
 
+        Member roles are not sent by default. Use `fields=roles` to retrieve the roles assigned to each listed member.
+        To use this parameter, you must include the `read:organization_member_roles scope` in the token.
+
         Args:
             id (str): the ID of the organization.
 
@@ -267,7 +272,14 @@ class Organizations:
             take (int, optional): The total amount of entries to retrieve when
                 using the from parameter. When not set, the default value is up to the server.
 
-        See: https://auth0.com/docs/api/management/v2#!/Organizations/get_members
+            fields (list of str, optional): A list of fields to include or
+              exclude from the result (depending on include_fields). If fields is left blank,
+              all fields (except roles) are returned.
+
+            include_fields (bool, optional): True if the fields specified are
+              to be included in the result, False otherwise. Defaults to True.
+
+        See: https://auth0.com/docs/api/management/v2/organizations/get-members
         """
 
         params = {
@@ -276,6 +288,8 @@ class Organizations:
             "include_totals": str(include_totals).lower(),
             "from": from_param,
             "take": take,
+            "fields": fields and ",".join(fields) or None,
+            "include_fields": str(include_fields).lower(),
         }
 
         return self.client.get(self._url(id, "members"), params=params)


Test patch:
diff --git a/auth0/test/management/test_organizations.py b/auth0/test/management/test_organizations.py
index a445ebf..ec1fc84 100644
--- a/auth0/test/management/test_organizations.py
+++ b/auth0/test/management/test_organizations.py
@@ -232,6 +232,8 @@ class TestOrganizations(unittest.TestCase):
                 "include_totals": "true",
                 "from": None,
                 "take": None,
+                "fields": None,
+                "include_fields": "true",
             },
         )
 
@@ -253,6 +255,8 @@ class TestOrganizations(unittest.TestCase):
                 "include_totals": "false",
                 "from": None,
                 "take": None,
+                "fields": None,
+                "include_fields": "true",
             },
         )
 
@@ -272,6 +276,29 @@ class TestOrganizations(unittest.TestCase):
                 "page": None,
                 "per_page": None,
                 "include_totals": "true",
+                "fields": None,
+                "include_fields": "true",
+            },
+        )
+
+        # With fields
+        c.all_organization_members("test-org", fields=["a,b"], include_fields=False)
+
+        args, kwargs = mock_instance.get.call_args
+
+        self.assertEqual(
+            "https://domain/api/v2/organizations/test-org/members", args[0]
+        )
+        self.assertEqual(
+            kwargs["params"],
+            {
+                "page": None,
+                "per_page": None,
+                "include_totals": "true",
+                "from": None,
+                "take": None,
+                "fields": "a,b",
+                "include_fields": "false",
             },
         )