s-aska/p5-WebService-Dropbox

/2/sharing APIv2 call missing from version 2.05

Closed this issue · 1 comments

tr606 commented

Hi,

I think the sharing APIv2 call that replaces the /shares APIv1 call is not available in v2.05 of the Perl module. See https://www.dropbox.com/developers/documentation/http/documentation#sharing
More specifically I am interested in this call: /2/sharing/get_shared_link_file
(https://www.dropbox.com/developers/documentation/http/documentation#sharing-get_shared_link_file) to retrieve a URL for a file I have just uploaded.
Currently there is no possibility in the Perl APIv2 implementation to retrieve a URL for a file that was just uploaded.
It looks like none of the calls under /2/sharing are implemented in module version 2.05.

I fiddled around with the module a little bit, and I implemented a "working" version with this patch:

hostname:~ root# diff -u /Library/Perl/5.18/WebService/Dropbox/Files.pm.original /Library/Perl/5.18/WebService/Dropbox/Files.pm
--- /Library/Perl/5.18/WebService/Dropbox/Files.pm.original 2016-10-02 12:54:59.000000000 +0200
+++ /Library/Perl/5.18/WebService/Dropbox/Files.pm  2016-10-02 12:52:10.000000000 +0200
@@ -245,4 +245,20 @@
     });
 }

+# https://www.dropbox.com/developers/documentation/http/documentation#sharing
+# /2/sharing/create_shared_link_with_settings
+sub sharing_create_shared_link_with_settings {
+    my ($self, $path, $optional_params) = @_;
+
+    my $params = {
+        path => $path,
+   %{ $optional_params || {} },
+    };
+
+    $self->api({
+   url => 'https://api.dropboxapi.com/2/sharing/create_shared_link_with_settings',
+   params => $params,
+    });
+}
+
 1;

Which allows me to use this Perl call:

                $data = $dropbox->sharing_create_shared_link_with_settings($stripped_article_out_pdf) or do {
. . .

Could you please implement this functionality one way or another. The above code is only "proof-of-concept'...

Best regards!

It is now supported in v2.08.

adc73dd