samples/AdminDirectoryV1/R/roleAssignments.R

	#' Deletes a role assignment.
	#'
	#'  Autogenerated via \code{\link[googlePackageMaker]{package_make}}.
	#'
	#' @seealso \href{http://developers.google.com/admin-sdk/}{Google Documentation}
	#'
	#' @details
	#' Authentication scopes used by this function are:
	#' \itemize{
	#' \item https://www.googleapis.com/auth/admin.directory.rolemanagement
	#' }
	#' @param roleAssignmentId Immutable ID of the role assignment.
	#' @param customer Immutable ID of the Google Workspace account.
	#' @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
	roleAssignments.delete <- function(roleAssignmentId, customer, gargle_token = gargle::token_fetch(scopes = .endpoints[['directory.roleAssignments.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[['directory.roleAssignments.delete']], params = params, base_url = 'https://admin.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)
	}

	#' Retrieve a role assignment.
	#'
	#'  Autogenerated via \code{\link[googlePackageMaker]{package_make}}.
	#'
	#' @seealso \href{http://developers.google.com/admin-sdk/}{Google Documentation}
	#'
	#' @details
	#' Authentication scopes used by this function are:
	#' \itemize{
	#' \item https://www.googleapis.com/auth/admin.directory.rolemanagement
	#' \item https://www.googleapis.com/auth/admin.directory.rolemanagement.readonly
	#' }
	#' @param roleAssignmentId Immutable ID of the role assignment.
	#' @param customer Immutable ID of the Google Workspace account.
	#' @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
	roleAssignments.get <- function(roleAssignmentId, customer, gargle_token = gargle::token_fetch(scopes = .endpoints[['directory.roleAssignments.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[['directory.roleAssignments.get']], params = params, base_url = 'https://admin.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 role assignment.
	#'
	#'  Autogenerated via \code{\link[googlePackageMaker]{package_make}}.
	#'
	#' @seealso \href{http://developers.google.com/admin-sdk/}{Google Documentation}
	#'
	#' @details
	#' Authentication scopes used by this function are:
	#' \itemize{
	#' \item https://www.googleapis.com/auth/admin.directory.rolemanagement
	#' }
	#' @param customer Immutable ID of the Google Workspace account.
	#' @param roleAssignmentId ID of this roleAssignment.
	#' @param kind The type of the API resource. This is always `admin#directory#roleAssignment`.
	#' @param assignedTo The unique ID of the user this role is assigned to.
	#' @param etag ETag of the resource.
	#' @param roleId The ID of the role that is assigned.
	#' @param scopeType The scope in which this role is assigned.
	#' @param orgUnitId If the role is restricted to an organization unit, this contains the ID for the organization unit the exercise of this role is restricted to.
	#' @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
	roleAssignments.insert <- function(customer, roleAssignmentId = NULL, kind = NULL, assignedTo = NULL, etag = NULL, roleId = NULL, scopeType = NULL, orgUnitId = NULL, gargle_token = gargle::token_fetch(scopes = .endpoints[['directory.roleAssignments.insert']]$scopes), return_response = F){
		params <- as.list(environment())[!names(as.list(environment())) %in% c('return_response', 'gargle_token')]
		req <- gargle::request_develop(endpoint = .endpoints[['directory.roleAssignments.insert']], params = params, base_url = 'https://admin.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)
	}

	#' Retrieves a paginated list of all roleAssignments.
	#'
	#'  Autogenerated via \code{\link[googlePackageMaker]{package_make}}.
	#'
	#' @seealso \href{http://developers.google.com/admin-sdk/}{Google Documentation}
	#'
	#' @details
	#' Authentication scopes used by this function are:
	#' \itemize{
	#' \item https://www.googleapis.com/auth/admin.directory.rolemanagement
	#' \item https://www.googleapis.com/auth/admin.directory.rolemanagement.readonly
	#' }
	#' @param customer Immutable ID of the Google Workspace account.
	#' @param pageToken Token to specify the next page in the list.
	#' @param roleId Immutable ID of a role. If included in the request, returns only role assignments containing this role ID.
	#' @param userKey The user's primary email address, alias email address, or unique user ID. If included in the request, returns role assignments only for this user.
	#' @param maxResults Maximum number of results to return.
	#' @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
	roleAssignments.list <- function(customer, pageToken = NULL, roleId = NULL, userKey = NULL, maxResults = NULL, gargle_token = gargle::token_fetch(scopes = .endpoints[['directory.roleAssignments.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[['directory.roleAssignments.list']], params = params, base_url = 'https://admin.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.