Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API management call and headers like X-Correlation-ID #529

Open
5 tasks done
a-marcellini opened this issue Sep 26, 2023 · 3 comments
Open
5 tasks done

API management call and headers like X-Correlation-ID #529

a-marcellini opened this issue Sep 26, 2023 · 3 comments
Labels
feature request A feature has been asked for or suggested by the community

Comments

@a-marcellini
Copy link

Checklist

  • I have looked into the Readme and Examples, and have not found a suitable solution or answer.
  • I have looked into the API documentation and have not found a suitable solution or answer.
  • I have searched the issues and have not found a suitable solution or answer.
  • I have searched the Auth0 Community forums and have not found a suitable solution or answer.
  • I agree to the terms within the Auth0 Code of Conduct.

Describe the problem you'd like to have solved

Hi all,
I need to specify X-Correlation-ID header in every management call, however, despite the fact that the low-level RestClient api allow to specify any request-header, the high-level ones don't.
As an example in users lib the method to get a user is:

    def get(
        self, id: str, fields: List[str] | None = None, include_fields: bool = True
    ) -> dict[str, Any]:
        """Get a user.

        Args:
            id (str): The user_id of the user to retrieve.

            fields (list of str, optional): A list of fields to include or
                exclude from the result (depending on include_fields). Leave empty to
                retrieve all fields.

            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#!/Users/get_users_by_id
        """
        params = {
            "fields": fields and ",".join(fields) or None,
            "include_fields": str(include_fields).lower(),
        }

        return self.client.get(self._url(id), params=params)

That doesn't allow to specify any request parameter.

Describe the ideal solution

What about change all the method signatures specifying an optional last parameter with the request_headers like this:

def get(
        self, id: str, fields: List[str] | None = None, include_fields: bool = True, request_headers: dict = None
    ) -> dict[str, Any]:
  
  ...
  
  return self.client.get(self._url(id), params=params, headers=request_headers)

Alternatives and current workarounds

No response

Additional context

No response

@a-marcellini a-marcellini added the feature request A feature has been asked for or suggested by the community label Sep 26, 2023
@adamjmcgrath
Copy link
Contributor

Thanks for raising this @a-marcellini - i'll review your request and get back to you

@adamjmcgrath
Copy link
Contributor

Hi @a-marcellini - we can do this, but I can't give you a timeline. You're welcome to offer a PR in the meantime, or wait for us to schedule it in.

@aleksandr-vin
Copy link

Came here with same request :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request A feature has been asked for or suggested by the community
Projects
None yet
Development

No branches or pull requests

3 participants