R/sheets_functions.R

#' Google Sheets API
#' Reads and writes Google Sheets.
#' 
#' Auto-generated code by googleAuthR::gar_create_api_skeleton
#'  at 2018-07-15 14:11:50
#' filename: ~/Downloads//googlesheetsv4.auto/R/sheets_functions.R
#' api_json: api_json
#' 
#' @details 
#' Authentication scopes used are:
#' \itemize{
#'   \item https://www.googleapis.com/auth/drive.file
#' \item https://www.googleapis.com/auth/drive
#' \item https://www.googleapis.com/auth/drive.readonly
#' \item https://www.googleapis.com/auth/spreadsheets.readonly
#' \item https://www.googleapis.com/auth/spreadsheets
#' }
#' 
#' @docType package 
#' @name sheets_googleAuthR
#' 
NULL
## NULL

#' A helper function that tests whether an object is either NULL _or_
#' a list of NULLs
#'
#' @keywords internal
is.NullOb <- function(x) is.null(x) | all(sapply(x, is.null))
#' Recursively step down into list, removing all such objects
#'
#' @keywords internal
rmNullObs <- function(x) {
    x <- Filter(Negate(is.NullOb), x)
    lapply(x, function(x) if (is.list(x)) 
        rmNullObs(x) else x)
}

#' Returns the spreadsheet at the given ID.The caller must specify the spreadsheet ID.By default, data within grids will not be returned.You can include grid data one of two ways:* Specify a field mask listing your desired fields using the `fields` URLparameter in HTTP* Set the includeGridDataURL parameter to true.  If a field mask is set, the `includeGridData`parameter is ignoredFor large spreadsheets, it is recommended to retrieve only the specificfields of the spreadsheet that you want.To retrieve only subsets of the spreadsheet, use theranges URL parameter.Multiple ranges can be specified.  Limiting the range willreturn only the portions of the spreadsheet that intersect the requestedranges. Ranges are specified using A1 notation.
#' 
#' Autogenerated via \code{\link[googleAuthR]{gar_create_api_skeleton}}
#' 
#' @seealso \href{https://developers.google.com/sheets/}{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
#' \item https://www.googleapis.com/auth/spreadsheets
#' \item https://www.googleapis.com/auth/spreadsheets.readonly
#' }
#' 
#' Set \code{options(googleAuthR.scopes.selected = c(https://www.googleapis.com/auth/drive, https://www.googleapis.com/auth/drive.file, https://www.googleapis.com/auth/drive.readonly, https://www.googleapis.com/auth/spreadsheets, https://www.googleapis.com/auth/spreadsheets.readonly)}
#' Then run \code{googleAuthR::gar_auth()} to authenticate.
#' See \code{\link[googleAuthR]{gar_auth}} for details. 
#' 
#' @param spreadsheetId The spreadsheet to request
#' @param ranges The ranges to retrieve from the spreadsheet
#' @param includeGridData True if grid data should be returned
#' @importFrom googleAuthR gar_api_generator
#' @export
spreadsheets.get <- function(spreadsheetId, ranges = NULL, includeGridData = NULL) {
    url <- sprintf("https://sheets.googleapis.com/v4/spreadsheets/%s", spreadsheetId)
    # sheets.spreadsheets.get
    pars = list(ranges = ranges, includeGridData = includeGridData)
    f <- googleAuthR::gar_api_generator(url, "GET", pars_args = rmNullObs(pars), 
        data_parse_function = function(x) x)
    f()
    
}

#' Returns the spreadsheet at the given ID.The caller must specify the spreadsheet ID.This method differs from GetSpreadsheet in that it allows selectingwhich subsets of spreadsheet data to return by specifying adataFilters parameter.Multiple DataFilters can be specified.  Specifying one ormore data filters will return the portions of the spreadsheet thatintersect ranges matched by any of the filters.By default, data within grids will not be returned.You can include grid data one of two ways:* Specify a field mask listing your desired fields using the `fields` URLparameter in HTTP* Set the includeGridDataparameter to true.  If a field mask is set, the `includeGridData`parameter is ignoredFor large spreadsheets, it is recommended to retrieve only the specificfields of the spreadsheet that you want.
#' 
#' Autogenerated via \code{\link[googleAuthR]{gar_create_api_skeleton}}
#' 
#' @seealso \href{https://developers.google.com/sheets/}{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/spreadsheets
#' }
#' 
#' Set \code{options(googleAuthR.scopes.selected = c(https://www.googleapis.com/auth/drive, https://www.googleapis.com/auth/drive.file, https://www.googleapis.com/auth/spreadsheets)}
#' Then run \code{googleAuthR::gar_auth()} to authenticate.
#' See \code{\link[googleAuthR]{gar_auth}} for details. 
#' 
#' @param GetSpreadsheetByDataFilterRequest The \link{GetSpreadsheetByDataFilterRequest} object to pass to this method
#' @param spreadsheetId The spreadsheet to request
#' @importFrom googleAuthR gar_api_generator
#' @family GetSpreadsheetByDataFilterRequest functions
#' @export
spreadsheets.getByDataFilter <- function(GetSpreadsheetByDataFilterRequest, spreadsheetId) {
    url <- sprintf("https://sheets.googleapis.com/v4/spreadsheets/%s:getByDataFilter", 
        spreadsheetId)
    # sheets.spreadsheets.getByDataFilter
    f <- googleAuthR::gar_api_generator(url, "POST", data_parse_function = function(x) x)
    stopifnot(inherits(GetSpreadsheetByDataFilterRequest, "gar_GetSpreadsheetByDataFilterRequest"))
    
    f(the_body = GetSpreadsheetByDataFilterRequest)
    
}

#' Creates a spreadsheet, returning the newly created spreadsheet.
#' 
#' Autogenerated via \code{\link[googleAuthR]{gar_create_api_skeleton}}
#' 
#' @seealso \href{https://developers.google.com/sheets/}{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/spreadsheets
#' }
#' 
#' Set \code{options(googleAuthR.scopes.selected = c(https://www.googleapis.com/auth/drive, https://www.googleapis.com/auth/drive.file, https://www.googleapis.com/auth/spreadsheets)}
#' Then run \code{googleAuthR::gar_auth()} to authenticate.
#' See \code{\link[googleAuthR]{gar_auth}} for details. 
#' 
#' @param Spreadsheet The \link{Spreadsheet} object to pass to this method
#' #' @importFrom googleAuthR gar_api_generator
#' @family Spreadsheet functions
#' @export
spreadsheets.create <- function(Spreadsheet) {
    url <- "https://sheets.googleapis.com/v4/spreadsheets"
    # sheets.spreadsheets.create
    f <- googleAuthR::gar_api_generator(url, "POST", data_parse_function = function(x) x)
    stopifnot(inherits(Spreadsheet, "gar_Spreadsheet"))
    
    f(the_body = Spreadsheet)
    
}

#' Applies one or more updates to the spreadsheet.Each request is validated beforebeing applied. If any request is not valid then the entire request willfail and nothing will be applied.Some requests have replies togive you some information about howthey are applied. The replies will mirror the requests.  For example,if you applied 4 updates and the 3rd one had a reply, then theresponse will have 2 empty replies, the actual reply, and another emptyreply, in that order.Due to the collaborative nature of spreadsheets, it is not guaranteed thatthe spreadsheet will reflect exactly your changes after this completes,however it is guaranteed that the updates in the request will beapplied together atomically. Your changes may be altered with respect tocollaborator changes. If there are no collaborators, the spreadsheetshould reflect your changes.
#' 
#' Autogenerated via \code{\link[googleAuthR]{gar_create_api_skeleton}}
#' 
#' @seealso \href{https://developers.google.com/sheets/}{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/spreadsheets
#' }
#' 
#' Set \code{options(googleAuthR.scopes.selected = c(https://www.googleapis.com/auth/drive, https://www.googleapis.com/auth/drive.file, https://www.googleapis.com/auth/spreadsheets)}
#' Then run \code{googleAuthR::gar_auth()} to authenticate.
#' See \code{\link[googleAuthR]{gar_auth}} for details. 
#' 
#' @param BatchUpdateSpreadsheetRequest The \link{BatchUpdateSpreadsheetRequest} object to pass to this method
#' @param spreadsheetId The spreadsheet to apply the updates to
#' @importFrom googleAuthR gar_api_generator
#' @family BatchUpdateSpreadsheetRequest functions
#' @export
spreadsheets.batchUpdate <- function(BatchUpdateSpreadsheetRequest, spreadsheetId) {
    url <- sprintf("https://sheets.googleapis.com/v4/spreadsheets/%s:batchUpdate", 
        spreadsheetId)
    # sheets.spreadsheets.batchUpdate
    f <- googleAuthR::gar_api_generator(url, "POST", data_parse_function = function(x) x)
    stopifnot(inherits(BatchUpdateSpreadsheetRequest, "gar_BatchUpdateSpreadsheetRequest"))
    
    f(the_body = BatchUpdateSpreadsheetRequest)
    
}

#' Copies a single sheet from a spreadsheet to another spreadsheet.Returns the properties of the newly created sheet.
#' 
#' Autogenerated via \code{\link[googleAuthR]{gar_create_api_skeleton}}
#' 
#' @seealso \href{https://developers.google.com/sheets/}{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/spreadsheets
#' }
#' 
#' Set \code{options(googleAuthR.scopes.selected = c(https://www.googleapis.com/auth/drive, https://www.googleapis.com/auth/drive.file, https://www.googleapis.com/auth/spreadsheets)}
#' Then run \code{googleAuthR::gar_auth()} to authenticate.
#' See \code{\link[googleAuthR]{gar_auth}} for details. 
#' 
#' @param CopySheetToAnotherSpreadsheetRequest The \link{CopySheetToAnotherSpreadsheetRequest} object to pass to this method
#' @param spreadsheetId The ID of the spreadsheet containing the sheet to copy
#' @param sheetId The ID of the sheet to copy
#' @importFrom googleAuthR gar_api_generator
#' @family CopySheetToAnotherSpreadsheetRequest functions
#' @export
spreadsheets.sheets.copyTo <- function(CopySheetToAnotherSpreadsheetRequest, spreadsheetId, 
    sheetId) {
    url <- sprintf("https://sheets.googleapis.com/v4/spreadsheets/%s/sheets/%s:copyTo", 
        spreadsheetId, sheetId)
    # sheets.spreadsheets.sheets.copyTo
    f <- googleAuthR::gar_api_generator(url, "POST", data_parse_function = function(x) x)
    stopifnot(inherits(CopySheetToAnotherSpreadsheetRequest, "gar_CopySheetToAnotherSpreadsheetRequest"))
    
    f(the_body = CopySheetToAnotherSpreadsheetRequest)
    
}

#' Returns all developer metadata matching the specified DataFilter.If the provided DataFilter represents a DeveloperMetadataLookup object,this will return all DeveloperMetadata entries selected by it. If theDataFilter represents a location in a spreadsheet, this will return alldeveloper metadata associated with locations intersecting that region.
#' 
#' Autogenerated via \code{\link[googleAuthR]{gar_create_api_skeleton}}
#' 
#' @seealso \href{https://developers.google.com/sheets/}{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/spreadsheets
#' }
#' 
#' Set \code{options(googleAuthR.scopes.selected = c(https://www.googleapis.com/auth/drive, https://www.googleapis.com/auth/drive.file, https://www.googleapis.com/auth/spreadsheets)}
#' Then run \code{googleAuthR::gar_auth()} to authenticate.
#' See \code{\link[googleAuthR]{gar_auth}} for details. 
#' 
#' @param SearchDeveloperMetadataRequest The \link{SearchDeveloperMetadataRequest} object to pass to this method
#' @param spreadsheetId The ID of the spreadsheet to retrieve metadata from
#' @importFrom googleAuthR gar_api_generator
#' @family SearchDeveloperMetadataRequest functions
#' @export
spreadsheets.developerMetadata.search <- function(SearchDeveloperMetadataRequest, 
    spreadsheetId) {
    url <- sprintf("https://sheets.googleapis.com/v4/spreadsheets/%s/developerMetadata:search", 
        spreadsheetId)
    # sheets.spreadsheets.developerMetadata.search
    f <- googleAuthR::gar_api_generator(url, "POST", data_parse_function = function(x) x)
    stopifnot(inherits(SearchDeveloperMetadataRequest, "gar_SearchDeveloperMetadataRequest"))
    
    f(the_body = SearchDeveloperMetadataRequest)
    
}

#' Returns the developer metadata with the specified ID.The caller must specify the spreadsheet ID and the developer metadata'sunique metadataId.
#' 
#' Autogenerated via \code{\link[googleAuthR]{gar_create_api_skeleton}}
#' 
#' @seealso \href{https://developers.google.com/sheets/}{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/spreadsheets
#' }
#' 
#' Set \code{options(googleAuthR.scopes.selected = c(https://www.googleapis.com/auth/drive, https://www.googleapis.com/auth/drive.file, https://www.googleapis.com/auth/spreadsheets)}
#' Then run \code{googleAuthR::gar_auth()} to authenticate.
#' See \code{\link[googleAuthR]{gar_auth}} for details. 
#' 
#' @param spreadsheetId The ID of the spreadsheet to retrieve metadata from
#' @param metadataId The ID of the developer metadata to retrieve
#' @importFrom googleAuthR gar_api_generator
#' @export
spreadsheets.developerMetadata.get <- function(spreadsheetId, metadataId) {
    url <- sprintf("https://sheets.googleapis.com/v4/spreadsheets/%s/developerMetadata/%s", 
        spreadsheetId, metadataId)
    # sheets.spreadsheets.developerMetadata.get
    f <- googleAuthR::gar_api_generator(url, "GET", data_parse_function = function(x) x)
    f()
    
}

#' Returns one or more ranges of values that match the specified data filters.The caller must specify the spreadsheet ID and one or moreDataFilters.  Ranges that match any of the data filters inthe request will be returned.
#' 
#' Autogenerated via \code{\link[googleAuthR]{gar_create_api_skeleton}}
#' 
#' @seealso \href{https://developers.google.com/sheets/}{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/spreadsheets
#' }
#' 
#' Set \code{options(googleAuthR.scopes.selected = c(https://www.googleapis.com/auth/drive, https://www.googleapis.com/auth/drive.file, https://www.googleapis.com/auth/spreadsheets)}
#' Then run \code{googleAuthR::gar_auth()} to authenticate.
#' See \code{\link[googleAuthR]{gar_auth}} for details. 
#' 
#' @param BatchGetValuesByDataFilterRequest The \link{BatchGetValuesByDataFilterRequest} object to pass to this method
#' @param spreadsheetId The ID of the spreadsheet to retrieve data from
#' @importFrom googleAuthR gar_api_generator
#' @family BatchGetValuesByDataFilterRequest functions
#' @export
spreadsheets.values.batchGetByDataFilter <- function(BatchGetValuesByDataFilterRequest, 
    spreadsheetId) {
    url <- sprintf("https://sheets.googleapis.com/v4/spreadsheets/%s/values:batchGetByDataFilter", 
        spreadsheetId)
    # sheets.spreadsheets.values.batchGetByDataFilter
    f <- googleAuthR::gar_api_generator(url, "POST", data_parse_function = function(x) x)
    stopifnot(inherits(BatchGetValuesByDataFilterRequest, "gar_BatchGetValuesByDataFilterRequest"))
    
    f(the_body = BatchGetValuesByDataFilterRequest)
    
}

#' Clears one or more ranges of values from a spreadsheet.The caller must specify the spreadsheet ID and one or more ranges.Only values are cleared -- all other properties of the cell (such asformatting, data validation, etc..) are kept.
#' 
#' Autogenerated via \code{\link[googleAuthR]{gar_create_api_skeleton}}
#' 
#' @seealso \href{https://developers.google.com/sheets/}{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/spreadsheets
#' }
#' 
#' Set \code{options(googleAuthR.scopes.selected = c(https://www.googleapis.com/auth/drive, https://www.googleapis.com/auth/drive.file, https://www.googleapis.com/auth/spreadsheets)}
#' Then run \code{googleAuthR::gar_auth()} to authenticate.
#' See \code{\link[googleAuthR]{gar_auth}} for details. 
#' 
#' @param BatchClearValuesRequest The \link{BatchClearValuesRequest} object to pass to this method
#' @param spreadsheetId The ID of the spreadsheet to update
#' @importFrom googleAuthR gar_api_generator
#' @family BatchClearValuesRequest functions
#' @export
spreadsheets.values.batchClear <- function(BatchClearValuesRequest, spreadsheetId) {
    url <- sprintf("https://sheets.googleapis.com/v4/spreadsheets/%s/values:batchClear", 
        spreadsheetId)
    # sheets.spreadsheets.values.batchClear
    f <- googleAuthR::gar_api_generator(url, "POST", data_parse_function = function(x) x)
    stopifnot(inherits(BatchClearValuesRequest, "gar_BatchClearValuesRequest"))
    
    f(the_body = BatchClearValuesRequest)
    
}

#' Returns a range of values from a spreadsheet.The caller must specify the spreadsheet ID and a range.
#' 
#' Autogenerated via \code{\link[googleAuthR]{gar_create_api_skeleton}}
#' 
#' @seealso \href{https://developers.google.com/sheets/}{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
#' \item https://www.googleapis.com/auth/spreadsheets
#' \item https://www.googleapis.com/auth/spreadsheets.readonly
#' }
#' 
#' Set \code{options(googleAuthR.scopes.selected = c(https://www.googleapis.com/auth/drive, https://www.googleapis.com/auth/drive.file, https://www.googleapis.com/auth/drive.readonly, https://www.googleapis.com/auth/spreadsheets, https://www.googleapis.com/auth/spreadsheets.readonly)}
#' Then run \code{googleAuthR::gar_auth()} to authenticate.
#' See \code{\link[googleAuthR]{gar_auth}} for details. 
#' 
#' @param spreadsheetId The ID of the spreadsheet to retrieve data from
#' @param range The A1 notation of the values to retrieve
#' @param valueRenderOption How values should be represented in the output
#' @param dateTimeRenderOption How dates, times, and durations should be represented in the output
#' @param majorDimension The major dimension that results should use
#' @importFrom googleAuthR gar_api_generator
#' @export
spreadsheets.values.get <- function(spreadsheetId, range, valueRenderOption = NULL, 
    dateTimeRenderOption = NULL, majorDimension = NULL) {
    url <- sprintf("https://sheets.googleapis.com/v4/spreadsheets/%s/values/%s", 
        spreadsheetId, range)
    # sheets.spreadsheets.values.get
    pars = list(valueRenderOption = valueRenderOption, dateTimeRenderOption = dateTimeRenderOption, 
        majorDimension = majorDimension)
    f <- googleAuthR::gar_api_generator(url, "GET", pars_args = rmNullObs(pars), 
        data_parse_function = function(x) x)
    f()
    
}

#' Sets values in a range of a spreadsheet.The caller must specify the spreadsheet ID, range, anda valueInputOption.
#' 
#' Autogenerated via \code{\link[googleAuthR]{gar_create_api_skeleton}}
#' 
#' @seealso \href{https://developers.google.com/sheets/}{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/spreadsheets
#' }
#' 
#' Set \code{options(googleAuthR.scopes.selected = c(https://www.googleapis.com/auth/drive, https://www.googleapis.com/auth/drive.file, https://www.googleapis.com/auth/spreadsheets)}
#' Then run \code{googleAuthR::gar_auth()} to authenticate.
#' See \code{\link[googleAuthR]{gar_auth}} for details. 
#' 
#' @param ValueRange The \link{ValueRange} object to pass to this method
#' @param spreadsheetId The ID of the spreadsheet to update
#' @param range The A1 notation of the values to update
#' @param includeValuesInResponse Determines if the update response should include the values
#' @param responseValueRenderOption Determines how values in the response should be rendered
#' @param valueInputOption How the input data should be interpreted
#' @param responseDateTimeRenderOption Determines how dates, times, and durations in the response should be
#' @importFrom googleAuthR gar_api_generator
#' @family ValueRange functions
#' @export
spreadsheets.values.update <- function(ValueRange, spreadsheetId, range, includeValuesInResponse = NULL, 
    responseValueRenderOption = NULL, valueInputOption = NULL, responseDateTimeRenderOption = NULL) {
    url <- sprintf("https://sheets.googleapis.com/v4/spreadsheets/%s/values/%s", 
        spreadsheetId, range)
    # sheets.spreadsheets.values.update
    pars = list(includeValuesInResponse = includeValuesInResponse, responseValueRenderOption = responseValueRenderOption, 
        valueInputOption = valueInputOption, responseDateTimeRenderOption = responseDateTimeRenderOption)
    f <- googleAuthR::gar_api_generator(url, "PUT", pars_args = rmNullObs(pars), 
        data_parse_function = function(x) x)
    stopifnot(inherits(ValueRange, "gar_ValueRange"))
    
    f(the_body = ValueRange)
    
}

#' Sets values in one or more ranges of a spreadsheet.The caller must specify the spreadsheet ID,a valueInputOption, and one or moreDataFilterValueRanges.
#' 
#' Autogenerated via \code{\link[googleAuthR]{gar_create_api_skeleton}}
#' 
#' @seealso \href{https://developers.google.com/sheets/}{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/spreadsheets
#' }
#' 
#' Set \code{options(googleAuthR.scopes.selected = c(https://www.googleapis.com/auth/drive, https://www.googleapis.com/auth/drive.file, https://www.googleapis.com/auth/spreadsheets)}
#' Then run \code{googleAuthR::gar_auth()} to authenticate.
#' See \code{\link[googleAuthR]{gar_auth}} for details. 
#' 
#' @param BatchUpdateValuesByDataFilterRequest The \link{BatchUpdateValuesByDataFilterRequest} object to pass to this method
#' @param spreadsheetId The ID of the spreadsheet to update
#' @importFrom googleAuthR gar_api_generator
#' @family BatchUpdateValuesByDataFilterRequest functions
#' @export
spreadsheets.values.batchUpdateByDataFilter <- function(BatchUpdateValuesByDataFilterRequest, 
    spreadsheetId) {
    url <- sprintf("https://sheets.googleapis.com/v4/spreadsheets/%s/values:batchUpdateByDataFilter", 
        spreadsheetId)
    # sheets.spreadsheets.values.batchUpdateByDataFilter
    f <- googleAuthR::gar_api_generator(url, "POST", data_parse_function = function(x) x)
    stopifnot(inherits(BatchUpdateValuesByDataFilterRequest, "gar_BatchUpdateValuesByDataFilterRequest"))
    
    f(the_body = BatchUpdateValuesByDataFilterRequest)
    
}

#' Sets values in one or more ranges of a spreadsheet.The caller must specify the spreadsheet ID,a valueInputOption, and one or moreValueRanges.
#' 
#' Autogenerated via \code{\link[googleAuthR]{gar_create_api_skeleton}}
#' 
#' @seealso \href{https://developers.google.com/sheets/}{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/spreadsheets
#' }
#' 
#' Set \code{options(googleAuthR.scopes.selected = c(https://www.googleapis.com/auth/drive, https://www.googleapis.com/auth/drive.file, https://www.googleapis.com/auth/spreadsheets)}
#' Then run \code{googleAuthR::gar_auth()} to authenticate.
#' See \code{\link[googleAuthR]{gar_auth}} for details. 
#' 
#' @param BatchUpdateValuesRequest The \link{BatchUpdateValuesRequest} object to pass to this method
#' @param spreadsheetId The ID of the spreadsheet to update
#' @importFrom googleAuthR gar_api_generator
#' @family BatchUpdateValuesRequest functions
#' @export
spreadsheets.values.batchUpdate <- function(BatchUpdateValuesRequest, spreadsheetId) {
    url <- sprintf("https://sheets.googleapis.com/v4/spreadsheets/%s/values:batchUpdate", 
        spreadsheetId)
    # sheets.spreadsheets.values.batchUpdate
    f <- googleAuthR::gar_api_generator(url, "POST", data_parse_function = function(x) x)
    stopifnot(inherits(BatchUpdateValuesRequest, "gar_BatchUpdateValuesRequest"))
    
    f(the_body = BatchUpdateValuesRequest)
    
}

#' Clears values from a spreadsheet.The caller must specify the spreadsheet ID and range.Only values are cleared -- all other properties of the cell (such asformatting, data validation, etc..) are kept.
#' 
#' Autogenerated via \code{\link[googleAuthR]{gar_create_api_skeleton}}
#' 
#' @seealso \href{https://developers.google.com/sheets/}{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/spreadsheets
#' }
#' 
#' Set \code{options(googleAuthR.scopes.selected = c(https://www.googleapis.com/auth/drive, https://www.googleapis.com/auth/drive.file, https://www.googleapis.com/auth/spreadsheets)}
#' Then run \code{googleAuthR::gar_auth()} to authenticate.
#' See \code{\link[googleAuthR]{gar_auth}} for details. 
#' 
#' @param ClearValuesRequest The \link{ClearValuesRequest} object to pass to this method
#' @param spreadsheetId The ID of the spreadsheet to update
#' @param range The A1 notation of the values to clear
#' @importFrom googleAuthR gar_api_generator
#' @family ClearValuesRequest functions
#' @export
spreadsheets.values.clear <- function(ClearValuesRequest, spreadsheetId, range) {
    url <- sprintf("https://sheets.googleapis.com/v4/spreadsheets/%s/values/%s:clear", 
        spreadsheetId, range)
    # sheets.spreadsheets.values.clear
    f <- googleAuthR::gar_api_generator(url, "POST", data_parse_function = function(x) x)
    stopifnot(inherits(ClearValuesRequest, "gar_ClearValuesRequest"))
    
    f(the_body = ClearValuesRequest)
    
}

#' Returns one or more ranges of values from a spreadsheet.The caller must specify the spreadsheet ID and one or more ranges.
#' 
#' Autogenerated via \code{\link[googleAuthR]{gar_create_api_skeleton}}
#' 
#' @seealso \href{https://developers.google.com/sheets/}{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
#' \item https://www.googleapis.com/auth/spreadsheets
#' \item https://www.googleapis.com/auth/spreadsheets.readonly
#' }
#' 
#' Set \code{options(googleAuthR.scopes.selected = c(https://www.googleapis.com/auth/drive, https://www.googleapis.com/auth/drive.file, https://www.googleapis.com/auth/drive.readonly, https://www.googleapis.com/auth/spreadsheets, https://www.googleapis.com/auth/spreadsheets.readonly)}
#' Then run \code{googleAuthR::gar_auth()} to authenticate.
#' See \code{\link[googleAuthR]{gar_auth}} for details. 
#' 
#' @param spreadsheetId The ID of the spreadsheet to retrieve data from
#' @param valueRenderOption How values should be represented in the output
#' @param dateTimeRenderOption How dates, times, and durations should be represented in the output
#' @param ranges The A1 notation of the values to retrieve
#' @param majorDimension The major dimension that results should use
#' @importFrom googleAuthR gar_api_generator
#' @export
spreadsheets.values.batchGet <- function(spreadsheetId, valueRenderOption = NULL, 
    dateTimeRenderOption = NULL, ranges = NULL, majorDimension = NULL) {
    url <- sprintf("https://sheets.googleapis.com/v4/spreadsheets/%s/values:batchGet", 
        spreadsheetId)
    # sheets.spreadsheets.values.batchGet
    pars = list(valueRenderOption = valueRenderOption, dateTimeRenderOption = dateTimeRenderOption, 
        ranges = ranges, majorDimension = majorDimension)
    f <- googleAuthR::gar_api_generator(url, "GET", pars_args = rmNullObs(pars), 
        data_parse_function = function(x) x)
    f()
    
}

#' Clears one or more ranges of values from a spreadsheet.The caller must specify the spreadsheet ID and one or moreDataFilters. Ranges matching any of the specified datafilters will be cleared.  Only values are cleared -- all other propertiesof the cell (such as formatting, data validation, etc..) are kept.
#' 
#' Autogenerated via \code{\link[googleAuthR]{gar_create_api_skeleton}}
#' 
#' @seealso \href{https://developers.google.com/sheets/}{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/spreadsheets
#' }
#' 
#' Set \code{options(googleAuthR.scopes.selected = c(https://www.googleapis.com/auth/drive, https://www.googleapis.com/auth/drive.file, https://www.googleapis.com/auth/spreadsheets)}
#' Then run \code{googleAuthR::gar_auth()} to authenticate.
#' See \code{\link[googleAuthR]{gar_auth}} for details. 
#' 
#' @param BatchClearValuesByDataFilterRequest The \link{BatchClearValuesByDataFilterRequest} object to pass to this method
#' @param spreadsheetId The ID of the spreadsheet to update
#' @importFrom googleAuthR gar_api_generator
#' @family BatchClearValuesByDataFilterRequest functions
#' @export
spreadsheets.values.batchClearByDataFilter <- function(BatchClearValuesByDataFilterRequest, 
    spreadsheetId) {
    url <- sprintf("https://sheets.googleapis.com/v4/spreadsheets/%s/values:batchClearByDataFilter", 
        spreadsheetId)
    # sheets.spreadsheets.values.batchClearByDataFilter
    f <- googleAuthR::gar_api_generator(url, "POST", data_parse_function = function(x) x)
    stopifnot(inherits(BatchClearValuesByDataFilterRequest, "gar_BatchClearValuesByDataFilterRequest"))
    
    f(the_body = BatchClearValuesByDataFilterRequest)
    
}


#' Appends values to a spreadsheet. The input range is used to search forexisting data and find a 'table' within that range. Values will beappended to the next row of the table, starting with the first column ofthe table. See the[guide](/sheets/api/guides/values#appending_values)and[sample code](/sheets/api/samples/writing#append_values)for specific details of how tables are detected and data is appended.The caller must specify the spreadsheet ID, range, anda valueInputOption.  The `valueInputOption` onlycontrols how the input data will be added to the sheet (column-wise orrow-wise), it does not influence what cell the data starts being writtento.
#' 
#' Autogenerated via \code{\link[googleAuthR]{gar_create_api_skeleton}}
#' 
#' @seealso \href{https://developers.google.com/sheets/}{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/spreadsheets
#' }
#' 
#' Set \code{options(googleAuthR.scopes.selected = c(https://www.googleapis.com/auth/drive, https://www.googleapis.com/auth/drive.file, https://www.googleapis.com/auth/spreadsheets)}
#' Then run \code{googleAuthR::gar_auth()} to authenticate.
#' See \code{\link[googleAuthR]{gar_auth}} for details. 
#' 
#' @param ValueRange The \link{ValueRange} object to pass to this method
#' @param spreadsheetId The ID of the spreadsheet to update

#' @param range The A1 notation of a range to search for a logical table of data

#' @param includeValuesInResponse Determines if the update response should include the values

#' @param responseValueRenderOption Determines how values in the response should be rendered

#' @param insertDataOption How the input data should be inserted

#' @param valueInputOption How the input data should be interpreted

#' @param responseDateTimeRenderOption Determines how dates, times, and durations in the response should be
#' @importFrom googleAuthR gar_api_generator
#' @family ValueRange functions
#' @export


spreadsheets.values.append <- function(ValueRange, spreadsheetId, range, includeValuesInResponse = NULL, 
    responseValueRenderOption = NULL, insertDataOption = NULL, valueInputOption = NULL, 
    responseDateTimeRenderOption = NULL) {
    
    
    url <- sprintf("https://sheets.googleapis.com/v4/spreadsheets/%s/values/%s:append", 
        spreadsheetId, range)
    # sheets.spreadsheets.values.append
    pars = list(includeValuesInResponse = includeValuesInResponse, responseValueRenderOption = responseValueRenderOption, 
        insertDataOption = insertDataOption, valueInputOption = valueInputOption, 
        responseDateTimeRenderOption = responseDateTimeRenderOption)
    
    f <- googleAuthR::gar_api_generator(url, "POST", pars_args = rmNullObs(pars), 
        data_parse_function = function(x) x)
    
    stopifnot(inherits(ValueRange, "gar_ValueRange"))
    
    f(the_body = ValueRange)
    
    
}
lantanacamara/googleSheetsR documentation built on May 3, 2019, 11:52 p.m.