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

Add Hooks management API #227

Merged
merged 7 commits into from
Jul 13, 2020
Merged

Add Hooks management API #227

merged 7 commits into from
Jul 13, 2020

Conversation

guillp
Copy link

@guillp guillp commented Jul 3, 2020

Changes

Adds the Hooks management API that was missing in auth0-python, along with unit tests.
It also includes Hooks Secrets management.

References

API docs: https://auth0.com/docs/api/management/v2#!/Hooks/get_hooks
Closes #224

Testing

  • This change adds unit test coverage
  • This change has been tested on Python 3.8

Checklist

@guillp guillp requested a review from a team July 3, 2020 08:40
Copy link
Contributor

@lbalmaceda lbalmaceda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! In general looks good. I left 2 comments. There are properties not publicly documented as available. Unless those are in the API swagger docs, we shouldn't add them to the SDK.

If anything, we can always add them later. But removing them later would be a breaking change.

"""
return self.client.post(self._url(), data=body)

def get(self, id, fields=None, include_fields=True):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any property other than id documented here https://auth0.com/docs/api/management/v2#!/Hooks/get_hooks_by_id.

Please, remove fields and include_fields.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review. Those fields are indeed not part of the documented fields but the descriptions states "Accepts a list of fields to include or exclude in the result." That's why I included them (I didn't test yet if they work or not).
I can remove them, but I also suggest to remove this comment from the documentation.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested, and those fields and include_fieldsactually work for this API. So I would suggest fixing the doc (if that might take too long, I can remove them from the PR so they can be added later, just let me know).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could do the PR to fix the docs but I'd first like to check with the Hooks team why these properties are not documented (there might be a reason).

We can hold off merging this PR until that response comes back (might take ~10 days), or if you want, you can remove these properties for now and if the team later says they are valid, we can update the docs and this SDK on a separate PR.

How does that sound @guillp?

Copy link
Author

@guillp guillp Jul 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries, I don't mind waiting for a few days until you sort it out internally.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@guillp I got confirmation that for GET Hooks/{id} the fields argument is supported. What they didn't specify is about the include_fields argument. I assume it is, since both relate. Can you run a quick request and test that for me, please?

For secrets, there's no support for fields. So good that you removed them. I think we can get this merged and released today if you're around. Please, do rebase the branch since I merged a few PRs a few hours ago.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update from the team: include_fields is not supported on neither of these endpoints. Let's keep the fields arg only for this endpoint.
Regarding the tests, I retried the build and it passed 👍

auth0/v3/management/hooks.py Outdated Show resolved Hide resolved
@lbalmaceda lbalmaceda added this to the v3-Next milestone Jul 3, 2020
@guillp
Copy link
Author

guillp commented Jul 3, 2020

not sure why that test fails, it is unrelated to the change I made.

@lbalmaceda lbalmaceda self-requested a review July 13, 2020 17:26
@lbalmaceda lbalmaceda merged commit d69ca20 into auth0:master Jul 13, 2020
@lbalmaceda lbalmaceda modified the milestones: v3-Next, 3.12.0 Jul 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing Hooks API
3 participants