Twitter::API::Trait::ApiMethods - Convenient API Methods
version 0.0104
This trait provides convenient methods for calling API endpoints. They are Net::Twitter compatible, with the same names and calling conventions.
Refer to Twitter's API documentation for details about each method's parameters.
These methods are simply shorthand forms of get and post. All methods can be called with a parameters hashref. It can be omitted for endpoints that do not require any parameters, such as mentions. For example, all of these calls are equivalent:
get
post
mentions
$client->mentions; $client->mentions({}); $client->get('statuses/mentions_timeline'); $client->get('statuses/mentions_timelien', {});
Use the parameters hashref to pass optional parameters. For example,
$client->mentions({ count => 200, trim_user=>'true' });
Some methods, with required parameters, can take positional parameters. For example, geo_id requires a place_id parameter. These calls are equivalent:
geo_id
place_id
$client->place_id($place); $client->place_id({ place_id => $place });
When positional parameters are allowed, they must be specified in the correct order, but they don't all need to be specified. Those not specified positionally can be added to the parameters hashref. For example, these calls are equivalent:
$client->add_collection_entry($id, $tweet_id); $client->add_collection_entry($id, { tweet_id => $tweet_id); $client->add_collection_entry({ id => $id, tweet_id => $tweet_id });
Many calls require a screen_name or user_id. Where noted, you may pass either ID as the first positional parameter. Twitter::API will inspect the value. If it contains only digits, it will be considered a user_id. Otherwise, it will be considered a screen_name. Best practice is to explicitly declare the ID type by passing it in the parameters hashref, because it is possible to for users to set their screen names to a string of digits, making the inferred ID ambiguous. These calls are equivalent:
screen_name
user_id
$client->create_block('realDonaldTrump'); $client->create_block({ screen_name => 'realDonaldTrump' });
Since all of these methods simple resolve to a get or post call, see the Twitter::API for details about return values and error handling.
https://dev.twitter.com/rest/reference/get/account/settings
Aliases: blocks_list
https://dev.twitter.com/rest/reference/get/blocks/list
Aliases: blocks_ids
https://dev.twitter.com/rest/reference/get/blocks/ids
https://dev.twitter.com/rest/reference/get/collections/entries
https://dev.twitter.com/rest/reference/get/collections/list
https://dev.twitter.com/rest/reference/get/direct_messages
https://dev.twitter.com/rest/reference/get/favorites/list
Aliases: followers_list
https://dev.twitter.com/rest/reference/get/followers/list
https://dev.twitter.com/rest/reference/get/followers/ids
Aliases: friends_list
https://dev.twitter.com/rest/reference/get/friends/list
Aliases: following_ids
https://dev.twitter.com/rest/reference/get/friends/ids
Aliases: incoming_friendships
https://dev.twitter.com/rest/reference/get/friendships/incoming
Aliases: outgoing_friendships
https://dev.twitter.com/rest/reference/get/friendships/outgoing
https://dev.twitter.com/rest/reference/get/geo/id/:place_id
https://dev.twitter.com/rest/reference/get/geo/search
https://dev.twitter.com/rest/reference/get/help/configuration
https://dev.twitter.com/rest/reference/get/help/languages
Aliases: show_list
https://dev.twitter.com/rest/reference/get/lists/show
Aliases: list_lists, all_subscriptions
https://dev.twitter.com/rest/reference/get/lists/list
https://dev.twitter.com/rest/reference/get/help/privacy
https://dev.twitter.com/rest/reference/get/help/tos
https://dev.twitter.com/rest/reference/get/statuses/home_timeline
https://dev.twitter.com/rest/reference/get/lists/members
https://dev.twitter.com/rest/reference/get/lists/memberships
https://dev.twitter.com/rest/reference/get/lists/ownerships
https://dev.twitter.com/rest/reference/get/lists/statuses
https://dev.twitter.com/rest/reference/get/lists/subscribers
Aliases: subscriptions
https://dev.twitter.com/rest/reference/get/lists/subscriptions
https://dev.twitter.com/rest/reference/get/friendships/lookup
https://dev.twitter.com/rest/reference/get/statuses/lookup
https://dev.twitter.com/rest/reference/get/users/lookup
Aliases: replies, mentions_timeline
https://dev.twitter.com/rest/reference/get/statuses/mentions_timeline
Aliases: muting_ids, muted_ids
https://dev.twitter.com/rest/reference/get/mutes/users/ids
Aliases: mutes_list
https://dev.twitter.com/rest/reference/get/mutes/users/list
Aliases: no_retweets_ids
https://dev.twitter.com/rest/reference/get/friendships/no_retweets/ids
https://dev.twitter.com/rest/reference/get/statuses/oembed
https://dev.twitter.com/rest/reference/get/users/profile_banner
https://dev.twitter.com/rest/reference/get/application/rate_limit_status
https://dev.twitter.com/rest/reference/get/statuses/retweeters/ids
https://dev.twitter.com/rest/reference/get/statuses/retweets/:id
Aliases: retweeted_of_me
https://dev.twitter.com/rest/reference/get/statuses/retweets_of_me
https://dev.twitter.com/rest/reference/get/geo/reverse_geocode
https://dev.twitter.com/rest/reference/get/saved_searches/list
https://dev.twitter.com/rest/reference/get/search/tweets
Aliases: direct_messages_sent
https://dev.twitter.com/rest/reference/get/direct_messages/sent
https://dev.twitter.com/rest/reference/get/direct_messages/show
Aliases: show_relationship
https://dev.twitter.com/rest/reference/get/friendships/show
Aliases: is_list_member
https://dev.twitter.com/rest/reference/get/lists/members/show
Aliases: is_list_subscriber, is_subscriber_lists
https://dev.twitter.com/rest/reference/get/lists/subscribers/show
https://dev.twitter.com/rest/reference/get/saved_searches/show/:id
https://dev.twitter.com/rest/reference/get/statuses/show/:id
https://dev.twitter.com/rest/reference/get/users/show
https://dev.twitter.com/rest/reference/get/users/suggestions
https://dev.twitter.com/rest/reference/get/trends/available
https://dev.twitter.com/rest/reference/get/trends/closest
https://dev.twitter.com/rest/reference/get/trends/place
https://dev.twitter.com/rest/reference/get/users/suggestions/:slug/members
Aliases: follow_suggestions
https://dev.twitter.com/rest/reference/get/users/suggestions/:slug
https://dev.twitter.com/rest/reference/get/statuses/user_timeline
Aliases: find_people, search_users
https://dev.twitter.com/rest/reference/get/users/search
https://dev.twitter.com/rest/reference/get/account/verify_credentials
https://dev.twitter.com/rest/reference/post/collections/entries/add
https://dev.twitter.com/rest/reference/post/lists/members/create
https://dev.twitter.com/rest/reference/post/blocks/create
https://dev.twitter.com/rest/reference/post/collections/create
https://dev.twitter.com/rest/reference/post/favorites/create
Aliases: follow, follow_new, create_friendship
https://dev.twitter.com/rest/reference/post/friendships/create
https://dev.twitter.com/rest/reference/post/lists/create
https://dev.twitter.com/rest/reference/post/media/metadata/create
https://dev.twitter.com/rest/reference/post/mutes/users/create
https://dev.twitter.com/rest/reference/post/saved_searches/create
https://dev.twitter.com/rest/reference/post/collections/entries/curate
https://dev.twitter.com/rest/reference/post/lists/destroy
https://dev.twitter.com/rest/reference/post/lists/members/destroy
https://dev.twitter.com/rest/reference/post/blocks/destroy
https://dev.twitter.com/rest/reference/post/collections/destroy
https://dev.twitter.com/rest/reference/post/direct_messages/destroy
https://dev.twitter.com/rest/reference/post/favorites/destroy
Aliases: unfollow, destroy_friendship
https://dev.twitter.com/rest/reference/post/friendships/destroy
https://dev.twitter.com/rest/reference/post/mutes/users/destroy
Aliases: delete_saved_search
https://dev.twitter.com/rest/reference/post/saved_searches/destroy/:id
https://dev.twitter.com/rest/reference/post/statuses/destroy/:id
Aliases: add_list_members
https://dev.twitter.com/rest/reference/post/lists/members/create_all
Aliases: remove_list_members
https://dev.twitter.com/rest/reference/post/lists/members/destroy_all
https://dev.twitter.com/rest/reference/post/collections/entries/move
https://dev.twitter.com/rest/reference/post/direct_messages/new
https://dev.twitter.com/rest/reference/post/collections/entries/remove
https://dev.twitter.com/rest/reference/post/account/remove_profile_banner
https://dev.twitter.com/rest/reference/post/users/report_spam
https://dev.twitter.com/rest/reference/post/statuses/retweet/:id
https://dev.twitter.com/rest/reference/post/lists/subscribers/create
https://dev.twitter.com/rest/reference/post/statuses/unretweet/:id
https://dev.twitter.com/rest/reference/post/lists/subscribers/destroy
https://dev.twitter.com/rest/reference/post/statuses/update
https://dev.twitter.com/rest/reference/post/account/settings
https://dev.twitter.com/rest/reference/post/collections/update
https://dev.twitter.com/rest/reference/post/friendships/update
https://dev.twitter.com/rest/reference/post/lists/update
https://dev.twitter.com/rest/reference/post/account/update_profile
https://dev.twitter.com/rest/reference/post/account/update_profile_background_image
https://dev.twitter.com/rest/reference/post/account/update_profile_banner
https://dev.twitter.com/rest/reference/post/account/update_profile_image
Aliases: upload
https://dev.twitter.com/rest/reference/post/media/upload
Marc Mims <marc@questright.com>
This software is copyright (c) 2015-2016 by Marc Mims.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Twitter::API, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Twitter::API
CPAN shell
perl -MCPAN -e shell install Twitter::API
For more information on module installation, please visit the detailed CPAN module installation guide.