GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Twitter::API::Trait::ApiMethods(3) User Contributed Perl Documentation Twitter::API::Trait::ApiMethods(3)

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

version 1.0006

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 <https://developer.twitter.com/en/docs/api-reference-index> 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_timeline', {});

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.

<https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/get-account-settings>

Aliases: blocks_list

<https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/get-blocks-list>

Aliases: blocks_ids

<https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/get-blocks-ids>

<https://developer.twitter.com/en/docs/tweets/curate-a-collection/api-reference/get-collections-entries>

<https://developer.twitter.com/en/docs/tweets/curate-a-collection/api-reference/get-collections-list>

<https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-favorites-list>

Aliases: followers_list

<https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-followers-list>

<https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-followers-ids>

Aliases: friends_list

<https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friends-list>

Aliases: following_ids

<https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friends-ids>

Aliases: incoming_friendships

<https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friendships-incoming>

Aliases: outgoing_friendships

<https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friendships-outgoing>

<https://developer.twitter.com/en/docs/geo/place-information/api-reference/get-geo-id-place_id>

<https://developer.twitter.com/en/docs/geo/places-near-location/api-reference/get-geo-search>

<https://developer.twitter.com/en/docs/developer-utilities/configuration/api-reference/get-help-configuration>

<https://developer.twitter.com/en/docs/developer-utilities/supported-languages/api-reference/get-help-languages>

Aliases: show_list

<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-show>

Aliases: list_lists, all_subscriptions

<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-list>

<https://developer.twitter.com/en/docs/developer-utilities/privacy-policy/api-reference/get-help-privacy>

<https://developer.twitter.com/en/docs/developer-utilities/terms-of-service/api-reference/get-help-tos>

<https://developer.twitter.com/en/docs/tweets/timelines/api-reference/get-statuses-home_timeline>

<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-members>

<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-memberships>

<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-ownerships>

<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-statuses>

<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-subscribers>

Aliases: subscriptions

<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-subscriptions>

<https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friendships-lookup>

<https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-statuses-lookup>

<https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-lookup>

Aliases: replies, mentions_timeline

<https://developer.twitter.com/en/docs/tweets/timelines/api-reference/get-statuses-mentions_timeline>

Aliases: muting_ids, muted_ids

<https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/get-mutes-users-ids>

Aliases: mutes_list

<https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/get-mutes-users-list>

Aliases: no_retweets_ids

<https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friendships-no_retweets-ids>

<https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-statuses-oembed>

<https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/get-users-profile_banner>

<https://developer.twitter.com/en/docs/developer-utilities/rate-limit-status/api-reference/get-application-rate_limit_status>

<https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-statuses-retweeters-ids>

<https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-statuses-retweets-id>

Aliases: retweeted_of_me

<https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-statuses-retweets_of_me>

<https://developer.twitter.com/en/docs/geo/places-near-location/api-reference/get-geo-reverse_geocode>

<https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/get-saved_searches-list>

<https://developer.twitter.com/en/docs/tweets/search/api-reference/get-search-tweets>

Aliases: direct_messages_sent

<https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/get-sent-message>

Aliases: show_relationship

<https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friendships-show>

Aliases: is_list_member

<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-members-show>

Aliases: is_list_subscriber, is_subscriber_lists

<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/get-lists-subscribers-show>

<https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/get-saved_searches-show-id>

<https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-statuses-show-id>

<https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-show>

<https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-suggestions>
<https://developer.twitter.com/en/docs/trends/locations-with-trending-topics/api-reference/get-trends-available>
<https://developer.twitter.com/en/docs/trends/locations-with-trending-topics/api-reference/get-trends-closest>
<https://developer.twitter.com/en/docs/trends/trends-for-location/api-reference/get-trends-place>

<https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-suggestions-slug-members>

Aliases: follow_suggestions

<https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-suggestions-slug>

<https://developer.twitter.com/en/docs/tweets/timelines/api-reference/get-statuses-user_timeline>

Aliases: find_people, search_users

<https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-search>

<https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/get-account-verify_credentials>

<https://developer.twitter.com/en/docs/tweets/curate-a-collection/api-reference/post-collections-entries-add>

<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-members-create>

<https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/post-blocks-create>

<https://developer.twitter.com/en/docs/tweets/curate-a-collection/api-reference/post-collections-create>

<https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-favorites-create>

Aliases: follow, follow_new, create_friendship

<https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/post-friendships-create>

<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-create>

<https://developer.twitter.com/en/docs/media/upload-media/api-reference/post-media-metadata-create>

<https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/post-mutes-users-create>

Alias: mute

<https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-saved_searches-create>

<https://developer.twitter.com/en/docs/tweets/curate-a-collection/api-reference/post-collections-entries-curate>

<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-destroy>

<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-members-destroy>

<https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/post-blocks-destroy>

<https://developer.twitter.com/en/docs/tweets/curate-a-collection/api-reference/post-collections-destroy>

<https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-favorites-destroy>

Aliases: unfollow, destroy_friendship

<https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/post-friendships-destroy>

<https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/post-mutes-users-destroy>

Alias: unmute

Aliases: delete_saved_search

<https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-saved_searches-destroy-id>

<https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-statuses-destroy-id>

Aliases: add_list_members

<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-members-create_all>

Aliases: remove_list_members

<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-members-destroy_all>

<https://developer.twitter.com/en/docs/tweets/curate-a-collection/api-reference/post-collections-entries-move>

<https://developer.twitter.com/en/docs/tweets/curate-a-collection/api-reference/post-collections-entries-remove>

<https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-account-remove_profile_banner>

<https://developer.twitter.com/en/docs/accounts-and-users/mute-block-report-users/api-reference/post-users-report_spam>

<https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-statuses-retweet-id>

<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-subscribers-create>

<https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-statuses-unretweet-id>

<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-subscribers-destroy>

<https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-statuses-update>

<https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-account-settings>

<https://developer.twitter.com/en/docs/tweets/curate-a-collection/api-reference/post-collections-update>

<https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/post-friendships-update>

<https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference/post-lists-update>

<https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-account-update_profile>

<https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-account-update_profile_background_image>

<https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-account-update_profile_banner>

<https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-account-update_profile_image>

Aliases: upload

<https://developer.twitter.com/en/docs/media/upload-media/api-reference/post-media-upload>

<https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/list-events.html>

<https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/get-event>

<https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/delete-message-event>

For simple usage, pass text and recipient ID:

    $client->new_dirrect_messages_event($text, $recipient_id)

For more complex messages, pass a full event structure, for example:

    $client->new_direct_massages_event({
        type => 'message_create',
        message_create => {
            target => { recipient_id => $user_id },
            message_data => {
                text => $text,
                attachment => {
                    type  => 'media',
                    media => { id => $media->{id} },
                },
            },
        },
    })

<https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/new-message>

Calling this method has the same effect as a user revoking access to the application via Twitter settings. The access token/secret pair will no longer be valid.

This method can be called with client that has been initialized with "access_token" and "access_token_secret" attributes, by passing "-token" and "-token_secret" parameters, or by passing "access_token" and "access_token_secret" parameters.

    $client->invalidate_access_token;
    $client->invalidate_access_token({ -token => $token, -token_secret => $secret });
    $client->invalidate_access_token({
        access_token        => $token,
        access_token_secret => $secret,
    });

Twitter added this method to the API on 2018-09-20.

See <https://developer.twitter.com/en/docs/basics/authentication/api-reference/invalidate_access_token>

Marc Mims <marc@questright.com>

This software is copyright (c) 2015-2021 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.

2021-04-01 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.