File Coverage

blib/lib/Net/Twitter/Role/API/RESTv1_1.pm
Criterion Covered Total %
statement 21 23 91.3
branch 2 2 100.0
condition n/a
subroutine 6 7 85.7
pod n/a
total 29 32 90.6


line stmt bran cond sub pod time code
1             package Net::Twitter::Role::API::RESTv1_1;
2             $Net::Twitter::Role::API::RESTv1_1::VERSION = '4.01042';
3 7     7   7634 use Moose::Role;
  7         15615  
  7         29  
4 7     7   26748 use Carp::Clan qw/^(?:Net::Twitter|Moose|Class::MOP)/;
  7         10  
  7         58  
5 7     7   4319 use Net::Twitter::API;
  7         19  
  7         40  
6 7     7   5064 use DateTime::Format::Strptime;
  7         11  
  7         74  
7 7     7   399 use URI;
  7         10  
  7         30673  
8              
9             with 'Net::Twitter::Role::API::UploadMedia';
10              
11             # API v1.1 incorporates the Search and Upload APIs
12             excludes map "Net::Twitter::Role::$_", qw/API::Search API::Upload Net::Twitter::Role::RateLimit/;
13              
14             has apiurl => ( isa => 'Str', is => 'ro', default => 'http://api.twitter.com/1.1' );
15             has apihost => ( isa => 'Str', is => 'ro', lazy => 1, builder => '_build_apihost' );
16             has apirealm => ( isa => 'Str', is => 'ro', default => 'Twitter API' );
17              
18             sub _build_apihost {
19 0     0   0     my $uri = URI->new(shift->apiurl);
20 0         0     join ':', $uri->host, $uri->port;
21             }
22              
23             after BUILD => sub {
24                 my $self = shift;
25              
26                 $self->{apiurl} =~ s/^http:/https:/ if $self->ssl;
27             };
28              
29             base_url     'apiurl';
30             authenticate 1;
31              
32             our $DATETIME_PARSER = DateTime::Format::Strptime->new(pattern => '%a %b %d %T %z %Y');
33             datetime_parser $DATETIME_PARSER;
34              
35             twitter_api_method mentions => (
36                 description => <<'',
37             Returns the 20 most recent mentions (statuses containing @username) for the
38             authenticating user.
39            
40                 aliases => [qw/replies mentions_timeline/],
41                 path => 'statuses/mentions_timeline',
42                 method => 'GET',
43                 params => [qw/since_id max_id count trim_user include_entities contributor_details/],
44                 booleans => [qw/trim_user include_entities contributor_details/],
45                 required => [],
46                 returns => 'ArrayRef[Status]',
47             );
48              
49             twitter_api_method user_timeline => (
50                 description => <<'',
51             Returns the 20 most recent statuses posted by the authenticating user, or the
52             user specified by C<screen_name> or C<user_id>.
53            
54                 path => 'statuses/user_timeline',
55                 method => 'GET',
56                 params => [qw/user_id screen_name since_id max_id count trim_user exclude_replies include_rts contributor_details/],
57                 booleans => [qw/trim_user exclude_replies include_rts contributor_details/],
58                 required => [],
59                 returns => 'ArrayRef[Status]',
60             );
61              
62             twitter_api_method home_timeline => (
63                 description => <<'',
64             Returns the 20 most recent statuses, including retweets, posted by the
65             authenticating user and that user's friends.
66            
67                 path => 'statuses/home_timeline',
68                 method => 'GET',
69                 params => [qw/since_id max_id count exclude_replies contributor_details
70             include_entities trim_user/],
71                 booleans => [qw/skip_user exclude_replies contributor_details include_rts include_entities
72             trim_user include_my_retweet/],
73                 required => [],
74                 returns => 'ArrayRef[Status]',
75             );
76              
77             twitter_api_method friends_timeline => (
78                 description => <<'',
79             Returns the 20 most recent statuses, including retweets, posted by the
80             authenticating user and that user's friends.
81            
82                 path => 'statuses/home_timeline',
83                 aliases => [qw/following_timeline/],
84                 method => 'GET',
85                 params => [qw/since_id max_id count exclude_replies contributor_details
86             include_entities trim_user/],
87                 booleans => [qw/skip_user exclude_replies contributor_details include_rts include_entities
88             trim_user include_my_retweet/],
89                 required => [],
90                 returns => 'ArrayRef[Status]',
91                 deprecated => sub { carp "$_[0] DEPRECATED: using home_timeline instead" },
92             );
93              
94             twitter_api_method retweets => (
95                 description => <<'',
96             Returns up to 100 of the first retweets of a given tweet.
97            
98                 path => 'statuses/retweets/:id',
99                 method => 'GET',
100                 params => [qw/id count trim_user/],
101                 booleans => [qw/trim_user/],
102                 required => [qw/id/],
103                 returns => 'Arrayref[Status]',
104             );
105              
106             twitter_api_method show_status => (
107                 description => <<'',
108             Returns a single status, specified by the id parameter. The
109             status's author will be returned inline.
110            
111                 path => 'statuses/show/:id',
112                 method => 'GET',
113                 params => [qw/id trim_user include_entities include_my_retweet/],
114                 booleans => [qw/trim_user include_entities include_my_retweet/],
115                 required => [qw/id/],
116                 returns => 'Status',
117             );
118              
119             twitter_api_method destroy_status => (
120                 description => <<'',
121             Destroys the status specified by the required ID parameter. The
122             authenticating user must be the author of the specified status.
123            
124                 path => 'statuses/destroy/:id',
125                 method => 'POST',
126                 params => [qw/id trim_user/],
127                 booleans => [qw/trim_user/],
128                 required => [qw/id/],
129                 returns => 'Status',
130             );
131              
132             twitter_api_method update => (
133                 path => 'statuses/update',
134                 method => 'POST',
135                 params => [qw/
136             attachment_url display_coordinates in_reply_to_status_id lat long
137             media_ids place_id status trim_user
138             /],
139                 required => [qw/status/],
140                 booleans => [qw/display_coordinates trim_user/],
141                 add_source => 1,
142                 returns => 'Status',
143                 description => <<EOT,
144            
145             Updates the authenticating user's status. Requires the status parameter
146             specified. A status update with text identical to the authenticating
147             user's current status will be ignored.
148            
149             \=over 4
150            
151             \=item status
152            
153             Required. The text of your status update. URL encode as necessary. Statuses
154             over 140 characters will cause a 403 error to be returned from the API.
155            
156             \=item in_reply_to_status_id
157            
158             Optional. The ID of an existing status that the update is in reply to. o Note:
159             This parameter will be ignored unless the author of the tweet this parameter
160             references is mentioned within the status text. Therefore, you must include
161             \@username, where username is the author of the referenced tweet, within the
162             update.
163            
164             \=item lat
165            
166             Optional. The location's latitude that this tweet refers to. The valid ranges
167             for latitude is -90.0 to +90.0 (North is positive) inclusive. This parameter
168             will be ignored if outside that range, if it is not a number, if geo_enabled is
169             disabled, or if there not a corresponding long parameter with this tweet.
170            
171             \=item long
172            
173             Optional. The location's longitude that this tweet refers to. The valid ranges
174             for longitude is -180.0 to +180.0 (East is positive) inclusive. This parameter
175             will be ignored if outside that range, if it is not a number, if geo_enabled is
176             disabled, or if there not a corresponding lat parameter with this tweet.
177            
178             \=item place_id
179            
180             Optional. The place to attach to this status update. Valid place_ids can be
181             found by querying C<reverse_geocode>.
182            
183             \=item display_coordinates
184            
185             Optional. By default, geo-tweets will have their coordinates exposed in the
186             status object (to remain backwards compatible with existing API applications).
187             To turn off the display of the precise latitude and longitude (but keep the
188             contextual location information), pass C<display_coordinates => 0> on the
189             status update.
190            
191             \=back
192            
193             EOT
194              
195             );
196              
197             twitter_api_method retweet => (
198                 description => <<'',
199             Retweets a tweet.
200            
201                 path => 'statuses/retweet/:id',
202                 method => 'POST',
203                 params => [qw/idtrim_user/],
204                 booleans => [qw/trim_user/],
205                 required => [qw/id/],
206                 returns => 'Status',
207             );
208              
209             twitter_api_method update_with_media => (
210                 path => 'statuses/update_with_media',
211                 method => 'POST',
212                 params => [qw/
213             status media[] possibly_sensitive in_reply_to_status_id lat long place_id display_coordinates
214             /],
215                 required => [qw/status media[]/],
216                 booleans => [qw/possibly_sensitive display_coordinates/],
217                 returns => 'Status',
218                 description => <<'EOT',
219             Updates the authenticating user's status and attaches media for upload.
220            
221             The C<media[]> parameter is an arrayref with the following interpretation:
222            
223             [ $file ]
224             [ $file, $filename ]
225             [ $file, $filename, Content_Type => $mime_type ]
226             [ undef, $filename, Content_Type => $mime_type, Content => $raw_image_data ]
227            
228             The first value of the array (C<$file>) is the name of a file to open. The
229             second value (C<$filename>) is the name given to Twitter for the file. If
230             C<$filename> is not provided, the basename portion of C<$file> is used. If
231             C<$mime_type> is not provided, it will be provided automatically using
232             L<LWP::MediaTypes::guess_media_type()>.
233            
234             C<$raw_image_data> can be provided, rather than opening a file, by passing
235             C<undef> as the first array value.
236            
237             The Tweet text will be rewritten to include the media URL(s), which will reduce
238             the number of characters allowed in the Tweet text. If the URL(s) cannot be
239             appended without text truncation, the tweet will be rejected and this method
240             will return an HTTP 403 error.
241             EOT
242              
243             );
244              
245             twitter_api_method oembed => (
246                 description => <<'EOT',
247             Returns information allowing the creation of an embedded representation of a
248             Tweet on third party sites. See the L<oEmbed|http://oembed.com/> specification
249             for information about the response format.
250            
251             While this endpoint allows a bit of customization for the final appearance of
252             the embedded Tweet, be aware that the appearance of the rendered Tweet may
253             change over time to be consistent with Twitter's L<Display
254             Requirements|https://dev.twitter.com/terms/display-requirements>. Do not rely
255             on any class or id parameters to stay constant in the returned markup.
256            
257             EOT
258              
259                 method => 'GET',
260                 path => 'statuses/oembed',
261                 params => [qw/id url maxwidth hide_media hide_thread omit_script align related lang/],
262                 required => [qw//],
263                 booleans => [qw/hide_media hide_thread omit_script/],
264                 returns => 'Status',
265             );
266              
267             twitter_api_method retweeters_ids => (
268                 description => <<'EOT',
269             Returns a collection of up to 100 user IDs belonging to users who have
270             retweeted the tweet specified by the id parameter.
271            
272             This method offers similar data to C<retweets> and replaces API v1's
273             C<retweeted_by_ids> method.
274             EOT
275                 method => 'GET',
276                 path => 'statuses/retweeters/ids',
277                 params => [qw/id cursor stringify_ids/],
278                 required => [qw/id/],
279                 booleans => [qw/stringify_ids/],
280                 returns => 'HashRef',
281             );
282              
283             twitter_api_method search => (
284                 description => <<'EOT',
285             Returns a HASH reference with some meta-data about the query including the
286             C<next_page>, C<refresh_url>, and C<max_id>. The statuses are returned in
287             C<results>. To iterate over the results, use something similar to:
288            
289             my $r = $nt->search($search_term);
290             for my $status ( @{$r->{statuses}} ) {
291             print "$status->{text}\n";
292             }
293             EOT
294              
295                 path => 'search/tweets',
296                 method => 'GET',
297                 params => [qw/q count callback lang locale rpp since_id max_id until geocode result_type include_entities/],
298                 required => [qw/q/],
299                 booleans => [qw/include_entities/],
300                 returns => 'HashRef',
301             );
302              
303             twitter_api_method direct_messages => (
304                 description => <<'EOT',
305             Returns a list of the 20 most recent direct messages sent to the authenticating
306             user including detailed information about the sending and recipient users.
307            
308             Important: this method requires an access token with RWD (read, write, and
309             direct message) permissions.
310             EOT
311              
312                 path => 'direct_messages',
313                 method => 'GET',
314                 params => [qw/since_id max_id count page include_entities skip_status/],
315                 required => [],
316                 booleans => [qw/include_entities skip_status/],
317                 returns => 'ArrayRef[DirectMessage]',
318             );
319              
320             twitter_api_method sent_direct_messages => (
321                 description => <<'EOT',
322             Returns a list of the 20 most recent direct messages sent by the authenticating
323             user including detailed information about the sending and recipient users.
324            
325             Important: this method requires an access token with RWD (read, write, and
326             direct message) permissions.
327             EOT
328              
329                 aliases => [qw/direct_messages_sent/],
330                 path => 'direct_messages/sent',
331                 method => 'GET',
332                 params => [qw/since_id max_id page count include_entities/],
333                 booleans => [qw/include_entities/],
334                 required => [qw//],
335                 returns => 'ArrayRef[DirectMessage]',
336             );
337              
338             twitter_api_method show_direct_message => (
339                 description => <<'EOT',
340             Returns a single direct message, specified by an id parameter. Like
341             the C<direct_messages> request, this method will include the
342             user objects of the sender and recipient. Requires authentication.
343            
344             Important: this method requires an access token with RWD (read, write, and
345             direct message) permissions.
346             EOT
347              
348                 path => 'direct_messages/show',
349                 method => 'GET',
350                 params => [qw/id/],
351                 booleans => [],
352                 required => [qw/id/],
353                 returns => 'HashRef',
354             );
355              
356             twitter_api_method destroy_direct_message => (
357                 description => <<'EOT',
358             Destroys the direct message specified in the required ID parameter.
359             The authenticating user must be the recipient of the specified direct
360             message.
361            
362             Important: this method requires an access token with RWD (read, write, and
363             direct message) permissions.
364             EOT
365              
366                 path => 'direct_messages/destroy',
367                 method => 'POST',
368                 params => [qw/id include_entities/],
369                 booleans => [qw/include_entities/],
370                 required => [qw/id/],
371                 returns => 'DirectMessage',
372             );
373              
374             twitter_api_method new_direct_message => (
375                 description => <<'EOT',
376             Sends a new direct message to the specified user from the authenticating user.
377             Requires both the user and text parameters. Returns the sent message when
378             successful. In order to support numeric screen names, the C<screen_name> or
379             C<user_id> parameters may be used instead of C<user>.
380            
381             Important: this method requires an access token with RWD (read, write, and
382             direct message) permissions.
383             EOT
384              
385                 path => 'direct_messages/new',
386                 method => 'POST',
387                 params => [qw/user_id screen_name text/],
388                 booleans => [qw//],
389                 required => [qw/text/],
390                 returns => 'DirectMessage',
391             );
392              
393             around new_direct_message => sub {
394                 my $orig = shift;
395                 my $self = shift;
396              
397                 my $args = ref $_[-1] eq ref {} ? pop : {};
398                 $args->{user} = shift unless exists $args->{user} || exists $args->{screen_name} || exists $args->{user_id};
399                 $args->{text} = shift unless exists $args->{text};
400              
401                 croak "too many args" if @_;
402              
403                 if ( my $user = delete $args->{user} ) {
404                     warn "user argument to new_direct_message deprecated; use screen_name or user_id";
405              
406                     if ( $user =~ /^\d+$/ ) {
407                         $args->{user_id} = $user;
408                     }
409                     else {
410                         $args->{screen_name} = $user;
411                     }
412                 }
413              
414                 return $self->$orig($args);
415             };
416              
417             twitter_api_method friends_ids => (
418                 description => <<'EOT',
419             Returns a reference to an array of numeric IDs for every user followed by the
420             specified user. The order of the IDs is reverse chronological.
421            
422             Use the optional C<cursor> parameter to retrieve IDs in pages of 5000. When
423             the C<cursor> parameter is used, the return value is a reference to a hash with
424             keys C<previous_cursor>, C<next_cursor>, and C<ids>. The value of C<ids> is a
425             reference to an array of IDS of the user's friends. Set the optional C<cursor>
426             parameter to -1 to get the first page of IDs. Set it to the prior return's
427             value of C<previous_cursor> or C<next_cursor> to page forward or backwards.
428             When there are no prior pages, the value of C<previous_cursor> will be 0. When
429             there are no subsequent pages, the value of C<next_cursor> will be 0.
430             EOT
431              
432                 aliases => [qw/following_ids/],
433                 path => 'friends/ids',
434                 method => 'GET',
435                 params => [qw/user_id screen_name cursor stringify_ids/],
436                 required => [qw//],
437                 booleans => [qw/stringify_ids/],
438                 returns => 'HashRef|ArrayRef[Int]',
439             );
440              
441             twitter_api_method followers => (
442                 description => <<'',
443             Returns a cursored collection of user objects for users following the specified user.
444            
445                 aliases => [qw/followers_list/],
446                 path => 'followers/list',
447                 method => 'GET',
448                 params => [qw/user_id screen_name cursor/],
449                 required => [qw//],
450                 returns => 'HashRef',
451             );
452              
453             twitter_api_method friends => (
454                 description => <<'',
455             Returns a cursored collection of user objects for users followed by the specified user.
456            
457                 aliases => [qw/friends_list/],
458                 path => 'friends/list',
459                 method => 'GET',
460                 params => [qw/user_id screen_name cursor/],
461                 required => [qw//],
462                 returns => 'HashRef',
463             );
464              
465             twitter_api_method followers_ids => (
466                 description => <<'EOT',
467             Returns a reference to an array of numeric IDs for every user following the
468             specified user. The order of the IDs may change from call to call. To obtain
469             the screen names, pass the arrayref to L</lookup_users>.
470            
471             Use the optional C<cursor> parameter to retrieve IDs in pages of 5000. When
472             the C<cursor> parameter is used, the return value is a reference to a hash with
473             keys C<previous_cursor>, C<next_cursor>, and C<ids>. The value of C<ids> is a
474             reference to an array of IDS of the user's followers. Set the optional C<cursor>
475             parameter to -1 to get the first page of IDs. Set it to the prior return's
476             value of C<previous_cursor> or C<next_cursor> to page forward or backwards.
477             When there are no prior pages, the value of C<previous_cursor> will be 0. When
478             there are no subsequent pages, the value of C<next_cursor> will be 0.
479             EOT
480              
481                 path => 'followers/ids',
482                 method => 'GET',
483                 params => [qw/user_id screen_name cursor/],
484                 params => [qw/user_id screen_name cursor stringify_ids/],
485                 required => [qw//],
486                 booleans => [qw/stringify_ids/],
487                 returns => 'HashRef|ArrayRef[Int]',
488             );
489              
490             twitter_api_method lookup_friendships => (
491                 path => 'friendships/lookup',
492                 method => 'GET',
493                 params => [qw/user_id screen_name/],
494                 required => [],
495                 returns => 'ArrayRef',
496                 description => <<''
497             Returns the relationship of the authenticating user to the comma separated list
498             or ARRAY ref of up to 100 screen_names or user_ids provided. Values for
499             connections can be: following, following_requested, followed_by, none.
500             Requires authentication.
501            
502             );
503              
504             twitter_api_method friendships_incoming => (
505                 description => <<'EOT',
506             Returns an HASH ref with an array of numeric IDs in the C<ids> element for
507             every user who has a pending request to follow the authenticating user.
508             EOT
509              
510                 aliases => [qw/incoming_friendships/],
511                 path => 'friendships/incoming',
512                 method => 'GET',
513                 params => [qw/cursor stringify_ids/],
514                 required => [],
515                 booleans => [qw/stringify_ids/],
516                 returns => 'HashRef',
517             );
518              
519             twitter_api_method friendships_outgoing => (
520                 description => <<'EOT',
521             Returns an HASH ref with an array of numeric IDs in the C<ids> element for
522             every protected user for whom the authenticating user has a pending follow
523             request.
524             EOT
525              
526                 aliases => [qw/outgoing_friendships/],
527                 path => 'friendships/outgoing',
528                 method => 'GET',
529                 params => [qw/cursor stringify_ids/],
530                 required => [],
531                 booleans => [qw/stringify_ids/],
532                 returns => 'HashRef',
533              
534             );
535              
536             twitter_api_method create_friend => (
537                 description => <<'',
538             Follows the user specified in the C<user_id> or C<screen_name> parameter as the
539             authenticating user. Returns the befriended user when successful. Returns a
540             string describing the failure condition when unsuccessful.
541            
542                 aliases => [qw/follow follow_new create_friendship/],
543                 path => 'friendships/create',
544                 method => 'POST',
545                 params => [qw/user_id screen_name follow/],
546                 booleans => [qw/follow/],
547                 required => [qw//],
548                 returns => 'BasicUser',
549             );
550              
551             twitter_api_method destroy_friend => (
552                 description => <<'',
553             Discontinues friendship with the user specified in the C<user_id> or
554             C<screen_name> parameter as the authenticating user. Returns the un-friended
555             user when successful. Returns a string describing the failure condition when
556             unsuccessful.
557            
558                 aliases => [qw/unfollow destroy_friendship/],
559                 path => 'friendships/destroy',
560                 method => 'POST',
561                 params => [qw/user_id screen_name/],
562                 booleans => [qw//],
563                 required => [qw/id/],
564                 returns => 'BasicUser',
565             );
566              
567             twitter_api_method update_friendship => (
568                 path => 'friendships/update',
569                 method => 'POST',
570                 params => [qw/user_id screen_name device retweets/],
571                 required => [qw//],
572                 booleans => [qw/device retweets/],
573                 returns => 'HashRef',
574                 description => <<''
575             Allows you enable or disable retweets and device notifications from the
576             specified user. All other values are assumed to be false. Requires
577             authentication.
578            
579             );
580              
581             twitter_api_method show_friendship => (
582                 description => <<'',
583             Returns detailed information about the relationship between two users.
584            
585                 aliases => [qw/show_relationship/],
586                 path => 'friendships/show',
587                 method => 'GET',
588                 params => [qw/source_id source_screen_name target_id target_screen_name/],
589                 required => [qw//],
590                 returns => 'Relationship',
591             );
592              
593             # infer source and target from positional args for convenience
594             around show_friendship => sub {
595                 my $orig = shift;
596                 my $self = shift;
597              
598                 my $args = ref $_[-1] eq ref {} ? pop : {};
599                 if ( @_ == 2 ) {
600                     for ( qw/source target/ ) {
601                         my $id = shift;
602                         $$args{$id =~ /^\d+$/ ? "${_}_id" : "${_}_screen_name"} = $id;
603                     }
604                 }
605                 return $self->$orig(@_, $args);
606             };
607              
608             # provided for backwards compatibility
609             twitter_api_method friendship_exists => (
610                 description => <<'EOT',
611             This method is provided for backwards compatibility with Twitter API V1.0.
612             Twitter API V1.1 does not provide an endpoint for this call. Instead,
613             C<show_friendship> is called, the result is inspected, and an appropriate value
614             is returned which can be evaluated in a boolean context.
615            
616             Tests for the existence of friendship between two users. Will return true if
617             user_a follows user_b, otherwise will return false.
618            
619             Use of C<user_a> and C<user_b> is deprecated. It has been preserved for backwards
620             compatibility, and is used for the two-argument positional form:
621            
622             $nt->friendship_exists($user_a, $user_b);
623            
624             Instead, you should use one of the named argument forms:
625            
626             $nt->friendship_exists({ user_id_a => $id1, user_id_b => $id2 });
627             $nt->friendship_exists({ screen_name_a => $name1, screen_name_b => $name2 });
628            
629             Consider using C<show_friendship> instead.
630             EOT
631              
632                 aliases => [qw/relationship_exists follows/],
633                 path => 'friendships/show',
634                 method => 'GET',
635                 params => [qw/user_id_a user_id_b screen_name_a screen_name_b user_a user_b/],
636                 required => [qw/user_a user_b/],
637                 returns => 'Bool',
638                 deprecated => sub { carp "$_[0] DEPRECATED: using show_friendship instead" },
639             );
640              
641             around [qw/friendship_exists relationship_exists follows/] => sub {
642                 my $orig = shift;
643                 my $self = shift;
644              
645                 my $args = ref $_[-1] eq ref {} ? pop : {};
646                 my ( $user_a, $user_b ) = @_; # default ags, if they exist
647                 if ( $user_a ||= delete $$args{user_a} ) {
648                     if ( $user_a =~ /^\d+$/ ) {
649                         $$args{source_id} = $user_a;
650                     }
651                     else {
652                         $$args{source_screen_name} = $user_a;
653                     }
654                 }
655                 elsif ( $user_a = delete $$args{screen_name_a} ) {
656                     $$args{source_screen_name} = $user_a;
657                 }
658                 elsif ( $user_a = delete $$args{user_id_a} ) {
659                     $$args{source_user_id} = $user_a;
660                 }
661                 else {
662                     croak "source user not specified";
663                 }
664              
665                 if ( $user_b ||= delete $$args{user_b} ) {
666                     if ( $user_b =~ /^\d+$/ ) {
667                         $$args{target_id} = $user_b;
668                     }
669                     else {
670                         $$args{target_screen_name} = $user_b;
671                     }
672                 }
673                 elsif ( $user_b = delete $$args{screen_name_b} ) {
674                     $$args{target_screen_name} = $user_b;
675                 }
676                 elsif ( $user_b = delete $$args{user_id_b} ) {
677                     $$args{target_user_id} = $user_b;
678                 }
679                 else {
680                     croak "target user not specified";
681                 }
682              
683                 my $r = $self->$orig($args);
684                 return !!$$r{relationship}{target}{followed_by};
685             };
686              
687             twitter_api_method account_settings => (
688                 description => <<'',
689             Returns the current trend, geo and sleep time information for the
690             authenticating user.
691            
692                 path => 'account/settings',
693                 method => 'GET',
694                 params => [],
695                 required => [],
696                 returns => 'HashRef',
697             );
698              
699             twitter_api_method verify_credentials => (
700                 description => <<'',
701             Returns an HTTP 200 OK response code and a representation of the
702             requesting user if authentication was successful; returns a 401 status
703             code and an error message if not. Use this method to test if supplied
704             user credentials are valid.
705            
706                 path => 'account/verify_credentials',
707                 method => 'GET',
708                 params => [qw/include_entities skip_status include_email/],
709                 booleans => [qw/include_entities skip_status include_email/],
710                 required => [qw//],
711                 returns => 'ExtendedUser',
712             );
713              
714             twitter_api_method update_account_settings => (
715                 description => <<'',
716             Updates the authenticating user's settings.
717            
718                 path => 'account/settings',
719                 method => 'POST',
720                 params => [qw/trend_location_woid sleep_time_enabled start_sleep_time end_sleep_time time_zone lang/],
721                 required => [],
722                 booleans => [qw/sleep_time_enabled/],
723                 returns => 'HashRef',
724             );
725              
726             twitter_api_method update_delivery_device => (
727                 description => <<'',
728             Sets which device Twitter delivers updates to for the authenticating user.
729             Sending none as the device parameter will disable SMS updates.
730            
731                 path => 'account/update_delivery_device',
732                 method => 'POST',
733                 params => [qw/device include_entities/],
734                 required => [qw/device/],
735                 booleans => [qw/include_entities/],
736                 returns => 'BasicUser',
737             );
738              
739             twitter_api_method update_profile => (
740                 description => <<'',
741             Sets values that users are able to set under the "Account" tab of their
742             settings page. Only the parameters specified will be updated; to only
743             update the "name" attribute, for example, only include that parameter
744             in your request.
745            
746                 path => 'account/update_profile',
747                 method => 'POST',
748                 params => [qw/name url location description include_entities skip_status/],
749                 required => [qw//],
750                 booleans => [qw/include_entities skip_status/],
751                 returns => 'ExtendedUser',
752             );
753              
754             twitter_api_method update_location => (
755                 description => <<'',
756             This method has been deprecated in favor of the update_profile method.
757             Its URL will continue to work, but please consider migrating to the newer
758             and more comprehensive method of updating profile attributes.
759            
760                 path => 'account/update_profile',
761                 method => 'POST',
762                 params => [qw/location/],
763                 required => [qw/location/],
764                 returns => 'BasicUser',
765                 deprecated => sub { carp "$_[0] DEPRECATED: using update_profile instead" },
766             );
767              
768             twitter_api_method update_profile_background_image => (
769                 description => <<'',
770             Updates the authenticating user's profile background image. The C<image>
771             parameter must be an arrayref with the same interpretation as the C<image>
772             parameter in the C<update_profile_image> method. See that method's
773             documentation for details. The C<use> parameter allows you to specify whether
774             to use the uploaded profile background or not.
775            
776                 path => 'account/update_profile_background_image',
777                 method => 'POST',
778                 params => [qw/image tile include_entities skip_status use/],
779                 required => [qw//],
780                 booleans => [qw/include_entities skip_status use/],
781                 returns => 'ExtendedUser',
782             );
783              
784             twitter_api_method update_profile_colors => (
785                 description => <<'',
786             Sets one or more hex values that control the color scheme of the
787             authenticating user's profile page on twitter.com. These values are
788             also returned in the /users/show API method.
789            
790                 path => 'account/update_profile_colors',
791                 method => 'POST',
792                 params => [qw/
793             profile_background_color
794             profile_text_color
795             profile_link_color
796             profile_sidebar_fill_color
797             profile_sidebar_border_color
798             include_entities
799             skip_status
800             /],
801                 required => [qw//],
802                 booleans => [qw/include_entities skip_status/],
803                 returns => 'ExtendedUser',
804             );
805              
806             twitter_api_method update_profile_image => (
807                 description => <<'EOT',
808             Updates the authenticating user's profile image. The C<image> parameter is an
809             arrayref with the following interpretation:
810            
811             [ $file ]
812             [ $file, $filename ]
813             [ $file, $filename, Content_Type => $mime_type ]
814             [ undef, $filename, Content_Type => $mime_type, Content => $raw_image_data ]
815            
816             The first value of the array (C<$file>) is the name of a file to open. The
817             second value (C<$filename>) is the name given to Twitter for the file. If
818             C<$filename> is not provided, the basename portion of C<$file> is used. If
819             C<$mime_type> is not provided, it will be provided automatically using
820             L<LWP::MediaTypes::guess_media_type()>.
821            
822             C<$raw_image_data> can be provided, rather than opening a file, by passing
823             C<undef> as the first array value.
824             EOT
825              
826                 path => 'account/update_profile_image',
827                 method => 'POST',
828                 params => [qw/image include_entities skip_status/],
829                 required => [qw/image/],
830                 booleans => [qw/include_entities skip_status/],
831                 returns => 'ExtendedUser',
832             );
833              
834             twitter_api_method blocking => (
835                 description => <<'',
836             Returns an array of user objects that the authenticating user is blocking.
837            
838                 path => 'blocks/list',
839                 aliases => [qw/blocks_list/],
840                 method => 'GET',
841                 params => [qw/cursor include_entities skip_status/],
842                 required => [qw//],
843                 returns => 'ArrayRef[BasicUser]',
844             );
845              
846             twitter_api_method blocking_ids => (
847                 description => <<'',
848             Returns an array of numeric user ids the authenticating user is blocking.
849            
850                 path => 'blocks/ids',
851                 aliases => [qw/blocks_ids/],
852                 method => 'GET',
853                 params => [qw/cursor stringify_ids/],
854                 required => [qw//],
855                 booleans => [qw/stringify_ids/],
856                 returns => 'ArrayRef[Int]',
857             );
858              
859             twitter_api_method create_block => (
860                 description => <<'',
861             Blocks the user specified in the C<user_id> or C<screen_name> parameter as the
862             authenticating user. Returns the blocked user when successful. You can find
863             out more about blocking in the Twitter Support Knowledge Base.
864            
865                 path => 'blocks/create',
866                 method => 'POST',
867                 params => [qw/user_id screen_name include_entities skip_status/],
868                 booleans => [qw/include_entities skip_status/],
869                 required => [qw/id/],
870                 returns => 'BasicUser',
871             );
872              
873             twitter_api_method destroy_block => (
874                 description => <<'',
875             Un-blocks the user specified in the C<user_id> or C<screen_name> parameter as
876             the authenticating user. Returns the un-blocked user when successful.
877            
878                 path => 'blocks/destroy',
879                 method => 'POST',
880                 params => [qw/user_id screen_name include_entities skip_status/],
881                 booleans => [qw/include_entities skip_status/],
882                 required => [qw/id/],
883                 returns => 'BasicUser',
884             );
885              
886             twitter_api_method lookup_users => (
887                 description => <<'EOT',
888             Return up to 100 users worth of extended information, specified by either ID,
889             screen name, or combination of the two. The author's most recent status (if the
890             authenticating user has permission) will be returned inline. This method is
891             rate limited to 1000 calls per hour.
892            
893             This method will accept user IDs or screen names as either a comma delimited
894             string, or as an ARRAY ref. It will also accept arguments in the normal
895             HASHREF form or as a simple list of named arguments. I.e., any of the
896             following forms are acceptable:
897            
898             $nt->lookup_users({ user_id => '1234,6543,3333' });
899             $nt->lookup_users(user_id => '1234,6543,3333');
900             $nt->lookup_users({ user_id => [ 1234, 6543, 3333 ] });
901             $nt->lookup_users({ screen_name => 'fred,barney,wilma' });
902             $nt->lookup_users(screen_name => ['fred', 'barney', 'wilma']);
903            
904             $nt->lookup_users(
905             screen_name => ['fred', 'barney' ],
906             user_id => '4321,6789',
907             );
908             EOT
909              
910                 path => 'users/lookup',
911                 method => 'GET',
912                 params => [qw/user_id screen_name include_entities/],
913                 booleans => [qw/include_entities/],
914                 required => [],
915                 returns => 'ArrayRef[User]',
916             );
917              
918             twitter_api_method show_user => (
919                 description => <<'',
920             Returns extended information of a given user, specified by ID or screen
921             name as per the required id parameter. This information includes
922             design settings, so third party developers can theme their widgets
923             according to a given user's preferences. You must be properly
924             authenticated to request the page of a protected user.
925            
926                 path => 'users/show',
927                 method => 'GET',
928                 params => [qw/user_id screen_name include_entities/],
929                 booleans => [qw/include_entities/],
930                 required => [qw//],
931                 returns => 'ExtendedUser',
932             );
933              
934             twitter_api_method users_search => (
935                 description => <<'',
936             Run a search for users similar to Find People button on Twitter.com; the same
937             results returned by people search on Twitter.com will be returned by using this
938             API (about being listed in the People Search). It is only possible to retrieve
939             the first 1000 matches from this API.
940            
941                 aliases => [qw/find_people search_users/],
942                 path => 'users/search',
943                 method => 'GET',
944                 params => [qw/q per_page page count include_entities/],
945                 booleans => [qw/include_entities/],
946                 required => [qw/q/],
947                 returns => 'ArrayRef[Users]',
948             );
949              
950             twitter_api_method contributees => (
951                 deprecated => 1,
952                 path => 'users/contributees',
953                 method => 'GET',
954                 params => [qw/user_id screen_name include_entities skip_satus/],
955                 required => [],
956                 booleans => [qw/include_entities skip_satus/],
957                 returns => 'ArrayRef[User]',
958                 description => <<'',
959             Returns an array of users that the specified user can contribute to.
960            
961             );
962              
963             twitter_api_method contributors => (
964                 deprecated => 1,
965                 path => 'users/contributors',
966                 method => 'GET',
967                 params => [qw/user_id screen_name include_entities skip_satus/],
968                 required => [],
969                 booleans => [qw/include_entities skip_satus/],
970                 returns => 'ArrayRef[User]',
971                 description => <<'',
972             Returns an array of users who can contribute to the specified account.
973            
974             );
975              
976             twitter_api_method suggestion_categories => (
977                 path => 'users/suggestions',
978                 method => 'GET',
979                 params => [],
980                 required => [],
981                 returns => 'ArrayRef',
982                 description => <<''
983             Returns the list of suggested user categories. The category slug can be used in
984             the C<user_suggestions> API method get the users in that category . Does not
985             require authentication.
986            
987             );
988              
989             twitter_api_method user_suggestions_for => (
990                 aliases => [qw/follow_suggestions_for/],
991                 path => 'users/suggestions/:slug',
992                 method => 'GET',
993                 params => [qw/slug lang/],
994                 required => [qw/slug/],
995                 returns => 'ArrayRef',
996                 description => <<''
997             Access the users in a given slug (category) of the Twitter suggested user list.
998            
999             );
1000              
1001             twitter_api_method user_suggestions => (
1002                 aliases => [qw/follow_suggestions/],
1003                 path => 'users/suggestions/:slug/members',
1004                 method => 'GET',
1005                 params => [qw/slug lang/],
1006                 required => [qw/slug/],
1007                 returns => 'ArrayRef',
1008                 description => <<''
1009             Access the users in a given slug (category) of the Twitter suggested user list
1010             and return their most recent status if they are not a protected user.
1011             Currently supported values for optional parameter C<lang> are C<en>, C<fr>,
1012             C<de>, C<es>, C<it>. Does not require authentication.
1013            
1014             );
1015              
1016             # backwards compatibility: Twitter renamed "category" to "slug"
1017             around [ qw/follow_suggestions follow_suggestions_for user_suggestions
1018             user_suggestions_for/ ] => sub {
1019                 my ( $next, $self ) = splice @_, 0, 2;
1020              
1021                 my $args = ref $_[-1] eq 'HASH' ? pop : {};
1022                 if ( exists $args->{category} ) {
1023                     $args->{slug} = delete $args->{category};
1024                 }
1025              
1026                 return $self->$next(@_, $args);
1027             };
1028              
1029             twitter_api_method favorites => (
1030                 description => <<'',
1031             Returns the 20 most recent favorite statuses for the authenticating
1032             user or user specified by the ID parameter.
1033            
1034                 path => 'favorites/list',
1035                 method => 'GET',
1036                 params => [qw/user_id screen_name count since_id max_id include_entities/],
1037                 booleans => [qw/include_entities/],
1038                 required => [qw//],
1039                 returns => 'ArrayRef[Status]',
1040             );
1041              
1042             twitter_api_method destroy_favorite => (
1043                 description => <<'',
1044             Un-favorites the status specified in the ID parameter as the
1045             authenticating user. Returns the un-favorited status.
1046            
1047                 path => 'favorites/destroy',
1048                 method => 'POST',
1049                 params => [qw/id include_entities/],
1050                 booleans => [qw/include_entities/],
1051                 required => [qw/id/],
1052                 returns => 'Status',
1053             );
1054              
1055             twitter_api_method create_favorite => (
1056                 description => <<'',
1057             Favorites the status specified in the ID parameter as the
1058             authenticating user. Returns the favorite status when successful.
1059            
1060                 path => 'favorites/create',
1061                 method => 'POST',
1062                 params => [qw/id include_entities/],
1063                 booleans => [qw/include_entities/],
1064                 required => [qw/id/],
1065                 returns => 'Status',
1066             );
1067              
1068             ### Lists ###
1069              
1070             twitter_api_method get_lists => (
1071                 description => <<'EOT',
1072             Returns all lists the authenticating or specified user subscribes to, including
1073             their own. The user is specified using the user_id or screen_name parameters.
1074             If no user is given, the authenticating user is used.
1075            
1076             A maximum of 100 results will be returned by this call. Subscribed lists are
1077             returned first, followed by owned lists. This means that if a user subscribes
1078             to 90 lists and owns 20 lists, this method returns 90 subscriptions and 10
1079             owned lists. The reverse method returns owned lists first, so with C<reverse =>
1080             1>, 20 owned lists and 80 subscriptions would be returned. If your goal is to
1081             obtain every list a user owns or subscribes to, use <list_ownerships> and/or
1082             C<list_subscriptions> instead.
1083             EOT
1084              
1085                 path => 'lists/list',
1086                 aliases => [qw/list_lists all_subscriptions/],
1087                 method => 'GET',
1088                 params => [qw/user_id screen_name reverse/],
1089                 required => [],
1090                 returns => 'Hashref',
1091             );
1092              
1093             twitter_api_method list_statuses => (
1094                 description => <<'',
1095             Returns tweet timeline for members of the specified list. Historically,
1096             retweets were not available in list timeline responses but you can now use the
1097             include_rts=true parameter to additionally receive retweet objects.
1098            
1099                 path => 'lists/statuses',
1100                 method => 'GET',
1101                 params => [qw/
1102             list_id slug owner_screen_name owner_id since_id max_id count
1103             include_entities include_rts
1104             /],
1105                 required => [],
1106                 booleans => [qw/include_entities include_rts/],
1107                 returns => 'ArrayRef[Status]',
1108             );
1109              
1110             twitter_api_method delete_list_member => (
1111                 description => <<'',
1112             Removes the specified member from the list. The authenticated user must be the
1113             list's owner to remove members from the list.
1114            
1115                 path => 'lists/members/destroy',
1116                 method => 'POST',
1117                 params => [qw/list_id slug user_id screen_name owner_screen_name owner_id/],
1118                 required => [],
1119                 returns => 'User',
1120                 aliases => [qw/remove_list_member/],
1121             );
1122              
1123             twitter_api_method list_memberships => (
1124                 description => <<'',
1125             Returns the lists the specified user has been added to. If user_id or
1126             screen_name are not provided the memberships for the authenticating user are
1127             returned.
1128            
1129                 path => 'lists/memberships',
1130                 method => 'GET',
1131                 params => [qw/user_id screen_name cursor filter_to_owned_lists/],
1132                 required => [],
1133                 booleans => [qw/filter_to_owned_lists/],
1134                 returns => 'Hashref',
1135             );
1136              
1137             twitter_api_method list_subscribers => (
1138                 path => 'lists/subscribers',
1139                 method => 'GET',
1140                 params => [qw/list_id slug owner_screen_name owner_id cursor include_entities skip_status/],
1141                 required => [],
1142                 booleans => [qw/include_entities skip_status/],
1143                 returns => 'Hashref',
1144                 description => <<'',
1145             Returns the subscribers of the specified list. Private list subscribers will
1146             only be shown if the authenticated user owns the specified list.
1147            
1148             );
1149              
1150             twitter_api_method subscribe_list => (
1151                 description => <<'',
1152             Subscribes the authenticated user to the specified list.
1153            
1154                 path => 'lists/subscribers/create',
1155                 method => 'POST',
1156                 params => [qw/owner_screen_name owner_id list_id slug/],
1157                 required => [],
1158                 returns => 'List',
1159             );
1160              
1161             twitter_api_method show_list_subscriber => (
1162                 description => <<'',
1163             Returns the user if they are a subscriber.
1164            
1165                 path => 'lists/subscribers/show',
1166                 aliases => [qw/is_list_subscriber is_subscriber_lists/],
1167                 method => 'GET',
1168                 params => [qw/
1169             owner_screen_name owner_id list_id slug user_id screen_name
1170             include_entities skip_status
1171             /],
1172                 required => [],
1173                 booleans => [qw/include_entities skip_status/],
1174                 returns => 'User',
1175             );
1176              
1177             around [qw/is_list_subscriber is_subscriber_lists/] => sub {
1178                 my $orig = shift;
1179                 my $self = shift;
1180              
1181                 $self->_user_or_undef($orig, 'subscriber', @_);
1182             };
1183              
1184             twitter_api_method unsubscribe_list => (
1185                 description => <<'',
1186             Unsubscribes the authenticated user from the specified list.
1187            
1188                 path => 'lists/subscribers/destroy',
1189                 method => 'POST',
1190                 params => [qw/list_id slug owner_screen_name owner_id/],
1191                 required => [],
1192                 returns => 'List',
1193             );
1194              
1195             twitter_api_method members_create_all => (
1196                 description => <<'',
1197             Adds multiple members to a list, by specifying a reference to an array or a
1198             comma-separated list of member ids or screen names. The authenticated user must
1199             own the list to be able to add members to it. Note that lists can't have more
1200             than 500 members, and you are limited to adding up to 100 members to a list at
1201             a time with this method.
1202            
1203                 path => 'lists/members/create_all',
1204                 method => 'POST',
1205                 params => [qw/list_id slug owner_screen_name owner_id/],
1206                 required => [],
1207                 returns => 'List',
1208                 aliases => [qw/add_list_members/],
1209             );
1210              
1211             twitter_api_method show_list_member => (
1212                 description => <<'',
1213             Check if the specified user is a member of the specified list. Returns the user or undef.
1214            
1215                 path => 'lists/members/show',
1216                 aliases => [qw/is_list_member/],
1217                 method => 'GET',
1218                 params => [qw/
1219             owner_screen_name owner_id list_id slug user_id screen_name
1220             include_entities skip_status
1221             /],
1222                 required => [],
1223                 booleans => [qw/include_entities skip_status/],
1224                 returns => 'Maybe[User]',
1225             );
1226              
1227             around is_list_member => sub {
1228                 my $orig = shift;
1229                 my $self = shift;
1230              
1231                 $self->_user_or_undef($orig, 'member', @_);
1232             };
1233              
1234             twitter_api_method list_members => (
1235                 description => <<'',
1236             Returns the members of the specified list. Private list members will only be
1237             shown if the authenticated user owns the specified list.
1238            
1239                 path => 'lists/members',
1240                 method => 'GET',
1241                 params => [qw/
1242             list_id slug owner_screen_name owner_id cursor
1243             include_entities skip_status
1244             /],
1245                 required => [],
1246                 booleans => [qw/include_entities skip_status/],
1247                 returns => 'Hashref',
1248             );
1249              
1250             twitter_api_method add_list_member => (
1251                 description => <<'',
1252             Add a member to a list. The authenticated user must own the list to be able to
1253             add members to it. Note that lists can't have more than 500 members.
1254            
1255                 path => 'lists/members/create',
1256                 method => 'POST',
1257                 params => [qw/list_id slug user_id screen_name owner_screen_name owner_id/],
1258                 required => [],
1259                 returns => 'User',
1260             );
1261              
1262             twitter_api_method delete_list => (
1263                 description => <<'',
1264             Deletes the specified list. The authenticated user must own the list to be able
1265             to destroy it.
1266            
1267                 path => 'lists/destroy',
1268                 method => 'POST',
1269                 params => [qw/owner_screen_name owner_id list_id slug/],
1270                 required => [],
1271                 returns => 'List',
1272             );
1273              
1274             twitter_api_method update_list => (
1275                 description => <<'',
1276             Updates the specified list. The authenticated user must own the list to be able
1277             to update it.
1278            
1279                 path => 'lists/update',
1280                 method => 'POST',
1281                 params => [qw/list_id slug name mode description owner_screen_name owner_id/],
1282                 required => [],
1283                 returns => 'List',
1284             );
1285              
1286             twitter_api_method create_list => (
1287                 description => <<'',
1288             Creates a new list for the authenticated user. Note that you can't create more
1289             than 20 lists per account.
1290            
1291                 path => 'lists/create',
1292                 method => 'POST',
1293                 params => [qw/list_id slug name mode description owner_screen_name owner_id/],
1294                 required => [qw/name/],
1295                 returns => 'List',
1296             );
1297              
1298             twitter_api_method get_list => (
1299                 description => <<'',
1300             Returns the specified list. Private lists will only be shown if the
1301             authenticated user owns the specified list.
1302            
1303                 aliases => [qw/show_list/],
1304                 path => 'lists/show',
1305                 method => 'GET',
1306                 params => [qw/list_id slug owner_screen_name owner_id/],
1307                 required => [],
1308                 returns => 'List',
1309             );
1310              
1311             twitter_api_method list_subscriptions => (
1312                 description => <<'',
1313             Obtain a collection of the lists the specified user is subscribed to, 20 lists
1314             per page by default. Does not include the user's own lists.
1315            
1316                 path => 'lists/subscriptions',
1317                 method => 'GET',
1318                 params => [qw/user_id screen_name count cursor/],
1319                 required => [],
1320                 returns => 'ArrayRef[List]',
1321                 aliases => [qw/subscriptions/],
1322             );
1323              
1324             twitter_api_method members_destroy_all => (
1325                 description => <<'EOT',
1326             Removes multiple members from a list, by specifying a reference to an array of
1327             member ids or screen names, or a string of comma separated user ids or screen
1328             names. The authenticated user must own the list to be able to remove members
1329             from it. Note that lists can't have more than 500 members, and you are limited
1330             to removing up to 100 members to a list at a time with this method.
1331            
1332             Please note that there can be issues with lists that rapidly remove and add
1333             memberships. Take care when using these methods such that you are not too
1334             rapidly switching between removals and adds on the same list.
1335            
1336             EOT
1337              
1338                 path => 'lists/members/destroy_all',
1339                 aliases => [qw/remove_list_members/],
1340                 method => 'POST',
1341                 params => [qw/list_id slug user_id screen_name owner_screen_name owner_id/],
1342                 required => [],
1343                 returns => 'List',
1344             );
1345              
1346             twitter_api_method list_ownerships => (
1347                 description => <<'',
1348             Obtain a collection of the lists owned by the specified Twitter user. Private
1349             lists will only be shown if the authenticated user is also the owner of the lists.
1350            
1351                 path => 'lists/ownerships',
1352                 method => 'GET',
1353                 params => [qw/user_id screen_name count cursor/],
1354                 required => [],
1355                 returns => 'ArrayRef[List]',
1356                 aliases => [],
1357             );
1358              
1359             ## saved searches ##
1360              
1361             twitter_api_method saved_searches => (
1362                 description => <<'',
1363             Returns the authenticated user's saved search queries.
1364            
1365                 path => 'saved_searches/list',
1366                 method => 'GET',
1367                 params => [],
1368                 required => [],
1369                 returns => 'ArrayRef[SavedSearch]',
1370             );
1371              
1372             twitter_api_method show_saved_search => (
1373                 description => <<'',
1374             Retrieve the data for a saved search, by C<id>, owned by the authenticating user.
1375            
1376                 path => 'saved_searches/show/:id',
1377                 method => 'GET',
1378                 params => [qw/id/],
1379                 required => [qw/id/],
1380                 returns => 'SavedSearch',
1381             );
1382              
1383             twitter_api_method create_saved_search => (
1384                 description => <<'',
1385             Creates a saved search for the authenticated user.
1386            
1387                 path => 'saved_searches/create',
1388                 method => 'POST',
1389                 params => [qw/query/],
1390                 required => [qw/query/],
1391                 returns => 'SavedSearch',
1392             );
1393              
1394             twitter_api_method destroy_saved_search => (
1395                 description => <<'',
1396             Destroys a saved search. The search, specified by C<id>, must be owned
1397             by the authenticating user.
1398            
1399                 aliases => [qw/delete_saved_search/],
1400                 path => 'saved_searches/destroy/:id',
1401                 method => 'POST',
1402                 params => [qw/id/],
1403                 required => [qw/id/],
1404                 returns => 'SavedSearch',
1405             );
1406              
1407             ## geo ##
1408              
1409             twitter_api_method geo_id => (
1410                 description => <<'',
1411             Returns details of a place returned from the C<reverse_geocode> method.
1412            
1413                 path => 'geo/id/:place_id',
1414                 method => 'GET',
1415                 params => [qw/place_id/],
1416                 required => [qw/place_id/],
1417                 returns => 'HashRef',
1418             );
1419              
1420             # backwards compat for 'geo/id/:id'
1421             # recast to 'geo/id/:place_id
1422             around geo_id => sub {
1423                 my ( $next, $self ) = splice @_, 0, 2;
1424              
1425                 my $args = ref $_[-1] eq 'HASH' ? pop @_ : {};
1426              
1427                 if ( exists $args->{id} ) {
1428                     $args->{place_id} = delete $args->{id};
1429                 }
1430              
1431                 return $self->$next(@_, $args);
1432             };
1433              
1434             twitter_api_method reverse_geocode => (
1435                 description => <<EOT,
1436             Search for places (cities and neighborhoods) that can be attached to a
1437             statuses/update. Given a latitude and a longitude, return a list of all the
1438             valid places that can be used as a place_id when updating a status.
1439             Conceptually, a query can be made from the user's location, retrieve a list of
1440             places, have the user validate the location he or she is at, and then send the
1441             ID of this location up with a call to statuses/update.
1442            
1443             There are multiple granularities of places that can be returned --
1444             "neighborhoods", "cities", etc. At this time, only United States data is
1445             available through this method.
1446            
1447             \=over 4
1448            
1449             \=item lat
1450            
1451             Required. The latitude to query about. Valid ranges are -90.0 to +90.0 (North
1452             is positive) inclusive.
1453            
1454             \=item long
1455            
1456             Required. The longitude to query about. Valid ranges are -180.0 to +180.0
1457             (East is positive) inclusive.
1458            
1459             \=item accuracy
1460            
1461             Optional. A hint on the "region" in which to search. If a number, then this is
1462             a radius in meters, but it can also take a string that is suffixed with ft to
1463             specify feet. If this is not passed in, then it is assumed to be 0m. If
1464             coming from a device, in practice, this value is whatever accuracy the device
1465             has measuring its location (whether it be coming from a GPS, WiFi
1466             triangulation, etc.).
1467            
1468             \=item granularity
1469            
1470             Optional. The minimal granularity of data to return. If this is not passed
1471             in, then C<neighborhood> is assumed. C<city> can also be passed.
1472            
1473             \=item max_results
1474            
1475             Optional. A hint as to the number of results to return. This does not
1476             guarantee that the number of results returned will equal max_results, but
1477             instead informs how many "nearby" results to return. Ideally, only pass in the
1478             number of places you intend to display to the user here.
1479            
1480             \=back
1481            
1482             EOT
1483              
1484                 path => 'geo/reverse_geocode',
1485                 method => 'GET',
1486                 params => [qw/lat long accuracy granularity max_results callback/],
1487                 required => [qw/lat long/],
1488                 returns => 'HashRef',
1489             );
1490              
1491             twitter_api_method geo_search => (
1492                 description => <<'EOT',
1493             Search for places that can be attached to a statuses/update. Given a latitude
1494             and a longitude pair, an IP address, or a name, this request will return a list
1495             of all the valid places that can be used as the place_id when updating a
1496             status.
1497            
1498             Conceptually, a query can be made from the user's location, retrieve a list of
1499             places, have the user validate the location he or she is at, and then send the
1500             ID of this location with a call to statuses/update.
1501            
1502             This is the recommended method to use find places that can be attached to
1503             statuses/update. Unlike geo/reverse_geocode which provides raw data access,
1504             this endpoint can potentially re-order places with regards to the user who
1505             is authenticated. This approach is also preferred for interactive place
1506             matching with the user.
1507             EOT
1508              
1509                 path => 'geo/search',
1510                 method => 'GET',
1511                 params => [qw/
1512             lat long query ip granularity accuracy max_results
1513             contained_within attribute:street_address callback
1514             /],
1515                 required => [],
1516                 returns => 'HashRef',
1517             );
1518              
1519             twitter_api_method similar_places => (
1520                 description => <<'EOT',
1521             Locates places near the given coordinates which are similar in name.
1522            
1523             Conceptually you would use this method to get a list of known places to choose
1524             from first. Then, if the desired place doesn't exist, make a request to
1525             C<add_place> to create a new one.
1526            
1527             The token contained in the response is the token needed to be able to create a
1528             new place.
1529             EOT
1530              
1531                 path => 'geo/similar_places',
1532                 method => 'GET',
1533                 params => [qw/lat long name contained_within attribute:street_address callback/],
1534                 required => [qw/lat long name/],
1535                 returns => 'HashRef',
1536             );
1537              
1538             twitter_api_method add_place => (
1539                 description => <<'EOT',
1540             Creates a new place object at the given latitude and longitude.
1541            
1542             Before creating a place you need to query C<similar_places> with the latitude,
1543             longitude and name of the place you wish to create. The query will return an
1544             array of places which are similar to the one you wish to create, and a token.
1545             If the place you wish to create isn't in the returned array you can use the
1546             token with this method to create a new one.
1547             EOT
1548              
1549                 path => 'geo/place',
1550                 method => 'POST',
1551                 params => [qw/name contained_within token lat long attribute:street_address callback/],
1552                 required => [qw/name contained_within token lat long/],
1553                 returns => 'Place',
1554             );
1555              
1556             ## trends ##
1557              
1558             twitter_api_method trends_place => (
1559                 description => <<'',
1560             Returns the top 10 trending topics for a specific WOEID. The response is an
1561             array of "trend" objects that encode the name of the trending topic, the query
1562             parameter that can be used to search for the topic on Search, and the direct
1563             URL that can be issued against Search. This information is cached for five
1564             minutes, and therefore users are discouraged from querying these endpoints
1565             faster than once every five minutes. Global trends information is also
1566             available from this API by using a WOEID of 1.
1567            
1568                 path => 'trends/place',
1569                 aliases => [qw/trends_location/],
1570                 method => 'GET',
1571                 params => [qw/id exclude/],
1572                 required => [qw/id/],
1573                 returns => 'ArrayRef[Trend]',
1574             );
1575              
1576             # accept woeid parameter for backwards compatibility with old trends/location endpoint
1577             around trends_location => sub {
1578                 my $orig = shift;
1579                 my $self = shift;
1580              
1581                 carp "trends_location DEPRECATED: using trends_place({ id => ... }) instead";
1582              
1583                 my $args = ref $_[-1] eq ref {} ? pop : {};
1584                 $$args{id} = delete $$args{woeid} || shift;
1585              
1586                 return $self->$orig($args);
1587             };
1588              
1589             twitter_api_method trends_available => (
1590                 description => <<EOT,
1591             Returns the locations with trending topic information. The response is an
1592             array of "locations" that encode the location's WOEID (a Yahoo! Where On Earth
1593             ID L<http://developer.yahoo.com/geo/geoplanet/>) and some other human-readable
1594             information such as a the location's canonical name and country.
1595            
1596             For backwards compatibility, this method accepts optional C<lat> and C<long>
1597             parameters. You should call C<trends_closest> directly, instead.
1598            
1599             Use the WOEID returned in the location object to query trends for a specific
1600             location.
1601             EOT
1602              
1603                 path => 'trends/available',
1604                 method => 'GET',
1605                 params => [],
1606                 required => [],
1607                 returns => 'ArrayRef[Location]',
1608             );
1609              
1610             around trends_available => sub {
1611                 my $orig = shift;
1612                 my $self = shift;
1613              
1614                 my $args = ref $_[-1] eq ref {} ? pop : {};
1615              
1616                 my $method = exists $$args{lat} || exists $$args{long} ? 'trends_closest' : $orig;
1617              
1618                 return $self->$method(@_, $args);
1619             };
1620              
1621             twitter_api_method trends_closest => (
1622                 description => <<EOT,
1623             Returns the locations with trending topic information. The response is an array
1624             of "locations" that encode the location's WOEID (a Yahoo! Where On Earth ID
1625             L<http://developer.yahoo.com/geo/geoplanet/>) and some other human-readable
1626             information such as a the location's canonical name and country. The results
1627             are sorted by distance from that location, nearest to farthest.
1628            
1629             Use the WOEID returned in the location object to query trends for a specific
1630             location.
1631             EOT
1632              
1633                 path => 'trends/closest',
1634                 method => 'GET',
1635                 params => [qw/lat long/],
1636                 required => [],
1637                 returns => 'ArrayRef[Location]',
1638             );
1639              
1640             ## spam reporting ##
1641              
1642             twitter_api_method report_spam => (
1643                 description => <<'',
1644             The user specified in the id is blocked by the authenticated user and reported as a spammer.
1645            
1646                 path => 'users/report_spam',
1647                 method => 'POST',
1648                 params => [qw/user_id screen_name/],
1649                 required => [qw/id/],
1650                 returns => 'User',
1651             );
1652              
1653             twitter_api_method get_languages => (
1654                 description => <<'',
1655             Returns the list of languages supported by Twitter along with their ISO 639-1
1656             code. The ISO 639-1 code is the two letter value to use if you include lang
1657             with any of your requests.
1658            
1659                 path => 'help/languages',
1660                 method => 'GET',
1661                 params => [],
1662                 required => [],
1663                 returns => 'ArrayRef[Lanugage]',
1664             );
1665              
1666             ## Help ##
1667              
1668             twitter_api_method get_configuration => (
1669                 description => <<'EOT',
1670             Returns the current configuration used by Twitter including twitter.com slugs
1671             which are not usernames, maximum photo resolutions, and t.co URL lengths.
1672            
1673             It is recommended applications request this endpoint when they are loaded, but
1674             no more than once a day.
1675             EOT
1676              
1677                 path => 'help/configuration',
1678                 method => 'GET',
1679                 params => [],
1680                 required => [],
1681                 returns => 'HashRef',
1682             );
1683              
1684             twitter_api_method get_privacy_policy => (
1685                 description => <<'',
1686             Returns Twitter's privacy policy.
1687            
1688                 path => 'help/privacy',
1689                 method => 'GET',
1690                 params => [],
1691                 required => [],
1692                 returns => 'HashRef',
1693             );
1694              
1695             twitter_api_method get_tos => (
1696                 description => <<'',
1697             Returns the Twitter Terms of Service. These are not the same as the Developer
1698             Rules of the Road.
1699            
1700                 path => 'help/tos',
1701                 method => 'GET',
1702                 params => [],
1703                 required => [],
1704                 returns => 'HashRef',
1705             );
1706              
1707             twitter_api_method rate_limit_status => (
1708                 description => <<'EOT',
1709             Returns the remaining number of API requests available to the
1710             authenticated user before the API limit is reached for the current hour.
1711            
1712             Use C<< ->rate_limit_status({ authenticate => 0 }) >> to force an
1713             unauthenticated call, which will return the status for the IP address rather
1714             than the authenticated user. (Note: for a web application, this is the server's
1715             IP address.)
1716             EOT
1717              
1718                 path => 'application/rate_limit_status',
1719                 method => 'GET',
1720                 params => [qw/resources/],
1721                 required => [qw//],
1722                 returns => 'RateLimitStatus',
1723             );
1724              
1725             # translate resources arrayref to a comma separated string
1726             around rate_limit_status => sub {
1727                 my $orig = shift;
1728                 my $self = shift;
1729              
1730                 my $args = ref $_[-1] eq ref {} ? pop : {};
1731                 croak "too many arguments" if @_;
1732              
1733                 if ( exists $args->{resources} && ref $args->{resources} eq ref [] ) {
1734                     $args->{resources} = join ',' => @{$args->{resources}};
1735                 }
1736              
1737                 return $self->$orig($args);
1738             };
1739              
1740             twitter_api_method test => (
1741                 description => <<'',
1742             Returns the string "ok" status code.
1743            
1744                 path => 'account/verify_credentials',
1745                 method => 'GET',
1746                 params => [qw//],
1747                 required => [qw//],
1748                 returns => 'Hash',
1749                 deprecated => sub { carp "$_[0] DEPRECATED: using verify_credentials instead" },
1750             );
1751              
1752             ## not included in API v1.1 ##
1753              
1754             twitter_api_method retweeted_by_me => (
1755                 description => <<'',
1756             Returns the 20 most recent retweets posted by the authenticating user.
1757            
1758                 path => 'statuses/retweeted_by_me',
1759                 method => 'GET',
1760                 params => [qw/since_id max_id count page trim_user include_entities/],
1761                 booleans => [qw/trim_user include_entities/],
1762                 required => [],
1763                 returns => 'ArrayRef[Status]',
1764                 deprecated => sub { croak "$_[0] not available in Twitter API V1.1" },
1765             );
1766              
1767             twitter_api_method retweeted_to_me => (
1768                 description => <<'',
1769             Returns the 20 most recent retweets posted by the authenticating user's friends.
1770            
1771                 path => 'statuses/retweeted_to_me',
1772                 method => 'GET',
1773                 params => [qw/since_id max_id count page/],
1774                 required => [],
1775                 returns => 'ArrayRef[Status]',
1776                 deprecated => sub { croak "$_[0] not available in Twitter API V1.1" },
1777             );
1778              
1779             twitter_api_method retweets_of_me => (
1780                 description => <<'',
1781             Returns the 20 most recent tweets of the authenticated user that have been
1782             retweeted by others.
1783            
1784                 aliases => [qw/retweeted_of_me/],
1785                 path => 'statuses/retweets_of_me',
1786                 method => 'GET',
1787                 params => [qw/since_id max_id count trim_user include_entities include_user_entities/],
1788                 booleans => [qw/trim_user include_entities/],
1789                 required => [],
1790                 returns => 'ArrayRef[Status]',
1791             );
1792              
1793             twitter_api_method no_retweet_ids => (
1794                 description => <<'',
1795             Returns an ARRAY ref of user IDs for which the authenticating user does not
1796             want to receive retweets.
1797            
1798                 aliases => [qw/no_retweets_ids/],
1799                 path => 'friendships/no_retweets/ids',
1800                 method => 'GET',
1801                 params => [],
1802                 required => [],
1803                 returns => 'ArrayRef[UserIDs]',
1804             );
1805              
1806             twitter_api_method end_session => (
1807                 description => <<'',
1808             Ends the session of the authenticating user, returning a null cookie.
1809             Use this method to sign users out of client-facing applications like
1810             widgets.
1811            
1812                 path => 'account/end_session',
1813                 method => 'POST',
1814                 params => [qw//],
1815                 required => [qw//],
1816                 returns => 'Error', # HTTP Status: 200, error content. Silly!
1817                 deprecated => sub { croak "$_[0] not available in Twitter API V1.1" },
1818             );
1819              
1820             twitter_api_method enable_notifications => (
1821                 description => <<'',
1822             Enables notifications for updates from the specified user to the
1823             authenticating user. Returns the specified user when successful.
1824            
1825                 path => 'notifications/follow/:id',
1826                 method => 'POST',
1827                 params => [qw/id screen_name include_entities/],
1828                 booleans => [qw/include_entities/],
1829                 required => [qw/id/],
1830                 returns => 'BasicUser',
1831                 deprecated => sub { croak "$_[0] not available in Twitter API V1.1" },
1832             );
1833              
1834             around enable_notifications => sub {
1835                 my $orig = shift;
1836                 my $self = shift;
1837              
1838                 return $self->_enable_disable_notifications(1, @_);
1839             };
1840              
1841             sub _enable_disable_notifications {
1842 4     4   5     my $self = shift;
1843 4         7     my $enable = shift;
1844              
1845 4         14     carp "enable_notifications/disable_notifications DEPRECATED: using update_friendship instead";
1846              
1847 4 100       956     my $args = ref $_[-1] eq ref {} ? pop : {};
1848 4         6     $$args{device} = $enable;
1849 4         17     return $self->update_friendship(@_, $args);
1850             };
1851              
1852             twitter_api_method disable_notifications => (
1853                 description => <<'',
1854             Disables notifications for updates from the specified user to the
1855             authenticating user. Returns the specified user when successful.
1856            
1857                 path => 'notifications/leave/:id',
1858                 method => 'POST',
1859                 params => [qw/id screen_name include_entities/],
1860                 booleans => [qw/include_entities/],
1861                 required => [qw/id/],
1862                 returns => 'BasicUser',
1863                 deprecated => sub { croak "$_[0] not available in Twitter API V1.1" },
1864             );
1865              
1866             around disable_notifications => sub {
1867                 my $orig = shift;
1868                 my $self = shift;
1869              
1870                 return $self->_enable_disable_notifications(0, @_);
1871             };
1872              
1873             twitter_api_method block_exists => (
1874                 description => <<'',
1875             Returns if the authenticating user is blocking a target user. Will return the blocked user's
1876             object if a block exists, and error with HTTP 404 response code otherwise.
1877            
1878                 path => 'blocks/exists/:id',
1879                 method => 'GET',
1880                 params => [qw/id user_id screen_name include_entities/],
1881                 booleans => [qw/include_entities/],
1882                 required => [qw/id/],
1883                 returns => 'BasicUser',
1884                 deprecated => sub { croak "$_[0] not available in Twitter API V1.1" },
1885             );
1886              
1887             twitter_api_method trends_current => (
1888                 description => <<'',
1889             Returns the current top ten trending topics on Twitter. The response includes
1890             the time of the request, the name of each trending topic, and query used on
1891             Twitter Search results page for that topic.
1892            
1893                 path => 'trends/current',
1894                 method => 'GET',
1895                 params => [qw/exclude/],
1896                 required => [qw//],
1897                 returns => 'HashRef',
1898                 deprecated => sub { croak "$_[0] not available in Twitter API V1.1" },
1899             );
1900              
1901             around trends_current => sub {
1902                 my $orig = shift;
1903                 my $self = shift;
1904              
1905                 carp "trends_current DEPRECATED: using trends_place({ id => 1 }) instead";
1906              
1907                 my $args = ref $_[-1] eq ref {} ? pop : {};
1908                 $$args{id} = 1;
1909              
1910                 return $self->trends_place($args);
1911             };
1912              
1913             twitter_api_method trends_daily => (
1914                 description => <<'',
1915             Returns the top 20 trending topics for each hour in a given day.
1916            
1917                 path => 'trends/daily',
1918                 method => 'GET',
1919                 params => [qw/date exclude/],
1920                 required => [qw//],
1921                 returns => 'HashRef',
1922                 deprecated => sub { croak "$_[0] not available in Twitter API V1.1" },
1923             );
1924              
1925             twitter_api_method trends_weekly => (
1926                 description => <<'',
1927             Returns the top 30 trending topics for each day in a given week.
1928            
1929                 path => 'trends/weekly',
1930                 method => 'GET',
1931                 params => [qw/date exclude/],
1932                 required => [qw//],
1933                 returns => 'HashRef',
1934                 deprecated => sub { croak "$_[0] not available in Twitter API V1.1" },
1935             );
1936              
1937             twitter_api_method retweeted_by => (
1938                 description => <<'',
1939             Returns up to 100 users who retweeted the status identified by C<id>.
1940            
1941                 path => 'statuses/:id/retweeted_by',
1942                 method => 'GET',
1943                 params => [qw/id count page trim_user include_entities/],
1944                 booleans => [qw/include_entities trim_user/],
1945                 required => [qw/id/],
1946                 returns => 'ArrayRef[User]',
1947                 deprecated => sub { croak "$_[0] not available in Twitter API V1.1" },
1948             );
1949              
1950             twitter_api_method retweeted_by_ids => (
1951                 description => <<'',
1952             Returns the IDs of up to 100 users who retweeted the status identified by C<id>.
1953            
1954                 path => 'statuses/:id/retweeted_by/ids',
1955                 method => 'GET',
1956                 params => [qw/id count page trim_user include_entities/],
1957                 booleans => [qw/include_entities trim_user/],
1958                 required => [qw/id/],
1959                 returns => 'ArrayRef[User]',
1960                 deprecated => sub { croak "$_[0] not available in Twitter API V1.1" },
1961             );
1962              
1963             # new in 3.17001 2010-10-19
1964              
1965             twitter_api_method account_totals => (
1966                 description => <<'',
1967             Returns the current count of friends, followers, updates (statuses)
1968             and favorites of the authenticating user.
1969            
1970                 path => 'account/totals',
1971                 method => 'GET',
1972                 params => [],
1973                 required => [],
1974                 returns => 'HashRef',
1975                 deprecated => sub { croak "$_[0] not available in Twitter API V1.1" },
1976             );
1977              
1978             twitter_api_method retweeted_to_user => (
1979                 description => <<'',
1980             Returns the 20 most recent retweets posted by users the specified user
1981             follows. The user is specified using the user_id or screen_name
1982             parameters. This method is identical to C<retweeted_to_me>
1983             except you can choose the user to view.
1984             Does not require authentication, unless the user is protected.
1985            
1986                 path => 'statuses/retweeted_to_user',
1987                 method => 'GET',
1988                 params => [qw/id user_id screen_name/],
1989                 required => [qw/id/],
1990                 returns => 'ArrayRef',
1991                 deprecated => sub { croak "$_[0] not available in Twitter API V1.1" },
1992             );
1993              
1994             twitter_api_method retweeted_by_user => (
1995                 description => <<'',
1996             Returns the 20 most recent retweets posted by the specified user. The user is
1997             specified using the user_id or screen_name parameters. This method is identical
1998             to C<retweeted_by_me> except you can choose the user to view. Does not require
1999             authentication, unless the user is protected.
2000            
2001                 path => 'statuses/retweeted_by_user',
2002                 method => 'GET',
2003                 params => [qw/id user_id screen_name/],
2004                 required => [qw/id/],
2005                 returns => 'ArrayRef',
2006                 deprecated => sub { croak "$_[0] not available in Twitter API V1.1" },
2007             );
2008              
2009             twitter_api_method related_results => (
2010                 description => <<'',
2011             If available, returns an array of replies and mentions related to the specified
2012             status. There is no guarantee there will be any replies or mentions in the
2013             response. This method is only available to users who have access to
2014             #newtwitter. Requires authentication.
2015            
2016                 path => 'related_results/show/:id',
2017                 method => 'GET',
2018                 params => [qw/id/],
2019                 required => [qw/id/],
2020                 returns => 'ArrayRef[Status]',
2021                 deprecated => sub { croak "$_[0] not available in Twitter API V1.1" },
2022             );
2023              
2024             twitter_api_method remove_profile_banner => (
2025                 description => <<'',
2026             Removes the uploaded profile banner for the authenticating user.
2027            
2028                 path => 'account/remove_profile_banner',
2029                 method => 'POST',
2030                 params => [qw//],
2031                 required => [qw//],
2032                 returns => 'Nothing',
2033             );
2034              
2035             twitter_api_method update_profile_banner => (
2036                 description => <<'EOT',
2037             Uploads a profile banner on behalf of the authenticating user. The C<image>
2038             parameter is an arrayref with the following interpretation:
2039            
2040             [ $file ]
2041             [ $file, $filename ]
2042             [ $file, $filename, Content_Type => $mime_type ]
2043             [ undef, $filename, Content_Type => $mime_type, Content => $raw_image_data ]
2044            
2045             The first value of the array (C<$file>) is the name of a file to open. The
2046             second value (C<$filename>) is the name given to Twitter for the file. If
2047             C<$filename> is not provided, the basename portion of C<$file> is used. If
2048             C<$mime_type> is not provided, it will be provided automatically using
2049             L<LWP::MediaTypes::guess_media_type()>.
2050            
2051             C<$raw_image_data> can be provided, rather than opening a file, by passing
2052             C<undef> as the first array value.
2053             EOT
2054              
2055                 path => 'account/update_profile_banner',
2056                 method => 'POST',
2057                 params => [qw/banner width height offset_left offset_top/],
2058                 required => [qw/banner/],
2059                 returns => 'Nothing',
2060             );
2061              
2062             twitter_api_method profile_banner => (
2063                 description => <<'',
2064             Returns a hash reference mapping available size variations to URLs that can be
2065             used to retrieve each variation of the banner.
2066            
2067                 path => 'users/profile_banner',
2068                 method => 'GET',
2069                 params => [qw/user_id screen_name/],
2070                 required => [qw//],
2071                 returns => 'HashRef',
2072             );
2073              
2074             twitter_api_method mutes => (
2075                 description => <<'',
2076             Returns an array of numeric user ids the authenticating user has muted.
2077            
2078                 path => 'mutes/users/ids',
2079                 aliases => [qw/muting_ids muted_ids/],
2080                 method => 'GET',
2081                 params => [qw/cursor/],
2082                 required => [qw//],
2083                 booleans => [qw//],
2084                 returns => 'ArrayRef[Int]',
2085             );
2086              
2087             twitter_api_method muting => (
2088                 description => <<'',
2089             Returns an array of user objects that the authenticating user is muting.
2090            
2091                 path => 'mutes/users/list',
2092                 aliases => [qw/mutes_list/],
2093                 method => 'GET',
2094                 params => [qw/cursor include_entities skip_status/],
2095                 required => [qw//],
2096                 returns => 'ArrayRef[BasicUser]',
2097             );
2098              
2099             twitter_api_method create_mute => (
2100                 description => <<'',
2101             Mutes the user specified in the C<user_id> or C<screen_name> parameter as the
2102             authenticating user. Returns the muted user when successful. You can find
2103             out more about muting in the Twitter Support Knowledge Base.
2104            
2105                 path => 'mutes/users/create',
2106                 method => 'POST',
2107                 params => [qw/user_id screen_name/],
2108                 booleans => [qw//],
2109                 required => [qw/id/],
2110                 returns => 'BasicUser',
2111             );
2112              
2113             twitter_api_method destroy_mute => (
2114                 description => <<'',
2115             Un-mutes the user specified in the C<user_id> or C<screen_name> parameter as
2116             the authenticating user. Returns the un-muted user when successful.
2117            
2118                 path => 'mutes/users/destroy',
2119                 method => 'POST',
2120                 params => [qw/user_id screen_name/],
2121                 booleans => [qw//],
2122                 required => [qw/id/],
2123                 returns => 'BasicUser',
2124             );
2125              
2126             twitter_api_method lookup_statuses => (
2127                 description => <<'',
2128             Returns a hash reference of tweets from an arbitrary set of ids.
2129            
2130                 path => 'statuses/lookup',
2131                 method => 'GET',
2132                 params => [qw/id include_entities trim_user map/],
2133                 required => [qw/id/],
2134                 returns => 'HashRef',
2135             );
2136              
2137             twitter_api_method create_media_metadata => (
2138                 path => 'media/metadata/create',
2139                 method => 'POST',
2140                 params => [qw/media_id alt_text/],
2141                 required => [qw/media_id/],
2142                 returns => 'HashRef',
2143                 description => 'add metadata to media',
2144                 content_type => 'application/json'
2145             );
2146              
2147             # infer screen_name or user_id from positional args for backwards compatibility
2148             # and convenience
2149             around [qw/
2150             show_user
2151             create_friend
2152             follow_new
2153             destroy_friend
2154             unfollow
2155             friends_ids
2156             following_ids
2157             followers_ids
2158             create_block
2159             destroy_block
2160             block_exists
2161             report_spam
2162             retweeted_by_user
2163             update_friendship
2164             /] => sub {
2165                 my $orig = shift;
2166                 my $self = shift;
2167              
2168                 my $args = ref $_[-1] eq ref {} ? pop : {};
2169                 if ( @_ && !exists $$args{user_id} && !exists $$args{screen_name} ) {
2170                     my $id = shift;
2171                     $$args{$id =~ /^\d+\$/ ? 'user_id' : 'screen_name' } = $id;
2172                 }
2173              
2174                 return $self->$orig(@_, $args);
2175             };
2176              
2177             1;
2178              
2179             __END__
2180            
2181            
2182             =head1 NAME
2183            
2184             Net::Twitter::Role::API::RESTv1_1 - A definition of the Twitter REST API v1.1 as a Moose role
2185            
2186             =head1 VERSION
2187            
2188             version 4.01042
2189            
2190             =head1 SYNOPSIS
2191            
2192             package My::Twitter;
2193             use Moose;
2194             with 'Net::Twitter::API::RESTv1_1';
2195            
2196             =head1 DESCRIPTION
2197            
2198             B<Net::Twitter::Role::API::RESTv1_1> provides definitions for all the Twitter REST API
2199             v1.1 methods. Applying this role to any class provides methods for all of the
2200             Twitter REST API methods.
2201            
2202            
2203             =head1 AUTHOR
2204            
2205             Marc Mims <marc@questright.com>
2206            
2207             =head1 LICENSE
2208            
2209             Copyright (c) 2016 Marc Mims
2210            
2211             The Twitter API itself, and the description text used in this module is:
2212            
2213             Copyright (c) 2009 Twitter
2214            
2215             This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
2216            
2217             =head1 DISCLAIMER OF WARRANTY
2218            
2219             BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
2220             FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
2221             OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
2222             PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
2223             EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
2224             WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
2225             ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
2226             YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
2227             NECESSARY SERVICING, REPAIR, OR CORRECTION.
2228            
2229             IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
2230             WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
2231             REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENSE, BE
2232             LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL,
2233             OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
2234             THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
2235             RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
2236             FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
2237             SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
2238             SUCH DAMAGES.
2239