samples/DriveV3/R/revisions.R

	#' Permanently deletes a file version.
	#'
	#' You can only delete revisions for files with binary content in Google Drive, like images or videos. Revisions for other files, like Google Docs or Sheets, and the last remaining file version can't be 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 revisionId The ID of the revision.
	#' @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
	revisions.delete <- function(fileId, revisionId, gargle_token = gargle::token_fetch(scopes = .endpoints[['drive.revisions.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.revisions.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)
	}

	#' Gets a revision'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 revisionId The ID of the revision.
	#' @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 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
	revisions.get <- function(fileId, revisionId, acknowledgeAbuse = NULL, gargle_token = gargle::token_fetch(scopes = .endpoints[['drive.revisions.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.revisions.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 a file's revisions.
	#'
	#'  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 pageSize The maximum number of revisions to return per page.
	#' @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 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
	revisions.list <- function(fileId, pageSize = NULL, pageToken = NULL, gargle_token = gargle::token_fetch(scopes = .endpoints[['drive.revisions.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.revisions.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 revision with 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
	#' }
	#' @param fileId The ID of the file.
	#' @param revisionId The ID of the revision.
	#' @param exportLinks Links for exporting Docs Editors files to specific formats.
	#' @param id The ID of the revision.
	#' @param keepForever Whether to keep this revision forever, even if it is no longer the head revision. If not set, the revision will be automatically purged 30 days after newer content is uploaded. This can be set on a maximum of 200 revisions for a file.This field is only applicable to files with binary content in Drive.
	#' @param kind Identifies what kind of resource this is. Value: the fixed string "drive#revision".
	#' @param lastModifyingUser The last user to modify this revision.
	#' @param md5Checksum The MD5 checksum of the revision's content. This is only applicable to files with binary content in Drive.
	#' @param mimeType The MIME type of the revision.
	#' @param modifiedTime The last time the revision was modified (RFC 3339 date-time).
	#' @param originalFilename The original filename used to create this revision. This is only applicable to files with binary content in Drive.
	#' @param publishAuto Whether subsequent revisions will be automatically republished. This is only applicable to Docs Editors files.
	#' @param published Whether this revision is published. This is only applicable to Docs Editors files.
	#' @param publishedLink A link to the published revision. This is only populated for Google Sites files.
	#' @param publishedOutsideDomain Whether this revision is published outside the domain. This is only applicable to Docs Editors files.
	#' @param size The size of the revision's content in bytes. This is only applicable to files with binary content in Drive.
	#' @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
	revisions.update <- function(fileId, revisionId, exportLinks = NULL, id = NULL, keepForever = NULL, kind = NULL, lastModifyingUser = NULL, md5Checksum = NULL, mimeType = NULL, modifiedTime = NULL, originalFilename = NULL, publishAuto = NULL, published = NULL, publishedLink = NULL, publishedOutsideDomain = NULL, size = NULL, gargle_token = gargle::token_fetch(scopes = .endpoints[['drive.revisions.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.revisions.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)
	}
samterfa/googlePackageMaker documentation built on May 18, 2022, 10:58 a.m.