diff --git a/README.md b/README.md index 9e09b8b..757860c 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ If you have any questions or concern, please [file an issue](https://github.com/ - [Releases](Repositories/Releases.md) - [Webhooks](Repositories/Webhooks.md) - [Users](Users) + - [Search](Users/Search.md) - [Emails](Users/Emails.md) - [Followers](Users/Followers.md) - [Public Keys](Users/Public%20Keys.md) diff --git a/Users/README.md b/Users/README.md index 98f8f57..895a175 100644 --- a/Users/README.md +++ b/Users/README.md @@ -1,53 +1,5 @@ # Users -## Search users - -``` -GET /users/search -``` - -> Request without providing basic authentication or access token will result empty `email` field for anti-spam purpose. - -### Parameters - -|Name|Type|Description| -|----|----|-----------| -|q|string|**Required** Keyword of username| -|limit|int|Limit number of search results. Default is **10**| - -### Example - -``` -$ curl https://try.gogs.io/api/v1/users/search?q=u&limit=5 -``` - -### Response - -``` -Status: 200 OK -``` -```json -{ - "data": [ - { - "id": 1, - "username": "unknwon", - "full_name": "", - "email": "fake@local", - "avatar_url": "/avatars/1" - }, - { - "id": 4, - "username": "user1", - "full_name": "", - "email": "user1@user.com", - "avatar_url": "/avatars/4" - } - ], - "ok": true -} -``` - ## Get a single user ``` diff --git a/Users/Search.md b/Users/Search.md new file mode 100644 index 0000000..9bce186 --- /dev/null +++ b/Users/Search.md @@ -0,0 +1,48 @@ +# Search users + +``` +GET /users/search +``` + +> Request without providing basic authentication or access token will result empty `email` field for anti-spam purpose. + +### Parameters + +|Name|Type|Description| +|----|----|-----------| +|q|string|**Required** Keyword of username| +|field|string|What field to search on. Only allows `name` (default) and `email`| +|limit|int|Limit number of search results. Default is **10**| + +### Example + +``` +$ curl https://try.gogs.io/api/v1/users/search?q=u&limit=5 +``` + +### Response + +``` +Status: 200 OK +``` +```json +{ + "data": [ + { + "id": 1, + "username": "unknwon", + "full_name": "", + "email": "fake@local", + "avatar_url": "/avatars/1" + }, + { + "id": 4, + "username": "user1", + "full_name": "", + "email": "user1@user.com", + "avatar_url": "/avatars/4" + } + ], + "ok": true +} +```