Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
佳 邓
Gitlab4j Api
Commits
0e3aaaa8
Commit
0e3aaaa8
authored
May 12, 2015
by
六幻
Browse files
add findUsers method.
parent
3d855d1f
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/com/messners/gitlab/api/UserApi.java
View file @
0e3aaaa8
package
com.messners.gitlab.api
;
package
com.messners.gitlab.api
;
import
java.io.IOException
;
import
java.net.MalformedURLException
;
import
java.net.URL
;
import
java.util.List
;
import
java.util.List
;
import
com.messners.gitlab.api.models.User
;
import
com.messners.gitlab.api.models.User
;
...
@@ -75,9 +78,17 @@ public class UserApi extends AbstractApi {
...
@@ -75,9 +78,17 @@ public class UserApi extends AbstractApi {
* @throws GitLabApiException
* @throws GitLabApiException
*/
*/
public
List
<
User
>
findUsers
(
String
emailOrUsername
)
throws
GitLabApiException
{
public
List
<
User
>
findUsers
(
String
emailOrUsername
)
throws
GitLabApiException
{
Form
formData
=
new
Form
();
URL
url
;
addFormParam
(
formData
,
"search"
,
emailOrUsername
,
true
);
try
{
ClientResponse
response
=
get
(
ClientResponse
.
Status
.
OK
,
formData
,
"users"
);
url
=
new
URL
(
getApiClient
().
getApiUrl
(
"users"
).
toString
()+
"?search="
+
emailOrUsername
);
}
catch
(
MalformedURLException
e
)
{
e
.
printStackTrace
();
return
null
;
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
return
null
;
}
ClientResponse
response
=
get
(
ClientResponse
.
Status
.
OK
,
null
,
url
);
return
(
response
.
getEntity
(
new
GenericType
<
List
<
User
>>()
{}));
return
(
response
.
getEntity
(
new
GenericType
<
List
<
User
>>()
{}));
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment