10 defined(
'JPATH_PLATFORM') or die();
34 public function getUsersLookup($screen_name = null, $id = null, $entities = null)
37 $this->checkRateLimit(
'users',
'lookup');
42 $data[
'user_id'] = $id;
46 $data[
'screen_name'] = $screen_name;
48 if ($id == null && $screen_name == null)
51 throw new RuntimeException(
'You must specify either a comma separated list of screen names, user IDs, or a combination of the two');
55 $path =
'/users/lookup.json';
58 if (!is_null($entities))
60 $data[
'include_entities'] = $entities;
64 return $this->sendRequest($path,
'POST', $data);
76 public function getUserProfileBanner($user)
79 $this->checkRateLimit(
'users',
'profile_banner');
82 $path =
'/users/profile_banner.json';
85 if (is_numeric($user))
87 $data[
'user_id'] = $user;
89 elseif (is_string($user))
91 $data[
'screen_name'] = $user;
96 throw new RuntimeException(
'The specified username is not in the correct format; must use integer or string');
100 return $this->sendRequest($path,
'GET', $data);
117 public function searchUsers($query, $page = 0, $count = 0, $entities = null)
120 $this->checkRateLimit(
'users',
'search');
122 $data[
'q'] = rawurlencode($query);
127 $data[
'page'] = $page;
133 $data[
'count'] = $count;
137 if (!is_null($entities))
139 $data[
'include_entities'] = $entities;
143 $path =
'/users/search.json';
146 return $this->sendRequest($path,
'GET', $data);
160 public function getUser($user, $entities = null)
163 $this->checkRateLimit(
'users',
'show');
166 if (is_numeric($user))
168 $data[
'user_id'] = $user;
170 elseif (is_string($user))
172 $data[
'screen_name'] = $user;
177 throw new RuntimeException(
'The specified username is not in the correct format; must use integer or string');
181 $path =
'/users/show.json';
184 if (!is_null($entities))
186 $data[
'include_entities'] = $entities;
190 return $this->sendRequest($path,
'GET', $data);
205 public function getContributees($user, $entities = null, $skip_status = null)
208 $this->checkRateLimit(
'users',
'contributees');
211 if (is_numeric($user))
213 $data[
'user_id'] = $user;
215 elseif (is_string($user))
217 $data[
'screen_name'] = $user;
222 throw new RuntimeException(
'The specified username is not in the correct format; must use integer or string');
226 $path =
'/users/contributees.json';
229 if (!is_null($entities))
231 $data[
'include_entities'] = $entities;
235 if (!is_null($skip_status))
237 $data[
'skip_status'] = $skip_status;
241 return $this->sendRequest($path,
'GET', $data);
256 public function getContributors($user, $entities = null, $skip_status = null)
259 $this->checkRateLimit(
'users',
'contributors');
262 if (is_numeric($user))
264 $data[
'user_id'] = $user;
266 elseif (is_string($user))
268 $data[
'screen_name'] = $user;
273 throw new RuntimeException(
'The specified username is not in the correct format; must use integer or string');
277 $path =
'/users/contributors.json';
280 if (!is_null($entities))
282 $data[
'include_entities'] = $entities;
286 if (!is_null($skip_status))
288 $data[
'skip_status'] = $skip_status;
292 return $this->sendRequest($path,
'GET', $data);
304 public function getSuggestions($lang = null)
307 $this->checkRateLimit(
'users',
'suggestions');
310 $path =
'/users/suggestions.json';
317 $data[
'lang'] = $lang;
321 return $this->sendRequest($path,
'GET', $data);
334 public function getSuggestionsSlug($slug, $lang = null)
337 $this->checkRateLimit(
'users',
'suggestions/:slug');
340 $path =
'/users/suggestions/' . $slug .
'.json';
347 $data[
'lang'] = $lang;
351 return $this->sendRequest($path,
'GET', $data);
364 public function getSuggestionsSlugMembers($slug)
367 $this->checkRateLimit(
'users',
'suggestions/:slug/members');
370 $path =
'/users/suggestions/' . $slug .
'/members.json';
373 return $this->sendRequest($path);