Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: share a file #30

Open
zezzagio opened this issue May 14, 2019 · 0 comments
Open

Feature request: share a file #30

zezzagio opened this issue May 14, 2019 · 0 comments

Comments

@zezzagio
Copy link

zezzagio commented May 14, 2019

This module is actually the simplest one I've found to access Google Drive, yet providing almost all I need... except, for what I can see, a method for sharing a file.

I tried something like this, and it works for my need; it would be better, though, having this as a native feature (possibly with a better, more robust implementation than mine):

package Net::Google::Drive::Simple;

sub file_share {

my( $self, $file_id ) = @_;

my $url = URI->new( $self->{ api_file_url } . '/' . $file_id . '/permissions' );

my $data = $self->http_json( $url, {
file_id => $file_id,
    type    => 'anyone',
    role  => 'reader',
    withLink  => 'true'
} );

if( ! defined $data ) {
    return undef;
}

my $metadata = $self->file_metadata($file_id);

return $metadata->{webContentLink};

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant