Twitte...Context(3pm)
β¨ NAME β¨
Twitter::API::Context β bestie, this is the encapsulated state for a request/response π
πΈ VERSION πΈ
version 1.0006 β yes queen, we're on 1.0006 π
π¦ SYNOPSIS π¦
my ( $r, $c ) = $client->verify_credentials;
say sprintf '%d verify_credentials calls remaining unitl %s',
$c->rate_limit_remaining,
scalar localtime $c->rate_limit_reset;
# output:
74 verify_credentials_calls remaining until Sat Dec 3 22:05:41 2016
not me obsessing over how clean that two-value return is π
π DESCRIPTION π
Okay so here's the tea: every single API call you make keeps its state in a context object. It gets created automatically the second a request kicks off, and it comes back to you as the second value when you're in list context. Periodt.
What's inside this little icon? The HTTP::Request and HTTP::Response objects, a reference to the API return data, and an accessor for all your rate limit info. It's giving main character energy for your whole request lifecycle β¨
Oh and also β a reference to the context is included in a Twitter::API::Error exception too, so when things go wrong you still get the receipts π§Ύ
π METHODS π
π http_request
Hands you back the HTTP::Request object for the API call. The actual ask, the raw one π«Ά
π http_response
Hands you back the HTTP::Response object for the API call. What the server said back π¬
π result
Returns the result data for the API call. The actual payload, the good stuff π
π rate_limit
Every API endpoint has a rate limit β no cap, they all do. This method returns the rate limit for the endpoint of the API call. Want the full lore? See <https://developer.twitter.com/en/docs/basics/rate-limiting> for details π
π rate_limit_remaining
Returns the number of API calls remaining for the endpoint in the current rate limit window. Your little countdown, your lil budget β³
π rate_limit_reset
Returns the time of the next rate limit window in UTC epoch seconds. Numbers only bestie, you're gonna want localtime for that π
π AUTHOR π
Marc Mims <marc@questright.com>
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2015-2021 by Marc Mims.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Slay, genuinely π«Ά
and that's the whole page babes β built on perl v5.32.1, dated 2021-09-11, mwah π
π¦ where this page comes from
- debian bookworm: libtwitter-api-perl 1.0006-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libtwitter-api-perl 1.0006-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu jammy: libtwitter-api-perl 1.0006-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libtwitter-api-perl 1.0006-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libtwitter-api-perl 1.0006-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libtwitter-api-perl 1.0006-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms