@@ -21,7 +21,7 @@ class UserService extends \JiraRestApi\JiraClient
2121 */
2222 public function get ($ paramArray )
2323 {
24- $ queryParam = '? ' . http_build_query ($ paramArray );
24+ $ queryParam = '? ' . http_build_query ($ paramArray );
2525
2626 $ ret = $ this ->exec ($ this ->uri .$ queryParam , null );
2727
@@ -32,11 +32,49 @@ public function get($paramArray)
3232 );
3333 }
3434
35- public function search ($ paramArray )
35+ /**
36+ * Returns a list of users that match the search string and/or property.
37+ *
38+ * @param $paramArray
39+ * @return array
40+ * @throws \JiraRestApi\JiraException
41+ * @throws \JsonMapper_Exception
42+ */
43+ public function findUsers ($ paramArray )
44+ {
45+ $ queryParam = '? ' . http_build_query ($ paramArray );
46+
47+ $ ret = $ this ->exec ($ this ->uri . '/search ' . $ queryParam , null );
48+
49+ $ this ->log ->addInfo ("Result= \n" .$ ret );
50+
51+ $ userData = json_decode ($ ret );
52+ $ users = [];
53+
54+ foreach ($ userData as $ user ) {
55+ $ users [] = $ this ->json_mapper ->map (
56+ $ user , new User ()
57+ );
58+ }
59+ return $ users ;
60+ }
61+
62+ /**
63+ * Returns a list of users that match the search string.
64+ * Please note that this resource should be called with an issue key when a list of assignable users is retrieved for editing.
65+ *
66+ * @param $paramArray
67+ * @return array
68+ * @throws \JiraRestApi\JiraException
69+ * @throws \JsonMapper_Exception
70+ *
71+ * @see https://docs.atlassian.com/jira/REST/cloud/#api/2/user-findAssignableUsers
72+ */
73+ public function findAssignableUsers ($ paramArray )
3674 {
37- $ queryParam = '? ' . http_build_query ($ paramArray );
75+ $ queryParam = '? ' . http_build_query ($ paramArray );
3876
39- $ ret = $ this ->exec ($ this ->uri . ' / search '. $ queryParam , null );
77+ $ ret = $ this ->exec ($ this ->uri . ' /assignable/ search ' . $ queryParam , null );
4078
4179 $ this ->log ->addInfo ("Result= \n" .$ ret );
4280
@@ -48,6 +86,7 @@ public function search($paramArray)
4886 $ user , new User ()
4987 );
5088 }
89+
5190 return $ users ;
5291 }
5392}
0 commit comments