Net::T...er::API(3pm)

πŸ“¦
version 4.01043 Β· 4 versions
, in debian bookworm, debian trixie, ubuntu noble

πŸ’– Net::Twitter::API πŸ’–

okay bestie, you found the manual page for Net::Twitter::API (that's the 3pm one, perl module docs, iykyk) β€” and ngl it's a little gem. it's Moose sugar for defining Twitter API methods, and yes that's the whole vibe. pull up a chair, grab a boba, let's go πŸ§‹βœ¨


✨ VERSION ✨

version 4.01043 β€” that's the one, that's the version, no notes πŸ’…


🌈 SYNOPSIS 🌈

okay so here's how you actually use this thing. watch and learn:

package My::Twitter::API;
use Moose::Role;
use Net::Twitter::API;

use namespace::autoclean;

has apiurl => ( isa => 'Str', is => 'rw', default => 'http://twitter.com' );

base_url 'apiurl';

twitter_api_method friends_timeline => (
    description => <<'',
Returns the 20 most recent statuses posted by the authenticating user
and that user's friends. This is the equivalent of /home on the Web.

    aliases   => [qw/following_timeline/],
    path      => 'statuses/friends_timeline',
    method    => 'GET',
    params    => [qw/since_id max_id count page/],
    required  => [],
    returns   => 'ArrayRef[Status]',
);

1;

like… it's giving declarative. it's giving clean. we love to see it πŸŽ€


πŸ¦‹ DESCRIPTION πŸ¦‹

so basically, this module hands you some Moose sugar for defining Twitter API methods. that's the whole job. it lives inside the Net-Twitter distribution on CPAN, and it's the thing that Net::Twitter::API::RESTv1_1, Net::Twitter::API::Search, and honestly maybe some other little guys are built on top of.

its whole intent β€” and this is a direct quote from the vibes β€” is to make maintaining Net::Twitter as easy as possible. iconic behavior, honestly πŸ‘‘


πŸ’… METHODS πŸ’…

🌸 base_url

Specifies, by name, the attribute which contains the base URL for the defined API.

like you don't hand it a URL, you hand it the name of the attribute that's holding the URL. naming your source of truth? very demure, very mindful 🫢

πŸ“ twitter_api_method

Defines a Twitter API method. and ooh girl, there are a LOT of valid arguments. here's the full list, no skips, no shortcuts:

  • authenticate β€” Specifies whether, by default, API methods calls should authenticate. (yes, the original really does say "methods calls". we're keeping it, it's canon πŸ’€)
  • datetime_parser β€” Specifies the Date::Time::Format derived parser to use for parsing and formatting date strings for the API being defined.
  • description β€” A string describing the method, suitable for documentation.
  • aliases β€” An ARRAY ref of strings containing alternate names for the method. aka the method's many nicknames, its government name AND its stage name ✨
  • path β€” A string containing the path part of the API URL.
  • path_suffix β€” A string containing an additional suffix to append to the path (for legacy reasons). If you want to suffix appended, pass the empty string. Defaults to ".json". (legacy reasons, bestie. we don't ask. we just respect it.)
  • method β€” A string containing the HTTP method for the call. Defaults to "GET".
  • add_source β€” A boolean, indicating whether or not the "source" parameter should be added to the API call. (The source value is assigned by Twitter for registered applications.) Defaults to 0.
  • params β€” An ARRAY ref of strings naming all of the valid parameters. Defaults to an empty ARRAY ref.
  • required β€” An ARRAY ref of strings naming all of the required parameters. Defaults to an empty ARRAY ref.
  • returns β€” A string describing the return type of the API method call.
  • deprecated β€” A boolean indicating whether or not this API is deprecated. If set to 1, code for the method will be created. This option is optional, and is used by the "Net-Twitter" distribution when generating documentation. It defaults to 0.
ok real talk: deprecated is a real flag and it really does still generate the code when you set it to 1 β€” so don't go assuming "deprecated" means "gone", because it does not πŸ’€ read it before you yeet it.

πŸ‘‘ AUTHOR πŸ‘‘

Marc Mims <marc@questright.com> β€” the legend, the moment, the whole entire author πŸ’–


πŸ“œ LICENSE πŸ“œ

Copyright (c) 2016 Marc Mims

The Twitter API itself, and the description text used in this module is:

Copyright (c) 2009 Twitter

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. slay, open source queen 🌈


🫢 DISCLAIMER OF WARRANTY 🫢

okay this part is the legal screaming section, and it is SCREAMING in all caps, so buckle up. we're keeping every word because the facts do not change, only the vibe:

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENSE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

translation bestie: it's free, it comes as-is, and if it breaks it is not their problem. periodt. πŸ’…

and that's the whole page!! this doc was generated by perl v5.34.0 on 2022-06-16, and you read it via Net::T...er::API(3pm) β€” yes the header truncates the name like that, it's not a typo, it's just perl being perl. mwah, go build something cute πŸ’–βœ¨

πŸ“¦ where this page comes from