R/firestore_functions.R

Defines functions projects.locations.get projects.locations.list projects.databases.documents.beginTransaction projects.databases.documents.partitionQuery projects.databases.documents.write projects.databases.documents.patch projects.databases.documents.batchWrite projects.databases.documents.delete projects.databases.documents.get projects.databases.documents.listen projects.databases.documents.createDocument projects.databases.documents.rollback projects.databases.documents.batchGet projects.databases.documents.runQuery projects.databases.documents.list projects.databases.documents.listCollectionIds projects.databases.documents.commit projects.databases.collectionGroups.fields.list projects.databases.collectionGroups.fields.get projects.databases.collectionGroups.fields.patch projects.databases.collectionGroups.indexes.get projects.databases.collectionGroups.indexes.create projects.databases.collectionGroups.indexes.list projects.databases.collectionGroups.indexes.delete projects.databases.operations.get projects.databases.operations.list projects.databases.operations.cancel projects.databases.operations.delete projects.databases.importDocuments projects.databases.exportDocuments rmNullObs is.NullOb

Documented in is.NullOb projects.databases.collectionGroups.fields.get projects.databases.collectionGroups.fields.list projects.databases.collectionGroups.fields.patch projects.databases.collectionGroups.indexes.create projects.databases.collectionGroups.indexes.delete projects.databases.collectionGroups.indexes.get projects.databases.collectionGroups.indexes.list projects.databases.documents.batchGet projects.databases.documents.batchWrite projects.databases.documents.beginTransaction projects.databases.documents.commit projects.databases.documents.createDocument projects.databases.documents.delete projects.databases.documents.get projects.databases.documents.list projects.databases.documents.listCollectionIds projects.databases.documents.listen projects.databases.documents.partitionQuery projects.databases.documents.patch projects.databases.documents.rollback projects.databases.documents.runQuery projects.databases.documents.write projects.databases.exportDocuments projects.databases.importDocuments projects.databases.operations.cancel projects.databases.operations.delete projects.databases.operations.get projects.databases.operations.list projects.locations.get projects.locations.list rmNullObs

#' Cloud Firestore API
#' Accesses the NoSQL document database built for automatic scaling, high performance, and ease of application development.
#'
#' Auto-generated code by googleAuthR::gar_create_api_skeleton
#'  at 2021-08-19 09:15:03
#' filename: /home/juha/workspace/autoGoogleAPI//googlefirestorev1.auto/R/firestore_functions.R
#' api_json: api_json
#'
#' @details
#' Authentication scopes used are:
#' \itemize{
#'   \item https://www.googleapis.com/auth/datastore
#' \item https://www.googleapis.com/auth/cloud-platform
#' }
#'
#' @docType package
#' @name firestore_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 <- base::Filter(base::Negate(is.NullOb), x)
    lapply(x, function(x) if (is.list(x))
        rmNullObs(x) else x)
}

#' Exports a copy of all or a subset of documents from Google Cloud Firestore to another storage system, such as Google Cloud Storage. Recent updates to documents may not be reflected in the export. The export occurs in the background and its progress can be monitored and managed via the Operation resource that is created. The output of an export may only be used once the associated operation is done. If an export operation is cancelled before completion it may leave partial data behind in Google Cloud Storage. For more details on export behavior and output format, refer to: https://cloud.google.com/firestore/docs/manage-data/export-import
#'
#' Autogenerated via \code{\link[googleAuthR]{gar_create_api_skeleton}}
#'
#' @seealso \href{https://cloud.google.com/firestore}{Google Documentation}
#'
#' @details
#' Authentication scopes used by this function are:
#' \itemize{
#'   \item https://www.googleapis.com/auth/cloud-platform
#' \item https://www.googleapis.com/auth/datastore
#' }
#'
#' Set \code{options(googleAuthR.scopes.selected = c(https://www.googleapis.com/auth/cloud-platform, https://www.googleapis.com/auth/datastore)}
#' Then run \code{googleAuthR::gar_auth()} to authenticate.
#' See \code{\link[googleAuthR]{gar_auth}} for details.
#'
#' @param GoogleFirestoreAdminV1ExportDocumentsRequest The \link{GoogleFirestoreAdminV1ExportDocumentsRequest} object to pass to this method
#' @param name Required
#' @importFrom googleAuthR gar_api_generator
#' @family GoogleFirestoreAdminV1ExportDocumentsRequest functions
#' @export
projects.databases.exportDocuments <- function(GoogleFirestoreAdminV1ExportDocumentsRequest,
    name) {
    url <- sprintf("https://firestore.googleapis.com/v1/%s:exportDocuments",
        name)
    # firestore.projects.databases.exportDocuments
    f <- googleAuthR::gar_api_generator(url, "POST", data_parse_function = function(x) x)
    stopifnot(inherits(GoogleFirestoreAdminV1ExportDocumentsRequest, "gar_GoogleFirestoreAdminV1ExportDocumentsRequest"))

    f(the_body = GoogleFirestoreAdminV1ExportDocumentsRequest)

}

#' Imports documents into Google Cloud Firestore. Existing documents with the same name are overwritten. The import occurs in the background and its progress can be monitored and managed via the Operation resource that is created. If an ImportDocuments operation is cancelled, it is possible that a subset of the data has already been imported to Cloud Firestore.
#'
#' Autogenerated via \code{\link[googleAuthR]{gar_create_api_skeleton}}
#'
#' @seealso \href{https://cloud.google.com/firestore}{Google Documentation}
#'
#' @details
#' Authentication scopes used by this function are:
#' \itemize{
#'   \item https://www.googleapis.com/auth/cloud-platform
#' \item https://www.googleapis.com/auth/datastore
#' }
#'
#' Set \code{options(googleAuthR.scopes.selected = c(https://www.googleapis.com/auth/cloud-platform, https://www.googleapis.com/auth/datastore)}
#' Then run \code{googleAuthR::gar_auth()} to authenticate.
#' See \code{\link[googleAuthR]{gar_auth}} for details.
#'
#' @param GoogleFirestoreAdminV1ImportDocumentsRequest The \link{GoogleFirestoreAdminV1ImportDocumentsRequest} object to pass to this method
#' @param name Required
#' @importFrom googleAuthR gar_api_generator
#' @family GoogleFirestoreAdminV1ImportDocumentsRequest functions
#' @export
projects.databases.importDocuments <- function(GoogleFirestoreAdminV1ImportDocumentsRequest,
    name) {
    url <- sprintf("https://firestore.googleapis.com/v1/%s:importDocuments",
        name)
    # firestore.projects.databases.importDocuments
    f <- googleAuthR::gar_api_generator(url, "POST", data_parse_function = function(x) x)
    stopifnot(inherits(GoogleFirestoreAdminV1ImportDocumentsRequest, "gar_GoogleFirestoreAdminV1ImportDocumentsRequest"))

    f(the_body = GoogleFirestoreAdminV1ImportDocumentsRequest)

}

#' Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
#'
#' Autogenerated via \code{\link[googleAuthR]{gar_create_api_skeleton}}
#'
#' @seealso \href{https://cloud.google.com/firestore}{Google Documentation}
#'
#' @details
#' Authentication scopes used by this function are:
#' \itemize{
#'   \item https://www.googleapis.com/auth/cloud-platform
#' \item https://www.googleapis.com/auth/datastore
#' }
#'
#' Set \code{options(googleAuthR.scopes.selected = c(https://www.googleapis.com/auth/cloud-platform, https://www.googleapis.com/auth/datastore)}
#' Then run \code{googleAuthR::gar_auth()} to authenticate.
#' See \code{\link[googleAuthR]{gar_auth}} for details.
#'
#' @param name The name of the operation resource to be deleted
#' @importFrom googleAuthR gar_api_generator
#' @export
projects.databases.operations.delete <- function(name) {
    url <- sprintf("https://firestore.googleapis.com/v1/%s", name)
    # firestore.projects.databases.operations.delete
    f <- googleAuthR::gar_api_generator(url, "DELETE", data_parse_function = function(x) x)
    f()

}

#' Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of 1, corresponding to `Code.CANCELLED`.
#'
#' Autogenerated via \code{\link[googleAuthR]{gar_create_api_skeleton}}
#'
#' @seealso \href{https://cloud.google.com/firestore}{Google Documentation}
#'
#' @details
#' Authentication scopes used by this function are:
#' \itemize{
#'   \item https://www.googleapis.com/auth/cloud-platform
#' \item https://www.googleapis.com/auth/datastore
#' }
#'
#' Set \code{options(googleAuthR.scopes.selected = c(https://www.googleapis.com/auth/cloud-platform, https://www.googleapis.com/auth/datastore)}
#' Then run \code{googleAuthR::gar_auth()} to authenticate.
#' See \code{\link[googleAuthR]{gar_auth}} for details.
#'
#' @param GoogleLongrunningCancelOperationRequest The \link{GoogleLongrunningCancelOperationRequest} object to pass to this method
#' @param name The name of the operation resource to be cancelled
#' @importFrom googleAuthR gar_api_generator
#' @family GoogleLongrunningCancelOperationRequest functions
#' @export
projects.databases.operations.cancel <- function(GoogleLongrunningCancelOperationRequest,
    name) {
    url <- sprintf("https://firestore.googleapis.com/v1/%s:cancel", name)
    # firestore.projects.databases.operations.cancel
    f <- googleAuthR::gar_api_generator(url, "POST", data_parse_function = function(x) x)
    stopifnot(inherits(GoogleLongrunningCancelOperationRequest, "gar_GoogleLongrunningCancelOperationRequest"))

    f(the_body = GoogleLongrunningCancelOperationRequest)

}

#' Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`. NOTE: the `name` binding allows API services to override the binding to use different resource name schemes, such as `users/*/operations`. To override the binding, API services can add a binding such as `'/v1/{name=users/*}/operations'` to their service configuration. For backwards compatibility, the default name includes the operations collection id, however overriding users must ensure the name binding is the parent resource, without the operations collection id.
#'
#' Autogenerated via \code{\link[googleAuthR]{gar_create_api_skeleton}}
#'
#' @seealso \href{https://cloud.google.com/firestore}{Google Documentation}
#'
#' @details
#' Authentication scopes used by this function are:
#' \itemize{
#'   \item https://www.googleapis.com/auth/cloud-platform
#' \item https://www.googleapis.com/auth/datastore
#' }
#'
#' Set \code{options(googleAuthR.scopes.selected = c(https://www.googleapis.com/auth/cloud-platform, https://www.googleapis.com/auth/datastore)}
#' Then run \code{googleAuthR::gar_auth()} to authenticate.
#' See \code{\link[googleAuthR]{gar_auth}} for details.
#'
#' @param name The name of the operation's parent resource
#' @param pageSize The standard list page size
#' @param pageToken The standard list page token
#' @param filter The standard list filter
#' @importFrom googleAuthR gar_api_generator
#' @export
projects.databases.operations.list <- function(name, pageSize = NULL, pageToken = NULL,
    filter = NULL) {
    url <- sprintf("https://firestore.googleapis.com/v1/%s/operations", name)
    # firestore.projects.databases.operations.list
    pars = list(pageSize = pageSize, pageToken = pageToken, filter = filter)
    f <- googleAuthR::gar_api_generator(url, "GET", pars_args = rmNullObs(pars),
        data_parse_function = function(x) x)
    f()

}

#' Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
#'
#' Autogenerated via \code{\link[googleAuthR]{gar_create_api_skeleton}}
#'
#' @seealso \href{https://cloud.google.com/firestore}{Google Documentation}
#'
#' @details
#' Authentication scopes used by this function are:
#' \itemize{
#'   \item https://www.googleapis.com/auth/cloud-platform
#' \item https://www.googleapis.com/auth/datastore
#' }
#'
#' Set \code{options(googleAuthR.scopes.selected = c(https://www.googleapis.com/auth/cloud-platform, https://www.googleapis.com/auth/datastore)}
#' Then run \code{googleAuthR::gar_auth()} to authenticate.
#' See \code{\link[googleAuthR]{gar_auth}} for details.
#'
#' @param name The name of the operation resource
#' @importFrom googleAuthR gar_api_generator
#' @export
projects.databases.operations.get <- function(name) {
    url <- sprintf("https://firestore.googleapis.com/v1/%s", name)
    # firestore.projects.databases.operations.get
    f <- googleAuthR::gar_api_generator(url, "GET", data_parse_function = function(x) x)
    f()

}

#' Deletes a composite index.
#'
#' Autogenerated via \code{\link[googleAuthR]{gar_create_api_skeleton}}
#'
#' @seealso \href{https://cloud.google.com/firestore}{Google Documentation}
#'
#' @details
#' Authentication scopes used by this function are:
#' \itemize{
#'   \item https://www.googleapis.com/auth/cloud-platform
#' \item https://www.googleapis.com/auth/datastore
#' }
#'
#' Set \code{options(googleAuthR.scopes.selected = c(https://www.googleapis.com/auth/cloud-platform, https://www.googleapis.com/auth/datastore)}
#' Then run \code{googleAuthR::gar_auth()} to authenticate.
#' See \code{\link[googleAuthR]{gar_auth}} for details.
#'
#' @param name Required
#' @importFrom googleAuthR gar_api_generator
#' @export
projects.databases.collectionGroups.indexes.delete <- function(name) {
    url <- sprintf("https://firestore.googleapis.com/v1/%s", name)
    # firestore.projects.databases.collectionGroups.indexes.delete
    f <- googleAuthR::gar_api_generator(url, "DELETE", data_parse_function = function(x) x)
    f()

}

#' Lists composite indexes.
#'
#' Autogenerated via \code{\link[googleAuthR]{gar_create_api_skeleton}}
#'
#' @seealso \href{https://cloud.google.com/firestore}{Google Documentation}
#'
#' @details
#' Authentication scopes used by this function are:
#' \itemize{
#'   \item https://www.googleapis.com/auth/cloud-platform
#' \item https://www.googleapis.com/auth/datastore
#' }
#'
#' Set \code{options(googleAuthR.scopes.selected = c(https://www.googleapis.com/auth/cloud-platform, https://www.googleapis.com/auth/datastore)}
#' Then run \code{googleAuthR::gar_auth()} to authenticate.
#' See \code{\link[googleAuthR]{gar_auth}} for details.
#'
#' @param parent Required
#' @param pageSize The number of results to return
#' @param pageToken A page token, returned from a previous call to FirestoreAdmin
#' @param filter The filter to apply to list results
#' @importFrom googleAuthR gar_api_generator
#' @export
projects.databases.collectionGroups.indexes.list <- function(parent, pageSize = NULL,
    pageToken = NULL, filter = NULL) {
    url <- sprintf("https://firestore.googleapis.com/v1/%s/indexes", parent)
    # firestore.projects.databases.collectionGroups.indexes.list
    pars = list(pageSize = pageSize, pageToken = pageToken, filter = filter)
    f <- googleAuthR::gar_api_generator(url, "GET", pars_args = rmNullObs(pars),
        data_parse_function = function(x) x)
    f()

}

#' Creates a composite index. This returns a google.longrunning.Operation which may be used to track the status of the creation. The metadata for the operation will be the type IndexOperationMetadata.
#'
#' Autogenerated via \code{\link[googleAuthR]{gar_create_api_skeleton}}
#'
#' @seealso \href{https://cloud.google.com/firestore}{Google Documentation}
#'
#' @details
#' Authentication scopes used by this function are:
#' \itemize{
#'   \item https://www.googleapis.com/auth/cloud-platform
#' \item https://www.googleapis.com/auth/datastore
#' }
#'
#' Set \code{options(googleAuthR.scopes.selected = c(https://www.googleapis.com/auth/cloud-platform, https://www.googleapis.com/auth/datastore)}
#' Then run \code{googleAuthR::gar_auth()} to authenticate.
#' See \code{\link[googleAuthR]{gar_auth}} for details.
#'
#' @param GoogleFirestoreAdminV1Index The \link{GoogleFirestoreAdminV1Index} object to pass to this method
#' @param parent Required
#' @importFrom googleAuthR gar_api_generator
#' @family GoogleFirestoreAdminV1Index functions
#' @export
projects.databases.collectionGroups.indexes.create <- function(GoogleFirestoreAdminV1Index,
    parent) {
    url <- sprintf("https://firestore.googleapis.com/v1/%s/indexes", parent)
    # firestore.projects.databases.collectionGroups.indexes.create
    f <- googleAuthR::gar_api_generator(url, "POST", data_parse_function = function(x) x)
    stopifnot(inherits(GoogleFirestoreAdminV1Index, "gar_GoogleFirestoreAdminV1Index"))

    f(the_body = GoogleFirestoreAdminV1Index)

}

#' Gets a composite index.
#'
#' Autogenerated via \code{\link[googleAuthR]{gar_create_api_skeleton}}
#'
#' @seealso \href{https://cloud.google.com/firestore}{Google Documentation}
#'
#' @details
#' Authentication scopes used by this function are:
#' \itemize{
#'   \item https://www.googleapis.com/auth/cloud-platform
#' \item https://www.googleapis.com/auth/datastore
#' }
#'
#' Set \code{options(googleAuthR.scopes.selected = c(https://www.googleapis.com/auth/cloud-platform, https://www.googleapis.com/auth/datastore)}
#' Then run \code{googleAuthR::gar_auth()} to authenticate.
#' See \code{\link[googleAuthR]{gar_auth}} for details.
#'
#' @param name Required
#' @importFrom googleAuthR gar_api_generator
#' @export
projects.databases.collectionGroups.indexes.get <- function(name) {
    url <- sprintf("https://firestore.googleapis.com/v1/%s", name)
    # firestore.projects.databases.collectionGroups.indexes.get
    f <- googleAuthR::gar_api_generator(url, "GET", data_parse_function = function(x) x)
    f()

}

#' Updates a field configuration. Currently, field updates apply only to single field index configuration. However, calls to FirestoreAdmin.UpdateField should provide a field mask to avoid changing any configuration that the caller isn't aware of. The field mask should be specified as: `{ paths: 'index_config' }`. This call returns a google.longrunning.Operation which may be used to track the status of the field update. The metadata for the operation will be the type FieldOperationMetadata. To configure the default field settings for the database, use the special `Field` with resource name: `projects/{project_id}/databases/{database_id}/collectionGroups/__default__/fields/*`.
#'
#' Autogenerated via \code{\link[googleAuthR]{gar_create_api_skeleton}}
#'
#' @seealso \href{https://cloud.google.com/firestore}{Google Documentation}
#'
#' @details
#' Authentication scopes used by this function are:
#' \itemize{
#'   \item https://www.googleapis.com/auth/cloud-platform
#' \item https://www.googleapis.com/auth/datastore
#' }
#'
#' Set \code{options(googleAuthR.scopes.selected = c(https://www.googleapis.com/auth/cloud-platform, https://www.googleapis.com/auth/datastore)}
#' Then run \code{googleAuthR::gar_auth()} to authenticate.
#' See \code{\link[googleAuthR]{gar_auth}} for details.
#'
#' @param GoogleFirestoreAdminV1Field The \link{GoogleFirestoreAdminV1Field} object to pass to this method
#' @param name Required
#' @param updateMask A mask, relative to the field
#' @importFrom googleAuthR gar_api_generator
#' @family GoogleFirestoreAdminV1Field functions
#' @export
projects.databases.collectionGroups.fields.patch <- function(GoogleFirestoreAdminV1Field,
    name, updateMask = NULL) {
    url <- sprintf("https://firestore.googleapis.com/v1/%s", name)
    # firestore.projects.databases.collectionGroups.fields.patch
    pars = list(updateMask = updateMask)
    f <- googleAuthR::gar_api_generator(url, "PATCH", pars_args = rmNullObs(pars),
        data_parse_function = function(x) x)
    stopifnot(inherits(GoogleFirestoreAdminV1Field, "gar_GoogleFirestoreAdminV1Field"))

    f(the_body = GoogleFirestoreAdminV1Field)

}

#' Gets the metadata and configuration for a Field.
#'
#' Autogenerated via \code{\link[googleAuthR]{gar_create_api_skeleton}}
#'
#' @seealso \href{https://cloud.google.com/firestore}{Google Documentation}
#'
#' @details
#' Authentication scopes used by this function are:
#' \itemize{
#'   \item https://www.googleapis.com/auth/cloud-platform
#' \item https://www.googleapis.com/auth/datastore
#' }
#'
#' Set \code{options(googleAuthR.scopes.selected = c(https://www.googleapis.com/auth/cloud-platform, https://www.googleapis.com/auth/datastore)}
#' Then run \code{googleAuthR::gar_auth()} to authenticate.
#' See \code{\link[googleAuthR]{gar_auth}} for details.
#'
#' @param name Required
#' @importFrom googleAuthR gar_api_generator
#' @export
projects.databases.collectionGroups.fields.get <- function(name) {
    url <- sprintf("https://firestore.googleapis.com/v1/%s", name)
    # firestore.projects.databases.collectionGroups.fields.get
    f <- googleAuthR::gar_api_generator(url, "GET", data_parse_function = function(x) x)
    f()

}

#' Lists the field configuration and metadata for this database. Currently, FirestoreAdmin.ListFields only supports listing fields that have been explicitly overridden. To issue this query, call FirestoreAdmin.ListFields with the filter set to `indexConfig.usesAncestorConfig:false` .
#'
#' Autogenerated via \code{\link[googleAuthR]{gar_create_api_skeleton}}
#'
#' @seealso \href{https://cloud.google.com/firestore}{Google Documentation}
#'
#' @details
#' Authentication scopes used by this function are:
#' \itemize{
#'   \item https://www.googleapis.com/auth/cloud-platform
#' \item https://www.googleapis.com/auth/datastore
#' }
#'
#' Set \code{options(googleAuthR.scopes.selected = c(https://www.googleapis.com/auth/cloud-platform, https://www.googleapis.com/auth/datastore)}
#' Then run \code{googleAuthR::gar_auth()} to authenticate.
#' See \code{\link[googleAuthR]{gar_auth}} for details.
#'
#' @param parent Required
#' @param pageToken A page token, returned from a previous call to FirestoreAdmin
#' @param pageSize The number of results to return
#' @param filter The filter to apply to list results
#' @importFrom googleAuthR gar_api_generator
#' @export
projects.databases.collectionGroups.fields.list <- function(parent, pageToken = NULL,
    pageSize = NULL, filter = NULL) {
    url <- sprintf("https://firestore.googleapis.com/v1/%s/fields", parent)
    # firestore.projects.databases.collectionGroups.fields.list
    pars = list(pageToken = pageToken, pageSize = pageSize, filter = filter)
    f <- googleAuthR::gar_api_generator(url, "GET", pars_args = rmNullObs(pars),
        data_parse_function = function(x) x)
    f()

}

#' Commits a transaction, while optionally updating documents.
#'
#' Autogenerated via \code{\link[googleAuthR]{gar_create_api_skeleton}}
#'
#' @seealso \href{https://cloud.google.com/firestore}{Google Documentation}
#'
#' @details
#' Authentication scopes used by this function are:
#' \itemize{
#'   \item https://www.googleapis.com/auth/cloud-platform
#' \item https://www.googleapis.com/auth/datastore
#' }
#'
#' Set \code{options(googleAuthR.scopes.selected = c(https://www.googleapis.com/auth/cloud-platform, https://www.googleapis.com/auth/datastore)}
#' Then run \code{googleAuthR::gar_auth()} to authenticate.
#' See \code{\link[googleAuthR]{gar_auth}} for details.
#'
#' @param CommitRequest The \link{CommitRequest} object to pass to this method
#' @param database Required
#' @importFrom googleAuthR gar_api_generator
#' @family CommitRequest functions
#' @export
projects.databases.documents.commit <- function(CommitRequest, database) {
    url <- sprintf("https://firestore.googleapis.com/v1/%s/documents:commit",
        database)
    # firestore.projects.databases.documents.commit
    f <- googleAuthR::gar_api_generator(url, "POST", data_parse_function = function(x) x)
    stopifnot(inherits(CommitRequest, "gar_CommitRequest"))

    f(the_body = CommitRequest)

}

#' Lists all the collection IDs underneath a document.
#'
#' Autogenerated via \code{\link[googleAuthR]{gar_create_api_skeleton}}
#'
#' @seealso \href{https://cloud.google.com/firestore}{Google Documentation}
#'
#' @details
#' Authentication scopes used by this function are:
#' \itemize{
#'   \item https://www.googleapis.com/auth/cloud-platform
#' \item https://www.googleapis.com/auth/datastore
#' }
#'
#' Set \code{options(googleAuthR.scopes.selected = c(https://www.googleapis.com/auth/cloud-platform, https://www.googleapis.com/auth/datastore)}
#' Then run \code{googleAuthR::gar_auth()} to authenticate.
#' See \code{\link[googleAuthR]{gar_auth}} for details.
#'
#' @param ListCollectionIdsRequest The \link{ListCollectionIdsRequest} object to pass to this method
#' @param parent Required
#' @importFrom googleAuthR gar_api_generator
#' @family ListCollectionIdsRequest functions
#' @export
projects.databases.documents.listCollectionIds <- function(ListCollectionIdsRequest,
    parent) {
    url <- sprintf("https://firestore.googleapis.com/v1/%s:listCollectionIds",
        parent)
    # firestore.projects.databases.documents.listCollectionIds
    f <- googleAuthR::gar_api_generator(url, "POST", data_parse_function = function(x) x)
    stopifnot(inherits(ListCollectionIdsRequest, "gar_ListCollectionIdsRequest"))

    f(the_body = ListCollectionIdsRequest)

}

#' Lists documents.
#'
#' Autogenerated via \code{\link[googleAuthR]{gar_create_api_skeleton}}
#'
#' @seealso \href{https://cloud.google.com/firestore}{Google Documentation}
#'
#' @details
#' Authentication scopes used by this function are:
#' \itemize{
#'   \item https://www.googleapis.com/auth/cloud-platform
#' \item https://www.googleapis.com/auth/datastore
#' }
#'
#' Set \code{options(googleAuthR.scopes.selected = c(https://www.googleapis.com/auth/cloud-platform, https://www.googleapis.com/auth/datastore)}
#' Then run \code{googleAuthR::gar_auth()} to authenticate.
#' See \code{\link[googleAuthR]{gar_auth}} for details.
#'
#' @param parent Required
#' @param collectionId Required
#' @param pageToken The `next_page_token` value returned from a previous List request, if any
#' @param orderBy The order to sort results by
#' @param transaction Reads documents in a transaction
#' @param mask.fieldPaths The list of field paths in the mask
#' @param pageSize The maximum number of documents to return
#' @param readTime Reads documents as they were at the given time
#' @param showMissing If the list should show missing documents
#' @importFrom googleAuthR gar_api_generator
#' @export
projects.databases.documents.list <- function(parent, collectionId, pageToken = NULL,
    orderBy = NULL, transaction = NULL, mask.fieldPaths = NULL, pageSize = NULL,
    readTime = NULL, showMissing = NULL) {
    url <- sprintf("https://firestore.googleapis.com/v1/%s/%s", parent, collectionId)
    # firestore.projects.databases.documents.list
    pars = list(pageToken = pageToken, orderBy = orderBy, transaction = transaction,
        mask.fieldPaths = mask.fieldPaths, pageSize = pageSize, readTime = readTime,
        showMissing = showMissing)
    f <- googleAuthR::gar_api_generator(url, "GET", pars_args = rmNullObs(pars),
                                        simplifyVector = FALSE,
        data_parse_function = function(x) x)
    f()

}

#' Runs a query.
#'
#' Autogenerated via \code{\link[googleAuthR]{gar_create_api_skeleton}}
#'
#' @seealso \href{https://cloud.google.com/firestore}{Google Documentation}
#'
#' @details
#' Authentication scopes used by this function are:
#' \itemize{
#'   \item https://www.googleapis.com/auth/cloud-platform
#' \item https://www.googleapis.com/auth/datastore
#' }
#'
#' Set \code{options(googleAuthR.scopes.selected = c(https://www.googleapis.com/auth/cloud-platform, https://www.googleapis.com/auth/datastore)}
#' Then run \code{googleAuthR::gar_auth()} to authenticate.
#' See \code{\link[googleAuthR]{gar_auth}} for details.
#'
#' @param RunQueryRequest The \link{RunQueryRequest} object to pass to this method
#' @param parent Required
#' @importFrom googleAuthR gar_api_generator
#' @family RunQueryRequest functions
#' @export
projects.databases.documents.runQuery <- function(RunQueryRequest, parent) {
    url <- sprintf("https://firestore.googleapis.com/v1/%s:runQuery", parent)
    # firestore.projects.databases.documents.runQuery
    f <- googleAuthR::gar_api_generator(url, "POST", data_parse_function = function(x) x)
    stopifnot(inherits(RunQueryRequest, "gar_RunQueryRequest"))

    f(the_body = RunQueryRequest)

}

#' Gets multiple documents. Documents returned by this method are not guaranteed to be returned in the same order that they were requested.
#'
#' Autogenerated via \code{\link[googleAuthR]{gar_create_api_skeleton}}
#'
#' @seealso \href{https://cloud.google.com/firestore}{Google Documentation}
#'
#' @details
#' Authentication scopes used by this function are:
#' \itemize{
#'   \item https://www.googleapis.com/auth/cloud-platform
#' \item https://www.googleapis.com/auth/datastore
#' }
#'
#' Set \code{options(googleAuthR.scopes.selected = c(https://www.googleapis.com/auth/cloud-platform, https://www.googleapis.com/auth/datastore)}
#' Then run \code{googleAuthR::gar_auth()} to authenticate.
#' See \code{\link[googleAuthR]{gar_auth}} for details.
#'
#' @param BatchGetDocumentsRequest The \link{BatchGetDocumentsRequest} object to pass to this method
#' @param database Required
#' @importFrom googleAuthR gar_api_generator
#' @family BatchGetDocumentsRequest functions
#' @export
projects.databases.documents.batchGet <- function(BatchGetDocumentsRequest, database) {
    url <- sprintf("https://firestore.googleapis.com/v1/%s/documents:batchGet",
        database)
    # firestore.projects.databases.documents.batchGet
    f <- googleAuthR::gar_api_generator(url, "POST", data_parse_function = function(x) x)
    stopifnot(inherits(BatchGetDocumentsRequest, "gar_BatchGetDocumentsRequest"))

    f(the_body = BatchGetDocumentsRequest)

}

#' Rolls back a transaction.
#'
#' Autogenerated via \code{\link[googleAuthR]{gar_create_api_skeleton}}
#'
#' @seealso \href{https://cloud.google.com/firestore}{Google Documentation}
#'
#' @details
#' Authentication scopes used by this function are:
#' \itemize{
#'   \item https://www.googleapis.com/auth/cloud-platform
#' \item https://www.googleapis.com/auth/datastore
#' }
#'
#' Set \code{options(googleAuthR.scopes.selected = c(https://www.googleapis.com/auth/cloud-platform, https://www.googleapis.com/auth/datastore)}
#' Then run \code{googleAuthR::gar_auth()} to authenticate.
#' See \code{\link[googleAuthR]{gar_auth}} for details.
#'
#' @param RollbackRequest The \link{RollbackRequest} object to pass to this method
#' @param database Required
#' @importFrom googleAuthR gar_api_generator
#' @family RollbackRequest functions
#' @export
projects.databases.documents.rollback <- function(RollbackRequest, database) {
    url <- sprintf("https://firestore.googleapis.com/v1/%s/documents:rollback",
        database)
    # firestore.projects.databases.documents.rollback
    f <- googleAuthR::gar_api_generator(url, "POST", data_parse_function = function(x) x)
    stopifnot(inherits(RollbackRequest, "gar_RollbackRequest"))

    f(the_body = RollbackRequest)

}

#' Creates a new document.
#'
#' Autogenerated via \code{\link[googleAuthR]{gar_create_api_skeleton}}
#'
#' @seealso \href{https://cloud.google.com/firestore}{Google Documentation}
#'
#' @details
#' Authentication scopes used by this function are:
#' \itemize{
#'   \item https://www.googleapis.com/auth/cloud-platform
#' \item https://www.googleapis.com/auth/datastore
#' }
#'
#' Set \code{options(googleAuthR.scopes.selected = c(https://www.googleapis.com/auth/cloud-platform, https://www.googleapis.com/auth/datastore)}
#' Then run \code{googleAuthR::gar_auth()} to authenticate.
#' See \code{\link[googleAuthR]{gar_auth}} for details.
#'
#' @param Document The \link{Document} object to pass to this method
#' @param parent Required
#' @param collectionId Required
#' @param documentId The client-assigned document ID to use for this document
#' @param mask.fieldPaths The list of field paths in the mask
#' @importFrom googleAuthR gar_api_generator
#' @family Document functions
#' @export
projects.databases.documents.createDocument <- function(Document, parent, collectionId,
    documentId = NULL, mask.fieldPaths = NULL) {
    url <- sprintf("https://firestore.googleapis.com/v1/%s/%s", parent, collectionId)
    # firestore.projects.databases.documents.createDocument
    pars = list(documentId = documentId, mask.fieldPaths = mask.fieldPaths)
    f <- googleAuthR::gar_api_generator(url, "POST", pars_args = rmNullObs(pars),
        data_parse_function = function(x) x)
    stopifnot(inherits(Document, "gar_Document"))

    f(the_body = Document)

}

#' Listens to changes.
#'
#' Autogenerated via \code{\link[googleAuthR]{gar_create_api_skeleton}}
#'
#' @seealso \href{https://cloud.google.com/firestore}{Google Documentation}
#'
#' @details
#' Authentication scopes used by this function are:
#' \itemize{
#'   \item https://www.googleapis.com/auth/cloud-platform
#' \item https://www.googleapis.com/auth/datastore
#' }
#'
#' Set \code{options(googleAuthR.scopes.selected = c(https://www.googleapis.com/auth/cloud-platform, https://www.googleapis.com/auth/datastore)}
#' Then run \code{googleAuthR::gar_auth()} to authenticate.
#' See \code{\link[googleAuthR]{gar_auth}} for details.
#'
#' @param ListenRequest The \link{ListenRequest} object to pass to this method
#' @param database Required
#' @importFrom googleAuthR gar_api_generator
#' @family ListenRequest functions
#' @export
projects.databases.documents.listen <- function(ListenRequest, database) {
    url <- sprintf("https://firestore.googleapis.com/v1/%s/documents:listen",
        database)
    # firestore.projects.databases.documents.listen
    f <- googleAuthR::gar_api_generator(url, "POST", data_parse_function = function(x) x)
    stopifnot(inherits(ListenRequest, "gar_ListenRequest"))

    f(the_body = ListenRequest)

}

#' Gets a single document.
#'
#' Autogenerated via \code{\link[googleAuthR]{gar_create_api_skeleton}}
#'
#' @seealso \href{https://cloud.google.com/firestore}{Google Documentation}
#'
#' @details
#' Authentication scopes used by this function are:
#' \itemize{
#'   \item https://www.googleapis.com/auth/cloud-platform
#' \item https://www.googleapis.com/auth/datastore
#' }
#'
#' Set \code{options(googleAuthR.scopes.selected = c(https://www.googleapis.com/auth/cloud-platform, https://www.googleapis.com/auth/datastore)}
#' Then run \code{googleAuthR::gar_auth()} to authenticate.
#' See \code{\link[googleAuthR]{gar_auth}} for details.
#'
#' @param name Required
#' @param mask.fieldPaths The list of field paths in the mask
#' @param readTime Reads the version of the document at the given time
#' @param transaction Reads the document in a transaction
#' @importFrom googleAuthR gar_api_generator
#' @export
projects.databases.documents.get <- function(name, mask.fieldPaths = NULL, readTime = NULL,
    transaction = NULL) {
    url <- sprintf("https://firestore.googleapis.com/v1/%s", name)
    # firestore.projects.databases.documents.get
    pars = list(mask.fieldPaths = mask.fieldPaths, readTime = readTime, transaction = transaction)
    f <- googleAuthR::gar_api_generator(url, "GET", pars_args = rmNullObs(pars),
                                        simplifyVector = FALSE,
                                        data_parse_function = function(x) x)
    f()
}

#' Deletes a document.
#'
#' Autogenerated via \code{\link[googleAuthR]{gar_create_api_skeleton}}
#'
#' @seealso \href{https://cloud.google.com/firestore}{Google Documentation}
#'
#' @details
#' Authentication scopes used by this function are:
#' \itemize{
#'   \item https://www.googleapis.com/auth/cloud-platform
#' \item https://www.googleapis.com/auth/datastore
#' }
#'
#' Set \code{options(googleAuthR.scopes.selected = c(https://www.googleapis.com/auth/cloud-platform, https://www.googleapis.com/auth/datastore)}
#' Then run \code{googleAuthR::gar_auth()} to authenticate.
#' See \code{\link[googleAuthR]{gar_auth}} for details.
#'
#' @param name Required
#' @param currentDocument.updateTime When set, the target document must exist and have been last updated at that time
#' @param currentDocument.exists When set to `true`, the target document must exist
#' @importFrom googleAuthR gar_api_generator
#' @export
projects.databases.documents.delete <- function(name, currentDocument.updateTime = NULL,
    currentDocument.exists = NULL) {
    url <- sprintf("https://firestore.googleapis.com/v1/%s", name)
    # firestore.projects.databases.documents.delete
    pars = list(currentDocument.updateTime = currentDocument.updateTime, currentDocument.exists = currentDocument.exists)
    f <- googleAuthR::gar_api_generator(url, "DELETE", pars_args = rmNullObs(pars),
        data_parse_function = function(x) x)
    f()

}

#' Applies a batch of write operations. The BatchWrite method does not apply the write operations atomically and can apply them out of order. Method does not allow more than one write per document. Each write succeeds or fails independently. See the BatchWriteResponse for the success status of each write. If you require an atomically applied set of writes, use Commit instead.
#'
#' Autogenerated via \code{\link[googleAuthR]{gar_create_api_skeleton}}
#'
#' @seealso \href{https://cloud.google.com/firestore}{Google Documentation}
#'
#' @details
#' Authentication scopes used by this function are:
#' \itemize{
#'   \item https://www.googleapis.com/auth/cloud-platform
#' \item https://www.googleapis.com/auth/datastore
#' }
#'
#' Set \code{options(googleAuthR.scopes.selected = c(https://www.googleapis.com/auth/cloud-platform, https://www.googleapis.com/auth/datastore)}
#' Then run \code{googleAuthR::gar_auth()} to authenticate.
#' See \code{\link[googleAuthR]{gar_auth}} for details.
#'
#' @param BatchWriteRequest The \link{BatchWriteRequest} object to pass to this method
#' @param database Required
#' @importFrom googleAuthR gar_api_generator
#' @family BatchWriteRequest functions
#' @export
projects.databases.documents.batchWrite <- function(BatchWriteRequest, database) {
    url <- sprintf("https://firestore.googleapis.com/v1/%s/documents:batchWrite",
        database)
    # firestore.projects.databases.documents.batchWrite
    f <- googleAuthR::gar_api_generator(url, "POST", data_parse_function = function(x) x)
    stopifnot(inherits(BatchWriteRequest, "gar_BatchWriteRequest"))

    f(the_body = BatchWriteRequest)

}

#' Updates or inserts a document.
#'
#' Autogenerated via \code{\link[googleAuthR]{gar_create_api_skeleton}}
#'
#' @seealso \href{https://cloud.google.com/firestore}{Google Documentation}
#'
#' @details
#' Authentication scopes used by this function are:
#' \itemize{
#'   \item https://www.googleapis.com/auth/cloud-platform
#' \item https://www.googleapis.com/auth/datastore
#' }
#'
#' Set \code{options(googleAuthR.scopes.selected = c(https://www.googleapis.com/auth/cloud-platform, https://www.googleapis.com/auth/datastore)}
#' Then run \code{googleAuthR::gar_auth()} to authenticate.
#' See \code{\link[googleAuthR]{gar_auth}} for details.
#'
#' @param Document The \link{Document} object to pass to this method
#' @param name The resource name of the document, for example `projects/{project_id}/databases/{database_id}/documents/{document_path}`
#' @param mask.fieldPaths The list of field paths in the mask
#' @param currentDocument.updateTime When set, the target document must exist and have been last updated at that time
#' @param currentDocument.exists When set to `true`, the target document must exist
#' @param updateMask.fieldPaths The list of field paths in the mask
#' @importFrom googleAuthR gar_api_generator
#' @family Document functions
#' @export
projects.databases.documents.patch <- function(Document, name, mask.fieldPaths = NULL,
    currentDocument.updateTime = NULL, currentDocument.exists = NULL, updateMask.fieldPaths = NULL) {
    url <- sprintf("https://firestore.googleapis.com/v1/%s", name)
    # firestore.projects.databases.documents.patch
    pars = list(mask.fieldPaths = mask.fieldPaths, currentDocument.updateTime = currentDocument.updateTime,
        currentDocument.exists = currentDocument.exists, updateMask.fieldPaths = updateMask.fieldPaths)
    f <- googleAuthR::gar_api_generator(url, "PATCH", pars_args = rmNullObs(pars),
        data_parse_function = function(x) x)
    stopifnot(inherits(Document, "gar_Document"))

    f(the_body = Document)

}

#' Streams batches of document updates and deletes, in order.
#'
#' Autogenerated via \code{\link[googleAuthR]{gar_create_api_skeleton}}
#'
#' @seealso \href{https://cloud.google.com/firestore}{Google Documentation}
#'
#' @details
#' Authentication scopes used by this function are:
#' \itemize{
#'   \item https://www.googleapis.com/auth/cloud-platform
#' \item https://www.googleapis.com/auth/datastore
#' }
#'
#' Set \code{options(googleAuthR.scopes.selected = c(https://www.googleapis.com/auth/cloud-platform, https://www.googleapis.com/auth/datastore)}
#' Then run \code{googleAuthR::gar_auth()} to authenticate.
#' See \code{\link[googleAuthR]{gar_auth}} for details.
#'
#' @param WriteRequest The \link{WriteRequest} object to pass to this method
#' @param database Required
#' @importFrom googleAuthR gar_api_generator
#' @family WriteRequest functions
#' @export
projects.databases.documents.write <- function(WriteRequest, database) {
    url <- sprintf("https://firestore.googleapis.com/v1/%s/documents:write",
        database)
    # firestore.projects.databases.documents.write
    f <- googleAuthR::gar_api_generator(url, "POST", data_parse_function = function(x) x)
    stopifnot(inherits(WriteRequest, "gar_WriteRequest"))

    f(the_body = WriteRequest)

}

#' Partitions a query by returning partition cursors that can be used to run the query in parallel. The returned partition cursors are split points that can be used by RunQuery as starting/end points for the query results.
#'
#' Autogenerated via \code{\link[googleAuthR]{gar_create_api_skeleton}}
#'
#' @seealso \href{https://cloud.google.com/firestore}{Google Documentation}
#'
#' @details
#' Authentication scopes used by this function are:
#' \itemize{
#'   \item https://www.googleapis.com/auth/cloud-platform
#' \item https://www.googleapis.com/auth/datastore
#' }
#'
#' Set \code{options(googleAuthR.scopes.selected = c(https://www.googleapis.com/auth/cloud-platform, https://www.googleapis.com/auth/datastore)}
#' Then run \code{googleAuthR::gar_auth()} to authenticate.
#' See \code{\link[googleAuthR]{gar_auth}} for details.
#'
#' @param PartitionQueryRequest The \link{PartitionQueryRequest} object to pass to this method
#' @param parent Required
#' @importFrom googleAuthR gar_api_generator
#' @family PartitionQueryRequest functions
#' @export
projects.databases.documents.partitionQuery <- function(PartitionQueryRequest, parent) {
    url <- sprintf("https://firestore.googleapis.com/v1/%s:partitionQuery",
        parent)
    # firestore.projects.databases.documents.partitionQuery
    f <- googleAuthR::gar_api_generator(url, "POST", data_parse_function = function(x) x)
    stopifnot(inherits(PartitionQueryRequest, "gar_PartitionQueryRequest"))

    f(the_body = PartitionQueryRequest)

}

#' Starts a new transaction.
#'
#' Autogenerated via \code{\link[googleAuthR]{gar_create_api_skeleton}}
#'
#' @seealso \href{https://cloud.google.com/firestore}{Google Documentation}
#'
#' @details
#' Authentication scopes used by this function are:
#' \itemize{
#'   \item https://www.googleapis.com/auth/cloud-platform
#' \item https://www.googleapis.com/auth/datastore
#' }
#'
#' Set \code{options(googleAuthR.scopes.selected = c(https://www.googleapis.com/auth/cloud-platform, https://www.googleapis.com/auth/datastore)}
#' Then run \code{googleAuthR::gar_auth()} to authenticate.
#' See \code{\link[googleAuthR]{gar_auth}} for details.
#'
#' @param BeginTransactionRequest The \link{BeginTransactionRequest} object to pass to this method
#' @param database Required
#' @importFrom googleAuthR gar_api_generator
#' @family BeginTransactionRequest functions
#' @export
projects.databases.documents.beginTransaction <- function(BeginTransactionRequest,
    database) {
    url <- sprintf("https://firestore.googleapis.com/v1/%s/documents:beginTransaction",
        database)
    # firestore.projects.databases.documents.beginTransaction
    f <- googleAuthR::gar_api_generator(url, "POST", data_parse_function = function(x) x)
    stopifnot(inherits(BeginTransactionRequest, "gar_BeginTransactionRequest"))

    f(the_body = BeginTransactionRequest)

}

#' Lists information about the supported locations for this service.
#'
#' Autogenerated via \code{\link[googleAuthR]{gar_create_api_skeleton}}
#'
#' @seealso \href{https://cloud.google.com/firestore}{Google Documentation}
#'
#' @details
#' Authentication scopes used by this function are:
#' \itemize{
#'   \item https://www.googleapis.com/auth/cloud-platform
#' \item https://www.googleapis.com/auth/datastore
#' }
#'
#' Set \code{options(googleAuthR.scopes.selected = c(https://www.googleapis.com/auth/cloud-platform, https://www.googleapis.com/auth/datastore)}
#' Then run \code{googleAuthR::gar_auth()} to authenticate.
#' See \code{\link[googleAuthR]{gar_auth}} for details.
#'
#' @param name The resource that owns the locations collection, if applicable
#' @param pageSize The maximum number of results to return
#' @param filter A filter to narrow down results to a preferred subset
#' @param pageToken A page token received from the `next_page_token` field in the response
#' @importFrom googleAuthR gar_api_generator
#' @export
projects.locations.list <- function(name, pageSize = NULL, filter = NULL, pageToken = NULL) {
    url <- sprintf("https://firestore.googleapis.com/v1/%s/locations", name)
    # firestore.projects.locations.list
    pars = list(pageSize = pageSize, filter = filter, pageToken = pageToken)
    f <- googleAuthR::gar_api_generator(url, "GET", pars_args = rmNullObs(pars),
        data_parse_function = function(x) x)
    f()

}


#' Gets information about a location.
#'
#' Autogenerated via \code{\link[googleAuthR]{gar_create_api_skeleton}}
#'
#' @seealso \href{https://cloud.google.com/firestore}{Google Documentation}
#'
#' @details
#' Authentication scopes used by this function are:
#' \itemize{
#'   \item https://www.googleapis.com/auth/cloud-platform
#' \item https://www.googleapis.com/auth/datastore
#' }
#'
#' Set \code{options(googleAuthR.scopes.selected = c(https://www.googleapis.com/auth/cloud-platform, https://www.googleapis.com/auth/datastore)}
#' Then run \code{googleAuthR::gar_auth()} to authenticate.
#' See \code{\link[googleAuthR]{gar_auth}} for details.
#'
#' @param name Resource name for the location
#' @importFrom googleAuthR gar_api_generator
#' @export


projects.locations.get <- function(name) {


    url <- sprintf("https://firestore.googleapis.com/v1/%s", name)
    # firestore.projects.locations.get

    f <- googleAuthR::gar_api_generator(url, "GET", data_parse_function = function(x) x)

    f()


}
robonomist/googleFirestore documentation built on Jan. 30, 2023, 6:39 p.m.