class GoogleDrive::File

Overview

The metadata for a file.

Included Modules

Defined in:

google_drive/models/file.cr

Constructors

Instance Method Summary

Instance methods inherited from module OpenApi::Json

after_initialize after_initialize, clone clone, eql?(o : self) eql?, to_hash : Hash(String, JSON::Any) to_hash, to_json_any : JSON::Any to_json_any

Class methods inherited from module OpenApi::Json

build_from_hash(hash : Hash) build_from_hash, build_from_json_any(json_any : JSON::Any) build_from_json_any

Instance methods inherited from module OpenApi::Validatable

list_invalid_properties : Array(String) list_invalid_properties, list_invalid_properties_for(key : String) : Array(String) list_invalid_properties_for, valid? : Bool valid?, validate : Nil validate

Instance methods inherited from module JSON::Serializable

to_hash : JSON::Any to_hash

Class methods inherited from module JSON::Serializable

build_from_hash(hash : JSON::Any) build_from_hash

Constructor Detail

def self.new(pull : JSON::PullParser) #

[View source]
def self.new(*, app_properties : Hash(String, String) | Nil = nil, capabilities : GoogleDrive::FileCapabilities | Nil = nil, content_hints : GoogleDrive::FileContentHints | Nil = nil, content_restrictions : Array(GoogleDrive::ContentRestriction) | Nil = nil, copy_requires_writer_permission : Bool | Nil = nil, created_time : Time | Nil = nil, description : String | Nil = nil, drive_id : String | Nil = nil, explicitly_trashed : Bool | Nil = nil, export_links : Hash(String, String) | Nil = nil, file_extension : String | Nil = nil, folder_color_rgb : String | Nil = nil, full_file_extension : String | Nil = nil, has_augmented_permissions : Bool | Nil = nil, has_thumbnail : Bool | Nil = nil, head_revision_id : String | Nil = nil, icon_link : String | Nil = nil, id : String | Nil = nil, image_media_metadata : GoogleDrive::FileImageMediaMetadata | Nil = nil, is_app_authorized : Bool | Nil = nil, kind : String | Nil = "drive#file", label_info : GoogleDrive::FileLabelInfo | Nil = nil, last_modifying_user : GoogleDrive::User | Nil = nil, link_share_metadata : GoogleDrive::FileLinkShareMetadata | Nil = nil, md5_checksum : String | Nil = nil, mime_type : String | Nil = nil, modified_by_me : Bool | Nil = nil, modified_by_me_time : Time | Nil = nil, modified_time : Time | Nil = nil, name : String | Nil = nil, original_filename : String | Nil = nil, owned_by_me : Bool | Nil = nil, owners : Array(GoogleDrive::User) | Nil = nil, parents : Array(String) | Nil = nil, permission_ids : Array(String) | Nil = nil, permissions : Array(GoogleDrive::Permission) | Nil = nil, properties : Hash(String, String) | Nil = nil, quota_bytes_used : String | Nil = nil, resource_key : String | Nil = nil, sha1_checksum : String | Nil = nil, sha256_checksum : String | Nil = nil, shared : Bool | Nil = nil, shared_with_me_time : Time | Nil = nil, sharing_user : GoogleDrive::User | Nil = nil, shortcut_details : GoogleDrive::FileShortcutDetails | Nil = nil, size : String | Nil = nil, spaces : Array(String) | Nil = nil, starred : Bool | Nil = nil, team_drive_id : String | Nil = nil, thumbnail_link : String | Nil = nil, thumbnail_version : String | Nil = nil, trashed : Bool | Nil = nil, trashed_time : Time | Nil = nil, trashing_user : GoogleDrive::User | Nil = nil, version : String | Nil = nil, video_media_metadata : GoogleDrive::FileVideoMediaMetadata | Nil = nil, viewed_by_me : Bool | Nil = nil, viewed_by_me_time : Time | Nil = nil, viewers_can_copy_content : Bool | Nil = nil, web_content_link : String | Nil = nil, web_view_link : String | Nil = nil, writers_can_share : Bool | Nil = nil) #

Initializes the object @param [Hash] attributes Model attributes in the form of hash


[View source]

Instance Method Detail

def ==(other : self) #

Generates #hash and #== methods from all fields #== @return [Bool] #hash calculates hash code according to all attributes. #hash @return [UInt64] Hash code


def app_properties : Hash(String, String) | Nil #

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 a OAuth 2 client ID. You cannot use an API key to retrieve private properties.


[View source]
def app_properties=(new_value : Hash(String, String) | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] app_properties Object to be assigned


[View source]
def capabilities : GoogleDrive::FileCapabilities | Nil #

[View source]
def capabilities=(new_value : GoogleDrive::FileCapabilities | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] capabilities Object to be assigned


[View source]
def content_hints : GoogleDrive::FileContentHints | Nil #

[View source]
def content_hints=(new_value : GoogleDrive::FileContentHints | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] content_hints Object to be assigned


[View source]
def content_restrictions : Array(GoogleDrive::ContentRestriction) | Nil #

Restrictions for accessing the content of the file. Only populated if such a restriction exists.


[View source]
def content_restrictions=(new_value : Array(GoogleDrive::ContentRestriction) | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] content_restrictions Object to be assigned


[View source]
def copy_requires_writer_permission : Bool | Nil #

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


[View source]
def copy_requires_writer_permission=(new_value : Bool | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] copy_requires_writer_permission Object to be assigned


[View source]
def created_time : Time | Nil #

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


[View source]
def created_time=(new_value : Time | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] created_time Object to be assigned


[View source]
def description : String | Nil #

A short description of the file.


[View source]
def description=(new_value : String | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] description Object to be assigned


[View source]
def drive_id : String | Nil #

ID of the shared drive the file resides in. Only populated for items in shared drives.


[View source]
def drive_id=(new_value : String | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] drive_id Object to be assigned


[View source]
def explicitly_trashed : Bool | Nil #

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


[View source]
def explicitly_trashed=(new_value : Bool | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] explicitly_trashed Object to be assigned


[View source]
def export_links : Hash(String, String) | Nil #

Links for exporting Docs Editors files to specific formats.


[View source]
def export_links=(new_value : Hash(String, String) | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] export_links Object to be assigned


[View source]
def file_extension : String | Nil #

The final component of fullFileExtension. This is only available for files with binary content in Google Drive.


[View source]
def file_extension=(new_value : String | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] file_extension Object to be assigned


[View source]
def folder_color_rgb : String | Nil #

The color for a folder or shortcut to a folder as an RGB hex string. The supported colors are published in the folderColorPalette field of the About resource. If an unsupported color is specified, the closest color in the palette will be used instead.


[View source]
def folder_color_rgb=(new_value : String | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] folder_color_rgb Object to be assigned


[View source]
def full_file_extension : String | Nil #

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 isn't cleared if the new name does not contain a valid extension.


[View source]
def full_file_extension=(new_value : String | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] full_file_extension Object to be assigned


[View source]
def has_augmented_permissions : Bool | Nil #

Whether there are permissions directly on this file. This field is only populated for items in shared drives.


[View source]
def has_augmented_permissions=(new_value : Bool | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] has_augmented_permissions Object to be assigned


[View source]
def has_thumbnail : Bool | Nil #

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 thumbnailLink field.


[View source]
def has_thumbnail=(new_value : Bool | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] has_thumbnail Object to be assigned


[View source]
def hash(hasher) #

Generates #hash and #== methods from all fields #== @return [Bool] #hash calculates hash code according to all attributes. #hash @return [UInt64] Hash code


def head_revision_id : String | Nil #

The ID of the file's head revision. This is currently only available for files with binary content in Google Drive.


[View source]
def head_revision_id=(new_value : String | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] head_revision_id Object to be assigned


[View source]
def icon_link : String | Nil #

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


[View source]
def icon_link=(new_value : String | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] icon_link Object to be assigned


[View source]
def id : String | Nil #

The ID of the file.


[View source]
def id=(new_value : String | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] id Object to be assigned


[View source]
def image_media_metadata : GoogleDrive::FileImageMediaMetadata | Nil #

[View source]
def image_media_metadata=(new_value : GoogleDrive::FileImageMediaMetadata | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] image_media_metadata Object to be assigned


[View source]
def is_app_authorized : Bool | Nil #

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


[View source]
def is_app_authorized=(new_value : Bool | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] is_app_authorized Object to be assigned


[View source]
def kind : String | Nil #

Identifies what kind of resource this is. Value: the fixed string "drive#file".


[View source]
def kind=(new_value : String | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] kind Object to be assigned


[View source]
def label_info : GoogleDrive::FileLabelInfo | Nil #

[View source]
def label_info=(new_value : GoogleDrive::FileLabelInfo | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] label_info Object to be assigned


[View source]
def last_modifying_user : GoogleDrive::User | Nil #

[View source]
def last_modifying_user=(new_value : GoogleDrive::User | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] last_modifying_user Object to be assigned


[View source]
def link_share_metadata : GoogleDrive::FileLinkShareMetadata | Nil #

[View source]
def link_share_metadata=(new_value : GoogleDrive::FileLinkShareMetadata | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] link_share_metadata Object to be assigned


[View source]
def list_invalid_properties : Array(String) #

Show invalid properties with the reasons. Usually used together with valid? @return Array for valid properties with the reasons


[View source]
def md5_checksum : String | Nil #

The MD5 checksum for the content of the file. This is only applicable to files with binary content in Google Drive.


[View source]
def md5_checksum=(new_value : String | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] md5_checksum Object to be assigned


[View source]
def mime_type : String | Nil #

The MIME type of the file. Google Drive will attempt 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 will be imported if possible. The supported import formats are published in the About resource.


[View source]
def mime_type=(new_value : String | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] mime_type Object to be assigned


[View source]
def modified_by_me : Bool | Nil #

Whether the file has been modified by this user.


[View source]
def modified_by_me=(new_value : Bool | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] modified_by_me Object to be assigned


[View source]
def modified_by_me_time : Time | Nil #

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


[View source]
def modified_by_me_time=(new_value : Time | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] modified_by_me_time Object to be assigned


[View source]
def modified_time : Time | Nil #

The last time the file was modified by anyone (RFC 3339 date-time). Note that setting modifiedTime will also update modifiedByMeTime for the user.


[View source]
def modified_time=(new_value : Time | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] modified_time Object to be assigned


[View source]
def name : String | Nil #

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.


[View source]
def name=(new_value : String | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] name Object to be assigned


[View source]
def original_filename : String | Nil #

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.


[View source]
def original_filename=(new_value : String | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] original_filename Object to be assigned


[View source]
def owned_by_me : Bool | Nil #

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


[View source]
def owned_by_me=(new_value : Bool | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] owned_by_me Object to be assigned


[View source]
def owners : Array(GoogleDrive::User) | Nil #

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.


[View source]
def owners=(new_value : Array(GoogleDrive::User) | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] owners Object to be assigned


[View source]
def parents : Array(String) | Nil #

The IDs of the parent folders which contain the file. If not specified as part of a create request, the file will be placed directly in the user's My Drive folder. If not specified as part of a copy request, the file will inherit any discoverable parents of the source file. Update requests must use the addParents and removeParents parameters to modify the parents list.


[View source]
def parents=(new_value : Array(String) | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] parents Object to be assigned


[View source]
def permission_ids : Array(String) | Nil #

List of permission IDs for users with access to this file.


[View source]
def permission_ids=(new_value : Array(String) | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] permission_ids Object to be assigned


[View source]
def permissions : Array(GoogleDrive::Permission) | Nil #

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.


[View source]
def permissions=(new_value : Array(GoogleDrive::Permission) | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] permissions Object to be assigned


[View source]
def properties : Hash(String, String) | Nil #

A collection of arbitrary key-value pairs which are visible to all apps. Entries with null values are cleared in update and copy requests.


[View source]
def properties=(new_value : Hash(String, String) | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] properties Object to be assigned


[View source]
def quota_bytes_used : String | Nil #

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


[View source]
def quota_bytes_used=(new_value : String | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] quota_bytes_used Object to be assigned


[View source]
def resource_key : String | Nil #

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


[View source]
def resource_key=(new_value : String | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] resource_key Object to be assigned


[View source]
def sha1_checksum : String | Nil #

The SHA1 checksum associated with this file, if available. This field is only populated for files with content stored in Google Drive; it isn't populated for Docs Editors or shortcut files.


[View source]
def sha1_checksum=(new_value : String | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] sha1_checksum Object to be assigned


[View source]
def sha256_checksum : String | Nil #

The SHA256 checksum associated with this file, if available. This field is only populated for files with content stored in Google Drive; it isn't populated for Docs Editors or shortcut files.


[View source]
def sha256_checksum=(new_value : String | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] sha256_checksum Object to be assigned


[View source]
def shared : Bool | Nil #

Whether the file has been shared. Not populated for items in shared drives.


[View source]
def shared=(new_value : Bool | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] shared Object to be assigned


[View source]
def shared_with_me_time : Time | Nil #

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


[View source]
def shared_with_me_time=(new_value : Time | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] shared_with_me_time Object to be assigned


[View source]
def sharing_user : GoogleDrive::User | Nil #

[View source]
def sharing_user=(new_value : GoogleDrive::User | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] sharing_user Object to be assigned


[View source]
def shortcut_details : GoogleDrive::FileShortcutDetails | Nil #

[View source]
def shortcut_details=(new_value : GoogleDrive::FileShortcutDetails | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] shortcut_details Object to be assigned


[View source]
def size : String | Nil #

The size of the file's content in bytes. This is applicable to binary files in Google Drive and Google Docs files.


[View source]
def size=(new_value : String | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] size Object to be assigned


[View source]
def spaces : Array(String) | Nil #

The list of spaces which contain the file. The currently supported values are 'drive', 'appDataFolder' and 'photos'.


[View source]
def spaces=(new_value : Array(String) | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] spaces Object to be assigned


[View source]
def starred : Bool | Nil #

Whether the user has starred the file.


[View source]
def starred=(new_value : Bool | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] starred Object to be assigned


[View source]
def team_drive_id : String | Nil #

Deprecated - use driveId instead.


[View source]
def team_drive_id=(new_value : String | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] team_drive_id Object to be assigned


[View source]
def thumbnail_link : String | Nil #

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.


[View source]
def thumbnail_link=(new_value : String | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] thumbnail_link Object to be assigned


[View source]
def thumbnail_version : String | Nil #

The thumbnail version for use in thumbnail cache invalidation.


[View source]
def thumbnail_version=(new_value : String | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] thumbnail_version Object to be assigned


[View source]
def trashed : Bool | Nil #

Whether the file has been trashed, either explicitly or from a trashed parent folder. Only the owner may trash a file. The trashed item is excluded from all files.list responses returned for any user who does not own the file. However, all users with access to the file can see the trashed item metadata in an API response. All users with access can copy, download, export, and share the file.


[View source]
def trashed=(new_value : Bool | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] trashed Object to be assigned


[View source]
def trashed_time : Time | Nil #

The time that the item was trashed (RFC 3339 date-time). Only populated for items in shared drives.


[View source]
def trashed_time=(new_value : Time | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] trashed_time Object to be assigned


[View source]
def trashing_user : GoogleDrive::User | Nil #

[View source]
def trashing_user=(new_value : GoogleDrive::User | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] trashing_user Object to be assigned


[View source]
def valid? : Bool #

Check to see if the all the properties in the model are valid @return true if the model is valid


[View source]
def version : String | Nil #

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.


[View source]
def version=(new_value : String | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] version Object to be assigned


[View source]
def video_media_metadata : GoogleDrive::FileVideoMediaMetadata | Nil #

[View source]
def video_media_metadata=(new_value : GoogleDrive::FileVideoMediaMetadata | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] video_media_metadata Object to be assigned


[View source]
def viewed_by_me : Bool | Nil #

Whether the file has been viewed by this user.


[View source]
def viewed_by_me=(new_value : Bool | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] viewed_by_me Object to be assigned


[View source]
def viewed_by_me_time : Time | Nil #

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


[View source]
def viewed_by_me_time=(new_value : Time | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] viewed_by_me_time Object to be assigned


[View source]
def viewers_can_copy_content : Bool | Nil #

Deprecated - use copyRequiresWriterPermission instead.


[View source]
def viewers_can_copy_content=(new_value : Bool | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] viewers_can_copy_content Object to be assigned


[View source]
def web_content_link : String | Nil #

A link for downloading the content of the file in a browser. This is only available for files with binary content in Google Drive.


[View source]
def web_content_link=(new_value : String | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] web_content_link Object to be assigned


[View source]
def web_view_link : String | Nil #

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


[View source]
def web_view_link=(new_value : String | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] web_view_link Object to be assigned


[View source]
def writers_can_share : Bool | Nil #

Whether users with only writer permission can modify the file's permissions. Not populated for items in shared drives.


[View source]
def writers_can_share=(new_value : Bool | Nil) #

Custom attribute writer method checking allowed values (enum). @param [Object] writers_can_share Object to be assigned


[View source]