R/tokens.R

Defines functions tokens.list tokens.get tokens.delete

Documented in tokens.delete tokens.get tokens.list

	#' Deletes all access tokens issued by a user for an application.
	#'
	#'  Autogenerated via \code{\link[googlePackageMaker]{package_make}}.
	#'
	#' @seealso \href{https://developers.google.com/admin-sdk/}{Google Documentation}
	#'
	#' @details
	#' Authentication scopes used by this function are:
	#' \itemize{
	#' \item https://www.googleapis.com/auth/admin.directory.user.security
	#' }
	#' @param userKey Identifies the user in the API request. The value can be the user's primary email address, alias email address, or unique user ID.
	#' @param clientId The Client ID of the application the token is issued to.
	#' @param callback JSONP
	#' @param fields Selector specifying which fields to include in a partial response.
	#' @param uploadType Legacy upload protocol for media (e.g. "media", "multipart").
	#' @param upload_protocol Upload protocol for media (e.g. "raw", "multipart").
	#' @param prettyPrint Returns response with indentations and line breaks.
	#' @param quotaUser Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
	#' @param alt Data format for 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_request Whether to return the request without making it. Defaults to FALSE. See \code{\link[gargle]{request_build}} for more info on the returned request object.
	#' @param return_response Whether to return the response or the response content. Defaults to FALSE (return response content).
	#' @export
	tokens.delete <- function(userKey, clientId, callback = NULL, fields = NULL, uploadType = NULL, upload_protocol = NULL, prettyPrint = NULL, quotaUser = NULL, alt = NULL, gargle_token = gargle::token_fetch(scopes = .endpoints[['directory.tokens.delete']]$scopes[[1]]), return_request = F, return_response = F){
		params <- as.list(environment())[!names(as.list(environment())) %in% c('return_request', 'return_response', 'gargle_token')]
		req <- gargle::request_develop(endpoint = .endpoints[['directory.tokens.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)
		if(return_request) return(req)
		res <- gargle::request_make(req, encode = 'json')
		if(return_response) return(res)
		httr::content(res)
	}

	#' Gets information about an access token issued by a user.
	#'
	#'  Autogenerated via \code{\link[googlePackageMaker]{package_make}}.
	#'
	#' @seealso \href{https://developers.google.com/admin-sdk/}{Google Documentation}
	#'
	#' @details
	#' Authentication scopes used by this function are:
	#' \itemize{
	#' \item https://www.googleapis.com/auth/admin.directory.user.security
	#' }
	#' @param clientId The Client ID of the application the token is issued to.
	#' @param userKey Identifies the user in the API request. The value can be the user's primary email address, alias email address, or unique user ID.
	#' @param callback JSONP
	#' @param fields Selector specifying which fields to include in a partial response.
	#' @param uploadType Legacy upload protocol for media (e.g. "media", "multipart").
	#' @param upload_protocol Upload protocol for media (e.g. "raw", "multipart").
	#' @param prettyPrint Returns response with indentations and line breaks.
	#' @param quotaUser Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
	#' @param alt Data format for 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_request Whether to return the request without making it. Defaults to FALSE. See \code{\link[gargle]{request_build}} for more info on the returned request object.
	#' @param return_response Whether to return the response or the response content. Defaults to FALSE (return response content).
	#' @export
	tokens.get <- function(clientId, userKey, callback = NULL, fields = NULL, uploadType = NULL, upload_protocol = NULL, prettyPrint = NULL, quotaUser = NULL, alt = NULL, gargle_token = gargle::token_fetch(scopes = .endpoints[['directory.tokens.get']]$scopes[[1]]), return_request = F, return_response = F){
		params <- as.list(environment())[!names(as.list(environment())) %in% c('return_request', 'return_response', 'gargle_token')]
		req <- gargle::request_develop(endpoint = .endpoints[['directory.tokens.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)
		if(return_request) return(req)
		res <- gargle::request_make(req, encode = 'json')
		if(return_response) return(res)
		httr::content(res)
	}

	#' Returns the set of tokens specified user has issued to 3rd party applications.
	#'
	#'  Autogenerated via \code{\link[googlePackageMaker]{package_make}}.
	#'
	#' @seealso \href{https://developers.google.com/admin-sdk/}{Google Documentation}
	#'
	#' @details
	#' Authentication scopes used by this function are:
	#' \itemize{
	#' \item https://www.googleapis.com/auth/admin.directory.user.security
	#' }
	#' @param userKey Identifies the user in the API request. The value can be the user's primary email address, alias email address, or unique user ID.
	#' @param callback JSONP
	#' @param fields Selector specifying which fields to include in a partial response.
	#' @param uploadType Legacy upload protocol for media (e.g. "media", "multipart").
	#' @param upload_protocol Upload protocol for media (e.g. "raw", "multipart").
	#' @param prettyPrint Returns response with indentations and line breaks.
	#' @param quotaUser Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
	#' @param alt Data format for 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_request Whether to return the request without making it. Defaults to FALSE. See \code{\link[gargle]{request_build}} for more info on the returned request object.
	#' @param return_response Whether to return the response or the response content. Defaults to FALSE (return response content).
	#' @export
	tokens.list <- function(userKey, callback = NULL, fields = NULL, uploadType = NULL, upload_protocol = NULL, prettyPrint = NULL, quotaUser = NULL, alt = NULL, gargle_token = gargle::token_fetch(scopes = .endpoints[['directory.tokens.list']]$scopes[[1]]), return_request = F, return_response = F){
		params <- as.list(environment())[!names(as.list(environment())) %in% c('return_request', 'return_response', 'gargle_token')]
		req <- gargle::request_develop(endpoint = .endpoints[['directory.tokens.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)
		if(return_request) return(req)
		res <- gargle::request_make(req, encode = 'json')
		if(return_response) return(res)
		httr::content(res)
	}
samterfa/gapiAdminSDK documentation built on Dec. 22, 2021, 10:11 p.m.