Closed StingRayZA closed 8 months ago
I think we may need to handle the scenario where no match is found?
I suspect .first will throw an error.
We can add a spec too.
Great work @StingRayZA
I think we may need to handle the scenario where no match is found?
I suspect .first will throw an error.
We can add a spec too.
I had a look at this specifically, and in the case where a 'plain' api returns no results, you get an empty array back. I decided to make this the behaviour for this method, too.
❯ curl -s --header "PRIVATE-TOKEN: ${GITLAB_TOKEN}" "http://gdk.test:3000/api/v4/users?username=reported_user_11234"
[]
I fleshed the specs out, too, in order to cater for this particular occurence.
Hi @NARKOZ Would you be able to take a look at this, please?
Thanks in advance 🙏
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I think we're still looking for a review here please 🙏
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Change
This change allows you to run a username search to find a single user.
Context
The GitLab api
search
parameter searches through more than justusername
. According to the docs, it searchesname
,username
andpublic_email
.You can see this behaviour here:
If I wanted to get a specific user by username, I need to use the
username
parameter:You can see this doesn't also return users starting with
reported_user_1
(likereported_user_10
, etc)Current behaviour
The current
user_search
endpoint would require the following invocation to return a single user:Invoking the same with 'simply'
user_search
returns multiple matches: