#' Creates a copy of a file and applies any requested updates with patch semantics.
#'
#' Folders cannot be copied. Autogenerated via \code{\link[googlePackageMaker]{package_make}}.
#'
#' @seealso \href{https://developers.google.com/drive/}{Google Documentation}
#'
#' @details
#' Authentication scopes used by this function are:
#' \itemize{
#' \item https://www.googleapis.com/auth/drive
#' \item https://www.googleapis.com/auth/drive.appdata
#' \item https://www.googleapis.com/auth/drive.file
#' \item https://www.googleapis.com/auth/drive.photos.readonly
#' }
#' @param fileId The ID of the file.
#' @param enforceSingleParent Deprecated. Copying files into multiple folders is no longer supported. Use shortcuts instead.
#' @param ignoreDefaultVisibility Whether to ignore the domain's default visibility settings for the created file. Domain administrators can choose to make all uploaded files visible to the domain by default; this parameter bypasses that behavior for the request. Permissions are still inherited from parent folders.
#' @param includePermissionsForView Specifies which additional view's permissions to include in the response. Only 'published' is supported.
#' @param keepRevisionForever Whether to set the 'keepForever' field in the new head revision. This is only applicable to files with binary content in Google Drive. Only 200 revisions for the file can be kept forever. If the limit is reached, try deleting pinned revisions.
#' @param ocrLanguage A language hint for OCR processing during image import (ISO 639-1 code).
#' @param supportsAllDrives Whether the requesting application supports both My Drives and shared drives.
#' @param supportsTeamDrives Deprecated use supportsAllDrives instead.
#' @param appProperties 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.
#' @param capabilities Capabilities the current user has on this file. Each capability corresponds to a fine-grained action that a user may take.
#' @param contentHints Additional information about the content of the file. These fields are never populated in responses.
#' @param contentRestrictions Restrictions for accessing the content of the file. Only populated if such a restriction exists.
#' @param copyRequiresWriterPermission Whether the options to copy, print, or download this file, should be disabled for readers and commenters.
#' @param createdTime The time at which the file was created (RFC 3339 date-time).
#' @param description A short description of the file.
#' @param driveId ID of the shared drive the file resides in. Only populated for items in shared drives.
#' @param explicitlyTrashed Whether the file has been explicitly trashed, as opposed to recursively trashed from a parent folder.
#' @param exportLinks Links for exporting Docs Editors files to specific formats.
#' @param fileExtension The final component of fullFileExtension. This is only available for files with binary content in Google Drive.
#' @param folderColorRgb The color for 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.
#' @param fullFileExtension 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.
#' @param hasAugmentedPermissions Whether there are permissions directly on this file. This field is only populated for items in shared drives.
#' @param hasThumbnail 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.
#' @param headRevisionId The ID of the file's head revision. This is currently only available for files with binary content in Google Drive.
#' @param iconLink A static, unauthenticated link to the file's icon.
#' @param id The ID of the file.
#' @param imageMediaMetadata Additional metadata about image media, if available.
#' @param isAppAuthorized Whether the file was created or opened by the requesting app.
#' @param kind Identifies what kind of resource this is. Value: the fixed string "drive#file".
#' @param lastModifyingUser The last user to modify the file.
#' @param md5Checksum The MD5 checksum for the content of the file. This is only applicable to files with binary content in Google Drive.
#' @param mimeType 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.
#' @param modifiedByMe Whether the file has been modified by this user.
#' @param modifiedByMeTime The last time the file was modified by the user (RFC 3339 date-time).
#' @param modifiedTime The last time the file was modified by anyone (RFC 3339 date-time).Note that setting modifiedTime will also update modifiedByMeTime for the user.
#' @param name 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.
#' @param originalFilename 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.
#' @param ownedByMe Whether the user owns the file. Not populated for items in shared drives.
#' @param owners The owners of the file. Currently, only certain legacy files may have more than one owner. Not populated for items in shared drives.
#' @param parents 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.
#' @param permissionIds List of permission IDs for users with access to this file.
#' @param permissions 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.
#' @param properties A collection of arbitrary key-value pairs which are visible to all apps.Entries with null values are cleared in update and copy requests.
#' @param quotaBytesUsed The number of storage quota bytes used by the file. This includes the head revision as well as previous revisions with keepForever enabled.
#' @param shared Whether the file has been shared. Not populated for items in shared drives.
#' @param sharedWithMeTime The time at which the file was shared with the user, if applicable (RFC 3339 date-time).
#' @param sharingUser The user who shared the file with the requesting user, if applicable.
#' @param shortcutDetails Shortcut file details. Only populated for shortcut files, which have the mimeType field set to application/vnd.google-apps.shortcut.
#' @param size The size of the file's content in bytes. This is applicable to binary files in Google Drive and Google Docs files.
#' @param spaces The list of spaces which contain the file. The currently supported values are 'drive', 'appDataFolder' and 'photos'.
#' @param starred Whether the user has starred the file.
#' @param teamDriveId Deprecated - use driveId instead.
#' @param thumbnailLink 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.
#' @param thumbnailVersion The thumbnail version for use in thumbnail cache invalidation.
#' @param trashed 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.
#' @param trashedTime The time that the item was trashed (RFC 3339 date-time). Only populated for items in shared drives.
#' @param trashingUser If the file has been explicitly trashed, the user who trashed it. Only populated for items in shared drives.
#' @param version 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.
#' @param videoMediaMetadata Additional metadata about video media. This may not be available immediately upon upload.
#' @param viewedByMe Whether the file has been viewed by this user.
#' @param viewedByMeTime The last time the file was viewed by the user (RFC 3339 date-time).
#' @param viewersCanCopyContent Deprecated - use copyRequiresWriterPermission instead.
#' @param webContentLink A link for downloading the content of the file in a browser. This is only available for files with binary content in Google Drive.
#' @param webViewLink A link for opening the file in a relevant Google editor or viewer in a browser.
#' @param writersCanShare Whether users with only writer permission can modify the file's permissions. Not populated for items in shared drives.
#' @param gargle_token A token prepared by one of gargle's token generating functions. Defaults to gargle::token_fetch(...) with appropriate scopes. See \code{\link[gargle]{token_fetch}} for more info.
#' @param return_response Whether to return the response or the response content. Defaults to FALSE (return response content).
#' @export
files.copy <- function(fileId, enforceSingleParent = NULL, ignoreDefaultVisibility = NULL, includePermissionsForView = NULL, keepRevisionForever = NULL, ocrLanguage = NULL, supportsAllDrives = NULL, supportsTeamDrives = NULL, appProperties = NULL, capabilities = NULL, contentHints = NULL, contentRestrictions = NULL, copyRequiresWriterPermission = NULL, createdTime = NULL, description = NULL, driveId = NULL, explicitlyTrashed = NULL, exportLinks = NULL, fileExtension = NULL, folderColorRgb = NULL, fullFileExtension = NULL, hasAugmentedPermissions = NULL, hasThumbnail = NULL, headRevisionId = NULL, iconLink = NULL, id = NULL, imageMediaMetadata = NULL, isAppAuthorized = NULL, kind = NULL, lastModifyingUser = NULL, md5Checksum = NULL, mimeType = NULL, modifiedByMe = NULL, modifiedByMeTime = NULL, modifiedTime = NULL, name = NULL, originalFilename = NULL, ownedByMe = NULL, owners = NULL, parents = NULL, permissionIds = NULL, permissions = NULL, properties = NULL, quotaBytesUsed = NULL, shared = NULL, sharedWithMeTime = NULL, sharingUser = NULL, shortcutDetails = NULL, size = NULL, spaces = NULL, starred = NULL, teamDriveId = NULL, thumbnailLink = NULL, thumbnailVersion = NULL, trashed = NULL, trashedTime = NULL, trashingUser = NULL, version = NULL, videoMediaMetadata = NULL, viewedByMe = NULL, viewedByMeTime = NULL, viewersCanCopyContent = NULL, webContentLink = NULL, webViewLink = NULL, writersCanShare = NULL, gargle_token = gargle::token_fetch(scopes = .endpoints[['drive.files.copy']]$scopes), return_response = F){
params <- as.list(environment())[!names(as.list(environment())) %in% c('return_response', 'gargle_token')]
req <- gargle::request_develop(endpoint = .endpoints[['drive.files.copy']], params = params, base_url = 'https://www.googleapis.com/')
req <- gargle::request_build(method = req$method, path = req$path, params = req$params, body = req$body, token = httr::config(token = gargle_token), base_url = req$base_url)
res <- gargle::request_make(req, encode = 'json')
if(return_response) return(res)
httr::content(res)
}
#' Creates a new file.
#'
#' Autogenerated via \code{\link[googlePackageMaker]{package_make}}.
#'
#' @seealso \href{https://developers.google.com/drive/}{Google Documentation}
#'
#' @details
#' Authentication scopes used by this function are:
#' \itemize{
#' \item https://www.googleapis.com/auth/drive
#' \item https://www.googleapis.com/auth/drive.appdata
#' \item https://www.googleapis.com/auth/drive.file
#' }
#' @param enforceSingleParent Deprecated. Creating files in multiple folders is no longer supported.
#' @param ignoreDefaultVisibility Whether to ignore the domain's default visibility settings for the created file. Domain administrators can choose to make all uploaded files visible to the domain by default; this parameter bypasses that behavior for the request. Permissions are still inherited from parent folders.
#' @param includePermissionsForView Specifies which additional view's permissions to include in the response. Only 'published' is supported.
#' @param keepRevisionForever Whether to set the 'keepForever' field in the new head revision. This is only applicable to files with binary content in Google Drive. Only 200 revisions for the file can be kept forever. If the limit is reached, try deleting pinned revisions.
#' @param ocrLanguage A language hint for OCR processing during image import (ISO 639-1 code).
#' @param supportsAllDrives Whether the requesting application supports both My Drives and shared drives.
#' @param supportsTeamDrives Deprecated use supportsAllDrives instead.
#' @param useContentAsIndexableText Whether to use the uploaded content as indexable text.
#' @param appProperties 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.
#' @param capabilities Capabilities the current user has on this file. Each capability corresponds to a fine-grained action that a user may take.
#' @param contentHints Additional information about the content of the file. These fields are never populated in responses.
#' @param contentRestrictions Restrictions for accessing the content of the file. Only populated if such a restriction exists.
#' @param copyRequiresWriterPermission Whether the options to copy, print, or download this file, should be disabled for readers and commenters.
#' @param createdTime The time at which the file was created (RFC 3339 date-time).
#' @param description A short description of the file.
#' @param driveId ID of the shared drive the file resides in. Only populated for items in shared drives.
#' @param explicitlyTrashed Whether the file has been explicitly trashed, as opposed to recursively trashed from a parent folder.
#' @param exportLinks Links for exporting Docs Editors files to specific formats.
#' @param fileExtension The final component of fullFileExtension. This is only available for files with binary content in Google Drive.
#' @param folderColorRgb The color for 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.
#' @param fullFileExtension 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.
#' @param hasAugmentedPermissions Whether there are permissions directly on this file. This field is only populated for items in shared drives.
#' @param hasThumbnail 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.
#' @param headRevisionId The ID of the file's head revision. This is currently only available for files with binary content in Google Drive.
#' @param iconLink A static, unauthenticated link to the file's icon.
#' @param id The ID of the file.
#' @param imageMediaMetadata Additional metadata about image media, if available.
#' @param isAppAuthorized Whether the file was created or opened by the requesting app.
#' @param kind Identifies what kind of resource this is. Value: the fixed string "drive#file".
#' @param lastModifyingUser The last user to modify the file.
#' @param md5Checksum The MD5 checksum for the content of the file. This is only applicable to files with binary content in Google Drive.
#' @param mimeType 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.
#' @param modifiedByMe Whether the file has been modified by this user.
#' @param modifiedByMeTime The last time the file was modified by the user (RFC 3339 date-time).
#' @param modifiedTime The last time the file was modified by anyone (RFC 3339 date-time).Note that setting modifiedTime will also update modifiedByMeTime for the user.
#' @param name 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.
#' @param originalFilename 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.
#' @param ownedByMe Whether the user owns the file. Not populated for items in shared drives.
#' @param owners The owners of the file. Currently, only certain legacy files may have more than one owner. Not populated for items in shared drives.
#' @param parents 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.
#' @param permissionIds List of permission IDs for users with access to this file.
#' @param permissions 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.
#' @param properties A collection of arbitrary key-value pairs which are visible to all apps.Entries with null values are cleared in update and copy requests.
#' @param quotaBytesUsed The number of storage quota bytes used by the file. This includes the head revision as well as previous revisions with keepForever enabled.
#' @param shared Whether the file has been shared. Not populated for items in shared drives.
#' @param sharedWithMeTime The time at which the file was shared with the user, if applicable (RFC 3339 date-time).
#' @param sharingUser The user who shared the file with the requesting user, if applicable.
#' @param shortcutDetails Shortcut file details. Only populated for shortcut files, which have the mimeType field set to application/vnd.google-apps.shortcut.
#' @param size The size of the file's content in bytes. This is applicable to binary files in Google Drive and Google Docs files.
#' @param spaces The list of spaces which contain the file. The currently supported values are 'drive', 'appDataFolder' and 'photos'.
#' @param starred Whether the user has starred the file.
#' @param teamDriveId Deprecated - use driveId instead.
#' @param thumbnailLink 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.
#' @param thumbnailVersion The thumbnail version for use in thumbnail cache invalidation.
#' @param trashed 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.
#' @param trashedTime The time that the item was trashed (RFC 3339 date-time). Only populated for items in shared drives.
#' @param trashingUser If the file has been explicitly trashed, the user who trashed it. Only populated for items in shared drives.
#' @param version 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.
#' @param videoMediaMetadata Additional metadata about video media. This may not be available immediately upon upload.
#' @param viewedByMe Whether the file has been viewed by this user.
#' @param viewedByMeTime The last time the file was viewed by the user (RFC 3339 date-time).
#' @param viewersCanCopyContent Deprecated - use copyRequiresWriterPermission instead.
#' @param webContentLink A link for downloading the content of the file in a browser. This is only available for files with binary content in Google Drive.
#' @param webViewLink A link for opening the file in a relevant Google editor or viewer in a browser.
#' @param writersCanShare Whether users with only writer permission can modify the file's permissions. Not populated for items in shared drives.
#' @param gargle_token A token prepared by one of gargle's token generating functions. Defaults to gargle::token_fetch(...) with appropriate scopes. See \code{\link[gargle]{token_fetch}} for more info.
#' @param return_response Whether to return the response or the response content. Defaults to FALSE (return response content).
#' @export
files.create <- function(enforceSingleParent = NULL, ignoreDefaultVisibility = NULL, includePermissionsForView = NULL, keepRevisionForever = NULL, ocrLanguage = NULL, supportsAllDrives = NULL, supportsTeamDrives = NULL, useContentAsIndexableText = NULL, appProperties = NULL, capabilities = NULL, contentHints = NULL, contentRestrictions = NULL, copyRequiresWriterPermission = NULL, createdTime = NULL, description = NULL, driveId = NULL, explicitlyTrashed = NULL, exportLinks = NULL, fileExtension = NULL, folderColorRgb = NULL, fullFileExtension = NULL, hasAugmentedPermissions = NULL, hasThumbnail = NULL, headRevisionId = NULL, iconLink = NULL, id = NULL, imageMediaMetadata = NULL, isAppAuthorized = NULL, kind = NULL, lastModifyingUser = NULL, md5Checksum = NULL, mimeType = NULL, modifiedByMe = NULL, modifiedByMeTime = NULL, modifiedTime = NULL, name = NULL, originalFilename = NULL, ownedByMe = NULL, owners = NULL, parents = NULL, permissionIds = NULL, permissions = NULL, properties = NULL, quotaBytesUsed = NULL, shared = NULL, sharedWithMeTime = NULL, sharingUser = NULL, shortcutDetails = NULL, size = NULL, spaces = NULL, starred = NULL, teamDriveId = NULL, thumbnailLink = NULL, thumbnailVersion = NULL, trashed = NULL, trashedTime = NULL, trashingUser = NULL, version = NULL, videoMediaMetadata = NULL, viewedByMe = NULL, viewedByMeTime = NULL, viewersCanCopyContent = NULL, webContentLink = NULL, webViewLink = NULL, writersCanShare = NULL, gargle_token = gargle::token_fetch(scopes = .endpoints[['drive.files.create']]$scopes), return_response = F){
params <- as.list(environment())[!names(as.list(environment())) %in% c('return_response', 'gargle_token')]
req <- gargle::request_develop(endpoint = .endpoints[['drive.files.create']], params = params, base_url = 'https://www.googleapis.com/')
req <- gargle::request_build(method = req$method, path = req$path, params = req$params, body = req$body, token = httr::config(token = gargle_token), base_url = req$base_url)
res <- gargle::request_make(req, encode = 'json')
if(return_response) return(res)
httr::content(res)
}
#' Permanently deletes a file owned by the user without moving it to the trash.
#'
#' If the file belongs to a shared drive the user must be an organizer on the parent. If the target is a folder, all descendants owned by the user are also deleted. Autogenerated via \code{\link[googlePackageMaker]{package_make}}.
#'
#' @seealso \href{https://developers.google.com/drive/}{Google Documentation}
#'
#' @details
#' Authentication scopes used by this function are:
#' \itemize{
#' \item https://www.googleapis.com/auth/drive
#' \item https://www.googleapis.com/auth/drive.appdata
#' \item https://www.googleapis.com/auth/drive.file
#' }
#' @param fileId The ID of the file.
#' @param enforceSingleParent Deprecated. If an item is not in a shared drive and its last parent is deleted but the item itself is not, the item will be placed under its owner's root.
#' @param supportsAllDrives Whether the requesting application supports both My Drives and shared drives.
#' @param supportsTeamDrives Deprecated use supportsAllDrives instead.
#' @param gargle_token A token prepared by one of gargle's token generating functions. Defaults to gargle::token_fetch(...) with appropriate scopes. See \code{\link[gargle]{token_fetch}} for more info.
#' @param return_response Whether to return the response or the response content. Defaults to FALSE (return response content).
#' @export
files.delete <- function(fileId, enforceSingleParent = NULL, supportsAllDrives = NULL, supportsTeamDrives = NULL, gargle_token = gargle::token_fetch(scopes = .endpoints[['drive.files.delete']]$scopes), return_response = F){
params <- as.list(environment())[!names(as.list(environment())) %in% c('return_response', 'gargle_token')]
req <- gargle::request_develop(endpoint = .endpoints[['drive.files.delete']], params = params, base_url = 'https://www.googleapis.com/')
req <- gargle::request_build(method = req$method, path = req$path, params = req$params, body = req$body, token = httr::config(token = gargle_token), base_url = req$base_url)
res <- gargle::request_make(req, encode = 'json')
if(return_response) return(res)
httr::content(res)
}
#' Permanently deletes all of the user's trashed files.
#'
#' Autogenerated via \code{\link[googlePackageMaker]{package_make}}.
#'
#' @seealso \href{https://developers.google.com/drive/}{Google Documentation}
#'
#' @details
#' Authentication scopes used by this function are:
#' \itemize{
#' \item https://www.googleapis.com/auth/drive
#' }
#' @param enforceSingleParent Deprecated. If an item is not in a shared drive and its last parent is deleted but the item itself is not, the item will be placed under its owner's root.
#' @param gargle_token A token prepared by one of gargle's token generating functions. Defaults to gargle::token_fetch(...) with appropriate scopes. See \code{\link[gargle]{token_fetch}} for more info.
#' @param return_response Whether to return the response or the response content. Defaults to FALSE (return response content).
#' @export
files.emptyTrash <- function(enforceSingleParent = NULL, gargle_token = gargle::token_fetch(scopes = .endpoints[['drive.files.emptyTrash']]$scopes), return_response = F){
params <- as.list(environment())[!names(as.list(environment())) %in% c('return_response', 'gargle_token')]
req <- gargle::request_develop(endpoint = .endpoints[['drive.files.emptyTrash']], params = params, base_url = 'https://www.googleapis.com/')
req <- gargle::request_build(method = req$method, path = req$path, params = req$params, body = req$body, token = httr::config(token = gargle_token), base_url = req$base_url)
res <- gargle::request_make(req, encode = 'json')
if(return_response) return(res)
httr::content(res)
}
#' Exports a Google Doc to the requested MIME type and returns the exported content.
#'
#' Please note that the exported content is limited to 10MB. Autogenerated via \code{\link[googlePackageMaker]{package_make}}.
#'
#' @seealso \href{https://developers.google.com/drive/}{Google Documentation}
#'
#' @details
#' Authentication scopes used by this function are:
#' \itemize{
#' \item https://www.googleapis.com/auth/drive
#' \item https://www.googleapis.com/auth/drive.file
#' \item https://www.googleapis.com/auth/drive.readonly
#' }
#' @param fileId The ID of the file.
#' @param mimeType The MIME type of the format requested for this export.
#' @param gargle_token A token prepared by one of gargle's token generating functions. Defaults to gargle::token_fetch(...) with appropriate scopes. See \code{\link[gargle]{token_fetch}} for more info.
#' @param return_response Whether to return the response or the response content. Defaults to FALSE (return response content).
#' @export
files.export <- function(fileId, mimeType, gargle_token = gargle::token_fetch(scopes = .endpoints[['drive.files.export']]$scopes), return_response = F){
params <- as.list(environment())[!names(as.list(environment())) %in% c('return_response', 'gargle_token')]
req <- gargle::request_develop(endpoint = .endpoints[['drive.files.export']], params = params, base_url = 'https://www.googleapis.com/')
req <- gargle::request_build(method = req$method, path = req$path, params = req$params, body = req$body, token = httr::config(token = gargle_token), base_url = req$base_url)
res <- gargle::request_make(req, encode = 'json')
if(return_response) return(res)
httr::content(res)
}
#' Generates a set of file IDs which can be provided in create or copy requests.
#'
#' Autogenerated via \code{\link[googlePackageMaker]{package_make}}.
#'
#' @seealso \href{https://developers.google.com/drive/}{Google Documentation}
#'
#' @details
#' Authentication scopes used by this function are:
#' \itemize{
#' \item https://www.googleapis.com/auth/drive
#' \item https://www.googleapis.com/auth/drive.appdata
#' \item https://www.googleapis.com/auth/drive.file
#' }
#' @param count The number of IDs to return.
#' @param space The space in which the IDs can be used to create new files. Supported values are 'drive' and 'appDataFolder'.
#' @param gargle_token A token prepared by one of gargle's token generating functions. Defaults to gargle::token_fetch(...) with appropriate scopes. See \code{\link[gargle]{token_fetch}} for more info.
#' @param return_response Whether to return the response or the response content. Defaults to FALSE (return response content).
#' @export
files.generateIds <- function(count = NULL, space = NULL, gargle_token = gargle::token_fetch(scopes = .endpoints[['drive.files.generateIds']]$scopes), return_response = F){
params <- as.list(environment())[!names(as.list(environment())) %in% c('return_response', 'gargle_token')]
req <- gargle::request_develop(endpoint = .endpoints[['drive.files.generateIds']], params = params, base_url = 'https://www.googleapis.com/')
req <- gargle::request_build(method = req$method, path = req$path, params = req$params, body = req$body, token = httr::config(token = gargle_token), base_url = req$base_url)
res <- gargle::request_make(req, encode = 'json')
if(return_response) return(res)
httr::content(res)
}
#' Gets a file's metadata or content by ID.
#'
#' Autogenerated via \code{\link[googlePackageMaker]{package_make}}.
#'
#' @seealso \href{https://developers.google.com/drive/}{Google Documentation}
#'
#' @details
#' Authentication scopes used by this function are:
#' \itemize{
#' \item https://www.googleapis.com/auth/drive
#' \item https://www.googleapis.com/auth/drive.appdata
#' \item https://www.googleapis.com/auth/drive.file
#' \item https://www.googleapis.com/auth/drive.metadata
#' \item https://www.googleapis.com/auth/drive.metadata.readonly
#' \item https://www.googleapis.com/auth/drive.photos.readonly
#' \item https://www.googleapis.com/auth/drive.readonly
#' }
#' @param fileId The ID of the file.
#' @param acknowledgeAbuse Whether the user is acknowledging the risk of downloading known malware or other abusive files. This is only applicable when alt=media.
#' @param includePermissionsForView Specifies which additional view's permissions to include in the response. Only 'published' is supported.
#' @param supportsAllDrives Whether the requesting application supports both My Drives and shared drives.
#' @param supportsTeamDrives Deprecated use supportsAllDrives instead.
#' @param gargle_token A token prepared by one of gargle's token generating functions. Defaults to gargle::token_fetch(...) with appropriate scopes. See \code{\link[gargle]{token_fetch}} for more info.
#' @param return_response Whether to return the response or the response content. Defaults to FALSE (return response content).
#' @export
files.get <- function(fileId, acknowledgeAbuse = NULL, includePermissionsForView = NULL, supportsAllDrives = NULL, supportsTeamDrives = NULL, gargle_token = gargle::token_fetch(scopes = .endpoints[['drive.files.get']]$scopes), return_response = F){
params <- as.list(environment())[!names(as.list(environment())) %in% c('return_response', 'gargle_token')]
req <- gargle::request_develop(endpoint = .endpoints[['drive.files.get']], params = params, base_url = 'https://www.googleapis.com/')
req <- gargle::request_build(method = req$method, path = req$path, params = req$params, body = req$body, token = httr::config(token = gargle_token), base_url = req$base_url)
res <- gargle::request_make(req, encode = 'json')
if(return_response) return(res)
httr::content(res)
}
#' Lists or searches files.
#'
#' Autogenerated via \code{\link[googlePackageMaker]{package_make}}.
#'
#' @seealso \href{https://developers.google.com/drive/}{Google Documentation}
#'
#' @details
#' Authentication scopes used by this function are:
#' \itemize{
#' \item https://www.googleapis.com/auth/drive
#' \item https://www.googleapis.com/auth/drive.appdata
#' \item https://www.googleapis.com/auth/drive.file
#' \item https://www.googleapis.com/auth/drive.metadata
#' \item https://www.googleapis.com/auth/drive.metadata.readonly
#' \item https://www.googleapis.com/auth/drive.photos.readonly
#' \item https://www.googleapis.com/auth/drive.readonly
#' }
#' @param corpora Groupings of files to which the query applies. Supported groupings are: 'user' (files created by, opened by, or shared directly with the user), 'drive' (files in the specified shared drive as indicated by the 'driveId'), 'domain' (files shared to the user's domain), and 'allDrives' (A combination of 'user' and 'drive' for all drives where the user is a member). When able, use 'user' or 'drive', instead of 'allDrives', for efficiency.
#' @param corpus The source of files to list. Deprecated: use 'corpora' instead.
#' @param driveId ID of the shared drive to search.
#' @param includeItemsFromAllDrives Whether both My Drive and shared drive items should be included in results.
#' @param includePermissionsForView Specifies which additional view's permissions to include in the response. Only 'published' is supported.
#' @param includeTeamDriveItems Deprecated use includeItemsFromAllDrives instead.
#' @param orderBy A comma-separated list of sort keys. Valid keys are 'createdTime', 'folder', 'modifiedByMeTime', 'modifiedTime', 'name', 'name_natural', 'quotaBytesUsed', 'recency', 'sharedWithMeTime', 'starred', and 'viewedByMeTime'. Each key sorts ascending by default, but may be reversed with the 'desc' modifier. Example usage: ?orderBy=folder,modifiedTime desc,name. Please note that there is a current limitation for users with approximately one million files in which the requested sort order is ignored.
#' @param pageSize The maximum number of files to return per page. Partial or empty result pages are possible even before the end of the files list has been reached.
#' @param pageToken The token for continuing a previous list request on the next page. This should be set to the value of 'nextPageToken' from the previous response.
#' @param q A query for filtering the file results. See the "Search for Files" guide for supported syntax.
#' @param spaces A comma-separated list of spaces to query within the corpus. Supported values are 'drive', 'appDataFolder' and 'photos'.
#' @param supportsAllDrives Whether the requesting application supports both My Drives and shared drives.
#' @param supportsTeamDrives Deprecated use supportsAllDrives instead.
#' @param teamDriveId Deprecated use driveId instead.
#' @param gargle_token A token prepared by one of gargle's token generating functions. Defaults to gargle::token_fetch(...) with appropriate scopes. See \code{\link[gargle]{token_fetch}} for more info.
#' @param return_response Whether to return the response or the response content. Defaults to FALSE (return response content).
#' @export
files.list <- function(corpora = NULL, corpus = NULL, driveId = NULL, includeItemsFromAllDrives = NULL, includePermissionsForView = NULL, includeTeamDriveItems = NULL, orderBy = NULL, pageSize = NULL, pageToken = NULL, q = NULL, spaces = NULL, supportsAllDrives = NULL, supportsTeamDrives = NULL, teamDriveId = NULL, gargle_token = gargle::token_fetch(scopes = .endpoints[['drive.files.list']]$scopes), return_response = F){
params <- as.list(environment())[!names(as.list(environment())) %in% c('return_response', 'gargle_token')]
req <- gargle::request_develop(endpoint = .endpoints[['drive.files.list']], params = params, base_url = 'https://www.googleapis.com/')
req <- gargle::request_build(method = req$method, path = req$path, params = req$params, body = req$body, token = httr::config(token = gargle_token), base_url = req$base_url)
res <- gargle::request_make(req, encode = 'json')
if(return_response) return(res)
httr::content(res)
}
#' Updates a file's metadata and/or content.
#'
#' This method supports patch semantics. Autogenerated via \code{\link[googlePackageMaker]{package_make}}.
#'
#' @seealso \href{https://developers.google.com/drive/}{Google Documentation}
#'
#' @details
#' Authentication scopes used by this function are:
#' \itemize{
#' \item https://www.googleapis.com/auth/drive
#' \item https://www.googleapis.com/auth/drive.appdata
#' \item https://www.googleapis.com/auth/drive.file
#' \item https://www.googleapis.com/auth/drive.metadata
#' \item https://www.googleapis.com/auth/drive.scripts
#' }
#' @param fileId The ID of the file.
#' @param addParents A comma-separated list of parent IDs to add.
#' @param enforceSingleParent Deprecated. Adding files to multiple folders is no longer supported. Use shortcuts instead.
#' @param includePermissionsForView Specifies which additional view's permissions to include in the response. Only 'published' is supported.
#' @param keepRevisionForever Whether to set the 'keepForever' field in the new head revision. This is only applicable to files with binary content in Google Drive. Only 200 revisions for the file can be kept forever. If the limit is reached, try deleting pinned revisions.
#' @param ocrLanguage A language hint for OCR processing during image import (ISO 639-1 code).
#' @param removeParents A comma-separated list of parent IDs to remove.
#' @param supportsAllDrives Whether the requesting application supports both My Drives and shared drives.
#' @param supportsTeamDrives Deprecated use supportsAllDrives instead.
#' @param useContentAsIndexableText Whether to use the uploaded content as indexable text.
#' @param appProperties 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.
#' @param capabilities Capabilities the current user has on this file. Each capability corresponds to a fine-grained action that a user may take.
#' @param contentHints Additional information about the content of the file. These fields are never populated in responses.
#' @param contentRestrictions Restrictions for accessing the content of the file. Only populated if such a restriction exists.
#' @param copyRequiresWriterPermission Whether the options to copy, print, or download this file, should be disabled for readers and commenters.
#' @param createdTime The time at which the file was created (RFC 3339 date-time).
#' @param description A short description of the file.
#' @param driveId ID of the shared drive the file resides in. Only populated for items in shared drives.
#' @param explicitlyTrashed Whether the file has been explicitly trashed, as opposed to recursively trashed from a parent folder.
#' @param exportLinks Links for exporting Docs Editors files to specific formats.
#' @param fileExtension The final component of fullFileExtension. This is only available for files with binary content in Google Drive.
#' @param folderColorRgb The color for 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.
#' @param fullFileExtension 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.
#' @param hasAugmentedPermissions Whether there are permissions directly on this file. This field is only populated for items in shared drives.
#' @param hasThumbnail 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.
#' @param headRevisionId The ID of the file's head revision. This is currently only available for files with binary content in Google Drive.
#' @param iconLink A static, unauthenticated link to the file's icon.
#' @param id The ID of the file.
#' @param imageMediaMetadata Additional metadata about image media, if available.
#' @param isAppAuthorized Whether the file was created or opened by the requesting app.
#' @param kind Identifies what kind of resource this is. Value: the fixed string "drive#file".
#' @param lastModifyingUser The last user to modify the file.
#' @param md5Checksum The MD5 checksum for the content of the file. This is only applicable to files with binary content in Google Drive.
#' @param mimeType 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.
#' @param modifiedByMe Whether the file has been modified by this user.
#' @param modifiedByMeTime The last time the file was modified by the user (RFC 3339 date-time).
#' @param modifiedTime The last time the file was modified by anyone (RFC 3339 date-time).Note that setting modifiedTime will also update modifiedByMeTime for the user.
#' @param name 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.
#' @param originalFilename 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.
#' @param ownedByMe Whether the user owns the file. Not populated for items in shared drives.
#' @param owners The owners of the file. Currently, only certain legacy files may have more than one owner. Not populated for items in shared drives.
#' @param parents 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.
#' @param permissionIds List of permission IDs for users with access to this file.
#' @param permissions 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.
#' @param properties A collection of arbitrary key-value pairs which are visible to all apps.Entries with null values are cleared in update and copy requests.
#' @param quotaBytesUsed The number of storage quota bytes used by the file. This includes the head revision as well as previous revisions with keepForever enabled.
#' @param shared Whether the file has been shared. Not populated for items in shared drives.
#' @param sharedWithMeTime The time at which the file was shared with the user, if applicable (RFC 3339 date-time).
#' @param sharingUser The user who shared the file with the requesting user, if applicable.
#' @param shortcutDetails Shortcut file details. Only populated for shortcut files, which have the mimeType field set to application/vnd.google-apps.shortcut.
#' @param size The size of the file's content in bytes. This is applicable to binary files in Google Drive and Google Docs files.
#' @param spaces The list of spaces which contain the file. The currently supported values are 'drive', 'appDataFolder' and 'photos'.
#' @param starred Whether the user has starred the file.
#' @param teamDriveId Deprecated - use driveId instead.
#' @param thumbnailLink 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.
#' @param thumbnailVersion The thumbnail version for use in thumbnail cache invalidation.
#' @param trashed 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.
#' @param trashedTime The time that the item was trashed (RFC 3339 date-time). Only populated for items in shared drives.
#' @param trashingUser If the file has been explicitly trashed, the user who trashed it. Only populated for items in shared drives.
#' @param version 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.
#' @param videoMediaMetadata Additional metadata about video media. This may not be available immediately upon upload.
#' @param viewedByMe Whether the file has been viewed by this user.
#' @param viewedByMeTime The last time the file was viewed by the user (RFC 3339 date-time).
#' @param viewersCanCopyContent Deprecated - use copyRequiresWriterPermission instead.
#' @param webContentLink A link for downloading the content of the file in a browser. This is only available for files with binary content in Google Drive.
#' @param webViewLink A link for opening the file in a relevant Google editor or viewer in a browser.
#' @param writersCanShare Whether users with only writer permission can modify the file's permissions. Not populated for items in shared drives.
#' @param gargle_token A token prepared by one of gargle's token generating functions. Defaults to gargle::token_fetch(...) with appropriate scopes. See \code{\link[gargle]{token_fetch}} for more info.
#' @param return_response Whether to return the response or the response content. Defaults to FALSE (return response content).
#' @export
files.update <- function(fileId, addParents = NULL, enforceSingleParent = NULL, includePermissionsForView = NULL, keepRevisionForever = NULL, ocrLanguage = NULL, removeParents = NULL, supportsAllDrives = NULL, supportsTeamDrives = NULL, useContentAsIndexableText = NULL, appProperties = NULL, capabilities = NULL, contentHints = NULL, contentRestrictions = NULL, copyRequiresWriterPermission = NULL, createdTime = NULL, description = NULL, driveId = NULL, explicitlyTrashed = NULL, exportLinks = NULL, fileExtension = NULL, folderColorRgb = NULL, fullFileExtension = NULL, hasAugmentedPermissions = NULL, hasThumbnail = NULL, headRevisionId = NULL, iconLink = NULL, id = NULL, imageMediaMetadata = NULL, isAppAuthorized = NULL, kind = NULL, lastModifyingUser = NULL, md5Checksum = NULL, mimeType = NULL, modifiedByMe = NULL, modifiedByMeTime = NULL, modifiedTime = NULL, name = NULL, originalFilename = NULL, ownedByMe = NULL, owners = NULL, parents = NULL, permissionIds = NULL, permissions = NULL, properties = NULL, quotaBytesUsed = NULL, shared = NULL, sharedWithMeTime = NULL, sharingUser = NULL, shortcutDetails = NULL, size = NULL, spaces = NULL, starred = NULL, teamDriveId = NULL, thumbnailLink = NULL, thumbnailVersion = NULL, trashed = NULL, trashedTime = NULL, trashingUser = NULL, version = NULL, videoMediaMetadata = NULL, viewedByMe = NULL, viewedByMeTime = NULL, viewersCanCopyContent = NULL, webContentLink = NULL, webViewLink = NULL, writersCanShare = NULL, gargle_token = gargle::token_fetch(scopes = .endpoints[['drive.files.update']]$scopes), return_response = F){
params <- as.list(environment())[!names(as.list(environment())) %in% c('return_response', 'gargle_token')]
req <- gargle::request_develop(endpoint = .endpoints[['drive.files.update']], params = params, base_url = 'https://www.googleapis.com/')
req <- gargle::request_build(method = req$method, path = req$path, params = req$params, body = req$body, token = httr::config(token = gargle_token), base_url = req$base_url)
res <- gargle::request_make(req, encode = 'json')
if(return_response) return(res)
httr::content(res)
}
#' NA
#'
#' NA Autogenerated via \code{\link[googlePackageMaker]{package_make}}.
#'
#' @seealso \href{https://developers.google.com/drive/}{Google Documentation}
#'
#' @details
#' Authentication scopes used by this function are:
#' \itemize{
#' \item https://www.googleapis.com/auth/drive
#' \item https://www.googleapis.com/auth/drive.appdata
#' \item https://www.googleapis.com/auth/drive.file
#' \item https://www.googleapis.com/auth/drive.metadata
#' \item https://www.googleapis.com/auth/drive.metadata.readonly
#' \item https://www.googleapis.com/auth/drive.photos.readonly
#' \item https://www.googleapis.com/auth/drive.readonly
#' }
#' @param fileId The ID of the file.
#' @param acknowledgeAbuse Whether the user is acknowledging the risk of downloading known malware or other abusive files. This is only applicable when alt=media.
#' @param includePermissionsForView Specifies which additional view's permissions to include in the response. Only 'published' is supported.
#' @param supportsAllDrives Whether the requesting application supports both My Drives and shared drives.
#' @param supportsTeamDrives Deprecated use supportsAllDrives instead.
#' @param address The address where notifications are delivered for this channel.
#' @param expiration Date and time of notification channel expiration, expressed as a Unix timestamp, in milliseconds. Optional.
#' @param id A UUID or similar unique string that identifies this channel.
#' @param kind Identifies this as a notification channel used to watch for changes to a resource, which is "api#channel".
#' @param params Additional parameters controlling delivery channel behavior. Optional.
#' @param payload A Boolean value to indicate whether payload is wanted. Optional.
#' @param resourceId An opaque ID that identifies the resource being watched on this channel. Stable across different API versions.
#' @param resourceUri A version-specific identifier for the watched resource.
#' @param token An arbitrary string delivered to the target address with each notification delivered over this channel. Optional.
#' @param type The type of delivery mechanism used for this channel.
#' @param gargle_token A token prepared by one of gargle's token generating functions. Defaults to gargle::token_fetch(...) with appropriate scopes. See \code{\link[gargle]{token_fetch}} for more info.
#' @param return_response Whether to return the response or the response content. Defaults to FALSE (return response content).
#' @export
files.watch <- function(fileId, acknowledgeAbuse = NULL, includePermissionsForView = NULL, supportsAllDrives = NULL, supportsTeamDrives = NULL, address = NULL, expiration = NULL, id = NULL, kind = NULL, params = NULL, payload = NULL, resourceId = NULL, resourceUri = NULL, token = NULL, type = NULL, gargle_token = gargle::token_fetch(scopes = .endpoints[['drive.files.watch']]$scopes), return_response = F){
params <- as.list(environment())[!names(as.list(environment())) %in% c('return_response', 'gargle_token')]
req <- gargle::request_develop(endpoint = .endpoints[['drive.files.watch']], params = params, base_url = 'https://www.googleapis.com/')
req <- gargle::request_build(method = req$method, path = req$path, params = req$params, body = req$body, token = httr::config(token = gargle_token), base_url = req$base_url)
res <- gargle::request_make(req, encode = 'json')
if(return_response) return(res)
httr::content(res)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.