NAME

Twitter::API::Trait::ApiMethods - Convenient API Methods

VERSION

version 0.0107

DESCRIPTION

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:

$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:

$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:

$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.

METHODS

account_settings([ \%args ])

https://dev.twitter.com/rest/reference/get/account/settings

blocking([ \%args ])

Aliases: blocks_list

https://dev.twitter.com/rest/reference/get/blocks/list

blocking_ids([ \%args ])

Aliases: blocks_ids

https://dev.twitter.com/rest/reference/get/blocks/ids

collection_entries([ $id, ][ \%args ])

https://dev.twitter.com/rest/reference/get/collections/entries

collections([ $screen_name | $user_id, ][ \%args ])

https://dev.twitter.com/rest/reference/get/collections/list

direct_messages([ \%args ])

https://dev.twitter.com/rest/reference/get/direct_messages

favorites([ \%args ])

https://dev.twitter.com/rest/reference/get/favorites/list

followers([ \%args ])

Aliases: followers_list

https://dev.twitter.com/rest/reference/get/followers/list

followers_ids([ $screen_name | $user_id, ][ \%args ])

https://dev.twitter.com/rest/reference/get/followers/ids

friends([ \%args ])

Aliases: friends_list

https://dev.twitter.com/rest/reference/get/friends/list

friends_ids([ \%args ])

Aliases: following_ids

https://dev.twitter.com/rest/reference/get/friends/ids

friendships_incoming([ \%args ])

Aliases: incoming_friendships

https://dev.twitter.com/rest/reference/get/friendships/incoming

friendships_outgoing([ \%args ])

Aliases: outgoing_friendships

https://dev.twitter.com/rest/reference/get/friendships/outgoing

geo_id([ $place_id, ][ \%args ])

https://dev.twitter.com/rest/reference/get/geo/id/:place_id

geo_search([ \%args ])

https://dev.twitter.com/rest/reference/get/geo/search

get_configuration([ \%args ])

https://dev.twitter.com/rest/reference/get/help/configuration

get_languages([ \%args ])

https://dev.twitter.com/rest/reference/get/help/languages

get_list([ \%args ])

Aliases: show_list

https://dev.twitter.com/rest/reference/get/lists/show

get_lists([ \%args ])

Aliases: list_lists, all_subscriptions

https://dev.twitter.com/rest/reference/get/lists/list

get_privacy_policy([ \%args ])

https://dev.twitter.com/rest/reference/get/help/privacy

get_tos([ \%args ])

https://dev.twitter.com/rest/reference/get/help/tos

home_timeline([ \%args ])

https://dev.twitter.com/rest/reference/get/statuses/home_timeline

list_members([ \%args ])

https://dev.twitter.com/rest/reference/get/lists/members

list_memberships([ \%args ])

https://dev.twitter.com/rest/reference/get/lists/memberships

list_ownerships([ \%args ])

https://dev.twitter.com/rest/reference/get/lists/ownerships

list_statuses([ \%args ])

https://dev.twitter.com/rest/reference/get/lists/statuses

list_subscribers([ \%args ])

https://dev.twitter.com/rest/reference/get/lists/subscribers

list_subscriptions([ \%args ])

Aliases: subscriptions

https://dev.twitter.com/rest/reference/get/lists/subscriptions

lookup_friendships([ \%args ])

https://dev.twitter.com/rest/reference/get/friendships/lookup

lookup_statuses([ $id, ][ \%args ])

https://dev.twitter.com/rest/reference/get/statuses/lookup

lookup_users([ \%args ])

https://dev.twitter.com/rest/reference/get/users/lookup

mentions([ \%args ])

Aliases: replies, mentions_timeline

https://dev.twitter.com/rest/reference/get/statuses/mentions_timeline

mutes([ \%args ])

Aliases: muting_ids, muted_ids

https://dev.twitter.com/rest/reference/get/mutes/users/ids

muting([ \%args ])

Aliases: mutes_list

https://dev.twitter.com/rest/reference/get/mutes/users/list

no_retweet_ids([ \%args ])

Aliases: no_retweets_ids

https://dev.twitter.com/rest/reference/get/friendships/no_retweets/ids

oembed([ \%args ])

https://dev.twitter.com/rest/reference/get/statuses/oembed

profile_banner([ \%args ])

https://dev.twitter.com/rest/reference/get/users/profile_banner

rate_limit_status([ \%args ])

https://dev.twitter.com/rest/reference/get/application/rate_limit_status

retweeters_ids([ $id, ][ \%args ])

https://dev.twitter.com/rest/reference/get/statuses/retweeters/ids

retweets([ $id, ][ \%args ])

https://dev.twitter.com/rest/reference/get/statuses/retweets/:id

retweets_of_me([ \%args ])

Aliases: retweeted_of_me

https://dev.twitter.com/rest/reference/get/statuses/retweets_of_me

reverse_geocode([ $lat, [ $long, ]][ \%args ])

https://dev.twitter.com/rest/reference/get/geo/reverse_geocode

saved_searches([ \%args ])

https://dev.twitter.com/rest/reference/get/saved_searches/list

search([ $q, ][ \%args ])

https://dev.twitter.com/rest/reference/get/search/tweets

sent_direct_messages([ \%args ])

Aliases: direct_messages_sent

https://dev.twitter.com/rest/reference/get/direct_messages/sent

show_direct_message([ $id, ][ \%args ])

https://dev.twitter.com/rest/reference/get/direct_messages/show

show_friendship([ \%args ])

Aliases: show_relationship

https://dev.twitter.com/rest/reference/get/friendships/show

show_list_member([ \%args ])

Aliases: is_list_member

https://dev.twitter.com/rest/reference/get/lists/members/show

show_list_subscriber([ \%args ])

Aliases: is_list_subscriber, is_subscriber_lists

https://dev.twitter.com/rest/reference/get/lists/subscribers/show

show_saved_search([ $id, ][ \%args ])

https://dev.twitter.com/rest/reference/get/saved_searches/show/:id

show_status([ $id, ][ \%args ])

https://dev.twitter.com/rest/reference/get/statuses/show/:id

show_user([ $screen_name | $user_id, ][ \%args ])

https://dev.twitter.com/rest/reference/get/users/show

suggestion_categories([ \%args ])

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

user_suggestions([ $slug, ][ \%args ])

https://dev.twitter.com/rest/reference/get/users/suggestions/:slug/members

user_suggestions_for([ $slug, ][ \%args ])

Aliases: follow_suggestions

https://dev.twitter.com/rest/reference/get/users/suggestions/:slug

user_timeline([ $screen_name | $user_id, ][ \%args ])

https://dev.twitter.com/rest/reference/get/statuses/user_timeline

users_search([ $q, ][ \%args ])

Aliases: find_people, search_users

https://dev.twitter.com/rest/reference/get/users/search

verify_credentials([ \%args ])

https://dev.twitter.com/rest/reference/get/account/verify_credentials

add_collection_entry([ $id, [ $tweet_id, ]][ \%args ])

https://dev.twitter.com/rest/reference/post/collections/entries/add

add_list_member([ \%args ])

https://dev.twitter.com/rest/reference/post/lists/members/create

create_block([ $screen_name | $user_id, ][ \%args ])

https://dev.twitter.com/rest/reference/post/blocks/create

create_collection([ $name, ][ \%args ])

https://dev.twitter.com/rest/reference/post/collections/create

create_favorite([ $id, ][ \%args ])

https://dev.twitter.com/rest/reference/post/favorites/create

create_friend([ $screen_name | $user_id, ][ \%args ])

Aliases: follow, follow_new, create_friendship

https://dev.twitter.com/rest/reference/post/friendships/create

create_list([ $name, ][ \%args ])

https://dev.twitter.com/rest/reference/post/lists/create

create_media_metadata([ \%args ])

https://dev.twitter.com/rest/reference/post/media/metadata/create

create_mute([ $id, ][ \%args ])

https://dev.twitter.com/rest/reference/post/mutes/users/create

create_saved_search([ $query, ][ \%args ])

https://dev.twitter.com/rest/reference/post/saved_searches/create

curate_collection([ \%args ])

https://dev.twitter.com/rest/reference/post/collections/entries/curate

delete_list([ \%args ])

https://dev.twitter.com/rest/reference/post/lists/destroy

delete_list_member([ \%args ])

https://dev.twitter.com/rest/reference/post/lists/members/destroy

destroy_block([ $screen_name | $user_id, ][ \%args ])

https://dev.twitter.com/rest/reference/post/blocks/destroy

destroy_collection([ $id, ][ \%args ])

https://dev.twitter.com/rest/reference/post/collections/destroy

destroy_direct_message([ $id, ][ \%args ])

https://dev.twitter.com/rest/reference/post/direct_messages/destroy

destroy_favorite([ $id, ][ \%args ])

https://dev.twitter.com/rest/reference/post/favorites/destroy

destroy_friend([ $screen_name | $user_id, ][ \%args ])

Aliases: unfollow, destroy_friendship

https://dev.twitter.com/rest/reference/post/friendships/destroy

destroy_mute([ $id, ][ \%args ])

https://dev.twitter.com/rest/reference/post/mutes/users/destroy

destroy_saved_search([ $id, ][ \%args ])

Aliases: delete_saved_search

https://dev.twitter.com/rest/reference/post/saved_searches/destroy/:id

destroy_status([ $id, ][ \%args ])

https://dev.twitter.com/rest/reference/post/statuses/destroy/:id

members_create_all([ \%args ])

Aliases: add_list_members

https://dev.twitter.com/rest/reference/post/lists/members/create_all

members_destroy_all([ \%args ])

Aliases: remove_list_members

https://dev.twitter.com/rest/reference/post/lists/members/destroy_all

move_collection_entry([ $id, [ $tweet_id, [ $relative_to, ]]][ \%args ])

https://dev.twitter.com/rest/reference/post/collections/entries/move

new_direct_message([ $text, [ $screen_name | $user_id, ]][ \%args ])

https://dev.twitter.com/rest/reference/post/direct_messages/new

remove_collection_entry([ $id, [ $tweet_id, ]][ \%args ])

https://dev.twitter.com/rest/reference/post/collections/entries/remove

remove_profile_banner([ \%args ])

https://dev.twitter.com/rest/reference/post/account/remove_profile_banner

report_spam([ \%args ])

https://dev.twitter.com/rest/reference/post/users/report_spam

retweet([ $id, ][ \%args ])

https://dev.twitter.com/rest/reference/post/statuses/retweet/:id

subscribe_list([ \%args ])

https://dev.twitter.com/rest/reference/post/lists/subscribers/create

unretweet([ $id, ][ \%args ])

https://dev.twitter.com/rest/reference/post/statuses/unretweet/:id

unsubscribe_list([ \%args ])

https://dev.twitter.com/rest/reference/post/lists/subscribers/destroy

update([ $status, ][ \%args ])

https://dev.twitter.com/rest/reference/post/statuses/update

update_account_settings([ \%args ])

https://dev.twitter.com/rest/reference/post/account/settings

update_collection([ $id, ][ \%args ])

https://dev.twitter.com/rest/reference/post/collections/update

update_friendship([ \%args ])

https://dev.twitter.com/rest/reference/post/friendships/update

update_list([ \%args ])

https://dev.twitter.com/rest/reference/post/lists/update

update_profile([ \%args ])

https://dev.twitter.com/rest/reference/post/account/update_profile

update_profile_background_image([ \%args ])

https://dev.twitter.com/rest/reference/post/account/update_profile_background_image

update_profile_banner([ $banner, ][ \%args ])

https://dev.twitter.com/rest/reference/post/account/update_profile_banner

update_profile_image([ $image, ][ \%args ])

https://dev.twitter.com/rest/reference/post/account/update_profile_image

upload_media([ $media, ][ \%args ])

Aliases: upload

https://dev.twitter.com/rest/reference/post/media/upload

AUTHOR

Marc Mims <marc@questright.com>

COPYRIGHT AND LICENSE

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.