10 defined(
'JPATH_PLATFORM') or die();
33 public function getLists($user, $reverse = null)
36 $this->checkRateLimit(
'lists',
'list');
39 if (is_numeric($user))
41 $data[
'user_id'] = $user;
43 elseif (is_string($user))
45 $data[
'screen_name'] = $user;
50 throw new RuntimeException(
'The specified username is not in the correct format; must use integer or string');
54 if (!is_null($reverse))
56 $data[
'reverse'] = $reverse;
60 $path =
'/lists/list.json';
63 return $this->sendRequest($path,
'GET', $data);
84 public function getStatuses($list, $owner = null, $since_id = 0, $max_id = 0, $count = 0, $entities = null, $include_rts = null)
87 $this->checkRateLimit(
'lists',
'statuses');
90 if (is_numeric($list))
92 $data[
'list_id'] = $list;
94 elseif (is_string($list))
96 $data[
'slug'] = $list;
99 if (is_numeric($owner))
101 $data[
'owner_id'] = $owner;
103 elseif (is_string($owner))
105 $data[
'owner_screen_name'] = $owner;
110 throw new RuntimeException(
'The specified username is not in the correct format; must use integer or string');
116 throw new RuntimeException(
'The specified list is not in the correct format; must use integer or string');
120 $path =
'/lists/statuses.json';
125 $data[
'since_id'] = $since_id;
131 $data[
'max_id'] = $max_id;
137 $data[
'count'] = $count;
141 if (!is_null($entities))
143 $data[
'include_entities'] = $entities;
147 if (!is_null($include_rts))
149 $data[
'include_rts'] = $include_rts;
153 return $this->sendRequest($path,
'GET', $data);
172 public function getSubscribers($list, $owner = null, $cursor = null, $entities = null, $skip_status = null)
175 $this->checkRateLimit(
'lists',
'subscribers');
178 if (is_numeric($list))
180 $data[
'list_id'] = $list;
182 elseif (is_string($list))
184 $data[
'slug'] = $list;
187 if (is_numeric($owner))
189 $data[
'owner_id'] = $owner;
191 elseif (is_string($owner))
193 $data[
'owner_screen_name'] = $owner;
198 throw new RuntimeException(
'The specified username is not in the correct format; must use integer or string');
204 throw new RuntimeException(
'The specified list is not in the correct format; must use integer or string');
208 $path =
'/lists/subscribers.json';
211 if (!is_null($cursor))
213 $data[
'cursor'] = $cursor;
217 if (!is_null($entities))
219 $data[
'include_entities'] = $entities;
223 if (!is_null($skip_status))
225 $data[
'skip_status'] = $skip_status;
229 return $this->sendRequest($path,
'GET', $data);
246 public function deleteMembers($list, $user_id = null, $screen_name = null, $owner = null)
249 if (is_numeric($list))
251 $data[
'list_id'] = $list;
253 elseif (is_string($list))
255 $data[
'slug'] = $list;
258 if (is_numeric($owner))
260 $data[
'owner_id'] = $owner;
262 elseif (is_string($owner))
264 $data[
'owner_screen_name'] = $owner;
269 throw new RuntimeException(
'The specified username for owner is not in the correct format; must use integer or string');
275 throw new RuntimeException(
'The specified list is not in the correct format; must use integer or string');
280 $data[
'user_id'] = $user_id;
284 $data[
'screen_name'] = $screen_name;
286 if ($user_id == null && $screen_name == null)
289 throw new RuntimeException(
'You must specify either a comma separated list of screen names, user IDs, or a combination of the two');
293 $path =
'/lists/members/destroy_all.json';
296 return $this->sendRequest($path,
'POST', $data);
310 public function subscribe($list, $owner = null)
313 $this->checkRateLimit(
'lists',
'subscribers/create');
316 if (is_numeric($list))
318 $data[
'list_id'] = $list;
320 elseif (is_string($list))
322 $data[
'slug'] = $list;
325 if (is_numeric($owner))
327 $data[
'owner_id'] = $owner;
329 elseif (is_string($owner))
331 $data[
'owner_screen_name'] = $owner;
336 throw new RuntimeException(
'The specified username for owner is not in the correct format; must use integer or string');
342 throw new RuntimeException(
'The specified list is not in the correct format; must use integer or string');
346 $path =
'/lists/subscribers/create.json';
349 return $this->sendRequest($path,
'POST', $data);
367 public function isMember($list, $user, $owner = null, $entities = null, $skip_status = null)
370 $this->checkRateLimit(
'lists',
'members/show');
373 if (is_numeric($list))
375 $data[
'list_id'] = $list;
377 elseif (is_string($list))
379 $data[
'slug'] = $list;
382 if (is_numeric($owner))
384 $data[
'owner_id'] = $owner;
386 elseif (is_string($owner))
388 $data[
'owner_screen_name'] = $owner;
393 throw new RuntimeException(
'The specified username is not in the correct format; must use integer or string');
399 throw new RuntimeException(
'The specified list is not in the correct format; must use integer or string');
402 if (is_numeric($user))
404 $data[
'user_id'] = $user;
406 elseif (is_string($user))
408 $data[
'screen_name'] = $user;
413 throw new RuntimeException(
'The specified username is not in the correct format; must use integer or string');
417 $path =
'/lists/members/show.json';
420 if (!is_null($entities))
422 $data[
'include_entities'] = $entities;
426 if (!is_null($skip_status))
428 $data[
'skip_status'] = $skip_status;
432 return $this->sendRequest($path,
'GET', $data);
450 public function isSubscriber($list, $user, $owner = null, $entities = null, $skip_status = null)
453 $this->checkRateLimit(
'lists',
'subscribers/show');
456 if (is_numeric($list))
458 $data[
'list_id'] = $list;
460 elseif (is_string($list))
462 $data[
'slug'] = $list;
465 if (is_numeric($owner))
467 $data[
'owner_id'] = $owner;
469 elseif (is_string($owner))
471 $data[
'owner_screen_name'] = $owner;
476 throw new RuntimeException(
'The specified username is not in the correct format; must use integer or string');
482 throw new RuntimeException(
'The specified list is not in the correct format; must use integer or string');
485 if (is_numeric($user))
487 $data[
'user_id'] = $user;
489 elseif (is_string($user))
491 $data[
'screen_name'] = $user;
496 throw new RuntimeException(
'The specified username is not in the correct format; must use integer or string');
500 $path =
'/lists/subscribers/show.json';
503 if (!is_null($entities))
505 $data[
'include_entities'] = $entities;
509 if (!is_null($skip_status))
511 $data[
'skip_status'] = $skip_status;
515 return $this->sendRequest($path,
'GET', $data);
529 public function unsubscribe($list, $owner = null)
532 $this->checkRateLimit(
'lists',
'subscribers/destroy');
535 if (is_numeric($list))
537 $data[
'list_id'] = $list;
539 elseif (is_string($list))
541 $data[
'slug'] = $list;
544 if (is_numeric($owner))
546 $data[
'owner_id'] = $owner;
548 elseif (is_string($owner))
550 $data[
'owner_screen_name'] = $owner;
555 throw new RuntimeException(
'The specified username is not in the correct format; must use integer or string');
561 throw new RuntimeException(
'The specified list is not in the correct format; must use integer or string');
565 $path =
'/lists/subscribers/destroy.json';
568 return $this->sendRequest($path,
'POST', $data);
584 public function addMembers($list, $user_id = null, $screen_name = null, $owner = null)
587 $this->checkRateLimit(
'lists',
'members/create_all');
590 if (is_numeric($list))
592 $data[
'list_id'] = $list;
594 elseif (is_string($list))
596 $data[
'slug'] = $list;
599 if (is_numeric($owner))
601 $data[
'owner_id'] = $owner;
603 elseif (is_string($owner))
605 $data[
'owner_screen_name'] = $owner;
610 throw new RuntimeException(
'The specified username is not in the correct format; must use integer or string');
616 throw new RuntimeException(
'The specified list is not in the correct format; must use integer or string');
621 $data[
'user_id'] = $user_id;
625 $data[
'screen_name'] = $screen_name;
627 if ($user_id == null && $screen_name == null)
630 throw new RuntimeException(
'You must specify either a comma separated list of screen names, user IDs, or a combination of the two');
634 $path =
'/lists/members/create_all.json';
637 return $this->sendRequest($path,
'POST', $data);
654 public function getMembers($list, $owner = null, $entities = null, $skip_status = null)
657 $this->checkRateLimit(
'lists',
'members');
660 if (is_numeric($list))
662 $data[
'list_id'] = $list;
664 elseif (is_string($list))
666 $data[
'slug'] = $list;
669 if (is_numeric($owner))
671 $data[
'owner_id'] = $owner;
673 elseif (is_string($owner))
675 $data[
'owner_screen_name'] = $owner;
680 throw new RuntimeException(
'The specified username is not in the correct format; must use integer or string');
686 throw new RuntimeException(
'The specified list is not in the correct format; must use integer or string');
690 $path =
'/lists/members.json';
693 if (!is_null($entities))
695 $data[
'include_entities'] = $entities;
699 if (!is_null($skip_status))
701 $data[
'skip_status'] = $skip_status;
705 return $this->sendRequest($path,
'GET', $data);
720 public function getListById($list, $owner = null)
723 $this->checkRateLimit(
'lists',
'show');
726 if (is_numeric($list))
728 $data[
'list_id'] = $list;
730 elseif (is_string($list))
732 $data[
'slug'] = $list;
735 if (is_numeric($owner))
737 $data[
'owner_id'] = $owner;
739 elseif (is_string($owner))
741 $data[
'owner_screen_name'] = $owner;
746 throw new RuntimeException(
'The specified username is not in the correct format; must use integer or string');
752 throw new RuntimeException(
'The specified list is not in the correct format; must use integer or string');
756 $path =
'/lists/show.json';
759 return $this->sendRequest($path,
'GET', $data);
774 public function getSubscriptions($user, $count = 0, $cursor = null)
777 $this->checkRateLimit(
'lists',
'subscriptions');
780 if (is_numeric($user))
782 $data[
'user_id'] = $user;
784 elseif (is_string($user))
786 $data[
'screen_name'] = $user;
791 throw new RuntimeException(
'The specified username is not in the correct format; must use integer or string');
797 $data[
'count'] = $count;
801 if (!is_null($cursor))
803 $data[
'cursor'] = $cursor;
807 $path =
'/lists/subscriptions.json';
810 return $this->sendRequest($path,
'GET', $data);
828 public function update($list, $owner = null, $name = null, $mode = null, $description = null)
831 $this->checkRateLimit(
'lists',
'update');
834 if (is_numeric($list))
836 $data[
'list_id'] = $list;
838 elseif (is_string($list))
840 $data[
'slug'] = $list;
843 if (is_numeric($owner))
845 $data[
'owner_id'] = $owner;
847 elseif (is_string($owner))
849 $data[
'owner_screen_name'] = $owner;
854 throw new RuntimeException(
'The specified username is not in the correct format; must use integer or string');
860 throw new RuntimeException(
'The specified list is not in the correct format; must use integer or string');
866 $data[
'name'] = $name;
872 $data[
'mode'] = $mode;
878 $data[
'description'] = $description;
882 $path =
'/lists/update.json';
885 return $this->sendRequest($path,
'POST', $data);
900 public function create($name, $mode = null, $description = null)
903 $this->checkRateLimit(
'lists',
'create');
908 $data[
'name'] = $name;
914 $data[
'mode'] = $mode;
920 $data[
'description'] = $description;
924 $path =
'/lists/create.json';
927 return $this->sendRequest($path,
'POST', $data);
941 public function delete($list, $owner = null)
944 $this->checkRateLimit(
'lists',
'destroy');
947 if (is_numeric($list))
949 $data[
'list_id'] = $list;
951 elseif (is_string($list))
953 $data[
'slug'] = $list;
956 if (is_numeric($owner))
958 $data[
'owner_id'] = $owner;
960 elseif (is_string($owner))
962 $data[
'owner_screen_name'] = $owner;
967 throw new RuntimeException(
'The specified username for owner is not in the correct format; must use integer or string');
973 throw new RuntimeException(
'The specified list is not in the correct format; must use integer or string');
977 $path =
'/lists/destroy.json';
980 return $this->sendRequest($path,
'POST', $data);