.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Net::Twitter::Lite 3pm" .TH Net::Twitter::Lite 3pm "2022-06-16" "perl v5.34.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Net::Twitter::Lite \- A perl interface to the Twitter API .SH "VERSION" .IX Header "VERSION" version 0.12008 .SH "STOP!" .IX Header "STOP!" You probably want Net::Twitter::Lite::WithAPIv1_1 which has support for Twitter \s-1API\s0 v1.1. If you're using a service with an \s-1API\s0 compatible with Twitter's deprecated \s-1API\s0 v1, then you're in the right place. .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Net::Twitter::Lite; \& \& my $nt = Net::Twitter::Lite\->new( \& username => $user, \& password => $password \& legacy_lists_api => 0, \& ); \& \& my $result = eval { $nt\->update(\*(AqHello, world!\*(Aq) }; \& \& eval { \& my $statuses = $nt\->friends_timeline({ since_id => $high_water, count => 100 }); \& for my $status ( @$statuses ) { \& print "$status\->{created_at} <$status\->{user}{screen_name}> $status\->{text}\en"; \& } \& }; \& warn "$@\en" if $@; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module provides a perl interface to the Twitter \s-1API\s0 v1. .PP It uses the same \s-1API\s0 definitions as Net::Twitter, but without the extra bells and whistles and without the additional dependencies. Same great taste, less filling. .PP This module is related to, but is not part of the \f(CW\*(C`Net::Twitter\*(C'\fR distribution. It's \s-1API\s0 methods and \s-1API\s0 method documentation are generated from \f(CW\*(C`Net::Twitter\*(C'\fR's internals. It exists for those who cannot, or prefer not to install Moose and its dependencies. .PP You should consider upgrading to \f(CW\*(C`Net::Twitter\*(C'\fR for additional functionality, finer grained control over features, backwards compatibility with older versions of \f(CW\*(C`Net::Twitter\*(C'\fR, and additional error handling options. .SH "CLIENT CODE CHANGES REQUIRED" .IX Header "CLIENT CODE CHANGES REQUIRED" .SS "Legacy Lists \s-1API\s0" .IX Subsection "Legacy Lists API" Twitter re-implemented the Lists \s-1API\s0 using new endpoints and semantics. For backwards compatibility, this version of \f(CW\*(C`Net::Twitter::Lite\*(C'\fR defaults to the deprecated, legacy endpoints and semantics. It issues a warning if the \f(CW\*(C`legacy_lists_api\*(C'\fR option to new is not provided. .PP To enable the new Lists endpoints and semantics, pass \f(CW\*(C`(legacy_lists_api =\*(C'\fR 0)> to \&\f(CW\*(C`new\*(C'\fR. To disable the warning, and keep the backwards compatible endpoints and semantics, pass \f(CW\*(C`(legacy_lists_api =\*(C'\fR 1)> to \f(CW\*(C`new\*(C'\fR. .PP The \f(CW\*(C`legacy_lists_api\*(C'\fR option to \f(CW\*(C`new\*(C'\fR sets the default for all lists \s-1API\s0 method calls. You can override the default an each \s-1API\s0 call by passing a \f(CW\*(C`\-legacy_lists_api\*(C'\fR option set to 1 or 0. .PP Support for \f(CW\*(C`legacy_lists_api\*(C'\fR option will be removed in a future version and the option to \f(CW\*(C`new\*(C'\fR will be silently ignored. .SS "netrc option" .IX Subsection "netrc option" The default \f(CW\*(C`apiurl\*(C'\fR changed in version 0.08006. The change should be transparent to client code, unless you're using the \f(CW\*(C`netrc\*(C'\fR option. If so, you'll need to either update the \f(CW\*(C`.netrc\*(C'\fR entry and change the \f(CW\*(C`machine\*(C'\fR value from \f(CW\*(C`twitter.com\*(C'\fR to \f(CW\*(C`api.twitter.com\*(C'\fR, or set either the \f(CW\*(C`netrc\*(C'\fR or \f(CW\*(C`netrc_machine\*(C'\fR options to \f(CW\*(C`twitter.com\*(C'\fR. .PP .Vb 3 \& $nt = Net::Twitter::Lite\->new(netrc_machine => \*(Aqtwitter.com\*(Aq, netrc => 1); \& # \-or\- \& $nt = Net::Twitter::Lite\->new(netrc => \*(Aqtwitter.com\*(Aq); .Ve .SS "OAuth requires callback parameter" .IX Subsection "OAuth requires callback parameter" Beginning with version 0.03, it is necessary for web applications using OAuth authentication to pass the \f(CW\*(C`callback\*(C'\fR parameter to \f(CW\*(C`get_authorization_url\*(C'\fR. In the absence of a callback parameter, when the user authorizes the application a \s-1PIN\s0 number is displayed rather than redirecting the user back to your site. .SH "MIGRATING FROM NET::TWITTER 2.x" .IX Header "MIGRATING FROM NET::TWITTER 2.x" If you are migrating from Net::Twitter 2.12 (or an earlier version), you may need to make some minor changes to your application code in order to user Net::Twitter::Lite successfully. .PP The primary difference is in error handling. Net::Twitter::Lite throws exceptions on error. It does not support the \f(CW\*(C`get_error\*(C'\fR, \f(CW\*(C`http_code\*(C'\fR, and \&\f(CW\*(C`http_message\*(C'\fR methods used in Net::Twitter 2.12 and prior versions. .PP Instead of .PP .Vb 5 \& # DON\*(AqT! \& my $friends = $nt\->friends(); \& if ( $friends ) { \& # process $friends \& } .Ve .PP wrap the \s-1API\s0 call in an eval block: .PP .Vb 5 \& # DO! \& my $friends = eval { $nt\->friends() }; \& if ( $friends ) { \& # process $friends \& } .Ve .PP Here's a much more complex example taken from application code using Net::Twitter 2.12: .PP .Vb 10 \& # DON\*(AqT! \& my $friends = $nt\->friends(); \& if ( $friends ) { \& # process $friends \& } \& else { \& my $error = $nt\->get_error; \& if ( ref $error ) { \& if ( ref($error) eq \*(AqHASH\*(Aq && exists $error\->{error} ) { \& $error = $error\->{error}; \& } \& else { \& $error = \*(AqUnexpected error type \*(Aq . ref($error); \& } \& } \& else { \& $error = $nt\->http_code() . ": " . $nt\->http_message; \& } \& warn "$error\en"; \& } .Ve .PP The Net::Twitter::Lite equivalent is: .PP .Vb 7 \& # DO! \& eval { \& my $friends = $nt\->friends(); \& # process $friends \& }; \& warn "$@\en" if $@; \& return; .Ve .PP In Net::Twitter::Lite, an error can always be treated as a string. See Net::Twitter::Lite::Error. The \s-1HTTP\s0 Status Code and \s-1HTTP\s0 Message are both available. Rather than accessing them via the Net::Twitter::Lite instance, you access them via the Net::Twitter::Lite::Error instance thrown as an error. .PP For example: .PP .Vb 12 \& # DO! \& eval { \& my $friends = $nt\->friends(); \& # process $friends \& }; \& if ( my $error = $@ ) { \& if ( blessed $error && $error\->isa("Net::Twitter::Lite::Error) \& && $error\->code() == 502 ) { \& $error = "Fail Whale!"; \& } \& warn "$error\en"; \& } .Ve .ie n .SS "Unsupported Net::Twitter 2.12 options to ""new""" .el .SS "Unsupported Net::Twitter 2.12 options to \f(CWnew\fP" .IX Subsection "Unsupported Net::Twitter 2.12 options to new" Net::Twitter::Lite does not support the following Net::Twitter 2.12 options to \&\f(CW\*(C`new\*(C'\fR. It silently ignores them: .IP "no_fallback" 4 .IX Item "no_fallback" If Net::Twitter::Lite is unable to create an instance of the class specified in the \f(CW\*(C`useragent_class\*(C'\fR option to \f(CW\*(C`new\*(C'\fR, it dies, rather than falling back to an LWP::UserAgent object. You really don't want a failure to create the \&\f(CW\*(C`useragent_class\*(C'\fR you specified to go unnoticed. .IP "twittervision" 4 .IX Item "twittervision" Net::Twitter::Lite does not support the TwitterVision \s-1API.\s0 Use Net::Twitter, instead, if you need it. .IP "skip_arg_validation" 4 .IX Item "skip_arg_validation" Net::Twitter::Lite does not \s-1API\s0 parameter validation. This is a feature. If Twitter adds a new option to an \s-1API\s0 method, you can use it immediately by passing it in the \s-1HASH\s0 ref to the \s-1API\s0 call. .Sp Net::Twitter::Lite relies on Twitter to validate its own parameters. An appropriate exception will be thrown if Twitter reports a parameter error. .IP "die_on_validation" 4 .IX Item "die_on_validation" See \*(L"skip_arg_validation\*(R". If Twitter returns an bad parameter error, an appropriate exception will be thrown. .IP "arrayref_on_error" 4 .IX Item "arrayref_on_error" This option allowed the following idiom in Net::Twitter 2.12: .Sp .Vb 4 \& # DON\*(AqT! \& for my $friend ( @{ $nt\->friends() } ) { \& # process $friend \& } .Ve .Sp The equivalent Net::Twitter::Lite code is: .Sp .Vb 6 \& # DO! \& eval { \& for my $friend ( @{ $nt\->friends() } ) { \& # process $friend \& } \& }; .Ve .SS "Unsupported Net::Twitter 2.12 methods" .IX Subsection "Unsupported Net::Twitter 2.12 methods" .IP "clone" 4 .IX Item "clone" The \f(CW\*(C`clone\*(C'\fR method was added to Net::Twitter 2.x to allow safe error handling in an environment where concurrent requests are handled, for example, when using LWP::UserAgent::POE as the \f(CW\*(C`useragent_class\*(C'\fR. Since Net::Twitter::Lite throws exceptions instead of stashing them in the Net::Twitter::Lite instance, it is safe in a current request environment, obviating the need for \f(CW\*(C`clone\*(C'\fR. .IP "get_error" 4 .IX Item "get_error" .PD 0 .IP "http_code" 4 .IX Item "http_code" .IP "http_message" 4 .IX Item "http_message" .PD These methods are replaced by Net::Twitter::Lite::Error. An instance of that class is thrown errors are encountered. .SH "METHODS AND ARGUMENTS" .IX Header "METHODS AND ARGUMENTS" .IP "new" 4 .IX Item "new" This constructs a \f(CW\*(C`Net::Twitter::Lite\*(C'\fR object. It takes several named parameters, all of them optional: .RS 4 .IP "username" 4 .IX Item "username" This is the screen name or email used to authenticate with Twitter. Use this option for Basic Authentication, only. .IP "password" 4 .IX Item "password" This is the password used to authenticate with Twitter. Use this option for Basic Authentication, only. .IP "consumer_key" 4 .IX Item "consumer_key" A string containing the OAuth consumer key provided by Twitter when an application is registered. Use this option for OAuth authentication, only. .IP "consumer_secret" 4 .IX Item "consumer_secret" A string containing the OAuth consumer secret. Use this option for OAuth authentication, only. the \f(CW\*(C`OAuth\*(C'\fR trait is included. .IP "oauth_urls" 4 .IX Item "oauth_urls" A \s-1HASH\s0 ref of URLs to be used with OAuth authentication. Defaults to: .Sp .Vb 6 \& { \& request_token_url => "http://twitter.com/oauth/request_token", \& authorization_url => "http://twitter.com/oauth/authorize", \& access_token_url => "http://twitter.com/oauth/access_token", \& xauth_url => "https://twitter.com/oauth/access_token", \& } .Ve .IP "clientname" 4 .IX Item "clientname" The value for the \f(CW\*(C`X\-Twitter\-Client\-Name\*(C'\fR \s-1HTTP\s0 header. It defaults to \*(L"Perl Net::Twitter::Lite\*(R". .IP "clientver" 4 .IX Item "clientver" The value for the \f(CW\*(C`X\-Twitter\-Client\-Version\*(C'\fR \s-1HTTP\s0 header. It defaults to current version of the \f(CW\*(C`Net::Twitter::Lite\*(C'\fR module. .IP "clienturl" 4 .IX Item "clienturl" The value for the \f(CW\*(C`X\-Twitter\-Client\-URL\*(C'\fR \s-1HTTP\s0 header. It defaults to the search.cpan.org page for the \f(CW\*(C`Net::Twitter::Lite\*(C'\fR distribution. .IP "useragent_class" 4 .IX Item "useragent_class" The \f(CW\*(C`LWP::UserAgent\*(C'\fR compatible class used internally by \f(CW\*(C`Net::Twitter::Lite\*(C'\fR. It defaults to \*(L"LWP::UserAgent\*(R". For \s-1POE\s0 based applications, consider using \&\*(L"LWP::UserAgent::POE\*(R". .IP "useragent_args" 4 .IX Item "useragent_args" An \s-1HASH\s0 ref of arguments to pass to constructor of the class specified with \&\f(CW\*(C`useragent_class\*(C'\fR, above. It defaults to {} (an empty \s-1HASH\s0 ref). .IP "useragent" 4 .IX Item "useragent" The value for \f(CW\*(C`User\-Agent\*(C'\fR \s-1HTTP\s0 header. It defaults to \&\*(L"Net::Twitter::Lite/0.11002 (Perl)\*(R". .IP "source" 4 .IX Item "source" The value used in the \f(CW\*(C`source\*(C'\fR parameter of \s-1API\s0 method calls. It is currently only used in the \f(CW\*(C`update\*(C'\fR method in the \s-1REST API.\s0 It defaults to \&\*(L"twitterpm\*(R". This results in the text \*(L"from Net::Twitter\*(R" rather than \*(L"from web\*(R" for status messages posted from \f(CW\*(C`Net::Twitter::Lite\*(C'\fR when displayed via the Twitter web interface. The value for this parameter is provided by Twitter when a Twitter application is registered. See . .IP "apiurl" 4 .IX Item "apiurl" The \s-1URL\s0 for the Twitter \s-1API.\s0 This defaults to \*(L"http://twitter.com\*(R". .IP "identica" 4 .IX Item "identica" If set to 1 (or any value that evaluates to true), apiurl defaults to \&\*(L"http://identi.ca/api\*(R". .IP "ssl" 4 .IX Item "ssl" If set to 1, an \s-1SSL\s0 connection will be used for all \s-1API\s0 calls. Defaults to 0. .IP "netrc" 4 .IX Item "netrc" (Optional) Sets the \fImachine\fR key to look up in \f(CW\*(C`.netrc\*(C'\fR to obtain credentials. If set to 1, Net::Twitter::Lite will use the value of the \f(CW\*(C`netrc_machine\*(C'\fR option (below). .Sp .Vb 7 \& # in .netrc \& machine api.twitter.com \& login YOUR_TWITTER_USER_NAME \& password YOUR_TWITTER_PASSWORD \& machine semifor.twitter.com \& login semifor \& password SUPERSECRET \& \& # in your perl program \& $nt = Net::Twitter::Lite\->new(netrc => 1); \& $nt = Net::Twitter::Lite\->new(netrc => \*(Aqsemifor.twitter.com\*(Aq); .Ve .IP "netrc_machine" 4 .IX Item "netrc_machine" (Optional) Sets the \f(CW\*(C`machine\*(C'\fR entry to look up in \f(CW\*(C`.netrc\*(C'\fR when \f(CW\*(C`> is used. Defaults to \f(CW\*(C`api.twitter.com\*(C'\fR. .IP "legacy_lists_api" 4 .IX Item "legacy_lists_api" If set to 1, this option enables backwards compatibility by using the now deprecated endpoints and semantics for lists \s-1API\s0 methods. If set to 0, the new endpoints and semantics will be used. Only the new lists \s-1API\s0 methods are documented here. .Sp If you do not provide this option to \f(CW\*(C`new\*(C'\fR a warning is issued. Support for this option and the legacy lists \s-1API\s0 methods will be removed in a future version. .IP "wrap_result" 4 .IX Item "wrap_result" (Optional) If set to 1, this option will return an Net::Twitter::Lite::WrapResult object, which provides both the Twitter \s-1API\s0 result and the HTTP::Response object for the \s-1API\s0 call. See Net::Twitter::Lite::WrapResult for details. .RE .RS 4 .RE .SS "\s-1BASIC AUTHENTICATION METHODS\s0" .IX Subsection "BASIC AUTHENTICATION METHODS" .ie n .IP "credentials($username, $password)" 4 .el .IP "credentials($username, \f(CW$password\fR)" 4 .IX Item "credentials($username, $password)" Set the credentials for Basic Authentication. This is helpful for managing multiple accounts. .SS "\s-1OAUTH METHODS\s0" .IX Subsection "OAUTH METHODS" .IP "authorized" 4 .IX Item "authorized" Whether the client has the necessary credentials to be authorized. .Sp Note that the credentials may be wrong and so the request may fail. .IP "request_access_token" 4 .IX Item "request_access_token" Returns list including the access token, access token secret, user_id, and screen_name for this user. Takes a \s-1HASH\s0 of arguments. The \f(CW\*(C`verifier\*(C'\fR argument is required. See \*(L"\s-1OAUTH EXAMPLES\*(R"\s0. .Sp The user must have authorized this app at the url given by \f(CW\*(C`get_authorization_url\*(C'\fR first. .Sp For desktop applications, the Twitter authorization page will present the user with a \s-1PIN\s0 number. Prompt the user for the \s-1PIN\s0 number, and pass it as the \&\f(CW\*(C`verifier\*(C'\fR argument to request_access_token. .Sp Returns the access token and access token secret but also sets them internally so that after calling this method, you can immediately call \s-1API\s0 methods requiring authentication. .ie n .IP "get_authorization_url(callback => $callback_url)" 4 .el .IP "get_authorization_url(callback => \f(CW$callback_url\fR)" 4 .IX Item "get_authorization_url(callback => $callback_url)" Get the \s-1URL\s0 used to authorize the user. Returns a \f(CW\*(C`URI\*(C'\fR object. For web applications, pass your applications callback \s-1URL\s0 as the \f(CW\*(C`callback\*(C'\fR parameter. No arguments are required for desktop applications (\f(CW\*(C`callback\*(C'\fR defaults to \&\f(CW\*(C`oob\*(C'\fR, out-of-band). .ie n .IP "get_authentication_url(callback => $callback_url)" 4 .el .IP "get_authentication_url(callback => \f(CW$callback_url\fR)" 4 .IX Item "get_authentication_url(callback => $callback_url)" Get the \s-1URL\s0 used to authenticate the user with \*(L"Sign in with Twitter\*(R" authentication flow. Returns a \f(CW\*(C`URI\*(C'\fR object. For web applications, pass your applications callback \s-1URL\s0 as the \f(CW\*(C`callback\*(C'\fR parameter. No arguments are required for desktop applications (\f(CW\*(C`callback\*(C'\fR defaults to \f(CW\*(C`oob\*(C'\fR, out-of-band). .ie n .IP "xauth($username, $password)" 4 .el .IP "xauth($username, \f(CW$password\fR)" 4 .IX Item "xauth($username, $password)" Exchanges a username and password for OAuth tokens. Your application must be approved for XAuth access by Twitter for this method to work. Twitter does not grant XAuth access for web applications except for a brief period of time to allow them to switch form Basic authentication to OAuth authentication. .IP "access_token" 4 .IX Item "access_token" Get or set the access token. .IP "access_token_secret" 4 .IX Item "access_token_secret" Get or set the access token secret. .IP "request_token" 4 .IX Item "request_token" Get or set the request token. .IP "request_token_secret" 4 .IX Item "request_token_secret" Get or set the request token secret. .IP "access_token_url" 4 .IX Item "access_token_url" Get or set the access_token \s-1URL.\s0 .IP "authentication_url" 4 .IX Item "authentication_url" Get or set the authentication \s-1URL.\s0 .IP "authorization_url" 4 .IX Item "authorization_url" Get or set the authorization \s-1URL.\s0 .IP "request_token_url" 4 .IX Item "request_token_url" Get or set the request_token \s-1URL.\s0 .IP "xauth_url" 4 .IX Item "xauth_url" Get or set the XAuth access token request \s-1URL.\s0 .SH "API METHODS AND ARGUMENTS" .IX Header "API METHODS AND ARGUMENTS" Most Twitter \s-1API\s0 methods take parameters. All Net::Twitter::Lite \s-1API\s0 methods will accept a \s-1HASH\s0 ref of named parameters as specified in the Twitter \&\s-1API\s0 documentation. For convenience, many Net::Twitter::Lite methods accept simple positional arguments as documented, below. The positional parameter passing style is optional; you can always use the named parameters in a hash ref if you prefer. .PP For example, the \s-1REST API\s0 method \f(CW\*(C`update\*(C'\fR has one required parameter, \&\f(CW\*(C`status\*(C'\fR. You can call \f(CW\*(C`update\*(C'\fR with a \s-1HASH\s0 ref argument: .PP .Vb 1 \& $nt\->update({ status => \*(AqHello world!\*(Aq }); .Ve .PP Or, you can use the convenient form: .PP .Vb 1 \& $nt\->update(\*(AqHello world!\*(Aq); .Ve .PP The \f(CW\*(C`update\*(C'\fR method also has an optional parameter, \f(CW\*(C`in_reply_to_status_id\*(C'\fR. To use it, you \fBmust\fR use the \s-1HASH\s0 ref form: .PP .Vb 1 \& $nt\->update({ status => \*(AqHello world!\*(Aq, in_reply_to_status_id => $reply_to }); .Ve .PP Convenience form is provided for the required parameters of all \s-1API\s0 methods. So, these two calls are equivalent: .PP .Vb 2 \& $nt\->friendship_exists({ user_a => $fred, user_b => $barney }); \& $nt\->friendship_exists($fred, $barney); .Ve .PP Many \s-1API\s0 methods have aliases. You can use the \s-1API\s0 method name, or any of its aliases, as you prefer. For example, these calls are all equivalent: .PP .Vb 3 \& $nt\->friendship_exists($fred, $barney); \& $nt\->relationship_exists($fred, $barney); \& $nt\->follows($fred, $barney); .Ve .PP Aliases support both the \s-1HASH\s0 ref and convenient forms: .PP .Vb 1 \& $nt\->follows({ user_a => $fred, user_b => $barney }); .Ve .PP Methods that support the \f(CW\*(C`page\*(C'\fR parameter expect page numbers > 0. Twitter silently ignores invalid \f(CW\*(C`page\*(C'\fR values. So \f(CW\*(C`{ page => 0 }\*(C'\fR produces the same result as \f(CW\*(C`{ page => 1 }\*(C'\fR. .PP In addition to the arguments specified for each \s-1API\s0 method described below, an additional \f(CW\*(C`authenticate\*(C'\fR parameter can be passed. To request an \&\f(CW\*(C`Authorization\*(C'\fR header, pass \f(CW\*(C`authenticated => 1\*(C'\fR; to suppress an authentication header, pass \f(CW\*(C`authentication => 0\*(C'\fR. Even if requested, an Authorization header will not be added if there are no user credentials (username and password for Basic Authentication; access tokens for OAuth). .PP This is probably only useful for the \*(L"rate_limit_status\*(R" method in the \s-1REST API,\s0 since it returns different values for an authenticated and a non-authenticated call. .SH "REST API Methods" .IX Header "REST API Methods" Several of these methods accept a user \s-1ID\s0 as the \f(CW\*(C`id\*(C'\fR parameter. The user \s-1ID\s0 can be either a screen name, or the users numeric \s-1ID.\s0 To disambiguate, use the \f(CW\*(C`screen_name\*(C'\fR or \f(CW\*(C`user_id\*(C'\fR parameters, instead. .PP For example, These calls are equivalent: .PP .Vb 5 \& $nt\->create_friend(\*(Aqperl_api\*(Aq); # screen name \& $nt\->create_friend(1564061); # numeric ID \& $nt\->create_friend({ id => \*(Aqperl_api\*(Aq }); \& $nt\->create_friend({ screen_name => \*(Aqperl_api\*(Aq }); \& $nt\->create_friend({ user_id => 1564061 }); .Ve .PP However user_id 911 and screen_name 911 are separate Twitter accounts. These calls are \s-1NOT\s0 equivalent: .PP .Vb 2 \& $nt\->create_friend(911); # interpreted as screen name \& $nt\->create_friend({ user_id => 911 }); # screen name: richellis .Ve .PP Whenever the \f(CW\*(C`id\*(C'\fR parameter is required and \f(CW\*(C`user_id\*(C'\fR and \f(CW\*(C`screen_name\*(C'\fR are also parameters, using any one of them satisfies the requirement. .IP "\fBaccount_settings\fR" 4 .IX Item "account_settings" .RS 4 .PD 0 .IP "Parameters: \fInone\fR" 4 .IX Item "Parameters: none" .IP "Required: \fInone\fR" 4 .IX Item "Required: none" .RE .RS 4 .PD .Sp Returns the current trend, geo and sleep time information for the authenticating user. .Sp Returns: HashRef .RE .IP "\fBaccount_totals\fR" 4 .IX Item "account_totals" .RS 4 .PD 0 .IP "Parameters: \fInone\fR" 4 .IX Item "Parameters: none" .IP "Required: \fInone\fR" 4 .IX Item "Required: none" .RE .RS 4 .PD .Sp Returns the current count of friends, followers, updates (statuses) and favorites of the authenticating user. .Sp Returns: HashRef .RE .IP "\fBadd_list_member\fR" 4 .IX Item "add_list_member" .RS 4 .PD 0 .IP "Parameters: list_id, slug, user_id, screen_name, owner_screen_name, owner_id" 4 .IX Item "Parameters: list_id, slug, user_id, screen_name, owner_screen_name, owner_id" .IP "Required: \fInone\fR" 4 .IX Item "Required: none" .RE .RS 4 .PD .Sp Add a member to a list. The authenticated user must own the list to be able to add members to it. Note that lists can't have more than 500 members. .Sp Returns: User .RE .IP "\fBadd_place\fR" 4 .IX Item "add_place" .PD 0 .IP "\fBadd_place(name, contained_within, token, lat, long)\fR" 4 .IX Item "add_place(name, contained_within, token, lat, long)" .RS 4 .IP "Parameters: name, contained_within, token, lat, long, attribute:street_address, callback" 4 .IX Item "Parameters: name, contained_within, token, lat, long, attribute:street_address, callback" .IP "Required: name, contained_within, token, lat, long" 4 .IX Item "Required: name, contained_within, token, lat, long" .RE .RS 4 .PD .Sp Creates a new place object at the given latitude and longitude. .Sp Before creating a place you need to query \f(CW\*(C`similar_places\*(C'\fR with the latitude, longitude and name of the place you wish to create. The query will return an array of places which are similar to the one you wish to create, and a token. If the place you wish to create isn't in the returned array you can use the token with this method to create a new one. .Sp Returns: Place .RE .IP "\fBall_subscriptions\fR" 4 .IX Item "all_subscriptions" .PD 0 .IP "alias: all_lists" 4 .IX Item "alias: all_lists" .IP "alias: list_subscriptions" 4 .IX Item "alias: list_subscriptions" .RS 4 .IP "Parameters: user_id, screen_name, count, cursor" 4 .IX Item "Parameters: user_id, screen_name, count, cursor" .IP "Required: \fInone\fR" 4 .IX Item "Required: none" .RE .RS 4 .PD .Sp Returns all lists the authenticating or specified user subscribes to, including their own. The user is specified using the user_id or screen_name parameters. If no user is given, the authenticating user is used. .Sp Returns: ArrayRef[List] .RE .IP "\fBblock_exists\fR" 4 .IX Item "block_exists" .PD 0 .IP "\fBblock_exists(id)\fR" 4 .IX Item "block_exists(id)" .RS 4 .IP "Parameters: id, user_id, screen_name, include_entities" 4 .IX Item "Parameters: id, user_id, screen_name, include_entities" .IP "Required: id" 4 .IX Item "Required: id" .RE .RS 4 .PD .Sp Returns if the authenticating user is blocking a target user. Will return the blocked user's object if a block exists, and error with \s-1HTTP 404\s0 response code otherwise. .Sp Returns: BasicUser .RE .IP "\fBblocking\fR" 4 .IX Item "blocking" .RS 4 .PD 0 .IP "Parameters: page, include_entities" 4 .IX Item "Parameters: page, include_entities" .IP "Required: \fInone\fR" 4 .IX Item "Required: none" .RE .RS 4 .PD .Sp Returns an array of user objects that the authenticating user is blocking. .Sp Returns: ArrayRef[BasicUser] .RE .IP "\fBblocking_ids\fR" 4 .IX Item "blocking_ids" .RS 4 .PD 0 .IP "Parameters: \fInone\fR" 4 .IX Item "Parameters: none" .IP "Required: \fInone\fR" 4 .IX Item "Required: none" .RE .RS 4 .PD .Sp Returns an array of numeric user ids the authenticating user is blocking. .Sp Returns: ArrayRef[Int] .RE .IP "\fBcontributees\fR" 4 .IX Item "contributees" .RS 4 .PD 0 .IP "Parameters: user_id, screen_name, include_entities, skip_satus" 4 .IX Item "Parameters: user_id, screen_name, include_entities, skip_satus" .IP "Required: \fInone\fR" 4 .IX Item "Required: none" .RE .RS 4 .PD .Sp Returns an array of users that the specified user can contribute to. .Sp Returns: ArrayRef[User] .RE .IP "\fBcontributors\fR" 4 .IX Item "contributors" .RS 4 .PD 0 .IP "Parameters: user_id, screen_name, include_entities, skip_satus" 4 .IX Item "Parameters: user_id, screen_name, include_entities, skip_satus" .IP "Required: \fInone\fR" 4 .IX Item "Required: none" .RE .RS 4 .PD .Sp Returns an array of users who can contribute to the specified account. .Sp Returns: ArrayRef[User] .RE .IP "\fBcreate_block\fR" 4 .IX Item "create_block" .PD 0 .IP "\fBcreate_block(id)\fR" 4 .IX Item "create_block(id)" .RS 4 .IP "Parameters: id, user_id, screen_name, include_entities" 4 .IX Item "Parameters: id, user_id, screen_name, include_entities" .IP "Required: id" 4 .IX Item "Required: id" .RE .RS 4 .PD .Sp Blocks the user specified in the \s-1ID\s0 parameter as the authenticating user. Returns the blocked user when successful. You can find out more about blocking in the Twitter Support Knowledge Base. .Sp Returns: BasicUser .RE .IP "\fBcreate_favorite\fR" 4 .IX Item "create_favorite" .PD 0 .IP "\fBcreate_favorite(id)\fR" 4 .IX Item "create_favorite(id)" .RS 4 .IP "Parameters: id, include_entities" 4 .IX Item "Parameters: id, include_entities" .IP "Required: id" 4 .IX Item "Required: id" .RE .RS 4 .PD .Sp Favorites the status specified in the \s-1ID\s0 parameter as the authenticating user. Returns the favorite status when successful. .Sp Returns: Status .RE .IP "\fBcreate_friend\fR" 4 .IX Item "create_friend" .PD 0 .IP "\fBcreate_friend(id)\fR" 4 .IX Item "create_friend(id)" .IP "alias: follow_new" 4 .IX Item "alias: follow_new" .RS 4 .IP "Parameters: id, user_id, screen_name, follow, include_entities" 4 .IX Item "Parameters: id, user_id, screen_name, follow, include_entities" .IP "Required: id" 4 .IX Item "Required: id" .RE .RS 4 .PD .Sp Befriends the user specified in the \s-1ID\s0 parameter as the authenticating user. Returns the befriended user when successful. Returns a string describing the failure condition when unsuccessful. .Sp Returns: BasicUser .RE .IP "\fBcreate_list\fR" 4 .IX Item "create_list" .RS 4 .PD 0 .IP "Parameters: list_id, slug, name, mode, description, owner_screen_name, owner_id" 4 .IX Item "Parameters: list_id, slug, name, mode, description, owner_screen_name, owner_id" .IP "Required: \fInone\fR" 4 .IX Item "Required: none" .RE .RS 4 .PD .Sp Creates a new list for the authenticated user. Note that you can't create more than 20 lists per account. .Sp Returns: List .RE .IP "\fBcreate_saved_search\fR" 4 .IX Item "create_saved_search" .PD 0 .IP "\fBcreate_saved_search(query)\fR" 4 .IX Item "create_saved_search(query)" .RS 4 .IP "Parameters: query" 4 .IX Item "Parameters: query" .IP "Required: query" 4 .IX Item "Required: query" .RE .RS 4 .PD .Sp Creates a saved search for the authenticated user. .Sp Returns: SavedSearch .RE .IP "\fBdelete_list\fR" 4 .IX Item "delete_list" .RS 4 .PD 0 .IP "Parameters: owner_screen_name, owner_id, list_id, slug" 4 .IX Item "Parameters: owner_screen_name, owner_id, list_id, slug" .IP "Required: \fInone\fR" 4 .IX Item "Required: none" .RE .RS 4 .PD .Sp Deletes the specified list. The authenticated user must own the list to be able to destroy it. .Sp Returns: List .RE .IP "\fBdelete_list_member\fR" 4 .IX Item "delete_list_member" .PD 0 .IP "alias: remove_list_member" 4 .IX Item "alias: remove_list_member" .RS 4 .IP "Parameters: list_id, slug, user_id, screen_name, owner_screen_name, owner_id" 4 .IX Item "Parameters: list_id, slug, user_id, screen_name, owner_screen_name, owner_id" .IP "Required: \fInone\fR" 4 .IX Item "Required: none" .RE .RS 4 .PD .Sp Removes the specified member from the list. The authenticated user must be the list's owner to remove members from the list. .Sp Returns: User .RE .IP "\fBdestroy_block\fR" 4 .IX Item "destroy_block" .PD 0 .IP "\fBdestroy_block(id)\fR" 4 .IX Item "destroy_block(id)" .RS 4 .IP "Parameters: id, user_id, screen_name" 4 .IX Item "Parameters: id, user_id, screen_name" .IP "Required: id" 4 .IX Item "Required: id" .RE .RS 4 .PD .Sp Un-blocks the user specified in the \s-1ID\s0 parameter as the authenticating user. Returns the un-blocked user when successful. .Sp Returns: BasicUser .RE .IP "\fBdestroy_direct_message\fR" 4 .IX Item "destroy_direct_message" .PD 0 .IP "\fBdestroy_direct_message(id)\fR" 4 .IX Item "destroy_direct_message(id)" .RS 4 .IP "Parameters: id, include_entities" 4 .IX Item "Parameters: id, include_entities" .IP "Required: id" 4 .IX Item "Required: id" .RE .RS 4 .PD .Sp Destroys the direct message specified in the required \s-1ID\s0 parameter. The authenticating user must be the recipient of the specified direct message. .Sp Returns: DirectMessage .RE .IP "\fBdestroy_favorite\fR" 4 .IX Item "destroy_favorite" .PD 0 .IP "\fBdestroy_favorite(id)\fR" 4 .IX Item "destroy_favorite(id)" .RS 4 .IP "Parameters: id, include_entities" 4 .IX Item "Parameters: id, include_entities" .IP "Required: id" 4 .IX Item "Required: id" .RE .RS 4 .PD .Sp Un-favorites the status specified in the \s-1ID\s0 parameter as the authenticating user. Returns the un-favorited status. .Sp Returns: Status .RE .IP "\fBdestroy_friend\fR" 4 .IX Item "destroy_friend" .PD 0 .IP "\fBdestroy_friend(id)\fR" 4 .IX Item "destroy_friend(id)" .IP "alias: unfollow" 4 .IX Item "alias: unfollow" .RS 4 .IP "Parameters: id, user_id, screen_name, include_entities" 4 .IX Item "Parameters: id, user_id, screen_name, include_entities" .IP "Required: id" 4 .IX Item "Required: id" .RE .RS 4 .PD .Sp Discontinues friendship with the user specified in the \s-1ID\s0 parameter as the authenticating user. Returns the un-friended user when successful. Returns a string describing the failure condition when unsuccessful. .Sp Returns: BasicUser .RE .IP "\fBdestroy_saved_search\fR" 4 .IX Item "destroy_saved_search" .PD 0 .IP "\fBdestroy_saved_search(id)\fR" 4 .IX Item "destroy_saved_search(id)" .RS 4 .IP "Parameters: id" 4 .IX Item "Parameters: id" .IP "Required: id" 4 .IX Item "Required: id" .RE .RS 4 .PD .Sp Destroys a saved search. The search, specified by \f(CW\*(C`id\*(C'\fR, must be owned by the authenticating user. .Sp Returns: SavedSearch .RE .IP "\fBdestroy_status\fR" 4 .IX Item "destroy_status" .PD 0 .IP "\fBdestroy_status(id)\fR" 4 .IX Item "destroy_status(id)" .RS 4 .IP "Parameters: id, trim_user, include_entities" 4 .IX Item "Parameters: id, trim_user, include_entities" .IP "Required: id" 4 .IX Item "Required: id" .RE .RS 4 .PD .Sp Destroys the status specified by the required \s-1ID\s0 parameter. The authenticating user must be the author of the specified status. .Sp Returns: Status .RE .IP "\fBdirect_messages\fR" 4 .IX Item "direct_messages" .PD 0 .IP "\fBdirect_messages(include_entities)\fR" 4 .IX Item "direct_messages(include_entities)" .RS 4 .IP "Parameters: since_id, max_id, count, page, include_entities" 4 .IX Item "Parameters: since_id, max_id, count, page, include_entities" .IP "Required: include_entities" 4 .IX Item "Required: include_entities" .RE .RS 4 .PD .Sp Returns a list of the 20 most recent direct messages sent to the authenticating user including detailed information about the sending and recipient users. .Sp Returns: ArrayRef[DirectMessage] .RE .IP "\fBdisable_notifications\fR" 4 .IX Item "disable_notifications" .PD 0 .IP "\fBdisable_notifications(id)\fR" 4 .IX Item "disable_notifications(id)" .RS 4 .IP "Parameters: id, screen_name, include_entities" 4 .IX Item "Parameters: id, screen_name, include_entities" .IP "Required: id" 4 .IX Item "Required: id" .RE .RS 4 .PD .Sp Disables notifications for updates from the specified user to the authenticating user. Returns the specified user when successful. .Sp Returns: BasicUser .RE .IP "\fBenable_notifications\fR" 4 .IX Item "enable_notifications" .PD 0 .IP "\fBenable_notifications(id)\fR" 4 .IX Item "enable_notifications(id)" .RS 4 .IP "Parameters: id, screen_name, include_entities" 4 .IX Item "Parameters: id, screen_name, include_entities" .IP "Required: id" 4 .IX Item "Required: id" .RE .RS 4 .PD .Sp Enables notifications for updates from the specified user to the authenticating user. Returns the specified user when successful. .Sp Returns: BasicUser .RE .IP "\fBend_session\fR" 4 .IX Item "end_session" .RS 4 .PD 0 .IP "Parameters: \fInone\fR" 4 .IX Item "Parameters: none" .IP "Required: \fInone\fR" 4 .IX Item "Required: none" .RE .RS 4 .PD .Sp Ends the session of the authenticating user, returning a null cookie. Use this method to sign users out of client-facing applications like widgets. .Sp Returns: Error .RE .IP "\fBfavorites\fR" 4 .IX Item "favorites" .RS 4 .PD 0 .IP "Parameters: id, page, include_entities" 4 .IX Item "Parameters: id, page, include_entities" .IP "Required: \fInone\fR" 4 .IX Item "Required: none" .RE .RS 4 .PD .Sp Returns the 20 most recent favorite statuses for the authenticating user or user specified by the \s-1ID\s0 parameter. .Sp Returns: ArrayRef[Status] .RE .IP "\fBfollowers_ids\fR" 4 .IX Item "followers_ids" .PD 0 .IP "\fBfollowers_ids(id)\fR" 4 .IX Item "followers_ids(id)" .RS 4 .IP "Parameters: id, user_id, screen_name, cursor" 4 .IX Item "Parameters: id, user_id, screen_name, cursor" .IP "Required: id" 4 .IX Item "Required: id" .RE .RS 4 .PD .Sp Returns a reference to an array of numeric IDs for every user following the specified user. The order of the IDs may change from call to call. To obtain the screen names, pass the arrayref to \*(L"lookup_users\*(R". .Sp Use the optional \f(CW\*(C`cursor\*(C'\fR parameter to retrieve IDs in pages of 5000. When the \f(CW\*(C`cursor\*(C'\fR parameter is used, the return value is a reference to a hash with keys \f(CW\*(C`previous_cursor\*(C'\fR, \f(CW\*(C`next_cursor\*(C'\fR, and \f(CW\*(C`ids\*(C'\fR. The value of \f(CW\*(C`ids\*(C'\fR is a reference to an array of \s-1IDS\s0 of the user's followers. Set the optional \f(CW\*(C`cursor\*(C'\fR parameter to \-1 to get the first page of IDs. Set it to the prior return's value of \f(CW\*(C`previous_cursor\*(C'\fR or \f(CW\*(C`next_cursor\*(C'\fR to page forward or backwards. When there are no prior pages, the value of \f(CW\*(C`previous_cursor\*(C'\fR will be 0. When there are no subsequent pages, the value of \f(CW\*(C`next_cursor\*(C'\fR will be 0. .Sp Returns: HashRef|ArrayRef[Int] .RE .IP "\fBfriends_ids\fR" 4 .IX Item "friends_ids" .PD 0 .IP "\fBfriends_ids(id)\fR" 4 .IX Item "friends_ids(id)" .IP "alias: following_ids" 4 .IX Item "alias: following_ids" .RS 4 .IP "Parameters: id, user_id, screen_name, cursor" 4 .IX Item "Parameters: id, user_id, screen_name, cursor" .IP "Required: id" 4 .IX Item "Required: id" .RE .RS 4 .PD .Sp Returns a reference to an array of numeric IDs for every user followed by the specified user. The order of the IDs is reverse chronological. .Sp Use the optional \f(CW\*(C`cursor\*(C'\fR parameter to retrieve IDs in pages of 5000. When the \f(CW\*(C`cursor\*(C'\fR parameter is used, the return value is a reference to a hash with keys \f(CW\*(C`previous_cursor\*(C'\fR, \f(CW\*(C`next_cursor\*(C'\fR, and \f(CW\*(C`ids\*(C'\fR. The value of \f(CW\*(C`ids\*(C'\fR is a reference to an array of \s-1IDS\s0 of the user's friends. Set the optional \f(CW\*(C`cursor\*(C'\fR parameter to \-1 to get the first page of IDs. Set it to the prior return's value of \f(CW\*(C`previous_cursor\*(C'\fR or \f(CW\*(C`next_cursor\*(C'\fR to page forward or backwards. When there are no prior pages, the value of \f(CW\*(C`previous_cursor\*(C'\fR will be 0. When there are no subsequent pages, the value of \f(CW\*(C`next_cursor\*(C'\fR will be 0. .Sp Returns: HashRef|ArrayRef[Int] .RE .IP "\fBfriendship_exists\fR" 4 .IX Item "friendship_exists" .PD 0 .IP "\fBfriendship_exists(user_a, user_b)\fR" 4 .IX Item "friendship_exists(user_a, user_b)" .IP "alias: relationship_exists" 4 .IX Item "alias: relationship_exists" .IP "alias: follows" 4 .IX Item "alias: follows" .RS 4 .IP "Parameters: user_id_a, user_id_b, screen_name_a, screen_name_b, user_a, user_b" 4 .IX Item "Parameters: user_id_a, user_id_b, screen_name_a, screen_name_b, user_a, user_b" .IP "Required: user_a, user_b" 4 .IX Item "Required: user_a, user_b" .RE .RS 4 .PD .Sp Tests for the existence of friendship between two users. Will return true if user_a follows user_b, otherwise will return false. .Sp Use of \f(CW\*(C`user_a\*(C'\fR and \f(CW\*(C`user_b\*(C'\fR is deprecated. It has been preserved for backwards compatibility, and is used for the two-argument positional form: .Sp .Vb 1 \& $nt\->friendship_exists($user_a, $user_b); .Ve .Sp Instead, you should use one of the named argument forms: .Sp .Vb 2 \& $nt\->friendship_exists({ user_id_a => $id1, user_id_b => $id2 }); \& $nt\->friendship_exists({ screen_name_a => $name1, screen_name_b => $name2 }); .Ve .Sp Consider using \f(CW\*(C`show_friendship\*(C'\fR instead. .Sp Returns: Bool .RE .IP "\fBfriendships_incoming\fR" 4 .IX Item "friendships_incoming" .PD 0 .IP "\fBfriendships_incoming(cursor)\fR" 4 .IX Item "friendships_incoming(cursor)" .RS 4 .IP "Parameters: cursor" 4 .IX Item "Parameters: cursor" .IP "Required: cursor" 4 .IX Item "Required: cursor" .RE .RS 4 .PD .Sp Returns an \s-1HASH\s0 ref with an array of numeric IDs in the \f(CW\*(C`ids\*(C'\fR element for every user who has a pending request to follow the authenticating user. .Sp Returns: HashRef .RE .IP "\fBfriendships_outgoing\fR" 4 .IX Item "friendships_outgoing" .PD 0 .IP "\fBfriendships_outgoing(cursor)\fR" 4 .IX Item "friendships_outgoing(cursor)" .RS 4 .IP "Parameters: cursor" 4 .IX Item "Parameters: cursor" .IP "Required: cursor" 4 .IX Item "Required: cursor" .RE .RS 4 .PD .Sp Returns an \s-1HASH\s0 ref with an array of numeric IDs in the \f(CW\*(C`ids\*(C'\fR element for every protected user for whom the authenticating user has a pending follow request. .Sp Returns: HashRef .RE .IP "\fBgeo_id\fR" 4 .IX Item "geo_id" .PD 0 .IP "\fBgeo_id(id)\fR" 4 .IX Item "geo_id(id)" .RS 4 .IP "Parameters: id" 4 .IX Item "Parameters: id" .IP "Required: id" 4 .IX Item "Required: id" .RE .RS 4 .PD .Sp Returns details of a place returned from the \f(CW\*(C`reverse_geocode\*(C'\fR method. .Sp Returns: HashRef .RE .IP "\fBgeo_search\fR" 4 .IX Item "geo_search" .RS 4 .PD 0 .IP "Parameters: lat, long, query, ip, granularity, accuracy, max_results, contained_within, attribute:street_address, callback" 4 .IX Item "Parameters: lat, long, query, ip, granularity, accuracy, max_results, contained_within, attribute:street_address, callback" .IP "Required: \fInone\fR" 4 .IX Item "Required: none" .RE .RS 4 .PD .Sp Search for places that can be attached to a statuses/update. Given a latitude and a longitude pair, an \s-1IP\s0 address, or a name, this request will return a list of all the valid places that can be used as the place_id when updating a status. .Sp Conceptually, a query can be made from the user's location, retrieve a list of places, have the user validate the location he or she is at, and then send the \&\s-1ID\s0 of this location with a call to statuses/update. .Sp This is the recommended method to use find places that can be attached to statuses/update. Unlike geo/reverse_geocode which provides raw data access, this endpoint can potentially re-order places with regards to the user who is authenticated. This approach is also preferred for interactive place matching with the user. .Sp Returns: HashRef .RE .IP "\fBget_configuration\fR" 4 .IX Item "get_configuration" .RS 4 .PD 0 .IP "Parameters: \fInone\fR" 4 .IX Item "Parameters: none" .IP "Required: \fInone\fR" 4 .IX Item "Required: none" .RE .RS 4 .PD .Sp Returns the current configuration used by Twitter including twitter.com slugs which are not usernames, maximum photo resolutions, and t.co \s-1URL\s0 lengths. .Sp It is recommended applications request this endpoint when they are loaded, but no more than once a day. .Sp Returns: HashRef .RE .IP "\fBget_languages\fR" 4 .IX Item "get_languages" .RS 4 .PD 0 .IP "Parameters: \fInone\fR" 4 .IX Item "Parameters: none" .IP "Required: \fInone\fR" 4 .IX Item "Required: none" .RE .RS 4 .PD .Sp Returns the list of languages supported by Twitter along with their \s-1ISO 639\-1\s0 code. The \s-1ISO 639\-1\s0 code is the two letter value to use if you include lang with any of your requests. .Sp Returns: ArrayRef[Lanugage] .RE .IP "\fBget_list\fR" 4 .IX Item "get_list" .RS 4 .PD 0 .IP "Parameters: list_id, slug, owner_screen_name, owner_id" 4 .IX Item "Parameters: list_id, slug, owner_screen_name, owner_id" .IP "Required: \fInone\fR" 4 .IX Item "Required: none" .RE .RS 4 .PD .Sp Returns the specified list. Private lists will only be shown if the authenticated user owns the specified list. .Sp Returns: List .RE .IP "\fBget_lists\fR" 4 .IX Item "get_lists" .PD 0 .IP "alias: list_lists" 4 .IX Item "alias: list_lists" .RS 4 .IP "Parameters: user_id, screen_name, cursor" 4 .IX Item "Parameters: user_id, screen_name, cursor" .IP "Required: \fInone\fR" 4 .IX Item "Required: none" .RE .RS 4 .PD .Sp Returns the lists of the specified (or authenticated) user. Private lists will be included if the authenticated user is the same as the user whose lists are being returned. .Sp Returns: Hashref .RE .IP "\fBget_privacy_policy\fR" 4 .IX Item "get_privacy_policy" .RS 4 .PD 0 .IP "Parameters: \fInone\fR" 4 .IX Item "Parameters: none" .IP "Required: \fInone\fR" 4 .IX Item "Required: none" .RE .RS 4 .PD .Sp Returns Twitter's privacy policy. .Sp Returns: HashRef .RE .IP "\fBget_tos\fR" 4 .IX Item "get_tos" .RS 4 .PD 0 .IP "Parameters: \fInone\fR" 4 .IX Item "Parameters: none" .IP "Required: \fInone\fR" 4 .IX Item "Required: none" .RE .RS 4 .PD .Sp Returns the Twitter Terms of Service. These are not the same as the Developer Rules of the Road. .Sp Returns: HashRef .RE .IP "\fBhome_timeline\fR" 4 .IX Item "home_timeline" .RS 4 .PD 0 .IP "Parameters: since_id, max_id, count, page, skip_user, exclude_replies, contributor_details, include_rts, include_entities, trim_user, include_my_retweet" 4 .IX Item "Parameters: since_id, max_id, count, page, skip_user, exclude_replies, contributor_details, include_rts, include_entities, trim_user, include_my_retweet" .IP "Required: \fInone\fR" 4 .IX Item "Required: none" .RE .RS 4 .PD .Sp Returns the 20 most recent statuses, including retweets, posted by the authenticating user and that user's friends. This is the equivalent of /timeline/home on the Web. .Sp Returns: ArrayRef[Status] .RE .IP "\fBis_list_member\fR" 4 .IX Item "is_list_member" .RS 4 .PD 0 .IP "Parameters: owner_screen_name, owner_id, list_id, slug, user_id, screen_name, include_entities, skip_status" 4 .IX Item "Parameters: owner_screen_name, owner_id, list_id, slug, user_id, screen_name, include_entities, skip_status" .IP "Required: \fInone\fR" 4 .IX Item "Required: none" .RE .RS 4 .PD .Sp Check if the specified user is a member of the specified list. Returns the user or undef. .Sp Returns: Maybe[User] .RE .IP "\fBis_list_subscriber\fR" 4 .IX Item "is_list_subscriber" .PD 0 .IP "alias: is_subscribed_list" 4 .IX Item "alias: is_subscribed_list" .RS 4 .IP "Parameters: owner_screen_name, owner_id, list_id, slug, user_id, screen_name, include_entities, skip_status" 4 .IX Item "Parameters: owner_screen_name, owner_id, list_id, slug, user_id, screen_name, include_entities, skip_status" .IP "Required: \fInone\fR" 4 .IX Item "Required: none" .RE .RS 4 .PD .Sp Check if the specified user is a subscriber of the specified list. Returns the user or undef. .Sp Returns: Maybe[User] .RE .IP "\fBlist_members\fR" 4 .IX Item "list_members" .RS 4 .PD 0 .IP "Parameters: list_id, slug, owner_screen_name, owner_id, cursor, include_entities, skip_status" 4 .IX Item "Parameters: list_id, slug, owner_screen_name, owner_id, cursor, include_entities, skip_status" .IP "Required: \fInone\fR" 4 .IX Item "Required: none" .RE .RS 4 .PD .Sp Returns the members of the specified list. Private list members will only be shown if the authenticated user owns the specified list. .Sp Returns: Hashref .RE .IP "\fBlist_memberships\fR" 4 .IX Item "list_memberships" .RS 4 .PD 0 .IP "Parameters: user_id, screen_name, cursor, filter_to_owned_lists" 4 .IX Item "Parameters: user_id, screen_name, cursor, filter_to_owned_lists" .IP "Required: \fInone\fR" 4 .IX Item "Required: none" .RE .RS 4 .PD .Sp Returns the lists the specified user has been added to. If user_id or screen_name are not provided the memberships for the authenticating user are returned. .Sp Returns: Hashref .RE .IP "\fBlist_statuses\fR" 4 .IX Item "list_statuses" .RS 4 .PD 0 .IP "Parameters: list_id, slug, owner_screen_name, owner_id, since_id, max_id, per_page, page, include_entities, include_rts" 4 .IX Item "Parameters: list_id, slug, owner_screen_name, owner_id, since_id, max_id, per_page, page, include_entities, include_rts" .IP "Required: \fInone\fR" 4 .IX Item "Required: none" .RE .RS 4 .PD .Sp Returns tweet timeline for members of the specified list. Historically, retweets were not available in list timeline responses but you can now use the include_rts=true parameter to additionally receive retweet objects. .Sp Returns: ArrayRef[Status] .RE .IP "\fBlist_subscribers\fR" 4 .IX Item "list_subscribers" .RS 4 .PD 0 .IP "Parameters: list_id, slug, owner_screen_name, owner_id, cursor, include_entities, skip_status" 4 .IX Item "Parameters: list_id, slug, owner_screen_name, owner_id, cursor, include_entities, skip_status" .IP "Required: \fInone\fR" 4 .IX Item "Required: none" .RE .RS 4 .PD .Sp Returns the subscribers of the specified list. Private list subscribers will only be shown if the authenticated user owns the specified list. .Sp Returns: Hashref .RE .IP "\fBlookup_friendships\fR" 4 .IX Item "lookup_friendships" .RS 4 .PD 0 .IP "Parameters: user_id, screen_name" 4 .IX Item "Parameters: user_id, screen_name" .IP "Required: \fInone\fR" 4 .IX Item "Required: none" .RE .RS 4 .PD .Sp Returns the relationship of the authenticating user to the comma separated list or \s-1ARRAY\s0 ref of up to 100 screen_names or user_ids provided. Values for connections can be: following, following_requested, followed_by, none. Requires authentication. .Sp Returns: ArrayRef .RE .IP "\fBlookup_users\fR" 4 .IX Item "lookup_users" .RS 4 .PD 0 .IP "Parameters: user_id, screen_name, include_entities" 4 .IX Item "Parameters: user_id, screen_name, include_entities" .IP "Required: \fInone\fR" 4 .IX Item "Required: none" .RE .RS 4 .PD .Sp Return up to 100 users worth of extended information, specified by either \s-1ID,\s0 screen name, or combination of the two. The author's most recent status (if the authenticating user has permission) will be returned inline. This method is rate limited to 1000 calls per hour. .Sp This method will accept user IDs or screen names as either a comma delimited string, or as an \s-1ARRAY\s0 ref. It will also accept arguments in the normal \&\s-1HASHREF\s0 form or as a simple list of named arguments. I.e., any of the following forms are acceptable: .Sp .Vb 5 \& $nt\->lookup_users({ user_id => \*(Aq1234,6543,3333\*(Aq }); \& $nt\->lookup_users(user_id => \*(Aq1234,6543,3333\*(Aq); \& $nt\->lookup_users({ user_id => [ 1234, 6543, 3333 ] }); \& $nt\->lookup_users({ screen_name => \*(Aqfred,barney,wilma\*(Aq }); \& $nt\->lookup_users(screen_name => [\*(Aqfred\*(Aq, \*(Aqbarney\*(Aq, \*(Aqwilma\*(Aq]); \& \& $nt\->lookup_users( \& screen_name => [\*(Aqfred\*(Aq, \*(Aqbarney\*(Aq ], \& user_id => \*(Aq4321,6789\*(Aq, \& ); .Ve .Sp Returns: ArrayRef[User] .RE .IP "\fBmembers_create_all\fR" 4 .IX Item "members_create_all" .PD 0 .IP "alias: add_list_members" 4 .IX Item "alias: add_list_members" .RS 4 .IP "Parameters: list_id, slug, owner_screen_name, owner_id" 4 .IX Item "Parameters: list_id, slug, owner_screen_name, owner_id" .IP "Required: \fInone\fR" 4 .IX Item "Required: none" .RE .RS 4 .PD .Sp Adds multiple members to a list, by specifying a reference to an array or a comma-separated list of member ids or screen names. The authenticated user must own the list to be able to add members to it. Note that lists can't have more than 500 members, and you are limited to adding up to 100 members to a list at a time with this method. .Sp Returns: List .RE .IP "\fBmembers_destroy_all\fR" 4 .IX Item "members_destroy_all" .PD 0 .IP "alias: remove_list_members" 4 .IX Item "alias: remove_list_members" .RS 4 .IP "Parameters: list_id, slug, user_id, screen_name, owner_screen_name, owner_id" 4 .IX Item "Parameters: list_id, slug, user_id, screen_name, owner_screen_name, owner_id" .IP "Required: \fInone\fR" 4 .IX Item "Required: none" .RE .RS 4 .PD .Sp Removes multiple members from a list, by specifying a reference to an array of member ids or screen names, or a string of comma separated user ids or screen names. The authenticated user must own the list to be able to remove members from it. Note that lists can't have more than 500 members, and you are limited to removing up to 100 members to a list at a time with this method. .Sp Please note that there can be issues with lists that rapidly remove and add memberships. Take care when using these methods such that you are not too rapidly switching between removals and adds on the same list. .Sp Returns: List .RE .IP "\fBmentions\fR" 4 .IX Item "mentions" .PD 0 .IP "alias: replies" 4 .IX Item "alias: replies" .RS 4 .IP "Parameters: since_id, max_id, count, page, trim_user, include_rts, include_entities" 4 .IX Item "Parameters: since_id, max_id, count, page, trim_user, include_rts, include_entities" .IP "Required: \fInone\fR" 4 .IX Item "Required: none" .RE .RS 4 .PD .Sp Returns the 20 most recent mentions (statuses containing \f(CW@username\fR) for the authenticating user. .Sp Returns: ArrayRef[Status] .RE .IP "\fBnew_direct_message\fR" 4 .IX Item "new_direct_message" .PD 0 .IP "\fBnew_direct_message(user, text)\fR" 4 .IX Item "new_direct_message(user, text)" .RS 4 .IP "Parameters: user, text, screen_name, user_id, include_entities" 4 .IX Item "Parameters: user, text, screen_name, user_id, include_entities" .IP "Required: user, text" 4 .IX Item "Required: user, text" .RE .RS 4 .PD .Sp Sends a new direct message to the specified user from the authenticating user. Requires both the user and text parameters. Returns the sent message when successful. In order to support numeric screen names, the \f(CW\*(C`screen_name\*(C'\fR or \&\f(CW\*(C`user_id\*(C'\fR parameters may be used instead of \f(CW\*(C`user\*(C'\fR. .Sp Returns: DirectMessage .RE .IP "\fBno_retweet_ids\fR" 4 .IX Item "no_retweet_ids" .RS 4 .PD 0 .IP "Parameters: \fInone\fR" 4 .IX Item "Parameters: none" .IP "Required: \fInone\fR" 4 .IX Item "Required: none" .RE .RS 4 .PD .Sp Returns an \s-1ARRAY\s0 ref of user IDs for which the authenticating user does not want to receive retweets. .Sp Returns: ArrayRef[UserIDs] .RE .IP "\fBpublic_timeline\fR" 4 .IX Item "public_timeline" .RS 4 .PD 0 .IP "Parameters: skip_user, trim_user, include_entities" 4 .IX Item "Parameters: skip_user, trim_user, include_entities" .IP "Required: \fInone\fR" 4 .IX Item "Required: none" .RE .RS 4 .PD .Sp Returns the 20 most recent statuses from non-protected users who have set a custom user icon. Does not require authentication. Note that the public timeline is cached for 60 seconds so requesting it more often than that is a waste of resources. .Sp If user credentials are provided, \f(CW\*(C`public_timeline\*(C'\fR calls are authenticated, so they count against the authenticated user's rate limit. Use \f(CW\*(C`\->public_timeline({ authenticate => 0 })\*(C'\fR to make an unauthenticated call which will count against the calling \s-1IP\s0 address' rate limit, instead. .Sp Returns: ArrayRef[Status] .RE .IP "\fBrate_limit_status\fR" 4 .IX Item "rate_limit_status" .RS 4 .PD 0 .IP "Parameters: \fInone\fR" 4 .IX Item "Parameters: none" .IP "Required: \fInone\fR" 4 .IX Item "Required: none" .RE .RS 4 .PD .Sp Returns the remaining number of \s-1API\s0 requests available to the authenticated user before the \s-1API\s0 limit is reached for the current hour. .Sp Use \f(CW\*(C`\->rate_limit_status({ authenticate => 0 })\*(C'\fR to force an unauthenticated call, which will return the status for the \s-1IP\s0 address rather than the authenticated user. (Note: for a web application, this is the server's \&\s-1IP\s0 address.) .Sp Returns: RateLimitStatus .RE .IP "\fBrelated_results\fR" 4 .IX Item "related_results" .PD 0 .IP "\fBrelated_results(id)\fR" 4 .IX Item "related_results(id)" .RS 4 .IP "Parameters: id" 4 .IX Item "Parameters: id" .IP "Required: id" 4 .IX Item "Required: id" .RE .RS 4 .PD .Sp If available, returns an array of replies and mentions related to the specified status. There is no guarantee there will be any replies or mentions in the response. This method is only available to users who have access to #newtwitter. Requires authentication. .Sp Returns: ArrayRef[Status] .RE .IP "\fBreport_spam\fR" 4 .IX Item "report_spam" .PD 0 .IP "\fBreport_spam(id)\fR" 4 .IX Item "report_spam(id)" .RS 4 .IP "Parameters: id, user_id, screen_name, include_entities" 4 .IX Item "Parameters: id, user_id, screen_name, include_entities" .IP "Required: id" 4 .IX Item "Required: id" .RE .RS 4 .PD .Sp The user specified in the id is blocked by the authenticated user and reported as a spammer. .Sp Returns: User .RE .IP "\fBretweet\fR" 4 .IX Item "retweet" .PD 0 .IP "\fBretweet(id)\fR" 4 .IX Item "retweet(id)" .RS 4 .IP "Parameters: id, include_entities, trim_user" 4 .IX Item "Parameters: id, include_entities, trim_user" .IP "Required: id" 4 .IX Item "Required: id" .RE .RS 4 .PD .Sp Retweets a tweet. Requires the id parameter of the tweet you are retweeting. Returns the original tweet with retweet details embedded. .Sp Returns: Status .RE .IP "\fBretweeted_by\fR" 4 .IX Item "retweeted_by" .PD 0 .IP "\fBretweeted_by(id)\fR" 4 .IX Item "retweeted_by(id)" .RS 4 .IP "Parameters: id, count, page, trim_user, include_entities" 4 .IX Item "Parameters: id, count, page, trim_user, include_entities" .IP "Required: id" 4 .IX Item "Required: id" .RE .RS 4 .PD .Sp Returns up to 100 users who retweeted the status identified by \f(CW\*(C`id\*(C'\fR. .Sp Returns: ArrayRef[User] .RE .IP "\fBretweeted_by_ids\fR" 4 .IX Item "retweeted_by_ids" .PD 0 .IP "\fBretweeted_by_ids(id)\fR" 4 .IX Item "retweeted_by_ids(id)" .RS 4 .IP "Parameters: id, count, page, trim_user, include_entities" 4 .IX Item "Parameters: id, count, page, trim_user, include_entities" .IP "Required: id" 4 .IX Item "Required: id" .RE .RS 4 .PD .Sp Returns the IDs of up to 100 users who retweeted the status identified by \f(CW\*(C`id\*(C'\fR. .Sp Returns: ArrayRef[User] .RE .IP "\fBretweeted_by_me\fR" 4 .IX Item "retweeted_by_me" .RS 4 .PD 0 .IP "Parameters: since_id, max_id, count, page, trim_user, include_entities" 4 .IX Item "Parameters: since_id, max_id, count, page, trim_user, include_entities" .IP "Required: \fInone\fR" 4 .IX Item "Required: none" .RE .RS 4 .PD .Sp Returns the 20 most recent retweets posted by the authenticating user. .Sp Returns: ArrayRef[Status] .RE .IP "\fBretweeted_by_user\fR" 4 .IX Item "retweeted_by_user" .PD 0 .IP "\fBretweeted_by_user(id)\fR" 4 .IX Item "retweeted_by_user(id)" .RS 4 .IP "Parameters: id, user_id, screen_name" 4 .IX Item "Parameters: id, user_id, screen_name" .IP "Required: id" 4 .IX Item "Required: id" .RE .RS 4 .PD .Sp Returns the 20 most recent retweets posted by the specified user. The user is specified using the user_id or screen_name parameters. This method is identical to \f(CW\*(C`retweeted_by_me\*(C'\fR except you can choose the user to view. Does not require authentication, unless the user is protected. .Sp Returns: ArrayRef .RE .IP "\fBretweeted_to_me\fR" 4 .IX Item "retweeted_to_me" .RS 4 .PD 0 .IP "Parameters: since_id, max_id, count, page" 4 .IX Item "Parameters: since_id, max_id, count, page" .IP "Required: \fInone\fR" 4 .IX Item "Required: none" .RE .RS 4 .PD .Sp Returns the 20 most recent retweets posted by the authenticating user's friends. .Sp Returns: ArrayRef[Status] .RE .IP "\fBretweeted_to_user\fR" 4 .IX Item "retweeted_to_user" .PD 0 .IP "\fBretweeted_to_user(id)\fR" 4 .IX Item "retweeted_to_user(id)" .RS 4 .IP "Parameters: id, user_id, screen_name" 4 .IX Item "Parameters: id, user_id, screen_name" .IP "Required: id" 4 .IX Item "Required: id" .RE .RS 4 .PD .Sp Returns the 20 most recent retweets posted by users the specified user follows. The user is specified using the user_id or screen_name parameters. This method is identical to \f(CW\*(C`retweeted_to_me\*(C'\fR except you can choose the user to view. Does not require authentication, unless the user is protected. .Sp Returns: ArrayRef .RE .IP "\fBretweets\fR" 4 .IX Item "retweets" .PD 0 .IP "\fBretweets(id)\fR" 4 .IX Item "retweets(id)" .RS 4 .IP "Parameters: id, count, trim_user, include_entities" 4 .IX Item "Parameters: id, count, trim_user, include_entities" .IP "Required: id" 4 .IX Item "Required: id" .RE .RS 4 .PD .Sp Returns up to 100 of the first retweets of a given tweet. .Sp Returns: Arrayref[Status] .RE .IP "\fBretweets_of_me\fR" 4 .IX Item "retweets_of_me" .PD 0 .IP "alias: retweeted_of_me" 4 .IX Item "alias: retweeted_of_me" .RS 4 .IP "Parameters: since_id, max_id, count, page, trim_user, include_entities" 4 .IX Item "Parameters: since_id, max_id, count, page, trim_user, include_entities" .IP "Required: \fInone\fR" 4 .IX Item "Required: none" .RE .RS 4 .PD .Sp Returns the 20 most recent tweets of the authenticated user that have been retweeted by others. .Sp Returns: ArrayRef[Status] .RE .IP "\fBreverse_geocode\fR" 4 .IX Item "reverse_geocode" .PD 0 .IP "\fBreverse_geocode(lat, long)\fR" 4 .IX Item "reverse_geocode(lat, long)" .RS 4 .IP "Parameters: lat, long, accuracy, granularity, max_results" 4 .IX Item "Parameters: lat, long, accuracy, granularity, max_results" .IP "Required: lat, long" 4 .IX Item "Required: lat, long" .RE .RS 4 .PD .Sp Search for places (cities and neighborhoods) that can be attached to a statuses/update. Given a latitude and a longitude, return a list of all the valid places that can be used as a place_id when updating a status. Conceptually, a query can be made from the user's location, retrieve a list of places, have the user validate the location he or she is at, and then send the \&\s-1ID\s0 of this location up with a call to statuses/update. .Sp There are multiple granularities of places that can be returned \*(-- \&\*(L"neighborhoods\*(R", \*(L"cities\*(R", etc. At this time, only United States data is available through this method. .IP "lat" 4 .IX Item "lat" Required. The latitude to query about. Valid ranges are \-90.0 to +90.0 (North is positive) inclusive. .IP "long" 4 .IX Item "long" Required. The longitude to query about. Valid ranges are \-180.0 to +180.0 (East is positive) inclusive. .IP "accuracy" 4 .IX Item "accuracy" Optional. A hint on the \*(L"region\*(R" in which to search. If a number, then this is a radius in meters, but it can also take a string that is suffixed with ft to specify feet. If this is not passed in, then it is assumed to be 0m. If coming from a device, in practice, this value is whatever accuracy the device has measuring its location (whether it be coming from a \s-1GPS,\s0 WiFi triangulation, etc.). .IP "granularity" 4 .IX Item "granularity" Optional. The minimal granularity of data to return. If this is not passed in, then \f(CW\*(C`neighborhood\*(C'\fR is assumed. \f(CW\*(C`city\*(C'\fR can also be passed. .IP "max_results" 4 .IX Item "max_results" Optional. A hint as to the number of results to return. This does not guarantee that the number of results returned will equal max_results, but instead informs how many \*(L"nearby\*(R" results to return. Ideally, only pass in the number of places you intend to display to the user here. .RE .RS 4 .Sp Returns: HashRef .RE .IP "\fBsaved_searches\fR" 4 .IX Item "saved_searches" .RS 4 .PD 0 .IP "Parameters: \fInone\fR" 4 .IX Item "Parameters: none" .IP "Required: \fInone\fR" 4 .IX Item "Required: none" .RE .RS 4 .PD .Sp Returns the authenticated user's saved search queries. .Sp Returns: ArrayRef[SavedSearch] .RE .IP "\fBsent_direct_messages\fR" 4 .IX Item "sent_direct_messages" .RS 4 .PD 0 .IP "Parameters: since_id, max_id, page, count, include_entities" 4 .IX Item "Parameters: since_id, max_id, page, count, include_entities" .IP "Required: \fInone\fR" 4 .IX Item "Required: none" .RE .RS 4 .PD .Sp Returns a list of the 20 most recent direct messages sent by the authenticating user including detailed information about the sending and recipient users. .Sp Returns: ArrayRef[DirectMessage] .RE .IP "\fBshow_direct_message\fR" 4 .IX Item "show_direct_message" .PD 0 .IP "\fBshow_direct_message(id)\fR" 4 .IX Item "show_direct_message(id)" .RS 4 .IP "Parameters: id, include_entities" 4 .IX Item "Parameters: id, include_entities" .IP "Required: id" 4 .IX Item "Required: id" .RE .RS 4 .PD .Sp Returns a single direct message, specified by an id parameter. Like the \f(CW\*(C`direct_messages\*(C'\fR request, this method will include the user objects of the sender and recipient. Requires authentication. .Sp Returns: HashRef .RE .IP "\fBshow_friendship\fR" 4 .IX Item "show_friendship" .PD 0 .IP "\fBshow_friendship(id)\fR" 4 .IX Item "show_friendship(id)" .IP "alias: show_relationship" 4 .IX Item "alias: show_relationship" .RS 4 .IP "Parameters: source_id, source_screen_name, target_id, target_id_name" 4 .IX Item "Parameters: source_id, source_screen_name, target_id, target_id_name" .IP "Required: id" 4 .IX Item "Required: id" .RE .RS 4 .PD .Sp Returns detailed information about the relationship between two users. .Sp Returns: Relationship .RE .IP "\fBshow_saved_search\fR" 4 .IX Item "show_saved_search" .PD 0 .IP "\fBshow_saved_search(id)\fR" 4 .IX Item "show_saved_search(id)" .RS 4 .IP "Parameters: id" 4 .IX Item "Parameters: id" .IP "Required: id" 4 .IX Item "Required: id" .RE .RS 4 .PD .Sp Retrieve the data for a saved search, by \f(CW\*(C`id\*(C'\fR, owned by the authenticating user. .Sp Returns: SavedSearch .RE .IP "\fBshow_status\fR" 4 .IX Item "show_status" .PD 0 .IP "\fBshow_status(id)\fR" 4 .IX Item "show_status(id)" .RS 4 .IP "Parameters: id, trim_user, include_entities" 4 .IX Item "Parameters: id, trim_user, include_entities" .IP "Required: id" 4 .IX Item "Required: id" .RE .RS 4 .PD .Sp Returns a single status, specified by the id parameter. The status's author will be returned inline. .Sp Returns: Status .RE .IP "\fBshow_user\fR" 4 .IX Item "show_user" .PD 0 .IP "\fBshow_user(id)\fR" 4 .IX Item "show_user(id)" .RS 4 .IP "Parameters: id, screen_name, include_entities" 4 .IX Item "Parameters: id, screen_name, include_entities" .IP "Required: id" 4 .IX Item "Required: id" .RE .RS 4 .PD .Sp Returns extended information of a given user, specified by \s-1ID\s0 or screen name as per the required id parameter. This information includes design settings, so third party developers can theme their widgets according to a given user's preferences. You must be properly authenticated to request the page of a protected user. .Sp Returns: ExtendedUser .RE .IP "\fBsimilar_places\fR" 4 .IX Item "similar_places" .PD 0 .IP "\fBsimilar_places(lat, long, name)\fR" 4 .IX Item "similar_places(lat, long, name)" .RS 4 .IP "Parameters: lat, long, name, contained_within, attribute:street_address, callback" 4 .IX Item "Parameters: lat, long, name, contained_within, attribute:street_address, callback" .IP "Required: lat, long, name" 4 .IX Item "Required: lat, long, name" .RE .RS 4 .PD .Sp Locates places near the given coordinates which are similar in name. .Sp Conceptually you would use this method to get a list of known places to choose from first. Then, if the desired place doesn't exist, make a request to \&\f(CW\*(C`add_place\*(C'\fR to create a new one. .Sp The token contained in the response is the token needed to be able to create a new place. .Sp Returns: HashRef .RE .IP "\fBsubscribe_list\fR" 4 .IX Item "subscribe_list" .RS 4 .PD 0 .IP "Parameters: owner_screen_name, owner_id, list_id, slug" 4 .IX Item "Parameters: owner_screen_name, owner_id, list_id, slug" .IP "Required: \fInone\fR" 4 .IX Item "Required: none" .RE .RS 4 .PD .Sp Subscribes the authenticated user to the specified list. .Sp Returns: List .RE .IP "\fBsubscriptions\fR" 4 .IX Item "subscriptions" .RS 4 .PD 0 .IP "Parameters: user_id, screen_name, count, cursor" 4 .IX Item "Parameters: user_id, screen_name, count, cursor" .IP "Required: \fInone\fR" 4 .IX Item "Required: none" .RE .RS 4 .PD .Sp Obtain a collection of the lists the specified user is subscribed to, 20 lists per page by default. Does not include the user's own lists. .Sp Returns: ArrayRef[List] .RE .IP "\fBsuggestion_categories\fR" 4 .IX Item "suggestion_categories" .RS 4 .PD 0 .IP "Parameters: \fInone\fR" 4 .IX Item "Parameters: none" .IP "Required: \fInone\fR" 4 .IX Item "Required: none" .RE .RS 4 .PD .Sp Returns the list of suggested user categories. The category slug can be used in the \f(CW\*(C`user_suggestions\*(C'\fR \s-1API\s0 method get the users in that category . Does not require authentication. .Sp Returns: ArrayRef .RE .IP "\fBtest\fR" 4 .IX Item "test" .RS 4 .PD 0 .IP "Parameters: \fInone\fR" 4 .IX Item "Parameters: none" .IP "Required: \fInone\fR" 4 .IX Item "Required: none" .RE .RS 4 .PD .Sp Returns the string \*(L"ok\*(R" status code. .Sp Returns: Str .RE .IP "\fBtrends_available\fR" 4 .IX Item "trends_available" .RS 4 .PD 0 .IP "Parameters: lat, long" 4 .IX Item "Parameters: lat, long" .IP "Required: \fInone\fR" 4 .IX Item "Required: none" .RE .RS 4 .PD .Sp Returns the locations with trending topic information. The response is an array of \*(L"locations\*(R" that encode the location's \s-1WOEID\s0 (a Yahoo! Where On Earth \&\s-1ID\s0 ) and some other human-readable information such as a the location's canonical name and country. .Sp When the optional \f(CW\*(C`lat\*(C'\fR and \f(CW\*(C`long\*(C'\fR parameters are passed, the available trend locations are sorted by distance from that location, nearest to farthest. .Sp Use the \s-1WOEID\s0 returned in the location object to query trends for a specific location. .Sp Returns: ArrayRef[Location] .RE .IP "\fBtrends_current\fR" 4 .IX Item "trends_current" .PD 0 .IP "\fBtrends_current(exclude)\fR" 4 .IX Item "trends_current(exclude)" .RS 4 .IP "Parameters: exclude" 4 .IX Item "Parameters: exclude" .IP "Required: \fInone\fR" 4 .IX Item "Required: none" .RE .RS 4 .PD .Sp Returns the current top ten trending topics on Twitter. The response includes the time of the request, the name of each trending topic, and query used on Twitter Search results page for that topic. .Sp Returns: HashRef .RE .IP "\fBtrends_daily\fR" 4 .IX Item "trends_daily" .RS 4 .PD 0 .IP "Parameters: date, exclude" 4 .IX Item "Parameters: date, exclude" .IP "Required: \fInone\fR" 4 .IX Item "Required: none" .RE .RS 4 .PD .Sp Returns the top 20 trending topics for each hour in a given day. .Sp Returns: HashRef .RE .IP "\fBtrends_location\fR" 4 .IX Item "trends_location" .PD 0 .IP "\fBtrends_location(woeid)\fR" 4 .IX Item "trends_location(woeid)" .RS 4 .IP "Parameters: woeid" 4 .IX Item "Parameters: woeid" .IP "Required: woeid" 4 .IX Item "Required: woeid" .RE .RS 4 .PD .Sp Returns the top 10 trending topics for a specific location. The response is an array of \*(L"trend\*(R" objects that encode the name of the trending topic, the query parameter that can be used to search for the topic on Search, and the direct \&\s-1URL\s0 that can be issued against Search. This information is cached for five minutes, and therefore users are discouraged from querying these endpoints faster than once every five minutes. Global trends information is also available from this \s-1API\s0 by using a \s-1WOEID\s0 of 1. .Sp Returns: ArrayRef[Trend] .RE .IP "\fBtrends_weekly\fR" 4 .IX Item "trends_weekly" .RS 4 .PD 0 .IP "Parameters: date, exclude" 4 .IX Item "Parameters: date, exclude" .IP "Required: \fInone\fR" 4 .IX Item "Required: none" .RE .RS 4 .PD .Sp Returns the top 30 trending topics for each day in a given week. .Sp Returns: HashRef .RE .IP "\fBunsubscribe_list\fR" 4 .IX Item "unsubscribe_list" .RS 4 .PD 0 .IP "Parameters: list_id, slug, owner_screen_name, owner_id" 4 .IX Item "Parameters: list_id, slug, owner_screen_name, owner_id" .IP "Required: \fInone\fR" 4 .IX Item "Required: none" .RE .RS 4 .PD .Sp Unsubscribes the authenticated user from the specified list. .Sp Returns: List .RE .IP "\fBupdate\fR" 4 .IX Item "update" .PD 0 .IP "\fBupdate(status)\fR" 4 .IX Item "update(status)" .RS 4 .IP "Parameters: status, lat, long, place_id, display_coordinates, in_reply_to_status_id, trim_user, include_entities" 4 .IX Item "Parameters: status, lat, long, place_id, display_coordinates, in_reply_to_status_id, trim_user, include_entities" .IP "Required: status" 4 .IX Item "Required: status" .RE .RS 4 .PD .Sp Updates the authenticating user's status. Requires the status parameter specified. A status update with text identical to the authenticating user's current status will be ignored. .IP "status" 4 .IX Item "status" Required. The text of your status update. \s-1URL\s0 encode as necessary. Statuses over 140 characters will cause a 403 error to be returned from the \s-1API.\s0 .IP "in_reply_to_status_id" 4 .IX Item "in_reply_to_status_id" Optional. The \s-1ID\s0 of an existing status that the update is in reply to. o Note: This parameter will be ignored unless the author of the tweet this parameter references is mentioned within the status text. Therefore, you must include \&\f(CW@username\fR, where username is the author of the referenced tweet, within the update. .IP "lat" 4 .IX Item "lat" Optional. The location's latitude that this tweet refers to. The valid ranges for latitude is \-90.0 to +90.0 (North is positive) inclusive. This parameter will be ignored if outside that range, if it is not a number, if geo_enabled is disabled, or if there not a corresponding long parameter with this tweet. .IP "long" 4 .IX Item "long" Optional. The location's longitude that this tweet refers to. The valid ranges for longitude is \-180.0 to +180.0 (East is positive) inclusive. This parameter will be ignored if outside that range, if it is not a number, if geo_enabled is disabled, or if there not a corresponding lat parameter with this tweet. .IP "place_id" 4 .IX Item "place_id" Optional. The place to attach to this status update. Valid place_ids can be found by querying \f(CW\*(C`reverse_geocode\*(C'\fR. .IP "display_coordinates" 4 .IX Item "display_coordinates" Optional. By default, geo-tweets will have their coordinates exposed in the status object (to remain backwards compatible with existing \s-1API\s0 applications). To turn off the display of the precise latitude and longitude (but keep the contextual location information), pass \f(CW\*(C`display_coordinates =\*(C'\fR 0> on the status update. .RE .RS 4 .Sp Returns: Status .RE .IP "\fBupdate_delivery_device\fR" 4 .IX Item "update_delivery_device" .PD 0 .IP "\fBupdate_delivery_device(device)\fR" 4 .IX Item "update_delivery_device(device)" .RS 4 .IP "Parameters: device" 4 .IX Item "Parameters: device" .IP "Required: device" 4 .IX Item "Required: device" .RE .RS 4 .PD .Sp Sets which device Twitter delivers updates to for the authenticating user. Sending none as the device parameter will disable \s-1IM\s0 or \s-1SMS\s0 updates. .Sp Returns: BasicUser .RE .IP "\fBupdate_friendship\fR" 4 .IX Item "update_friendship" .PD 0 .IP "\fBupdate_friendship(id)\fR" 4 .IX Item "update_friendship(id)" .RS 4 .IP "Parameters: id, user_id, screen_name, device, retweets" 4 .IX Item "Parameters: id, user_id, screen_name, device, retweets" .IP "Required: id" 4 .IX Item "Required: id" .RE .RS 4 .PD .Sp Allows you enable or disable retweets and device notifications from the specified user. All other values are assumed to be false. Requires authentication. .Sp Returns: HashRef .RE .IP "\fBupdate_list\fR" 4 .IX Item "update_list" .RS 4 .PD 0 .IP "Parameters: list_id, slug, name, mode, description, owner_screen_name, owner_id" 4 .IX Item "Parameters: list_id, slug, name, mode, description, owner_screen_name, owner_id" .IP "Required: \fInone\fR" 4 .IX Item "Required: none" .RE .RS 4 .PD .Sp Updates the specified list. The authenticated user must own the list to be able to update it. .Sp Returns: List .RE .IP "\fBupdate_profile\fR" 4 .IX Item "update_profile" .RS 4 .PD 0 .IP "Parameters: name, email, url, location, description, include_entities" 4 .IX Item "Parameters: name, email, url, location, description, include_entities" .IP "Required: \fInone\fR" 4 .IX Item "Required: none" .RE .RS 4 .PD .Sp Sets values that users are able to set under the \*(L"Account\*(R" tab of their settings page. Only the parameters specified will be updated; to only update the \*(L"name\*(R" attribute, for example, only include that parameter in your request. .Sp Returns: ExtendedUser .RE .IP "\fBupdate_profile_background_image\fR" 4 .IX Item "update_profile_background_image" .PD 0 .IP "\fBupdate_profile_background_image(image)\fR" 4 .IX Item "update_profile_background_image(image)" .RS 4 .IP "Parameters: image, use" 4 .IX Item "Parameters: image, use" .IP "Required: image" 4 .IX Item "Required: image" .RE .RS 4 .PD .Sp Updates the authenticating user's profile background image. The \f(CW\*(C`image\*(C'\fR parameter must be an arrayref with the same interpretation as the \f(CW\*(C`image\*(C'\fR parameter in the \f(CW\*(C`update_profile_image\*(C'\fR method. The \f(CW\*(C`use\*(C'\fR parameter allows you to specify whether to use the uploaded profile background or not. See that method's documentation for details. .Sp Returns: ExtendedUser .RE .IP "\fBupdate_profile_colors\fR" 4 .IX Item "update_profile_colors" .RS 4 .PD 0 .IP "Parameters: profile_background_color, profile_text_color, profile_link_color, profile_sidebar_fill_color, profile_sidebar_border_color" 4 .IX Item "Parameters: profile_background_color, profile_text_color, profile_link_color, profile_sidebar_fill_color, profile_sidebar_border_color" .IP "Required: \fInone\fR" 4 .IX Item "Required: none" .RE .RS 4 .PD .Sp Sets one or more hex values that control the color scheme of the authenticating user's profile page on twitter.com. These values are also returned in the /users/show \s-1API\s0 method. .Sp Returns: ExtendedUser .RE .IP "\fBupdate_profile_image\fR" 4 .IX Item "update_profile_image" .PD 0 .IP "\fBupdate_profile_image(image)\fR" 4 .IX Item "update_profile_image(image)" .RS 4 .IP "Parameters: image" 4 .IX Item "Parameters: image" .IP "Required: image" 4 .IX Item "Required: image" .RE .RS 4 .PD .Sp Updates the authenticating user's profile image. The \f(CW\*(C`image\*(C'\fR parameter is an arrayref with the following interpretation: .Sp .Vb 4 \& [ $file ] \& [ $file, $filename ] \& [ $file, $filename, Content_Type => $mime_type ] \& [ undef, $filename, Content_Type => $mime_type, Content => $raw_image_data ] .Ve .Sp The first value of the array (\f(CW$file\fR) is the name of a file to open. The second value (\f(CW$filename\fR) is the name given to Twitter for the file. If \&\f(CW$filename\fR is not provided, the basename portion of \f(CW$file\fR is used. If \&\f(CW$mime_type\fR is not provided, it will be provided automatically using \&\fBLWP::MediaTypes::guess_media_type()\fR. .Sp \&\f(CW$raw_image_data\fR can be provided, rather than opening a file, by passing \&\f(CW\*(C`undef\*(C'\fR as the first array value. .Sp Returns: ExtendedUser .RE .IP "\fBupdate_with_media\fR" 4 .IX Item "update_with_media" .PD 0 .IP "\fBupdate_with_media(status, media)\fR" 4 .IX Item "update_with_media(status, media)" .RS 4 .IP "Parameters: status, media[], possibly_sensitive, in_reply_to_status_id, lat, long, place_id, display_coordinates" 4 .IX Item "Parameters: status, media[], possibly_sensitive, in_reply_to_status_id, lat, long, place_id, display_coordinates" .IP "Required: status, media" 4 .IX Item "Required: status, media" .RE .RS 4 .PD .Sp Updates the authenticating user's status and attaches media for upload. .Sp The \f(CW\*(C`media[]\*(C'\fR parameter is an arrayref with the following interpretation: .Sp .Vb 4 \& [ $file ] \& [ $file, $filename ] \& [ $file, $filename, Content_Type => $mime_type ] \& [ undef, $filename, Content_Type => $mime_type, Content => $raw_image_data ] .Ve .Sp The first value of the array (\f(CW$file\fR) is the name of a file to open. The second value (\f(CW$filename\fR) is the name given to Twitter for the file. If \&\f(CW$filename\fR is not provided, the basename portion of \f(CW$file\fR is used. If \&\f(CW$mime_type\fR is not provided, it will be provided automatically using \&\fBLWP::MediaTypes::guess_media_type()\fR. .Sp \&\f(CW$raw_image_data\fR can be provided, rather than opening a file, by passing \&\f(CW\*(C`undef\*(C'\fR as the first array value. .Sp The Tweet text will be rewritten to include the media \s-1URL\s0(s), which will reduce the number of characters allowed in the Tweet text. If the \s-1URL\s0(s) cannot be appended without text truncation, the tweet will be rejected and this method will return an \s-1HTTP 403\s0 error. .Sp Returns: Status .RE .IP "\fBuser_suggestions\fR" 4 .IX Item "user_suggestions" .PD 0 .IP "\fBuser_suggestions(category)\fR" 4 .IX Item "user_suggestions(category)" .IP "alias: follow_suggestions" 4 .IX Item "alias: follow_suggestions" .RS 4 .IP "Parameters: category, lang" 4 .IX Item "Parameters: category, lang" .IP "Required: category" 4 .IX Item "Required: category" .RE .RS 4 .PD .Sp Access the users in a given category of the Twitter suggested user list and return their most recent status if they are not a protected user. Currently supported values for optional parameter \f(CW\*(C`lang\*(C'\fR are \f(CW\*(C`en\*(C'\fR, \f(CW\*(C`fr\*(C'\fR, \f(CW\*(C`de\*(C'\fR, \f(CW\*(C`es\*(C'\fR, \&\f(CW\*(C`it\*(C'\fR. Does not require authentication. .Sp Returns: ArrayRef .RE .IP "\fBuser_timeline\fR" 4 .IX Item "user_timeline" .RS 4 .PD 0 .IP "Parameters: id, user_id, screen_name, since_id, max_id, count, page, skip_user, trim_user, include_entities, include_rts" 4 .IX Item "Parameters: id, user_id, screen_name, since_id, max_id, count, page, skip_user, trim_user, include_entities, include_rts" .IP "Required: \fInone\fR" 4 .IX Item "Required: none" .RE .RS 4 .PD .Sp Returns the 20 most recent statuses posted from the authenticating user. It's also possible to request another user's timeline via the id parameter. This is the equivalent of the Web /archive page for your own user, or the profile page for a third party. .Sp Returns: ArrayRef[Status] .RE .IP "\fBusers_search\fR" 4 .IX Item "users_search" .PD 0 .IP "\fBusers_search(q)\fR" 4 .IX Item "users_search(q)" .IP "alias: find_people" 4 .IX Item "alias: find_people" .IP "alias: search_users" 4 .IX Item "alias: search_users" .RS 4 .IP "Parameters: q, per_page, page, include_entities" 4 .IX Item "Parameters: q, per_page, page, include_entities" .IP "Required: q" 4 .IX Item "Required: q" .RE .RS 4 .PD .Sp Run a search for users similar to Find People button on Twitter.com; the same results returned by people search on Twitter.com will be returned by using this \&\s-1API\s0 (about being listed in the People Search). It is only possible to retrieve the first 1000 matches from this \s-1API.\s0 .Sp Returns: ArrayRef[Users] .RE .IP "\fBverify_credentials\fR" 4 .IX Item "verify_credentials" .PD 0 .IP "\fBverify_credentials(include_entities)\fR" 4 .IX Item "verify_credentials(include_entities)" .RS 4 .IP "Parameters: include_entities" 4 .IX Item "Parameters: include_entities" .IP "Required: \fInone\fR" 4 .IX Item "Required: none" .RE .RS 4 .PD .Sp Returns an \s-1HTTP 200 OK\s0 response code and a representation of the requesting user if authentication was successful; returns a 401 status code and an error message if not. Use this method to test if supplied user credentials are valid. .Sp Returns: ExtendedUser .RE .SH "Search API Methods" .IX Header "Search API Methods" .IP "\fBsearch\fR" 4 .IX Item "search" .PD 0 .IP "\fBsearch(q)\fR" 4 .IX Item "search(q)" .RS 4 .IP "Parameters: q, callback, lang, locale, rpp, page, since_id, until, geocode, show_user, result_type" 4 .IX Item "Parameters: q, callback, lang, locale, rpp, page, since_id, until, geocode, show_user, result_type" .IP "Required: q" 4 .IX Item "Required: q" .RE .RS 4 .PD .Sp Returns a \s-1HASH\s0 reference with some meta-data about the query including the \&\f(CW\*(C`next_page\*(C'\fR, \f(CW\*(C`refresh_url\*(C'\fR, and \f(CW\*(C`max_id\*(C'\fR. The statuses are returned in \&\f(CW\*(C`results\*(C'\fR. To iterate over the results, use something similar to: .Sp .Vb 4 \& my $r = $nt\->search($searh_term); \& for my $status ( @{$r\->{results}} ) { \& print "$status\->{text}\en"; \& } .Ve .Sp Returns: HashRef .RE .SH "ERROR HANDLING" .IX Header "ERROR HANDLING" When \f(CW\*(C`Net::Twitter::Lite\*(C'\fR encounters a Twitter \s-1API\s0 error or a network error, it throws a \f(CW\*(C`Net::Twitter::Lite::Error\*(C'\fR object. You can catch and process these exceptions by using \f(CW\*(C`eval\*(C'\fR blocks and testing $@: .PP .Vb 2 \& eval { \& my $statuses = $nt\->friends_timeline(); # this might die! \& \& for my $status ( @$statuses ) { \& #... \& } \& }; \& if ( $@ ) { \& # friends_timeline encountered an error \& \& if ( blessed $@ && $@\->isa(\*(AqNet::Twitter::Lite::Error\*(Aq ) { \& #... use the thrown error obj \& warn $@\->error; \& } \& else { \& # something bad happened! \& die $@; \& } \& } .Ve .PP \&\f(CW\*(C`Net::Twitter::Lite::Error\*(C'\fR stringifies to something reasonable, so if you don't need detailed error information, you can simply treat $@ as a string: .PP .Vb 4 \& eval { $nt\->update($status) }; \& if ( $@ ) { \& warn "update failed because: $@\en"; \& } .Ve .SH "AUTHENTICATION" .IX Header "AUTHENTICATION" Net::Twitter::Lite currently supports both Basic Authentication and OAuth. The choice of authentication strategies is determined by the options passed to \&\f(CW\*(C`new\*(C'\fR or the use of the \f(CW\*(C`credentials\*(C'\fR method. An error will be thrown if options for both strategies are provided. .SS "\s-1BASIC AUTHENTICATION\s0" .IX Subsection "BASIC AUTHENTICATION" To use Basic Authentication, pass the \f(CW\*(C`username\*(C'\fR and \f(CW\*(C`password\*(C'\fR options to \&\f(CW\*(C`new\*(C'\fR, or call \f(CW\*(C`credentials\*(C'\fR to set them. When Basic Authentication is used, the \f(CW\*(C`Authorization\*(C'\fR header is set on each authenticated \s-1API\s0 call. .SS "\s-1OAUTH AUTHENTICATION\s0" .IX Subsection "OAUTH AUTHENTICATION" To use OAuth authentication, pass the \f(CW\*(C`consumer_key\*(C'\fR and \f(CW\*(C`consumer_secret\*(C'\fR options to new. .PP Net::OAuth::Simple must be installed in order to use OAuth and an error will be thrown if OAuth is attempted without it. Net::Twitter::Lite does not \&\fIrequire\fR Net::OAuth::Simple, making OAuth an optional feature. .SS "\s-1OAUTH EXAMPLES\s0" .IX Subsection "OAUTH EXAMPLES" See the \f(CW\*(C`examples\*(C'\fR directory included in this distribution for full working examples using OAuth. .PP Here's how to authorize users as a desktop app mode: .PP .Vb 1 \& use Net::Twitter::Lite; \& \& my $nt = Net::Twitter::Lite\->new( \& consumer_key => "YOUR\-CONSUMER\-KEY", \& consumer_secret => "YOUR\-CONSUMER\-SECRET", \& ); \& \& # You\*(Aqll save the token and secret in cookie, config file or session database \& my($access_token, $access_token_secret) = restore_tokens(); \& if ($access_token && $access_token_secret) { \& $nt\->access_token($access_token); \& $nt\->access_token_secret($access_token_secret); \& } \& \& unless ( $nt\->authorized ) { \& # The client is not yet authorized: Do it now \& print "Authorize this app at ", $nt\->get_authorization_url, " and enter the PIN#\en"; \& \& my $pin = ; # wait for input \& chomp $pin; \& \& my($access_token, $access_token_secret, $user_id, $screen_name) = \& $nt\->request_access_token(verifier => $pin); \& save_tokens($access_token, $access_token_secret); # if necessary \& } \& \& # Everything\*(Aqs ready .Ve .PP In a web application mode, you need to save the oauth_token and oauth_token_secret somewhere when you redirect the user to the OAuth authorization \s-1URL.\s0 .PP .Vb 2 \& sub twitter_authorize : Local { \& my($self, $c) = @_; \& \& my $nt = Net::Twitter::Lite\->new(%param); \& my $url = $nt\->get_authorization_url(callback => $callbackurl); \& \& $c\->response\->cookies\->{oauth} = { \& value => { \& token => $nt\->request_token, \& token_secret => $nt\->request_token_secret, \& }, \& }; \& \& $c\->response\->redirect($url); \& } .Ve .PP And when the user returns back, you'll reset those request token and secret to upgrade the request token to access token. .PP .Vb 2 \& sub twitter_auth_callback : Local { \& my($self, $c) = @_; \& \& my %cookie = $c\->request\->cookies\->{oauth}\->value; \& \& my $nt = Net::Twitter::Lite\->new(%param); \& $nt\->request_token($cookie{token}); \& $nt\->request_token_secret($cookie{token_secret}); \& my $verifier = $c\->req\->param\->{oauth_verifier}; \& \& my($access_token, $access_token_secret, $user_id, $screen_name) = \& $nt\->request_access_token(verifier => $verifier); \& \& # Save $access_token and $access_token_secret in the database associated with $c\->user \& } .Ve .PP Later on, you can retrieve and reset those access token and secret before calling any Twitter \s-1API\s0 methods. .PP .Vb 2 \& sub make_tweet : Local { \& my($self, $c) = @_; \& \& my($access_token, $access_token_secret) = ...; \& \& my $nt = Net::Twitter::Lite\->new(%param); \& $nt\->access_token($access_token); \& $nt\->access_token_secret($access_token_secret); \& \& # Now you can call any Net::Twitter::Lite API methods on $nt \& my $status = $c\->req\->param(\*(Aqstatus\*(Aq); \& my $res = $nt\->update({ status => $status }); \& } .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" .IP "Net::Twitter::Lite::WithAPIv1_1" 4 .IX Item "Net::Twitter::Lite::WithAPIv1_1" With support for Twitter \s-1API\s0 v1.1 .IP "Net::Twitter::Lite::Error" 4 .IX Item "Net::Twitter::Lite::Error" The \f(CW\*(C`Net::Twitter::Lite\*(C'\fR exception object. .IP "" 4 .IX Item "" This is the official Twitter \s-1API\s0 documentation. It describes the methods and their parameters in more detail and may be more current than the documentation provided with this module. .IP "LWP::UserAgent::POE" 4 .IX Item "LWP::UserAgent::POE" This LWP::UserAgent compatible class can be used in \s-1POE\s0 based application along with Net::Twitter::Lite to provide concurrent, non-blocking requests. .SH "SUPPORT" .IX Header "SUPPORT" Please report bugs to \f(CW\*(C`bug\-net\-twitter@rt.cpan.org\*(C'\fR, or through the web interface at . .PP Join the Net::Twitter \s-1IRC\s0 channel at . .PP Follow perl_api: . .PP Track Net::Twitter::Lite development at . .SH "AUTHOR" .IX Header "AUTHOR" Marc Mims .SH "CONTRIBUTORS" .IX Header "CONTRIBUTORS" Chris Page .SH "LICENSE" .IX Header "LICENSE" Copyright (c) 2013 Marc Mims .PP This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.