logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Net::Twitter::Lite::WrapResult - Wrap the HTTP response and Twitter result

Author

       Marc Mims <marc@questright.com>

Description

       Often, the result of a Twitter API call, inflated from the JSON body of the HTTP response does not
       contain all the information you need. Twitter includes meta data, such as rate limiting information, in
       HTTP response headers. This object wraps both the inflated Twitter result and the HTTP response giving
       the caller full access to all the meta data. It also provides accessors for the rate limit information.

Methods

       new($twitter_result, $http_response)
           Constructs an object wrapping the Twitter result and HTTP response.

       result
           Returns the inflated Twitter API result.

       http_response
           Returns the HTTP::Response object for the API call.

       rate_limit
           Returns  the  rate  limit,  per  15  minute window, for the API endpoint called.  Returns undef if no
           suitable rate limit header is available.

       rate_limit_remaining
           Returns the calls remaining in the current 15 minute window for the  API  endpoint  called.   Returns
           undef if no suitable header is available.

       rate_limit_reset
           Returns  the  unix  epoch  time  time of the next 15 minute window, i.e., when the rate limit will be
           reset, for the API endpoint called.  Returns undef if no suitable header is available.

Name

       Net::Twitter::Lite::WrapResult - Wrap the HTTP response and Twitter result

Synopsis

           use Net::Twitter::Lite::WithAPIv1_1;

           my $nt = Net::Twitter::Lite::WithAPIv1_1->new(
               consumer_key        => $consumer_key,
               consumer_secret     => $consumer_secret,
               access_token        => $access_token,
               access_token_secret => $access_token_secret,
               wrap_result         => 1,
           );

           my $r = $nt->verify_credentials;

           my $http_response        = $r->http_response;
           my $twitter_result       = $r->result;
           my $rate_limit_remaining = $r->rate_limit_remaining;

Version

       version 0.12008

See Also