File Coverage

blib/lib/Twitter/API/Trait/ApiMethods.pm
Criterion Covered Total %
statement 45 154 29.2
branch 7 14 50.0
condition 15 34 44.1
subroutine 14 115 12.1
pod 104 109 95.4
total 185 426 43.4


line stmt bran cond sub pod time code
1             package Twitter::API::Trait::ApiMethods;
2             # ABSTRACT: Convenient API Methods
3             $Twitter::API::Trait::ApiMethods::VERSION = '1.0006';
4 4     4   3316 use 5.14.1;
  4         15  
5 4     4   22 use Carp;
  4         63  
  4         295  
6 4     4   23 use Moo::Role;
  4         7  
  4         29  
7 4     4   3260 use MooX::Aliases;
  4         12005  
  4         25  
8 4     4   1364 use Ref::Util qw/is_hashref is_arrayref/;
  4         10  
  4         200  
9 4     4   23 use namespace::clean;
  4         8  
  4         33  
10              
11             requires 'request';
12              
13             with 'Twitter::API::Role::RequestArgs';
14              
15             #pod =method account_settings([ \%args ])
16             #pod
17             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/get-account-settings>
18             #pod
19             #pod =cut
20              
21             sub account_settings {
22 0     0 1 0 shift->request(get => 'account/settings', @_);
23             }
24              
25             #pod =method blocking([ \%args ])
26             #pod
27             #pod Aliases: blocks_list
28             #pod
29             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/get-blocks-list>
30             #pod
31             #pod =cut
32              
33             sub blocking {
34 0     0 1 0 shift->request(get => 'blocks/list', @_);
35             }
36             alias blocks_list => 'blocking';
37              
38             #pod =method blocking_ids([ \%args ])
39             #pod
40             #pod Aliases: blocks_ids
41             #pod
42             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/get-blocks-ids>
43             #pod
44             #pod =cut
45              
46             sub blocking_ids {
47 0     0 1 0 shift->request(get => 'blocks/ids', @_);
48             }
49             alias blocks_ids => 'blocking_ids';
50              
51             #pod =method collection_entries([ $id, ][ \%args ])
52             #pod
53             #pod L<https://developer.twitter.com/en/docs/tweets/curate-a-collection/api-reference/get-collections-entries>
54             #pod
55             #pod =cut
56              
57             sub collection_entries {
58 0     0 1 0 shift->request_with_pos_args(id => get => 'collections/entries', @_);
59             }
60              
61             #pod =method collections([ $screen_name | $user_id, ][ \%args ])
62             #pod
63             #pod L<https://developer.twitter.com/en/docs/tweets/curate-a-collection/api-reference/get-collections-list>
64             #pod
65             #pod =cut
66              
67             sub collections {
68 0     0 1 0 shift->request_with_pos_args(':ID', get => 'collections/list', @_);
69             }
70              
71 0     0 0 0 sub direct_messages { croak 'DEPRECATED - use direct_messages_events instead' }
72              
73             #pod =method favorites([ \%args ])
74             #pod
75             #pod L<https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-favorites-list>
76             #pod
77             #pod =cut
78              
79             sub favorites {
80 0     0 1 0 shift->request(get => 'favorites/list', @_);
81             }
82              
83             #pod =method followers([ \%args ])
84             #pod
85             #pod Aliases: followers_list
86             #pod
87             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-followers-list>
88             #pod
89             #pod =cut
90              
91             sub followers {
92 0     0 1 0 shift->request(get => 'followers/list', @_);
93             }
94             alias followers_list => 'followers';
95              
96             #pod =method followers_ids([ $screen_name | $user_id, ][ \%args ])
97             #pod
98             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-followers-ids>
99             #pod
100             #pod =cut
101              
102             sub followers_ids {
103 0     0 1 0 shift->request_with_pos_args(':ID', get => 'followers/ids', @_);
104             }
105              
106             #pod =method friends([ \%args ])
107             #pod
108             #pod Aliases: friends_list
109             #pod
110             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friends-list>
111             #pod
112             #pod =cut
113              
114             sub friends {
115 0     0 1 0 shift->request(get => 'friends/list', @_);
116             }
117             alias friends_list => 'friends';
118              
119             #pod =method friends_ids([ \%args ])
120             #pod
121             #pod Aliases: following_ids
122             #pod
123             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friends-ids>
124             #pod
125             #pod =cut
126              
127             sub friends_ids {
128 0     0 1 0 shift->request_with_id(get => 'friends/ids', @_);
129             }
130             alias following_ids => 'friends_ids';
131              
132             #pod =method friendships_incoming([ \%args ])
133             #pod
134             #pod Aliases: incoming_friendships
135             #pod
136             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friendships-incoming>
137             #pod
138             #pod =cut
139              
140             sub friendships_incoming {
141 0     0 1 0 shift->request(get => 'friendships/incoming', @_);
142             }
143             alias incoming_friendships => 'friendships_incoming';
144              
145             #pod =method friendships_outgoing([ \%args ])
146             #pod
147             #pod Aliases: outgoing_friendships
148             #pod
149             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friendships-outgoing>
150             #pod
151             #pod =cut
152              
153             sub friendships_outgoing {
154 0     0 1 0 shift->request(get => 'friendships/outgoing', @_);
155             }
156             alias outgoing_friendships => 'friendships_outgoing';
157              
158             #pod =method geo_id([ $place_id, ][ \%args ])
159             #pod
160             #pod L<https://developer.twitter.com/en/docs/geo/place-information/api-reference/get-geo-id-place_id>
161             #pod
162             #pod =cut
163              
164             # NT incompatibility
165             sub geo_id {
166 0     0 1 0 shift->request_with_pos_args(place_id => get => 'geo/id/:place_id', @_);
167             }
168              
169             #pod =method geo_search([ \%args ])
170             #pod
171             #pod L<https://developer.twitter.com/en/docs/geo/places-near-location/api-reference/get-geo-search>
172             #pod
173             #pod =cut
174              
175             sub geo_search {
176 0     0 1 0 shift->request(get => 'geo/search', @_);
177             }
178              
179             #pod =method get_configuration([ \%args ])
180             #pod
181             #pod L<https://developer.twitter.com/en/docs/developer-utilities/configuration/api-reference/get-help-configuration>
182             #pod
183             #pod =cut
184              
185             sub get_configuration {
186 0     0 1 0 shift->request(get => 'help/configuration', @_);
187             }
188              
189             #pod =method get_languages([ \%args ])
190             #pod
191             #pod L<https://developer.twitter.com/en/docs/developer-utilities/supported-languages/api-reference/get-help-languages>
192             #pod
193             #pod =cut
194              
195             sub get_languages {
196 0     0 1 0 shift->request(get => 'help/languages', @_);
197             }
198              
199             #pod =method get_list([ \%args ])
200             #pod
201             #pod Aliases: show_list
202             #pod
203             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-show>
204             #pod
205             #pod =cut
206              
207             sub get_list {
208 0     0 1 0 shift->request(get => 'lists/show', @_);
209             }
210             alias show_list => 'get_list';
211              
212             #pod =method get_lists([ \%args ])
213             #pod
214             #pod Aliases: list_lists, all_subscriptions
215             #pod
216             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-list>
217             #pod
218             #pod =cut
219              
220             sub get_lists {
221 0     0 1 0 shift->request(get => 'lists/list', @_);
222             }
223             alias $_ => 'get_lists' for qw/list_lists all_subscriptions/;
224              
225             #pod =method get_privacy_policy([ \%args ])
226             #pod
227             #pod L<https://developer.twitter.com/en/docs/developer-utilities/privacy-policy/api-reference/get-help-privacy>
228             #pod
229             #pod =cut
230              
231             sub get_privacy_policy {
232 0     0 1 0 shift->request(get => 'help/privacy', @_);
233             }
234              
235             #pod =method get_tos([ \%args ])
236             #pod
237             #pod L<https://developer.twitter.com/en/docs/developer-utilities/terms-of-service/api-reference/get-help-tos>
238             #pod
239             #pod =cut
240              
241             sub get_tos {
242 0     0 1 0 shift->request(get => 'help/tos', @_);
243             }
244              
245             #pod =method home_timeline([ \%args ])
246             #pod
247             #pod L<https://developer.twitter.com/en/docs/tweets/timelines/api-reference/get-statuses-home_timeline>
248             #pod
249             #pod =cut
250              
251             sub home_timeline {
252 0     0 1 0 shift->request(get => 'statuses/home_timeline', @_);
253             }
254              
255             #pod =method list_members([ \%args ])
256             #pod
257             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-members>
258             #pod
259             #pod =cut
260              
261             sub list_members {
262 0     0 1 0 shift->request(get => 'lists/members', @_);
263             }
264              
265             #pod =method list_memberships([ \%args ])
266             #pod
267             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-memberships>
268             #pod
269             #pod =cut
270              
271             sub list_memberships {
272 0     0 1 0 shift->request(get => 'lists/memberships', @_);
273             }
274              
275             #pod =method list_ownerships([ \%args ])
276             #pod
277             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-ownerships>
278             #pod
279             #pod =cut
280              
281             sub list_ownerships {
282 0     0 1 0 shift->request(get => 'lists/ownerships', @_);
283             }
284              
285             #pod =method list_statuses([ \%args ])
286             #pod
287             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-statuses>
288             #pod
289             #pod =cut
290              
291             sub list_statuses {
292 0     0 1 0 shift->request(get => 'lists/statuses', @_);
293             }
294              
295             #pod =method list_subscribers([ \%args ])
296             #pod
297             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-subscribers>
298             #pod
299             #pod =cut
300              
301             sub list_subscribers {
302 0     0 1 0 shift->request(get => 'lists/subscribers', @_);
303             }
304              
305             #pod =method list_subscriptions([ \%args ])
306             #pod
307             #pod Aliases: subscriptions
308             #pod
309             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-subscriptions>
310             #pod
311             #pod =cut
312              
313             sub list_subscriptions {
314 0     0 1 0 shift->request(get => 'lists/subscriptions', @_);
315             }
316             alias subscriptions => 'list_subscriptions';
317              
318             #pod =method lookup_friendships([ \%args ])
319             #pod
320             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friendships-lookup>
321             #pod
322             #pod =cut
323              
324             sub lookup_friendships {
325 0     0 1 0 shift->request(get => 'friendships/lookup', @_);
326             }
327              
328             #pod =method lookup_statuses([ $id, ][ \%args ])
329             #pod
330             #pod L<https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-statuses-lookup>
331             #pod
332             #pod =cut
333              
334             sub lookup_statuses {
335 0     0 1 0 shift->request_with_pos_args(id => get => 'statuses/lookup', @_);
336             }
337              
338             #pod =method lookup_users([ \%args ])
339             #pod
340             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-lookup>
341             #pod
342             #pod =cut
343              
344             sub lookup_users {
345 0     0 1 0 shift->request(get => 'users/lookup', @_);
346             }
347              
348             #pod =method mentions([ \%args ])
349             #pod
350             #pod Aliases: replies, mentions_timeline
351             #pod
352             #pod L<https://developer.twitter.com/en/docs/tweets/timelines/api-reference/get-statuses-mentions_timeline>
353             #pod
354             #pod =cut
355              
356             sub mentions {
357 0     0 1 0 shift->request(get => 'statuses/mentions_timeline', @_);
358             }
359             alias $_ => 'mentions' for qw/replies mentions_timeline/;
360              
361             #pod =method mutes([ \%args ])
362             #pod
363             #pod Aliases: muting_ids, muted_ids
364             #pod
365             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/get-mutes-users-ids>
366             #pod
367             #pod =cut
368              
369             sub mutes {
370 0     0 1 0 shift->request(get => 'mutes/users/ids', @_);
371             }
372             alias $_ => 'mutes' for qw/muting_ids muted_ids/;
373              
374             #pod =method muting([ \%args ])
375             #pod
376             #pod Aliases: mutes_list
377             #pod
378             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/get-mutes-users-list>
379             #pod
380             #pod =cut
381              
382             sub muting {
383 0     0 1 0 shift->request(get => 'mutes/users/list', @_);
384             }
385             alias mutes_list => 'muting';
386              
387             #pod =method no_retweet_ids([ \%args ])
388             #pod
389             #pod Aliases: no_retweets_ids
390             #pod
391             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friendships-no_retweets-ids>
392             #pod
393             #pod =cut
394              
395             sub no_retweet_ids {
396 0     0 1 0 shift->request(get => 'friendships/no_retweets/ids', @_);
397             }
398             alias no_retweets_ids => 'no_retweet_ids';
399              
400             #pod =method oembed([ \%args ])
401             #pod
402             #pod L<https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-statuses-oembed>
403             #pod
404             #pod =cut
405              
406             sub oembed {
407 0     0 1 0 shift->request(get => 'statuses/oembed', @_);
408             }
409              
410             #pod =method profile_banner([ \%args ])
411             #pod
412             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/get-users-profile_banner>
413             #pod
414             #pod =cut
415              
416             sub profile_banner {
417 0     0 1 0 shift->request(get => 'users/profile_banner', @_);
418             }
419              
420             #pod =method rate_limit_status([ \%args ])
421             #pod
422             #pod L<https://developer.twitter.com/en/docs/developer-utilities/rate-limit-status/api-reference/get-application-rate_limit_status>
423             #pod
424             #pod =cut
425              
426             sub rate_limit_status {
427 0     0 1 0 shift->request(get => 'application/rate_limit_status', @_);
428             }
429              
430             #pod =method retweeters_ids([ $id, ][ \%args ])
431             #pod
432             #pod L<https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-statuses-retweeters-ids>
433             #pod
434             #pod =cut
435              
436             sub retweeters_ids {
437 0     0 1 0 shift->request_with_pos_args(id => get => 'statuses/retweeters/ids', @_);
438             }
439              
440             #pod =method retweets([ $id, ][ \%args ])
441             #pod
442             #pod L<https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-statuses-retweets-id>
443             #pod
444             #pod =cut
445              
446             sub retweets {
447 0     0 1 0 shift->request_with_pos_args(id => get => 'statuses/retweets/:id', @_);
448             }
449              
450             #pod =method retweets_of_me([ \%args ])
451             #pod
452             #pod Aliases: retweeted_of_me
453             #pod
454             #pod L<https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-statuses-retweets_of_me>
455             #pod
456             #pod =cut
457              
458             sub retweets_of_me {
459 0     0 1 0 shift->request(get => 'statuses/retweets_of_me', @_);
460             }
461             alias retweeted_of_me => 'retweets_of_me';
462              
463             #pod =method reverse_geocode([ $lat, [ $long, ]][ \%args ])
464             #pod
465             #pod L<https://developer.twitter.com/en/docs/geo/places-near-location/api-reference/get-geo-reverse_geocode>
466             #pod
467             #pod =cut
468              
469             sub reverse_geocode {
470 0     0 1 0 shift->request_with_pos_args([ qw/lat long/ ], get => 'geo/reverse_geocode', @_);
471             }
472              
473             #pod =method saved_searches([ \%args ])
474             #pod
475             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/get-saved_searches-list>
476             #pod
477             #pod =cut
478              
479             sub saved_searches {
480 0     0 1 0 shift->request(get => 'saved_searches/list', @_);
481             }
482              
483             #pod =method search([ $q, ][ \%args ])
484             #pod
485             #pod L<https://developer.twitter.com/en/docs/tweets/search/api-reference/get-search-tweets>
486             #pod
487             #pod =cut
488              
489             sub search {
490 0     0 1 0 shift->request_with_pos_args(q => get => 'search/tweets', @_);
491             }
492              
493             #pod =method sent_direct_messages([ \%args ])
494             #pod
495             #pod Aliases: direct_messages_sent
496             #pod
497             #pod L<https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/get-sent-message>
498             #pod
499             #pod =cut
500              
501 0     0 1 0 sub sent_direct_messages { croak 'DEPRECATED - use direct_messages_events instead' }
502             alias direct_messages_sent => 'sent_direct_messages';
503              
504 0     0 0 0 sub show_direct_message { croak 'DEPRECATED - show_direct_messages_event instead' }
505              
506             #pod =method show_friendship([ \%args ])
507             #pod
508             #pod Aliases: show_relationship
509             #pod
510             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friendships-show>
511             #pod
512             #pod =cut
513              
514             sub show_friendship {
515 0     0 1 0 shift->request(get => 'friendships/show', @_);
516             }
517             alias show_relationship => 'show_friendship';
518              
519             #pod =method show_list_member([ \%args ])
520             #pod
521             #pod Aliases: is_list_member
522             #pod
523             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-members-show>
524             #pod
525             #pod =cut
526              
527             sub show_list_member {
528 0     0 1 0 shift->request(get => 'lists/members/show', @_);
529             }
530             alias is_list_member => 'show_list_member';
531              
532             #pod =method show_list_subscriber([ \%args ])
533             #pod
534             #pod Aliases: is_list_subscriber, is_subscriber_lists
535             #pod
536             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-subscribers-show>
537             #pod
538             #pod =cut
539              
540             sub show_list_subscriber {
541 0     0 1 0 shift->request(get => 'lists/subscribers/show', @_);
542             }
543             alias $_ => 'show_list_subscriber' for qw/is_list_subscriber is_subscriber_lists/;
544              
545             #pod =method show_saved_search([ $id, ][ \%args ])
546             #pod
547             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/get-saved_searches-show-id>
548             #pod
549             #pod =cut
550              
551             sub show_saved_search {
552 0     0 1 0 shift->request_with_pos_args(id => get => 'saved_searches/show/:id', @_);
553             }
554              
555             #pod =method show_status([ $id, ][ \%args ])
556             #pod
557             #pod L<https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-statuses-show-id>
558             #pod
559             #pod =cut
560              
561             sub show_status {
562 0     0 1 0 shift->request_with_pos_args(id => get => 'statuses/show/:id', @_);
563             }
564              
565             #pod =method show_user([ $screen_name | $user_id, ][ \%args ])
566             #pod
567             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-show>
568             #pod
569             #pod =cut
570              
571             sub show_user {
572 0     0 1 0 shift->request_with_pos_args(':ID', get => 'users/show', @_);
573             }
574              
575             #pod =method suggestion_categories([ \%args ])
576             #pod
577             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-suggestions>
578             #pod
579             #pod =cut
580              
581             sub suggestion_categories {
582 0     0 1 0 shift->request(get => 'users/suggestions', @_);
583             }
584              
585             #pod =method trends_available([ \%args ])
586             #pod
587             #pod L<https://developer.twitter.com/en/docs/trends/locations-with-trending-topics/api-reference/get-trends-available>
588             #pod
589             #pod =cut
590              
591             sub trends_available {
592 0     0 1 0 my ( $self, $args ) = @_;
593              
594 0 0 0     0 goto &trends_closest if exists $$args{lat} || exists $$args{long};
595              
596 0         0 shift->request(get => 'trends/available', @_);
597             }
598              
599             #pod =method trends_closest([ \%args ])
600             #pod
601             #pod L<https://developer.twitter.com/en/docs/trends/locations-with-trending-topics/api-reference/get-trends-closest>
602             #pod
603             #pod =cut
604              
605             sub trends_closest {
606 0     0 1 0 shift->request(get => 'trends/closest', @_);
607             }
608              
609             #pod =method trends_place([ $id, ][ \%args ])
610             #pod
611             #pod L<https://developer.twitter.com/en/docs/trends/trends-for-location/api-reference/get-trends-place>
612             #pod
613             #pod =cut
614              
615             sub trends_place {
616 0     0 1 0 shift->request_with_pos_args(id => get => 'trends/place', @_);
617             }
618             alias trends_location => 'trends_place';
619              
620             #pod =method user_suggestions([ $slug, ][ \%args ])
621             #pod
622             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-suggestions-slug-members>
623             #pod
624             #pod =cut
625              
626             # Net::Twitter compatibility - rename category to slug
627             my $rename_category = sub {
628             my $self = shift;
629              
630             my $args = is_hashref($_[-1]) ? pop : {};
631             $args->{slug} = delete $args->{category} if exists $args->{category};
632             return ( @_, $args );
633             };
634              
635             sub user_suggestions {
636 0     0 1 0 my $self = shift;
637              
638 0         0 $self->request_with_pos_args(slug => get => 'users/suggestions/:slug/members',
639             $self->$rename_category(@_));
640             }
641             alias follow_suggestions => 'user_suggestions';
642              
643             #pod =method user_suggestions_for([ $slug, ][ \%args ])
644             #pod
645             #pod Aliases: follow_suggestions
646             #pod
647             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-suggestions-slug>
648             #pod
649             #pod =cut
650              
651             sub user_suggestions_for {
652 0     0 1 0 my $self = shift;
653              
654 0         0 $self->request_with_pos_args(slug => get => 'users/suggestions/:slug',
655             $self->$rename_category(@_));
656             }
657             alias follow_suggestions_for => 'user_suggestions_for';
658              
659             #pod =method user_timeline([ $screen_name | $user_id, ][ \%args ])
660             #pod
661             #pod L<https://developer.twitter.com/en/docs/tweets/timelines/api-reference/get-statuses-user_timeline>
662             #pod
663             #pod =cut
664              
665             sub user_timeline {
666 0     0 1 0 shift->request_with_id(get => 'statuses/user_timeline', @_);
667             }
668              
669             #pod =method users_search([ $q, ][ \%args ])
670             #pod
671             #pod Aliases: find_people, search_users
672             #pod
673             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-search>
674             #pod
675             #pod =cut
676              
677             sub users_search {
678 0     0 1 0 shift->request_with_pos_args(q => get => 'users/search', @_);
679             }
680             alias $_ => 'users_search' for qw/find_people search_users/;
681              
682             #pod =method verify_credentials([ \%args ])
683             #pod
684             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/get-account-verify_credentials>
685             #pod
686             #pod =cut
687              
688             sub verify_credentials {
689 1     1 1 542 shift->request(get => 'account/verify_credentials', @_);
690             }
691              
692             #pod =method add_collection_entry([ $id, [ $tweet_id, ]][ \%args ])
693             #pod
694             #pod L<https://developer.twitter.com/en/docs/tweets/curate-a-collection/api-reference/post-collections-entries-add>
695             #pod
696             #pod =cut
697              
698             sub add_collection_entry {
699 0     0 1 0 shift->request_with_pos_args([ qw/id tweet_id /],
700             post => 'collections/entries/add', @_);
701             }
702              
703             #pod =method add_list_member([ \%args ])
704             #pod
705             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-members-create>
706             #pod
707             #pod =cut
708              
709             sub add_list_member {
710 0     0 1 0 shift->request(post => 'lists/members/create', @_);
711             }
712              
713             # deprecated: https://dev.twitter.com/rest/reference/post/geo/place
714             sub add_place {
715 0     0 0 0 shift->request_with_pos_args([ qw/name contained_within token lat long/ ],
716             post => 'geo/place', @_);
717             }
718              
719             #pod =method create_block([ $screen_name | $user_id, ][ \%args ])
720             #pod
721             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/post-blocks-create>
722             #pod
723             #pod =cut
724              
725             sub create_block {
726 0     0 1 0 shift->request_with_pos_args(':ID', post => 'blocks/create', @_);
727             }
728              
729             #pod =method create_collection([ $name, ][ \%args ])
730             #pod
731             #pod L<https://developer.twitter.com/en/docs/tweets/curate-a-collection/api-reference/post-collections-create>
732             #pod
733             #pod =cut
734              
735             sub create_collection {
736 0     0 1 0 shift->request_with_pos_args(name => post => 'collections/create', @_);
737             }
738              
739             #pod =method create_favorite([ $id, ][ \%args ])
740             #pod
741             #pod L<https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-favorites-create>
742             #pod
743             #pod =cut
744              
745             sub create_favorite {
746 0     0 1 0 shift->request_with_pos_args(id => post => 'favorites/create', @_);
747             }
748              
749             #pod =method create_friend([ $screen_name | $user_id, ][ \%args ])
750             #pod
751             #pod Aliases: follow, follow_new, create_friendship
752             #pod
753             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/post-friendships-create>
754             #pod
755             #pod =cut
756              
757             sub create_friend {
758 0     0 1 0 shift->request_with_pos_args(':ID', post => 'friendships/create', @_);
759             }
760             alias $_ => 'create_friend' for qw/follow follow_new create_friendship/;
761              
762             #pod =method create_list([ $name, ][ \%args ])
763             #pod
764             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-create>
765             #pod
766             #pod =cut
767              
768             sub create_list {
769 0     0 1 0 shift->request_with_pos_args(name => post => 'lists/create', @_);
770             }
771              
772             #pod =method create_media_metadata([ \%args ])
773             #pod
774             #pod L<https://developer.twitter.com/en/docs/media/upload-media/api-reference/post-media-metadata-create>
775             #pod
776             #pod =cut
777              
778             # E.g.:
779             # create_media_metadata({ media_id => $id, alt_text => { text => $text } })
780             sub create_media_metadata {
781 0     0 1 0 my ( $self, $to_json ) = @_;
782              
783 0 0 0     0 croak 'expected a single hashref argument'
784             unless @_ == 2 && is_hashref($_[1]);
785              
786 0         0 $self->request(post => 'media/metadata/create', {
787             -to_json => $to_json,
788             });
789             }
790              
791             #pod =method create_mute([ $screen_name | $user_id, ][ \%args ])
792             #pod
793             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/post-mutes-users-create>
794             #pod
795             #pod Alias: mute
796             #pod
797             #pod =cut
798              
799             sub create_mute {
800 0     0 1 0 shift->request_with_pos_args(':ID' => post => 'mutes/users/create', @_);
801             }
802             alias mute => 'create_mute';
803              
804             #pod =method create_saved_search([ $query, ][ \%args ])
805             #pod
806             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-saved_searches-create>
807             #pod
808             #pod =cut
809              
810             sub create_saved_search {
811 0     0 1 0 shift->request_with_pos_args(query => post => 'saved_searches/create', @_);
812             }
813              
814             #pod =method curate_collection([ \%args ])
815             #pod
816             #pod L<https://developer.twitter.com/en/docs/tweets/curate-a-collection/api-reference/post-collections-entries-curate>
817             #pod
818             #pod =cut
819              
820             sub curate_collection {
821 0     0 1 0 my ( $self, $to_json ) = @_;
822              
823 0 0       0 croak 'unexpected extra args' if @_ > 2;
824 0         0 $self->request(post => 'collections/entries/curate', {
825             -to_json => $to_json,
826             });
827             }
828              
829             #pod =method delete_list([ \%args ])
830             #pod
831             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-destroy>
832             #pod
833             #pod =cut
834              
835             sub delete_list {
836 0     0 1 0 shift->request(post => 'lists/destroy', @_);
837             }
838              
839             #pod =method delete_list_member([ \%args ])
840             #pod
841             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-members-destroy>
842             #pod
843             #pod =cut
844              
845             sub delete_list_member {
846 0     0 1 0 shift->request(post => 'lists/members/destroy', @_);
847             }
848             alias remove_list_member => 'delete_list_member';
849              
850             #pod =method destroy_block([ $screen_name | $user_id, ][ \%args ])
851             #pod
852             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/post-blocks-destroy>
853             #pod
854             #pod =cut
855              
856             sub destroy_block {
857 0     0 1 0 shift->request_with_pos_args(':ID', post => 'blocks/destroy', @_);
858             }
859              
860             #pod =method destroy_collection([ $id, ][ \%args ])
861             #pod
862             #pod L<https://developer.twitter.com/en/docs/tweets/curate-a-collection/api-reference/post-collections-destroy>
863             #pod
864             #pod =cut
865              
866             sub destroy_collection {
867 0     0 1 0 shift->request_with_pos_args(id => post => 'collections/destroy', @_);
868             }
869              
870 0     0 0 0 sub destroy_direct_message { croak 'DEPRECATED - use destroy_direct_messages_event instead' }
871              
872             #pod =method destroy_favorite([ $id, ][ \%args ])
873             #pod
874             #pod L<https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-favorites-destroy>
875             #pod
876             #pod =cut
877              
878             sub destroy_favorite {
879 0     0 1 0 shift->request_with_pos_args(id => post => 'favorites/destroy', @_);
880             }
881              
882             #pod =method destroy_friend([ $screen_name | $user_id, ][ \%args ])
883             #pod
884             #pod Aliases: unfollow, destroy_friendship
885             #pod
886             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/post-friendships-destroy>
887             #pod
888             #pod =cut
889              
890             sub destroy_friend {
891 0     0 1 0 shift->request_with_pos_args(':ID', post => 'friendships/destroy', @_);
892             }
893             alias $_ => 'destroy_friend' for qw/unfollow destroy_friendship/;
894              
895             #pod =method destroy_mute([ $screen_name | $user_id, ][ \%args ])
896             #pod
897             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/post-mutes-users-destroy>
898             #pod
899             #pod Alias: unmute
900             #pod
901             #pod =cut
902              
903             sub destroy_mute {
904 0     0 1 0 shift->request_with_pos_args(':ID' => post => 'mutes/users/destroy', @_);
905             }
906             alias unmute => 'destroy_mute';
907              
908             #pod =method destroy_saved_search([ $id, ][ \%args ])
909             #pod
910             #pod Aliases: delete_saved_search
911             #pod
912             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-saved_searches-destroy-id>
913             #pod
914             #pod =cut
915              
916             sub destroy_saved_search {
917 0     0 1 0 shift->request_with_pos_args(id => post => 'saved_searches/destroy/:id', @_);
918             }
919             alias delete_saved_search => 'destroy_saved_search';
920              
921             #pod =method destroy_status([ $id, ][ \%args ])
922             #pod
923             #pod L<https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-statuses-destroy-id>
924             #pod
925             #pod =cut
926              
927             sub destroy_status {
928 0     0 1 0 shift->request_with_pos_args(id => post => 'statuses/destroy/:id', @_);
929             }
930              
931             #pod =method members_create_all([ \%args ])
932             #pod
933             #pod Aliases: add_list_members
934             #pod
935             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-members-create_all>
936             #pod
937             #pod =cut
938              
939             sub members_create_all {
940 0     0 1 0 shift->request(post => 'lists/members/create_all', @_);
941             }
942             alias add_list_members => 'members_create_all';
943              
944             #pod =method members_destroy_all([ \%args ])
945             #pod
946             #pod Aliases: remove_list_members
947             #pod
948             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-members-destroy_all>
949             #pod
950             #pod =cut
951              
952             sub members_destroy_all {
953 0     0 1 0 shift->request(post => 'lists/members/destroy_all', @_);
954             }
955             alias remove_list_members => 'members_destroy_all';
956              
957             #pod =method move_collection_entry([ $id, [ $tweet_id, [ $relative_to, ]]][ \%args ])
958             #pod
959             #pod L<https://developer.twitter.com/en/docs/tweets/curate-a-collection/api-reference/post-collections-entries-move>
960             #pod
961             #pod =cut
962              
963             sub move_collection_entry {
964 0     0 1 0 shift->request_with_pos_args([ qw/id tweet_id relative_to /],
965             post => 'collections/entries/move', @_);
966             }
967              
968 0     0 0 0 sub new_direct_message { croak 'DEPRECATED - use new_direct_messages_event instead' }
969              
970             #pod =method remove_collection_entry([ $id, [ $tweet_id, ]][ \%args ])
971             #pod
972             #pod L<https://developer.twitter.com/en/docs/tweets/curate-a-collection/api-reference/post-collections-entries-remove>
973             #pod
974             #pod =cut
975              
976             sub remove_collection_entry {
977 0     0 1 0 shift->request_with_pos_args([ qw/id tweet_id/ ],
978             post => 'collections/entries/remove', @_);
979             }
980              
981             #pod =method remove_profile_banner([ \%args ])
982             #pod
983             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-account-remove_profile_banner>
984             #pod
985             #pod =cut
986              
987             sub remove_profile_banner {
988 0     0 1 0 shift->request(post => 'account/remove_profile_banner', @_);
989             }
990              
991             #pod =method report_spam([ \%args ])
992             #pod
993             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/post-users-report_spam>
994             #pod
995             #pod =cut
996              
997             sub report_spam {
998 0     0 1 0 shift->request_with_id(post => 'users/report_spam', @_);
999             }
1000              
1001             #pod =method retweet([ $id, ][ \%args ])
1002             #pod
1003             #pod L<https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-statuses-retweet-id>
1004             #pod
1005             #pod =cut
1006              
1007             sub retweet {
1008 0     0 1 0 shift->request_with_pos_args(id => post => 'statuses/retweet/:id', @_);
1009             }
1010              
1011             #pod =method subscribe_list([ \%args ])
1012             #pod
1013             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-subscribers-create>
1014             #pod
1015             #pod =cut
1016              
1017             sub subscribe_list {
1018 0     0 1 0 shift->request(post => 'lists/subscribers/create', @_);
1019             }
1020              
1021             #pod =method unretweet([ $id, ][ \%args ])
1022             #pod
1023             #pod L<https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-statuses-unretweet-id>
1024             #pod
1025             #pod =cut
1026              
1027             sub unretweet {
1028 0     0 1 0 shift->request_with_pos_args(id => post => 'statuses/unretweet/:id', @_);
1029             }
1030              
1031             #pod =method unsubscribe_list([ \%args ])
1032             #pod
1033             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-subscribers-destroy>
1034             #pod
1035             #pod =cut
1036              
1037             sub unsubscribe_list {
1038 0     0 1 0 shift->request(post => 'lists/subscribers/destroy', @_);
1039             }
1040              
1041             #pod =method update([ $status, ][ \%args ])
1042             #pod
1043             #pod L<https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-statuses-update>
1044             #pod
1045             #pod =cut
1046              
1047             sub update {
1048 1     1 1 539 my $self = shift;
1049              
1050 1         5 my ( $http_method, $path, $args, @rest ) =
1051             $self->normalize_pos_args(status => post => 'statuses/update', @_);
1052              
1053 1         7 $self->flatten_list_args(media_ids => $args);
1054 1         7 return $self->request($http_method, $path, $args, @rest);
1055             }
1056              
1057             #pod =method update_account_settings([ \%args ])
1058             #pod
1059             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-account-settings>
1060             #pod
1061             #pod =cut
1062              
1063             sub update_account_settings {
1064 0     0 1 0 shift->request(post => 'account/settings', @_);
1065             }
1066              
1067             #pod =method update_collection([ $id, ][ \%args ])
1068             #pod
1069             #pod L<https://developer.twitter.com/en/docs/tweets/curate-a-collection/api-reference/post-collections-update>
1070             #pod
1071             #pod =cut
1072              
1073             sub update_collection {
1074 0     0 1 0 shift->request_with_pos_args(id => post => 'collections/update', @_);
1075             }
1076              
1077             #pod =method update_friendship([ \%args ])
1078             #pod
1079             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/post-friendships-update>
1080             #pod
1081             #pod =cut
1082              
1083             sub update_friendship {
1084 0     0 1 0 shift->request_with_id(post => 'friendships/update', @_);
1085             }
1086              
1087             #pod =method update_list([ \%args ])
1088             #pod
1089             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-update>
1090             #pod
1091             #pod =cut
1092              
1093             sub update_list {
1094 0     0 1 0 shift->request(post => 'lists/update', @_);
1095             }
1096              
1097             #pod =method update_profile([ \%args ])
1098             #pod
1099             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-account-update_profile>
1100             #pod
1101             #pod =cut
1102              
1103             sub update_profile {
1104 0     0 1 0 shift->request(post => 'account/update_profile', @_);
1105             }
1106              
1107             #pod =method update_profile_background_image([ \%args ])
1108             #pod
1109             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-account-update_profile_background_image>
1110             #pod
1111             #pod =cut
1112              
1113             sub update_profile_background_image {
1114 0     0 1 0 shift->request(post => 'account/update_profile_background_image', @_);
1115             }
1116              
1117             #pod =method update_profile_banner([ $banner, ][ \%args ])
1118             #pod
1119             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-account-update_profile_banner>
1120             #pod
1121             #pod =cut
1122              
1123             sub update_profile_banner {
1124 0     0 1 0 shift->request_with_pos_args(banner => post => 'account/update_profile_banner', @_);
1125             }
1126              
1127             #pod =method update_profile_image([ $image, ][ \%args ])
1128             #pod
1129             #pod L<https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-account-update_profile_image>
1130             #pod
1131             #pod =cut
1132              
1133             sub update_profile_image {
1134 0     0 1 0 shift->request_with_pos_args(image => post => 'account/update_profile_image', @_);
1135             }
1136              
1137             #pod =method upload_media([ $media, ][ \%args ])
1138             #pod
1139             #pod Aliases: upload
1140             #pod
1141             #pod L<https://developer.twitter.com/en/docs/media/upload-media/api-reference/post-media-upload>
1142             #pod
1143             #pod =cut
1144              
1145             sub upload_media {
1146 8     8 1 4189 my $self = shift;
1147              
1148             # Used to require media. Now requires media *or* media_data.
1149             # Handle either as a positional parameter, like we do with
1150             # screen_name or user_id on other methods.
1151 8 100 66     84 if ( @_ && !is_hashref($_[0]) ) {
1152 7         18 my $media = shift;
1153 7 100       25 my $key = is_arrayref($media) ? 'media' : 'media_data';
1154 7 50 33     55 my $args = @_ && is_hashref($_[0]) ? pop : {};
1155 7         22 $args->{$key} = $media;
1156 7         20 unshift @_, $args;
1157             }
1158              
1159 8         17 my $args = shift;
1160 8         21 $args->{-multipart_form_data} = 1;
1161 8         63 $self->flatten_list_args(additional_owners => $args);
1162              
1163 8         48 $self->request(post => $self->upload_url_for('media/upload'), $args, @_);
1164             }
1165             alias upload => 'upload_media';
1166              
1167             #pod =method direct_messages_events([ \%args ])
1168             #pod
1169             #pod L<https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/list-events.html>
1170             #pod
1171             #pod =cut
1172              
1173             sub direct_messages_events {
1174 1     1 1 331 shift->request(get => 'direct_messages/events/list', @_);
1175             }
1176              
1177             #pod =method show_direct_messages_event([ $id, ][ \%args ])
1178             #pod
1179             #pod L<https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/get-event>
1180             #pod
1181             #pod =cut
1182              
1183             sub show_direct_messages_event {
1184 1     1 1 379 shift->request_with_pos_args(id => get => 'direct_messages/events/show', @_);
1185             }
1186              
1187             #pod =method destroy_direct_messages_event([ $id, ][ \%args ])
1188             #pod
1189             #pod L<https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/delete-message-event>
1190             #pod
1191             #pod =cut
1192              
1193             sub destroy_direct_messages_event {
1194 1     1 1 349 shift->request_with_pos_args(id => delete => 'direct_messages/events/destroy', @_);
1195             }
1196              
1197             #pod =method new_direct_messages_event([$text, $recipient_id ] | [ \%event ], [ \%args ])
1198             #pod
1199             #pod For simple usage, pass text and recipient ID:
1200             #pod
1201             #pod $client->new_dirrect_messages_event($text, $recipient_id)
1202             #pod
1203             #pod For more complex messages, pass a full event structure, for example:
1204             #pod
1205             #pod $client->new_direct_massages_event({
1206             #pod type => 'message_create',
1207             #pod message_create => {
1208             #pod target => { recipient_id => $user_id },
1209             #pod message_data => {
1210             #pod text => $text,
1211             #pod attachment => {
1212             #pod type => 'media',
1213             #pod media => { id => $media->{id} },
1214             #pod },
1215             #pod },
1216             #pod },
1217             #pod })
1218             #pod
1219             #pod L<https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/new-message>
1220             #pod
1221             #pod =cut
1222              
1223             sub new_direct_messages_event {
1224 3     3 1 811 my $self = shift;
1225              
1226             # The first argument is either an event hashref, or we'll create one with
1227             # the first two arguments: text and recipient_id.
1228 3 100       12 my $event = ref $_[0] ? shift : {
1229             type => 'message_create',
1230             message_create => {
1231             message_data => { text => shift },
1232             target => { recipient_id => shift },
1233             },
1234             };
1235              
1236             # only synthetic args are appropriate, here, e.g.
1237             # { -token => '...', -token_secret => '...' }
1238 3   100     12 my $args = shift // {};
1239              
1240              
1241 3         13 $self->request(post => 'direct_messages/events/new', {
1242             -to_json => { event => $event }, %$args
1243             });
1244             }
1245              
1246             #pod =method invalidate_access_token([ \%args ])
1247             #pod
1248             #pod Calling this method has the same effect as a user revoking access to the
1249             #pod application via Twitter settings. The access token/secret pair will no longer
1250             #pod be valid.
1251             #pod
1252             #pod This method can be called with client that has been initialized with
1253             #pod C<access_token> and C<access_token_secret> attributes, by passing C<-token> and
1254             #pod C<-token_secret> parameters, or by passing C<access_token> and
1255             #pod C<access_token_secret> parameters.
1256             #pod
1257             #pod $client->invalidate_access_token;
1258             #pod $client->invalidate_access_token({ -token => $token, -token_secret => $secret });
1259             #pod $client->invalidate_access_token({
1260             #pod access_token => $token,
1261             #pod access_token_secret => $secret,
1262             #pod });
1263             #pod
1264             #pod Twitter added this method to the API on 2018-09-20.
1265             #pod
1266             #pod See
1267             #pod L<https://developer.twitter.com/en/docs/basics/authentication/api-reference/invalidate_access_token>
1268             #pod
1269             #pod =cut
1270              
1271             # We've already used invalidate_token for oauth2/invalidate_otkon in
1272             # Trait::AppAuth, so we'll name this method invalidate_acccess_token to avoid
1273             # any conflict.
1274              
1275             sub invalidate_access_token {
1276 3     3 1 1303 my ( $self, $args ) = @_;
1277              
1278 3   100     15 $args //= {};
1279              
1280             # For consistency with Twitter::API calling conventions:
1281             # - accept -token/-token_secret synthetic arguments
1282             # - or use access_token/access_token_secret attributes
1283             #
1284             # Or, allow passing access_token/access_token secrets parameters as
1285             # specified in Twitter's API documentation.
1286              
1287             my $access_token = $$args{'-token'} // $self->access_token
1288             // ( $$args{'-token'} = delete $$args{access_token} )
1289 3   66     24 // croak 'requires an oauth token';
      33        
      33        
1290              
1291             my $access_token_secret = $$args{'-token_secret'}
1292             // $self->access_token_secret
1293             // ( $$args{'-token_secret'} = delete $$args{access_token_secret} )
1294 3   66     22 // croak 'requires an oauth token secret';
      33        
      33        
1295              
1296 3         36 return $self->request(post => 'oauth/invalidate_token', {
1297             access_token => $access_token,
1298             access_token_secret => $access_token_secret,
1299             %$args
1300             });
1301             }
1302              
1303             1;
1304              
1305             __END__
1306              
1307             =pod
1308              
1309             =encoding UTF-8
1310              
1311             =head1 NAME
1312              
1313             Twitter::API::Trait::ApiMethods - Convenient API Methods
1314              
1315             =head1 VERSION
1316              
1317             version 1.0006
1318              
1319             =head1 DESCRIPTION
1320              
1321             This trait provides convenient methods for calling API endpoints. They are
1322             L<Net::Twitter> compatible, with the same names and calling conventions.
1323              
1324             Refer to L<Twitter's API documentation|https://developer.twitter.com/en/docs/api-reference-index>
1325             for details about each method's parameters.
1326              
1327             These methods are simply shorthand forms of C<get> and C<post>. All methods
1328             can be called with a parameters hashref. It can be omitted for endpoints that
1329             do not require any parameters, such as C<mentions>. For example, all of these
1330             calls are equivalent:
1331              
1332             $client->mentions;
1333             $client->mentions({});
1334             $client->get('statuses/mentions_timeline');
1335             $client->get('statuses/mentions_timeline', {});
1336              
1337             Use the parameters hashref to pass optional parameters. For example,
1338              
1339             $client->mentions({ count => 200, trim_user=>'true' });
1340              
1341             Some methods, with required parameters, can take positional parameters. For
1342             example, C<geo_id> requires a C<place_id> parameter. These calls are
1343             equivalent:
1344              
1345             $client->place_id($place);
1346             $client->place_id({ place_id => $place });
1347              
1348             When positional parameters are allowed, they must be specified in the correct
1349             order, but they don't all need to be specified. Those not specified
1350             positionally can be added to the parameters hashref. For example, these calls
1351             are equivalent:
1352              
1353             $client->add_collection_entry($id, $tweet_id);
1354             $client->add_collection_entry($id, { tweet_id => $tweet_id);
1355             $client->add_collection_entry({ id => $id, tweet_id => $tweet_id });
1356              
1357             Many calls require a C<screen_name> or C<user_id>. Where noted, you may pass
1358             either ID as the first positional parameter. Twitter::API will inspect the
1359             value. If it contains only digits, it will be considered a C<user_id>.
1360             Otherwise, it will be considered a C<screen_name>. Best practice is to
1361             explicitly declare the ID type by passing it in the parameters hashref, because
1362             it is possible to for users to set their screen names to a string of digits,
1363             making the inferred ID ambiguous. These calls are equivalent:
1364              
1365             $client->create_block('realDonaldTrump');
1366             $client->create_block({ screen_name => 'realDonaldTrump' });
1367              
1368             Since all of these methods simple resolve to a C<get> or C<post> call, see the
1369             L<Twitter::API> for details about return values and error handling.
1370              
1371             =head1 METHODS
1372              
1373             =head2 account_settings([ \%args ])
1374              
1375             L<https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/get-account-settings>
1376              
1377             =head2 blocking([ \%args ])
1378              
1379             Aliases: blocks_list
1380              
1381             L<https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/get-blocks-list>
1382              
1383             =head2 blocking_ids([ \%args ])
1384              
1385             Aliases: blocks_ids
1386              
1387             L<https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/get-blocks-ids>
1388              
1389             =head2 collection_entries([ $id, ][ \%args ])
1390              
1391             L<https://developer.twitter.com/en/docs/tweets/curate-a-collection/api-reference/get-collections-entries>
1392              
1393             =head2 collections([ $screen_name | $user_id, ][ \%args ])
1394              
1395             L<https://developer.twitter.com/en/docs/tweets/curate-a-collection/api-reference/get-collections-list>
1396              
1397             =head2 favorites([ \%args ])
1398              
1399             L<https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-favorites-list>
1400              
1401             =head2 followers([ \%args ])
1402              
1403             Aliases: followers_list
1404              
1405             L<https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-followers-list>
1406              
1407             =head2 followers_ids([ $screen_name | $user_id, ][ \%args ])
1408              
1409             L<https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-followers-ids>
1410              
1411             =head2 friends([ \%args ])
1412              
1413             Aliases: friends_list
1414              
1415             L<https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friends-list>
1416              
1417             =head2 friends_ids([ \%args ])
1418              
1419             Aliases: following_ids
1420              
1421             L<https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friends-ids>
1422              
1423             =head2 friendships_incoming([ \%args ])
1424              
1425             Aliases: incoming_friendships
1426              
1427             L<https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friendships-incoming>
1428              
1429             =head2 friendships_outgoing([ \%args ])
1430              
1431             Aliases: outgoing_friendships
1432              
1433             L<https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friendships-outgoing>
1434              
1435             =head2 geo_id([ $place_id, ][ \%args ])
1436              
1437             L<https://developer.twitter.com/en/docs/geo/place-information/api-reference/get-geo-id-place_id>
1438              
1439             =head2 geo_search([ \%args ])
1440              
1441             L<https://developer.twitter.com/en/docs/geo/places-near-location/api-reference/get-geo-search>
1442              
1443             =head2 get_configuration([ \%args ])
1444              
1445             L<https://developer.twitter.com/en/docs/developer-utilities/configuration/api-reference/get-help-configuration>
1446              
1447             =head2 get_languages([ \%args ])
1448              
1449             L<https://developer.twitter.com/en/docs/developer-utilities/supported-languages/api-reference/get-help-languages>
1450              
1451             =head2 get_list([ \%args ])
1452              
1453             Aliases: show_list
1454              
1455             L<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-show>
1456              
1457             =head2 get_lists([ \%args ])
1458              
1459             Aliases: list_lists, all_subscriptions
1460              
1461             L<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-list>
1462              
1463             =head2 get_privacy_policy([ \%args ])
1464              
1465             L<https://developer.twitter.com/en/docs/developer-utilities/privacy-policy/api-reference/get-help-privacy>
1466              
1467             =head2 get_tos([ \%args ])
1468              
1469             L<https://developer.twitter.com/en/docs/developer-utilities/terms-of-service/api-reference/get-help-tos>
1470              
1471             =head2 home_timeline([ \%args ])
1472              
1473             L<https://developer.twitter.com/en/docs/tweets/timelines/api-reference/get-statuses-home_timeline>
1474              
1475             =head2 list_members([ \%args ])
1476              
1477             L<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-members>
1478              
1479             =head2 list_memberships([ \%args ])
1480              
1481             L<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-memberships>
1482              
1483             =head2 list_ownerships([ \%args ])
1484              
1485             L<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-ownerships>
1486              
1487             =head2 list_statuses([ \%args ])
1488              
1489             L<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-statuses>
1490              
1491             =head2 list_subscribers([ \%args ])
1492              
1493             L<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-subscribers>
1494              
1495             =head2 list_subscriptions([ \%args ])
1496              
1497             Aliases: subscriptions
1498              
1499             L<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-subscriptions>
1500              
1501             =head2 lookup_friendships([ \%args ])
1502              
1503             L<https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friendships-lookup>
1504              
1505             =head2 lookup_statuses([ $id, ][ \%args ])
1506              
1507             L<https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-statuses-lookup>
1508              
1509             =head2 lookup_users([ \%args ])
1510              
1511             L<https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-lookup>
1512              
1513             =head2 mentions([ \%args ])
1514              
1515             Aliases: replies, mentions_timeline
1516              
1517             L<https://developer.twitter.com/en/docs/tweets/timelines/api-reference/get-statuses-mentions_timeline>
1518              
1519             =head2 mutes([ \%args ])
1520              
1521             Aliases: muting_ids, muted_ids
1522              
1523             L<https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/get-mutes-users-ids>
1524              
1525             =head2 muting([ \%args ])
1526              
1527             Aliases: mutes_list
1528              
1529             L<https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/get-mutes-users-list>
1530              
1531             =head2 no_retweet_ids([ \%args ])
1532              
1533             Aliases: no_retweets_ids
1534              
1535             L<https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friendships-no_retweets-ids>
1536              
1537             =head2 oembed([ \%args ])
1538              
1539             L<https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-statuses-oembed>
1540              
1541             =head2 profile_banner([ \%args ])
1542              
1543             L<https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/get-users-profile_banner>
1544              
1545             =head2 rate_limit_status([ \%args ])
1546              
1547             L<https://developer.twitter.com/en/docs/developer-utilities/rate-limit-status/api-reference/get-application-rate_limit_status>
1548              
1549             =head2 retweeters_ids([ $id, ][ \%args ])
1550              
1551             L<https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-statuses-retweeters-ids>
1552              
1553             =head2 retweets([ $id, ][ \%args ])
1554              
1555             L<https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-statuses-retweets-id>
1556              
1557             =head2 retweets_of_me([ \%args ])
1558              
1559             Aliases: retweeted_of_me
1560              
1561             L<https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-statuses-retweets_of_me>
1562              
1563             =head2 reverse_geocode([ $lat, [ $long, ]][ \%args ])
1564              
1565             L<https://developer.twitter.com/en/docs/geo/places-near-location/api-reference/get-geo-reverse_geocode>
1566              
1567             =head2 saved_searches([ \%args ])
1568              
1569             L<https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/get-saved_searches-list>
1570              
1571             =head2 search([ $q, ][ \%args ])
1572              
1573             L<https://developer.twitter.com/en/docs/tweets/search/api-reference/get-search-tweets>
1574              
1575             =head2 sent_direct_messages([ \%args ])
1576              
1577             Aliases: direct_messages_sent
1578              
1579             L<https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/get-sent-message>
1580              
1581             =head2 show_friendship([ \%args ])
1582              
1583             Aliases: show_relationship
1584              
1585             L<https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friendships-show>
1586              
1587             =head2 show_list_member([ \%args ])
1588              
1589             Aliases: is_list_member
1590              
1591             L<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-members-show>
1592              
1593             =head2 show_list_subscriber([ \%args ])
1594              
1595             Aliases: is_list_subscriber, is_subscriber_lists
1596              
1597             L<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-subscribers-show>
1598              
1599             =head2 show_saved_search([ $id, ][ \%args ])
1600              
1601             L<https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/get-saved_searches-show-id>
1602              
1603             =head2 show_status([ $id, ][ \%args ])
1604              
1605             L<https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-statuses-show-id>
1606              
1607             =head2 show_user([ $screen_name | $user_id, ][ \%args ])
1608              
1609             L<https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-show>
1610              
1611             =head2 suggestion_categories([ \%args ])
1612              
1613             L<https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-suggestions>
1614              
1615             =head2 trends_available([ \%args ])
1616              
1617             L<https://developer.twitter.com/en/docs/trends/locations-with-trending-topics/api-reference/get-trends-available>
1618              
1619             =head2 trends_closest([ \%args ])
1620              
1621             L<https://developer.twitter.com/en/docs/trends/locations-with-trending-topics/api-reference/get-trends-closest>
1622              
1623             =head2 trends_place([ $id, ][ \%args ])
1624              
1625             L<https://developer.twitter.com/en/docs/trends/trends-for-location/api-reference/get-trends-place>
1626              
1627             =head2 user_suggestions([ $slug, ][ \%args ])
1628              
1629             L<https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-suggestions-slug-members>
1630              
1631             =head2 user_suggestions_for([ $slug, ][ \%args ])
1632              
1633             Aliases: follow_suggestions
1634              
1635             L<https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-suggestions-slug>
1636              
1637             =head2 user_timeline([ $screen_name | $user_id, ][ \%args ])
1638              
1639             L<https://developer.twitter.com/en/docs/tweets/timelines/api-reference/get-statuses-user_timeline>
1640              
1641             =head2 users_search([ $q, ][ \%args ])
1642              
1643             Aliases: find_people, search_users
1644              
1645             L<https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-search>
1646              
1647             =head2 verify_credentials([ \%args ])
1648              
1649             L<https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/get-account-verify_credentials>
1650              
1651             =head2 add_collection_entry([ $id, [ $tweet_id, ]][ \%args ])
1652              
1653             L<https://developer.twitter.com/en/docs/tweets/curate-a-collection/api-reference/post-collections-entries-add>
1654              
1655             =head2 add_list_member([ \%args ])
1656              
1657             L<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-members-create>
1658              
1659             =head2 create_block([ $screen_name | $user_id, ][ \%args ])
1660              
1661             L<https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/post-blocks-create>
1662              
1663             =head2 create_collection([ $name, ][ \%args ])
1664              
1665             L<https://developer.twitter.com/en/docs/tweets/curate-a-collection/api-reference/post-collections-create>
1666              
1667             =head2 create_favorite([ $id, ][ \%args ])
1668              
1669             L<https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-favorites-create>
1670              
1671             =head2 create_friend([ $screen_name | $user_id, ][ \%args ])
1672              
1673             Aliases: follow, follow_new, create_friendship
1674              
1675             L<https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/post-friendships-create>
1676              
1677             =head2 create_list([ $name, ][ \%args ])
1678              
1679             L<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-create>
1680              
1681             =head2 create_media_metadata([ \%args ])
1682              
1683             L<https://developer.twitter.com/en/docs/media/upload-media/api-reference/post-media-metadata-create>
1684              
1685             =head2 create_mute([ $screen_name | $user_id, ][ \%args ])
1686              
1687             L<https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/post-mutes-users-create>
1688              
1689             Alias: mute
1690              
1691             =head2 create_saved_search([ $query, ][ \%args ])
1692              
1693             L<https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-saved_searches-create>
1694              
1695             =head2 curate_collection([ \%args ])
1696              
1697             L<https://developer.twitter.com/en/docs/tweets/curate-a-collection/api-reference/post-collections-entries-curate>
1698              
1699             =head2 delete_list([ \%args ])
1700              
1701             L<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-destroy>
1702              
1703             =head2 delete_list_member([ \%args ])
1704              
1705             L<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-members-destroy>
1706              
1707             =head2 destroy_block([ $screen_name | $user_id, ][ \%args ])
1708              
1709             L<https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/post-blocks-destroy>
1710              
1711             =head2 destroy_collection([ $id, ][ \%args ])
1712              
1713             L<https://developer.twitter.com/en/docs/tweets/curate-a-collection/api-reference/post-collections-destroy>
1714              
1715             =head2 destroy_favorite([ $id, ][ \%args ])
1716              
1717             L<https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-favorites-destroy>
1718              
1719             =head2 destroy_friend([ $screen_name | $user_id, ][ \%args ])
1720              
1721             Aliases: unfollow, destroy_friendship
1722              
1723             L<https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/post-friendships-destroy>
1724              
1725             =head2 destroy_mute([ $screen_name | $user_id, ][ \%args ])
1726              
1727             L<https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/post-mutes-users-destroy>
1728              
1729             Alias: unmute
1730              
1731             =head2 destroy_saved_search([ $id, ][ \%args ])
1732              
1733             Aliases: delete_saved_search
1734              
1735             L<https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-saved_searches-destroy-id>
1736              
1737             =head2 destroy_status([ $id, ][ \%args ])
1738              
1739             L<https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-statuses-destroy-id>
1740              
1741             =head2 members_create_all([ \%args ])
1742              
1743             Aliases: add_list_members
1744              
1745             L<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-members-create_all>
1746              
1747             =head2 members_destroy_all([ \%args ])
1748              
1749             Aliases: remove_list_members
1750              
1751             L<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-members-destroy_all>
1752              
1753             =head2 move_collection_entry([ $id, [ $tweet_id, [ $relative_to, ]]][ \%args ])
1754              
1755             L<https://developer.twitter.com/en/docs/tweets/curate-a-collection/api-reference/post-collections-entries-move>
1756              
1757             =head2 remove_collection_entry([ $id, [ $tweet_id, ]][ \%args ])
1758              
1759             L<https://developer.twitter.com/en/docs/tweets/curate-a-collection/api-reference/post-collections-entries-remove>
1760              
1761             =head2 remove_profile_banner([ \%args ])
1762              
1763             L<https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-account-remove_profile_banner>
1764              
1765             =head2 report_spam([ \%args ])
1766              
1767             L<https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/post-users-report_spam>
1768              
1769             =head2 retweet([ $id, ][ \%args ])
1770              
1771             L<https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-statuses-retweet-id>
1772              
1773             =head2 subscribe_list([ \%args ])
1774              
1775             L<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-subscribers-create>
1776              
1777             =head2 unretweet([ $id, ][ \%args ])
1778              
1779             L<https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-statuses-unretweet-id>
1780              
1781             =head2 unsubscribe_list([ \%args ])
1782              
1783             L<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-subscribers-destroy>
1784              
1785             =head2 update([ $status, ][ \%args ])
1786              
1787             L<https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-statuses-update>
1788              
1789             =head2 update_account_settings([ \%args ])
1790              
1791             L<https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-account-settings>
1792              
1793             =head2 update_collection([ $id, ][ \%args ])
1794              
1795             L<https://developer.twitter.com/en/docs/tweets/curate-a-collection/api-reference/post-collections-update>
1796              
1797             =head2 update_friendship([ \%args ])
1798              
1799             L<https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/post-friendships-update>
1800              
1801             =head2 update_list([ \%args ])
1802              
1803             L<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-update>
1804              
1805             =head2 update_profile([ \%args ])
1806              
1807             L<https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-account-update_profile>
1808              
1809             =head2 update_profile_background_image([ \%args ])
1810              
1811             L<https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-account-update_profile_background_image>
1812              
1813             =head2 update_profile_banner([ $banner, ][ \%args ])
1814              
1815             L<https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-account-update_profile_banner>
1816              
1817             =head2 update_profile_image([ $image, ][ \%args ])
1818              
1819             L<https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-account-update_profile_image>
1820              
1821             =head2 upload_media([ $media, ][ \%args ])
1822              
1823             Aliases: upload
1824              
1825             L<https://developer.twitter.com/en/docs/media/upload-media/api-reference/post-media-upload>
1826              
1827             =head2 direct_messages_events([ \%args ])
1828              
1829             L<https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/list-events.html>
1830              
1831             =head2 show_direct_messages_event([ $id, ][ \%args ])
1832              
1833             L<https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/get-event>
1834              
1835             =head2 destroy_direct_messages_event([ $id, ][ \%args ])
1836              
1837             L<https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/delete-message-event>
1838              
1839             =head2 new_direct_messages_event([$text, $recipient_id ] | [ \%event ], [ \%args ])
1840              
1841             For simple usage, pass text and recipient ID:
1842              
1843             $client->new_dirrect_messages_event($text, $recipient_id)
1844              
1845             For more complex messages, pass a full event structure, for example:
1846              
1847             $client->new_direct_massages_event({
1848             type => 'message_create',
1849             message_create => {
1850             target => { recipient_id => $user_id },
1851             message_data => {
1852             text => $text,
1853             attachment => {
1854             type => 'media',
1855             media => { id => $media->{id} },
1856             },
1857             },
1858             },
1859             })
1860              
1861             L<https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/new-message>
1862              
1863             =head2 invalidate_access_token([ \%args ])
1864              
1865             Calling this method has the same effect as a user revoking access to the
1866             application via Twitter settings. The access token/secret pair will no longer
1867             be valid.
1868              
1869             This method can be called with client that has been initialized with
1870             C<access_token> and C<access_token_secret> attributes, by passing C<-token> and
1871             C<-token_secret> parameters, or by passing C<access_token> and
1872             C<access_token_secret> parameters.
1873              
1874             $client->invalidate_access_token;
1875             $client->invalidate_access_token({ -token => $token, -token_secret => $secret });
1876             $client->invalidate_access_token({
1877             access_token => $token,
1878             access_token_secret => $secret,
1879             });
1880              
1881             Twitter added this method to the API on 2018-09-20.
1882              
1883             See
1884             L<https://developer.twitter.com/en/docs/basics/authentication/api-reference/invalidate_access_token>
1885              
1886             =head1 AUTHOR
1887              
1888             Marc Mims <marc@questright.com>
1889              
1890             =head1 COPYRIGHT AND LICENSE
1891              
1892             This software is copyright (c) 2015-2021 by Marc Mims.
1893              
1894             This is free software; you can redistribute it and/or modify it under
1895             the same terms as the Perl 5 programming language system itself.
1896              
1897             =cut