Net::D...ox::API(3pm)

๐Ÿ“ฆ
version 1.9 ยท 4 versions
, in debian bookworm, debian trixie, ubuntu noble

๐Ÿ’– Net::Dropbox::API ๐Ÿ’–

okay bestie, gather round, because this is Net::Dropbox::API โ€” a whole entire Dropbox API interface, living its best life in the User Contributed Perl Documentation section (3pm). yes it's a Perl module. yes it's iconic. let's get into it ๐Ÿซถ


โœจ NAME โœจ

Net::Dropbox::API โ€” a Dropbox API interface. that's the whole vibe. it talks to Dropbox so you don't have to. ๐Ÿ’…


๐ŸŒธ VERSION ๐ŸŒธ

Version 1.9.8 โ€” periodt.


๐Ÿฆ‹ SYNOPSIS ๐Ÿฆ‹

so the Dropbox API is OAuth-based (iykyk), and this module tries to abstract as much of that away as possible so you don't need to know too much about it. literally the point. here's how it goes:

use Net::Dropbox::API;

my $box = Net::Dropbox::API->new({key => 'KEY', secret => 'SECRET'});
my $login_link = $box->login;  # user needs to click this link and login
$box->auth;                    # oauth keys get exchanged
my $info = $box->account_info; # and here we have our account info

not me making OAuth look easy ๐Ÿ˜ญ see the examples for a working Mojolicious web client using the Dropbox API โ€” it's giving main character energy.

and if you wanna read the source material, Dropbox's API documentation lives at <https://www.dropbox.com/developers/web_docs> โœจ


๐Ÿ’œ FUNCTIONS ๐Ÿ’œ

๐ŸŽ€ login

This sets up the initial OAuth handshake and returns the login URL. this URL has to be clicked by the user and then the user has to accept the application in dropbox. no click, no entry, bestie.

Dropbox then redirects back to the callback URL defined with $self->callback_url. and here's a lil tea: if the user already accepted the application, the redirect may happen without the user actually clicking anywhere. sneaky. ๐Ÿ™ˆ

๐ŸŒˆ auth

The auth method changes the initial request token into access token that we need for subsequent access to the API. You only have to call this method once after login. one and done, slay.

โญ account_info

account_info polls the users info from dropbox. that's it. that's the function. ๐Ÿ‘‘

๐Ÿ“ list

lists all files in the path defined:

$data = $box->list();           # top-level
$data = $box->list( "/Photos" ); # folder

The data returned is a ref to a hash containing various fields returned by Dropbox, including a "hash" value, which can be used later to check if Dropbox data beneath a specified folder has changed since the last call. caching queen behavior.

For this, list() accepts an optional 'hash' argument:

$data = $box->list({ hash => "ce9ccbfb8f255f234c93adcfef33b5a6" },
                   "/Photos");

This will either return

{ http_response_code => 304 }

in which case nothing has changed since the last call โ€” like, at all, no notes โ€” or

{ http_response_code => 200,
  # ... various other fields
}

if there were modifications. changes detected, we love to see it ๐Ÿ”ฅ

๐Ÿงš copy

copies a folder

copy($from, $to)

๐Ÿ’ซ move

move a folder

move($from, $to)

๐ŸŒธ mkdir

creates a folder

mkdir($path)

๐Ÿฆ‹ delete

delete a folder

delete($path)
okay be careful with this one, bestie โ€” it's called delete for a reason ๐Ÿ’€

๐Ÿ’– view

creates a cookie protected link for the user to look at.

view($path)

๐Ÿ‘‘ metadata

creates a cookie protected link for the user to look at.

metadata($path)

๐ŸŽ€ putfile

uploads a file to dropbox

โญ getfile

get a file from dropbox

๐Ÿ’… debug

Set this to a non-false value in order to print some debugging information to STDOUT.

debug(1)

๐Ÿ”ฎ INTERNAL API ๐Ÿ”ฎ

๐Ÿซถ _talk

_talk handles the access to the restricted resources. You should normally not need to access this directly. like, stay out of the kitchen unless you're the chef, yk?

๐Ÿ’œ nonce

Generate a different nonce for every request. fresh nonce every time, no cap. โœจ


๐ŸŒŸ AUTHOR ๐ŸŒŸ

Lenz Gschwendtner, "<norbu09 at cpan.org>"

With Bug fixes from:

  • Greg Knauss "gknauss at eod.com"
  • Chris Prather "chris at prather.org"
  • Shinichiro Aska
  • [ktdreyer]
  • SureVoIP <http://www.surevoip.co.uk>

shoutout to the whole squad, they really carried ๐Ÿซถ


๐Ÿ˜ญ BUGS ๐Ÿ˜ญ

Please report any bugs through the web interface at <https://github.com/norbu09/Net--Dropbox/issues>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. teamwork makes the dream work fr fr.


๐ŸŒˆ SUPPORT ๐ŸŒˆ

You can find documentation for this module with the perldoc command.

perldoc Net::Dropbox::API

You can also look for information at:


Copyright 2010 Lenz Gschwendtner.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See <http://dev.perl.org/licenses/> for more information.


and that's the whole page, bestie ๐ŸŽ€ this was perl v5.34.0, dated 2022-06-16, and it's Net::Dropbox::API โ€” now go forth and API responsibly ๐Ÿ’…โœจ๐Ÿฆ‹

๐Ÿ“ฆ where this page comes from