1 | <?php |
||
14 | class Tweet |
||
15 | { |
||
16 | /** |
||
17 | * End point constants |
||
18 | */ |
||
19 | const USER_TIMELINE_ENDPOINT = 'statuses/user_timeline.json'; |
||
20 | const HOME_TIMELINE_ENDPOINT = 'statuses/home_timeline.json'; |
||
21 | const MENTIONS_ENDPOINT = 'statuses/mentions_timeline.json'; |
||
22 | const MY_RETWEETS_ENDPOINT = 'statuses/retweets_of_me.json'; |
||
23 | const RETRIEVE_ENDPOINT = 'statuses/show/'; |
||
24 | const RETWEETS_ENDPOINT = 'statuses/retweets/'; |
||
25 | const UPDATE_ENDPOINT = 'statuses/update.json'; |
||
26 | const SEND_RETWEET_ENDPOINT = 'statuses/retweet/'; |
||
27 | const DELETE_TWEET_ENDPOINT = 'statuses/destroy/'; |
||
28 | |||
29 | /** |
||
30 | * Use the options filter trait to eliminate unavailable query string params |
||
31 | */ |
||
32 | use OptionsFilter; |
||
33 | |||
34 | /** |
||
35 | * The Twitter Client for making the requests |
||
36 | * |
||
37 | * @var TwitterClient $client |
||
38 | */ |
||
39 | private $client; |
||
40 | |||
41 | /** |
||
42 | * Constructor |
||
43 | * |
||
44 | * @param TwitterClient $client |
||
45 | */ |
||
46 | public function __construct(TwitterClient $client) |
||
50 | |||
51 | /** |
||
52 | * Method to retrieve a tweet by id |
||
53 | * |
||
54 | * @param int $id |
||
55 | * @param Array $options optional parameters to refine a search |
||
56 | * - trim_user boolean returns a user object with just numerical ID when true |
||
57 | * - include_my_retweet boolean when true any tweets RT'd by authenticated user |
||
58 | * will have current_user_retweet node |
||
59 | * - include_entites boolean entities node will be excluded when set to false |
||
60 | * @return string |
||
61 | */ |
||
62 | public function retrieve($id, Array $options = []) |
||
73 | |||
74 | /** |
||
75 | * Retrieve a collection of mentions for the authenticated user |
||
76 | * |
||
77 | * @param Array $options optional parameters to refine the output |
||
78 | * - count int number of results to return, up to 200, if omitted returns 20 |
||
79 | * - since_id int returns results with an ID more recent than the provided ID |
||
80 | * - max_id int returns results with an ID older than the provided ID |
||
81 | * - trim_user boolean when true returns the user object with only an ID |
||
82 | * - contributor_details boolean when true enhances the contributors element of the response |
||
83 | * - include_entities boolean entities node will be excluded when set to false |
||
84 | * @return string |
||
85 | */ |
||
86 | public function retrieveMentions(Array $options = []) |
||
100 | |||
101 | /** |
||
102 | * A method to return the tweets in a users timeline |
||
103 | * |
||
104 | * @param Array $options optional parameters to refine a search |
||
105 | * - user_id int user id for whom to return results for (if blank defaults to authenticated user) |
||
106 | * - screen_name string screen name for whom to return results for (if blank, defaults to authenticated user) |
||
107 | * - since_id int returns results with an ID more recent than the provided ID |
||
108 | * - count int number of results to return, up to 200 |
||
109 | * - max_id int returns results with an ID older than the provided ID |
||
110 | * - trim_user boolean when true returns the user object with only an ID |
||
111 | * - exclude_replies boolean when true, prevents replies from appearing in the returned timeline |
||
112 | * - contributor_details boolean when true enhances the contributors element of the response |
||
113 | * - include_rts boolean when false the timeline will strip any native retweets |
||
114 | * @return string |
||
115 | */ |
||
116 | public function retrieveUserTimeline(Array $options = []) |
||
134 | |||
135 | /** |
||
136 | * Method to retrieve the home timeline for the authenticated user |
||
137 | * |
||
138 | * @param Array $options |
||
139 | * - count int number of results to return, up to 200, if omitted returns 20 |
||
140 | * - since_id int returns results with an ID more recent than the provided ID |
||
141 | * - max_id int returns results with an ID older than the provided ID |
||
142 | * - include_entities boolean entities node will be excluded when set to false |
||
143 | * - exclude_replies boolean when true, prevents replies from appearing in the returned timeline |
||
144 | * - contributor_details boolean when true enhances the contributors element of the response |
||
145 | * @return string |
||
146 | */ |
||
147 | public function retrieveHomeTimeline(Array $options = []) |
||
161 | |||
162 | /** |
||
163 | * Retrieving a collection of your tweets that were retweeted by others |
||
164 | * |
||
165 | * @param Array $options |
||
166 | * - count int number of results to return, up to 200, if omitted returns 20 |
||
167 | * - since_id int returns results with an ID more recent than the provided ID |
||
168 | * - max_id int returns results with an ID older than the provided ID |
||
169 | * - trim_user boolean when true returns the user object with only an ID |
||
170 | * - include_entities boolean tweet entities node will be excluded when set to false |
||
171 | * - include_user_entities boolean user entities node will be excluded when set to false |
||
172 | * @return string |
||
173 | */ |
||
174 | public function retrieveMyRetweets(Array $options = []) |
||
188 | |||
189 | /** |
||
190 | * Retrieve the retweets for a specific tweet |
||
191 | * |
||
192 | * @param int $id ID of the tweet to retrieve the retweeters |
||
193 | * @param Array $options |
||
194 | * - count int number of results to return up to 100, 100 is the max allowed |
||
195 | * - trim_user boolean when true returns the user object with only an ID |
||
196 | * @return string |
||
197 | */ |
||
198 | public function retrieveRetweets($id, $options) |
||
208 | |||
209 | /** |
||
210 | * Method to create a Tweet |
||
211 | * |
||
212 | * @param string $status The status or tweet that will be sent |
||
213 | * @param Array $options Optional parameters for the request |
||
214 | * - in_reply_to_status_id int the ID for the tweet you are replying to, must @ mention original author |
||
215 | * - possibly_sensitive boolean should be set when tweet contains nudity, violence or other gross stuff |
||
216 | * - lat float latitude |
||
217 | * - long float longitude |
||
218 | * - place_id string a place in the world |
||
219 | * - display_coordinates boolean when true will put a pin an exact coordinates tweet was sent from |
||
220 | * - trim_user boolean when true returns the user object with only an ID |
||
221 | * - media_ids string a list of media ids to associate to a tweet |
||
222 | */ |
||
223 | public function create($status, $options = []) |
||
241 | |||
242 | /** |
||
243 | * Method to retweet an existing tweet |
||
244 | * |
||
245 | * @param int $id Id for a specific tweet to be retweeted |
||
246 | * @param Array $options Optional parameters for the request |
||
247 | * - trim_user boolean when true returns the user object with only an ID |
||
248 | */ |
||
249 | public function retweet($id, $options = []) |
||
255 | |||
256 | /** |
||
257 | * Method for deleting a tweet that you've previously published |
||
258 | * |
||
259 | * @param int $id id for the tweet to be deleted |
||
260 | * @param Array $options Optional parameters for the request |
||
261 | * - trim_user boolean when true returns the user object with only an ID |
||
262 | */ |
||
263 | public function delete($id, $options = []) |
||
269 | } |
||
270 |