10 defined(
'JPATH_PLATFORM') or die();
35 public function getDirectMessages($since_id = 0, $max_id = 0, $count = 20, $entities = null, $skip_status = null)
38 $this->checkRateLimit(
'direct_messages');
41 $path =
'/direct_messages.json';
46 $data[
'since_id'] = $since_id;
52 $data[
'max_id'] = $max_id;
58 $data[
'count'] = $count;
62 if (!is_null($entities))
64 $data[
'include_entities'] = $entities;
68 if (!is_null($skip_status))
70 $data[
'skip_status'] = $skip_status;
74 return $this->sendRequest($path,
'GET', $data);
91 public function getSentDirectMessages($since_id = 0, $max_id = 0, $count = 20, $page = 0, $entities = null)
94 $this->checkRateLimit(
'direct_messages',
'sent');
97 $path =
'/direct_messages/sent.json';
102 $data[
'since_id'] = $since_id;
108 $data[
'max_id'] = $max_id;
114 $data[
'count'] = $count;
120 $data[
'page'] = $page;
124 if (!is_null($entities))
126 $data[
'include_entities'] = $entities;
130 return $this->sendRequest($path,
'GET', $data);
144 public function sendDirectMessages($user, $text)
147 $path =
'/direct_messages/new.json';
150 if (is_numeric($user))
152 $data[
'user_id'] = $user;
154 elseif (is_string($user))
156 $data[
'screen_name'] = $user;
161 throw new RuntimeException(
'The specified username is not in the correct format; must use integer or string');
164 $data[
'text'] = $text;
167 return $this->sendRequest($path,
'POST', $data);
179 public function getDirectMessagesById($id)
182 $this->checkRateLimit(
'direct_messages',
'show');
185 $path =
'/direct_messages/show.json';
190 return $this->sendRequest($path,
'GET', $data);
204 public function deleteDirectMessages($id, $entities = null)
207 $path =
'/direct_messages/destroy.json';
212 if (!is_null($entities))
214 $data[
'include_entities'] = $entities;
218 return $this->sendRequest($path,
'POST', $data);