File

Struct File 

Source
pub struct File {
Show 60 fields pub kind: Option<String>, pub drive_id: Option<String>, pub file_extension: Option<String>, pub copy_requires_writer_permission: Option<bool>, pub md5_checksum: Option<String>, pub content_hints: Option<ContentHints>, pub writers_can_share: Option<bool>, pub viewed_by_me: Option<bool>, pub mime_type: Option<String>, pub export_links: Option<Map<String, Value>>, pub parents: Option<Vec<String>>, pub thumbnail_link: Option<String>, pub icon_link: Option<String>, pub shared: Option<bool>, pub last_modifying_user: Option<User>, pub owners: Option<Vec<User>>, pub head_revision_id: Option<String>, pub sharing_user: Option<User>, pub web_view_link: Option<String>, pub web_content_link: Option<String>, pub size: Option<String>, pub permissions: Option<Vec<Permission>>, pub has_thumbnail: Option<bool>, pub spaces: Option<Vec<String>>, pub folder_color_rgb: Option<String>, pub id: Option<String>, pub name: Option<String>, pub description: Option<String>, pub starred: Option<bool>, pub trashed: Option<bool>, pub explicitly_trashed: Option<bool>, pub created_time: Option<String>, pub modified_time: Option<String>, pub modified_by_me_time: Option<String>, pub viewed_by_me_time: Option<String>, pub shared_with_me_time: Option<String>, pub quota_bytes_used: Option<String>, pub version: Option<String>, pub original_filename: Option<String>, pub owned_by_me: Option<bool>, pub full_file_extension: Option<String>, pub properties: Option<Map<String, Value>>, pub app_properties: Option<Map<String, Value>>, pub is_app_authorized: Option<bool>, pub capabilities: Option<FileCapabilities>, pub has_augmented_permissions: Option<bool>, pub trashing_user: Option<User>, pub thumbnail_version: Option<String>, pub trashed_time: Option<String>, pub modified_by_me: Option<bool>, pub permission_ids: Option<Vec<String>>, pub image_media_metadata: Option<ImageMediaMetadata>, pub video_media_metadata: Option<VideoMediaMetadata>, pub shortcut_details: Option<ShortcutDetails>, pub content_restrictions: Option<Vec<ContentRestriction>>, pub resource_key: Option<String>, pub link_share_metadata: Option<LinkShareMetadata>, pub label_info: Option<LabelInfo>, pub sha1_checksum: Option<String>, pub sha256_checksum: Option<String>,
}
Expand description

The metadata for a file.

Some resource methods (such as files.update) require a fileId. Use the files.list method to retrieve the ID for a file.

See Google’s documentation for a full list and more detailed information.

§Warning

Fields like teamDriveId are not included in this struct, since they are marked as deprecated in Google’s documentation.

§Note

All of the fields of File are an Option<T> since the values that Google’s API will return are dependent on the fields requested, by default all fields will be requested but if you change this value only the specified fields will be Some<T>, the rest will be None.

Fields§

§kind: Option<String>

Identifies what kind of resource this is.

Value: the fixed string “drive#file”.

§drive_id: Option<String>

ID of the shared drive the file resides in.

Only populated for items in shared drives.

§file_extension: Option<String>

The final component of fullFileExtension.

This is only available for files with binary content in Google Drive.

§copy_requires_writer_permission: Option<bool>

Whether the options to copy, print, or download this file, should be disabled for readers and commenters.

§md5_checksum: Option<String>

The MD5 checksum for the content of the file.

This is only applicable to files with binary content in Google Drive.

§content_hints: Option<ContentHints>

Additional information about the content of the file.

These fields are never populated in responses.

§writers_can_share: Option<bool>

Whether users with only writer permission can modify the file’s permissions.

Not populated for items in shared drives.

§viewed_by_me: Option<bool>

Whether the file has been viewed by this user.

§mime_type: Option<String>

The MIME type of the file.

Google Drive attempts to automatically detect an appropriate value from uploaded content, if no value is provided. The value cannot be changed unless a new revision is uploaded.

If a file is created with a Google Doc MIME type, the uploaded content is imported, if possible. The supported import formats are published in the About resource.

§export_links: Option<Map<String, Value>>

Links for exporting Docs Editors files to specific formats.

§parents: Option<Vec<String>>

The IDs of the parent folders which contain the file.

If not specified as part of a create request, a file is placed directly in the user’s My Drive folder. If not specified as part of a copy request, a file inherits any discoverable parents of the source file. files.update requests must use the addParents and removeParents parameters to modify the parents list.

§thumbnail_link: Option<String>

A short-lived link to the file’s thumbnail, if available.

Typically lasts on the order of hours. Only populated when the requesting app can access the file’s content. If the file isn’t shared publicly, the URL returned in Files.thumbnailLink must be fetched using a credentialed request.

§icon_link: Option<String>

A static, unauthenticated link to the file’s icon.

§shared: Option<bool>

Whether the file has been shared.

Not populated for items in shared drives.

§last_modifying_user: Option<User>

The last user to modify the file.

§owners: Option<Vec<User>>

The owner of this file.

Only certain legacy files may have more than one owner. This field isn’t populated for items in shared drives.

§head_revision_id: Option<String>

The ID of the file’s head revision.

This is currently only available for files with binary content in Google Drive.

§sharing_user: Option<User>

The user who shared the file with the requesting user, if applicable.

§web_view_link: Option<String>

A link for opening the file in a relevant Google editor or viewer in a browser.

§web_content_link: Option<String>

A link for downloading the content of the file in a browser.

This is only available for files with binary content in Google Drive.

§size: Option<String>

Size in bytes of blobs and first party editor files.

Won’t be populated for files that have no size, like shortcuts and folders.

§permissions: Option<Vec<Permission>>

The full list of permissions for the file.

This is only available if the requesting user can share the file. Not populated for items in shared drives.

§has_thumbnail: Option<bool>

Whether this file has a thumbnail.

This does not indicate whether the requesting app has access to the thumbnail. To check access, look for the presence of the thumbnail_link field.

§spaces: Option<Vec<String>>

The list of spaces which contain the file.

The currently supported values are drive, appDataFolder and photos.

§folder_color_rgb: Option<String>

The color for a folder or a shortcut to a folder as an RGB hex string.

The supported colors are published in the folder_color_palette field of the About resource.

§id: Option<String>

The ID of the file.

§name: Option<String>

The name of the file.

This is not necessarily unique within a folder. Note that for immutable items such as the top level folders of shared drives, My Drive root folder, and Application Data folder the name is constant.

§description: Option<String>

A short description of the file.

§starred: Option<bool>

Whether the user has starred the file.

§trashed: Option<bool>

Whether the file has been trashed, either explicitly or from a trashed parent folder.

Only the owner may trash a file, and other users cannot see files in the owner’s trash.

§explicitly_trashed: Option<bool>

Whether the file has been explicitly trashed, as opposed to recursively trashed from a parent folder.

§created_time: Option<String>

The time at which the file was created (RFC 3339 date-time).

§modified_time: Option<String>

The last time the file was modified by anyone (RFC 3339 date-time).

Note that setting modified_time also updates modified_by_me_time for the user.

§modified_by_me_time: Option<String>

The last time the file was modified by the user (RFC 3339 date-time).

§viewed_by_me_time: Option<String>

The last time the file was viewed by the user (RFC 3339 date-time).

§shared_with_me_time: Option<String>

The time at which the file was shared with the user, if applicable (RFC 3339 date-time).

§quota_bytes_used: Option<String>

The number of storage quota bytes used by the file. This includes the head revision as well as previous revisions with keepForever enabled.

§version: Option<String>

A monotonically increasing version number for the file. This reflects every change made to the file on the server, even those not visible to the user.

§original_filename: Option<String>

The original filename of the uploaded content if available, or else the original value of the name field.

This is only available for files with binary content in Google Drive.

§owned_by_me: Option<bool>

Whether the user owns the file. Not populated for items in shared drives.

§full_file_extension: Option<String>

The full file extension extracted from the name field.

May contain multiple concatenated extensions, such as “tar.gz”. This is only available for files with binary content in Google Drive.

This is automatically updated when the name field changes, however it is not cleared if the new name does not contain a valid extension.

§properties: Option<Map<String, Value>>

A collection of arbitrary key-value pairs which are visible to all apps.

Entries with null values are cleared in update and copy requests.

§app_properties: Option<Map<String, Value>>

A collection of arbitrary key-value pairs which are private to the requesting app.

Entries with null values are cleared in update and copy requests.

These properties can only be retrieved using an authenticated request. An authenticated request uses an access token obtained with an OAuth 2 client ID. You cannot use an API key to retrieve private properties.

§is_app_authorized: Option<bool>

Whether the file was created or opened by the requesting app.

§capabilities: Option<FileCapabilities>

Capabilities the current user has on this file.

Each capability corresponds to a fine-grained action that a user may take.

§has_augmented_permissions: Option<bool>

Whether there are permissions directly on this file.

This field is only populated for items in shared drives.

§trashing_user: Option<User>

If the file has been explicitly trashed, the user who trashed it.

Only populated for items in shared drives.

§thumbnail_version: Option<String>

The thumbnail version for use in thumbnail cache invalidation.

§trashed_time: Option<String>

The time that the item was trashed (RFC 3339 date-time).

Only populated for items in shared drives.

§modified_by_me: Option<bool>

Whether the file has been modified by this user.

§permission_ids: Option<Vec<String>>

files.list of permission IDs for users with access to this file.

§image_media_metadata: Option<ImageMediaMetadata>

Additional metadata about image media, if available.

§video_media_metadata: Option<VideoMediaMetadata>

Additional metadata about video media.

This may not be available immediately upon upload.

§shortcut_details: Option<ShortcutDetails>

Shortcut file details.

Only populated for shortcut files, which have the mime_type field set to application/vnd.google-apps.shortcut.

§content_restrictions: Option<Vec<ContentRestriction>>

Restrictions for accessing the content of the file.

Only populated if such a restriction exists.

§resource_key: Option<String>

A key needed to access the item via a shared link.

§link_share_metadata: Option<LinkShareMetadata>

Contains details about the link URLs that clients are using to refer to this item.

§label_info: Option<LabelInfo>

An overview of the labels on the file.

§sha1_checksum: Option<String>

The SHA1 checksum associated with this file, if available.

This field is only populated for files with content stored in Google Drive; it is not populated for Docs Editors or shortcut files.

§sha256_checksum: Option<String>

The SHA256 checksum associated with this file, if available.

This field is only populated for files with content stored in Google Drive; it is not populated for Docs Editors or shortcut files.

Implementations§

Source§

impl File

Source

pub fn new() -> Self

Creates a new, empty instance of this struct.

Trait Implementations§

Source§

impl Clone for File

Source§

fn clone(&self) -> File

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for File

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for File

Source§

fn default() -> File

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for File

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for File

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Serialize for File

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for File

§

impl RefUnwindSafe for File

§

impl Send for File

§

impl Sync for File

§

impl Unpin for File

§

impl UnwindSafe for File

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,