NAME

Google::RestApi::DriveApi3::File - File object for Google Drive.

SYNOPSIS

my $file = $drive->file(id => 'file_id');

# Get file metadata
my $metadata = $file->get();
my $name = $file->get(fields => 'name')->{name};

# Update file
$file->update(name => 'new_name', description => 'new description');

# Copy and delete
my $copy = $file->copy(name => 'copy_of_file');
$file->delete();

# Export (for Google Docs)
my $pdf = $file->export(mime_type => 'application/pdf');

# Watch for changes
$file->watch(id => 'channel-id', address => 'https://example.com/webhook');

# Permissions
my @perms = $file->permissions();
my $perm = $file->permission(id => 'perm_id');
$file->permission()->create(role => 'reader', type => 'anyone');

# Revisions
my @revs = $file->revisions();
my $rev = $file->revision(id => 'rev_id');

# Comments
my @comments = $file->comments();
my $comment = $file->comment(id => 'comment_id');
$file->comment()->create(content => 'Nice work!');

DESCRIPTION

Represents a Google Drive file with full CRUD operations, permissions, revisions, and comments management.

METHODS

get(fields => $fields, params => \%params)

Retrieves file metadata.

update(name => $name, description => $desc, ...)

Updates file metadata. Supports name, description, mime_type, add_parents, and remove_parents parameters.

copy(name => $name)

Creates a copy of the file. Returns a new File object.

delete()

Permanently deletes the file.

export(mime_type => $type)

Exports Google Docs/Sheets/Slides to the specified format.

watch(id => $channel_id, address => $url)

Sets up a notification channel for file changes.

permission(id => $id)

Returns a Permission object. If id is provided, represents that permission. Without id, can be used to create new permissions.

permissions()

Lists all permissions on the file.

revision(id => $id)

Returns a Revision object for the given revision ID.

revisions()

Lists all revisions of the file.

comment(id => $id)

Returns a Comment object. Without id, can be used to create new comments.

comments(include_deleted => $bool)

Lists all comments on the file.

AUTHORS

  • Robin Murray mvsjes@cpan.org

COPYRIGHT

Copyright (c) 2019-2026 Robin Murray. All rights reserved.

This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself.