samples/DriveV3/R/permissions.R

	#' Creates a permission for a file or shared drive.
	#'
	#'  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
	#' }
	#' @param fileId The ID of the file or shared drive.
	#' @param emailMessage A plain text custom message to include in the notification email.
	#' @param enforceSingleParent Deprecated. See moveToNewOwnersRoot for details.
	#' @param moveToNewOwnersRoot This parameter will only take effect if the item is not in a shared drive and the request is attempting to transfer the ownership of the item. If set to true, the item will be moved to the new owner's My Drive root folder and all prior parents removed. If set to false, parents are not changed.
	#' @param sendNotificationEmail Whether to send a notification email when sharing to users or groups. This defaults to true for users and groups, and is not allowed for other requests. It must not be disabled for ownership transfers.
	#' @param supportsAllDrives Whether the requesting application supports both My Drives and shared drives.
	#' @param supportsTeamDrives Deprecated use supportsAllDrives instead.
	#' @param transferOwnership Whether to transfer ownership to the specified user and downgrade the current owner to a writer. This parameter is required as an acknowledgement of the side effect.
	#' @param useDomainAdminAccess Issue the request as a domain administrator; if set to true, then the requester will be granted access if the file ID parameter refers to a shared drive and the requester is an administrator of the domain to which the shared drive belongs.
	#' @param allowFileDiscovery Whether the permission allows the file to be discovered through search. This is only applicable for permissions of type domain or anyone.
	#' @param deleted Whether the account associated with this permission has been deleted. This field only pertains to user and group permissions.
	#' @param displayName The "pretty" name of the value of the permission. The following is a list of examples for each type of permission:  - user - User's full name, as defined for their Google account, such as "Joe Smith." - group - Name of the Google Group, such as "The Company Administrators." - domain - String domain name, such as "thecompany.com." - anyone - No displayName is present.
	#' @param domain The domain to which this permission refers.
	#' @param emailAddress The email address of the user or group to which this permission refers.
	#' @param expirationTime The time at which this permission will expire (RFC 3339 date-time). Expiration times have the following restrictions:  - They can only be set on user and group permissions - The time must be in the future - The time cannot be more than a year in the future
	#' @param id The ID of this permission. This is a unique identifier for the grantee, and is published in User resources as permissionId. IDs should be treated as opaque values.
	#' @param kind Identifies what kind of resource this is. Value: the fixed string "drive#permission".
	#' @param permissionDetails Details of whether the permissions on this shared drive item are inherited or directly on this item. This is an output-only field which is present only for shared drive items.
	#' @param photoLink A link to the user's profile photo, if available.
	#' @param role The role granted by this permission. While new values may be supported in the future, the following are currently allowed:  - owner - organizer - fileOrganizer - writer - commenter - reader
	#' @param teamDrivePermissionDetails Deprecated - use permissionDetails instead.
	#' @param type The type of the grantee. Valid values are:  - user - group - domain - anyone  When creating a permission, if type is user or group, you must provide an emailAddress for the user or group. When type is domain, you must provide a domain. There isn't extra information required for a anyone type.
	#' @param view Indicates the view for this permission. Only populated for permissions that belong to a view. published is the only supported value.
	#' @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
	permissions.create <- function(fileId, emailMessage = NULL, enforceSingleParent = NULL, moveToNewOwnersRoot = NULL, sendNotificationEmail = NULL, supportsAllDrives = NULL, supportsTeamDrives = NULL, transferOwnership = NULL, useDomainAdminAccess = NULL, allowFileDiscovery = NULL, deleted = NULL, displayName = NULL, domain = NULL, emailAddress = NULL, expirationTime = NULL, id = NULL, kind = NULL, permissionDetails = NULL, photoLink = NULL, role = NULL, teamDrivePermissionDetails = NULL, type = NULL, view = NULL, gargle_token = gargle::token_fetch(scopes = .endpoints[['drive.permissions.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.permissions.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)
	}

	#' Deletes a permission.
	#'
	#'  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
	#' }
	#' @param fileId The ID of the file or shared drive.
	#' @param permissionId The ID of the permission.
	#' @param supportsAllDrives Whether the requesting application supports both My Drives and shared drives.
	#' @param supportsTeamDrives Deprecated use supportsAllDrives instead.
	#' @param useDomainAdminAccess Issue the request as a domain administrator; if set to true, then the requester will be granted access if the file ID parameter refers to a shared drive and the requester is an administrator of the domain to which the shared drive belongs.
	#' @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
	permissions.delete <- function(fileId, permissionId, supportsAllDrives = NULL, supportsTeamDrives = NULL, useDomainAdminAccess = NULL, gargle_token = gargle::token_fetch(scopes = .endpoints[['drive.permissions.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.permissions.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 permission 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.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 permissionId The ID of the permission.
	#' @param supportsAllDrives Whether the requesting application supports both My Drives and shared drives.
	#' @param supportsTeamDrives Deprecated use supportsAllDrives instead.
	#' @param useDomainAdminAccess Issue the request as a domain administrator; if set to true, then the requester will be granted access if the file ID parameter refers to a shared drive and the requester is an administrator of the domain to which the shared drive belongs.
	#' @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
	permissions.get <- function(fileId, permissionId, supportsAllDrives = NULL, supportsTeamDrives = NULL, useDomainAdminAccess = NULL, gargle_token = gargle::token_fetch(scopes = .endpoints[['drive.permissions.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.permissions.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 or shared drive's permissions.
	#'
	#'  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.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 or shared drive.
	#' @param includePermissionsForView Specifies which additional view's permissions to include in the response. Only 'published' is supported.
	#' @param pageSize The maximum number of permissions to return per page. When not set for files in a shared drive, at most 100 results will be returned. When not set for files that are not in a shared drive, the entire list will be returned.
	#' @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 supportsAllDrives Whether the requesting application supports both My Drives and shared drives.
	#' @param supportsTeamDrives Deprecated use supportsAllDrives instead.
	#' @param useDomainAdminAccess Issue the request as a domain administrator; if set to true, then the requester will be granted access if the file ID parameter refers to a shared drive and the requester is an administrator of the domain to which the shared drive belongs.
	#' @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
	permissions.list <- function(fileId, includePermissionsForView = NULL, pageSize = NULL, pageToken = NULL, supportsAllDrives = NULL, supportsTeamDrives = NULL, useDomainAdminAccess = NULL, gargle_token = gargle::token_fetch(scopes = .endpoints[['drive.permissions.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.permissions.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 permission 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.file
	#' }
	#' @param fileId The ID of the file or shared drive.
	#' @param permissionId The ID of the permission.
	#' @param removeExpiration Whether to remove the expiration date.
	#' @param supportsAllDrives Whether the requesting application supports both My Drives and shared drives.
	#' @param supportsTeamDrives Deprecated use supportsAllDrives instead.
	#' @param transferOwnership Whether to transfer ownership to the specified user and downgrade the current owner to a writer. This parameter is required as an acknowledgement of the side effect.
	#' @param useDomainAdminAccess Issue the request as a domain administrator; if set to true, then the requester will be granted access if the file ID parameter refers to a shared drive and the requester is an administrator of the domain to which the shared drive belongs.
	#' @param allowFileDiscovery Whether the permission allows the file to be discovered through search. This is only applicable for permissions of type domain or anyone.
	#' @param deleted Whether the account associated with this permission has been deleted. This field only pertains to user and group permissions.
	#' @param displayName The "pretty" name of the value of the permission. The following is a list of examples for each type of permission:  - user - User's full name, as defined for their Google account, such as "Joe Smith." - group - Name of the Google Group, such as "The Company Administrators." - domain - String domain name, such as "thecompany.com." - anyone - No displayName is present.
	#' @param domain The domain to which this permission refers.
	#' @param emailAddress The email address of the user or group to which this permission refers.
	#' @param expirationTime The time at which this permission will expire (RFC 3339 date-time). Expiration times have the following restrictions:  - They can only be set on user and group permissions - The time must be in the future - The time cannot be more than a year in the future
	#' @param id The ID of this permission. This is a unique identifier for the grantee, and is published in User resources as permissionId. IDs should be treated as opaque values.
	#' @param kind Identifies what kind of resource this is. Value: the fixed string "drive#permission".
	#' @param permissionDetails Details of whether the permissions on this shared drive item are inherited or directly on this item. This is an output-only field which is present only for shared drive items.
	#' @param photoLink A link to the user's profile photo, if available.
	#' @param role The role granted by this permission. While new values may be supported in the future, the following are currently allowed:  - owner - organizer - fileOrganizer - writer - commenter - reader
	#' @param teamDrivePermissionDetails Deprecated - use permissionDetails instead.
	#' @param type The type of the grantee. Valid values are:  - user - group - domain - anyone  When creating a permission, if type is user or group, you must provide an emailAddress for the user or group. When type is domain, you must provide a domain. There isn't extra information required for a anyone type.
	#' @param view Indicates the view for this permission. Only populated for permissions that belong to a view. published is the only supported value.
	#' @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
	permissions.update <- function(fileId, permissionId, removeExpiration = NULL, supportsAllDrives = NULL, supportsTeamDrives = NULL, transferOwnership = NULL, useDomainAdminAccess = NULL, allowFileDiscovery = NULL, deleted = NULL, displayName = NULL, domain = NULL, emailAddress = NULL, expirationTime = NULL, id = NULL, kind = NULL, permissionDetails = NULL, photoLink = NULL, role = NULL, teamDrivePermissionDetails = NULL, type = NULL, view = NULL, gargle_token = gargle::token_fetch(scopes = .endpoints[['drive.permissions.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.permissions.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.