1Net::Twitter::WrappedReUssuelrt(C3o)ntributed Perl DocumNeentt:a:tTiwointter::WrappedResult(3)
2
3
4
6 Net::Twitter::WrappedResult - Wrap an HTTP response and Twitter result
7
9 version 4.01043
10
12 use Net::Twitter;
13
14 my $nt = Net::Twitter->new(
15 traits => [ qw/API::RESTv1_1 WrapResult/ ],
16 %other_new_options,
17 );
18
19 my $r = $nt->verify_credentials;
20
21 my $http_response = $r->http_response;
22 my $twitter_result = $r->result;
23 my $rate_limit_remaining = $r->rate_limit_remaining;
24
26 Often, the result of a Twitter API call, inflated from the JSON body of
27 the HTTP response does not contain all the information you need.
28 Twitter includes meta data, such as rate limiting information, in HTTP
29 response headers. This object wraps both the inflated Twitter result
30 and the HTTP response giving the caller full access to all the meta
31 data. It also provides accessors for the rate limit information.
32
34 new(result => $twitter_result, http_response => $http_response)
35 Constructs an object wrapping the Twitter result and HTTP response.
36
37 result
38 Returns the Twitter API result, i.e., the decode JSON response
39 body.
40
41 http_response
42 Returns the HTTP::Response object for the API call.
43
44 rate_limit
45 Returns the rate limit, per 15 minute window, for the API endpoint
46 called. Returns undef if no suitable rate limit header is
47 available.
48
49 rate_limit_remaining
50 Returns the calls remaining in the current 15 minute window for the
51 API endpoint called. Returns undef if no suitable header is
52 available.
53
54 rate_limit_reset
55 Returns the Unix epoch time time of the next 15 minute window,
56 i.e., when the rate limit will be reset, for the API endpoint
57 called. Returns undef if no suitable header is available.
58
60 Marc Mims <marc@questright.com>
61
63 Copyright (c) 2016 Marc Mims
64
65 This program is free software; you can redistribute it and/or modify it
66 under the same terms as perl itself.
67
68
69
70perl v5.34.0 2021-07-22 Net::Twitter::WrappedResult(3)