-
Notifications
You must be signed in to change notification settings - Fork 174
Add GET Users-by-email to the Management API #96
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #96 +/- ##
==========================================
+ Coverage 93.24% 93.46% +0.22%
==========================================
Files 33 33
Lines 666 658 -8
==========================================
- Hits 621 615 -6
+ Misses 45 43 -2
Continue to review full report at Codecov.
|
@lbalmaceda hi, this is for ZD # 37109 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@saltukalakus thanks for the contribution. The endpoint returns an array of "users" and this type of object is already being handled by the Users
class. Please move the changes to the existing class rather than creating this new one. I've left 2 more in-line comments.
Cheers
self.assertEqual('https://domain/api/v2/users-by-email', args[0]) | ||
self.assertEqual(kwargs['params'], { | ||
'email': '[email protected]', | ||
'fields': None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean that there's a field=null
parameter being sent on the body?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes we set this parameter to None before sending it, if the field array is empty on this line.
self.assertEqual(kwargs['params'], { | ||
'email': '[email protected]', | ||
'fields': None, | ||
'include_fields': 'true' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this is probably no harm, but why sending this if no fields
where passed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made a quick test and setting the field to True or False makes no harm if fields array is not sent. I had copied this behaviour from list API.
Hi @saltukalakus any updates to this? We are waiting for this to be merged. |
Hi @lbalmaceda thanks for the review and sorry for the late response as this was slipped through the cracks. Before I fix the issues for the other inlined comments, can we decide on this?
In the past months, we had grouped the functionality based on the grouping of https://auth0.com/docs/api/management/v2 site . This makes it more easy and intuitive for the developers using the library. If we go that way, it is better to create a separate file for this endpoint otherwise I will follow your recommendation. cc @mcschan |
Personally in my libs, I'd keep it inside the On a related topic, this doesn't seem to handle pagination, does it? All APIv2 endpoints will soon require that and since this one hasn't been merged yet, I'd like you to only expose a paginated method + result. Would that be OK ? |
Pagination for this API isn't documented in the API explorer so it might be a better idea to keep it this way until it is public. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds right to keep pagination out for now. @saltukalakus only one last comment. Also please rebase.
url = 'https://%s/api/v2/users-by-email' % self.domain | ||
return url | ||
|
||
def search_users_by_email(self, email, fields=[], include_fields=True): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default values are evaluated when the function is compiled, which is an important distinction if the value is mutable.
Please change []
to None
and do the check later. See how it's done here
@saltukalakus I was about to merge this one but I realized you're missing the import and initialization in these two files, following the existing code: https://github.com/auth0/auth0-python/blob/master/auth0/v3/management/__init__.py https://github.com/auth0/auth0-python/blob/master/auth0/v3/management/auth0.py can you please do that ? |
Hi @lbalmaceda updated my fork and did the changes. Does it look fine? |
No description provided.