Skip to content

Commit

Permalink
Updated banctable documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderbates committed Jul 19, 2024
1 parent 371be51 commit 36e9ae3
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 20 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export(banc_voxdims)
export(banc_xyz2id)
export(banctable_login)
export(banctable_query)
export(banctable_set_token)
export(banctable_update_rows)
export(choose_banc)
export(dr_banc)
Expand Down
25 changes: 14 additions & 11 deletions R/banc-table.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Read and write to the seatable for draft BANC annotations
#' @title Read and write to the seatable for draft BANC annotations
#'
#' @description These functions use the logic and wrap some code
#' from the `flytable_.*` functions in the `fafbseg` R package.
Expand Down Expand Up @@ -46,16 +46,19 @@
#' @return a \code{data.frame} of results. There should be 0 rows if no rows
#' matched query.
#'
#' @seealso \code{\link{fafbseg::flytable_query}}
#' @seealso \code{fafbseg::\link{flytable_query}}
#' @examples
#' \dontrun{
#' banc_set_token(user="my_gmail.com",
# pwd="MY_PASSWORD",
# url="https://cloud.seatable.io/")
#' # Do this once
#' banctable_set_token(user="MY_EMAIL_FOR_SEATABLE.com",
#' pwd="MY_SEATABLE_PASSWORD",
#' url="https://cloud.seatable.io/")
#'
#' # Thereafter:
#' banc.meta <- banctable_query()
#' }
#' @export
#' @rdname banctable
#' @rdname banctable_query
banctable_query <- function (sql = "SELECT * FROM banc_meta",
limit = 100000L,
base = NULL,
Expand Down Expand Up @@ -110,9 +113,9 @@ banctable_query <- function (sql = "SELECT * FROM banc_meta",
}

#' @export
#' @rdname banctable
banc_set_token <- function(user, pwd, url = "https://cloud.seatable.io/"){
st <- check_seatable()
#' @rdname banctable_query
banctable_set_token <- function(user, pwd, url = "https://cloud.seatable.io/"){
st <- fafbseg:::check_seatable()
ac <- reticulate::py_call(st$Account, login_name = user,
password = pwd, server_url = url)
ac$auth()
Expand All @@ -123,15 +126,15 @@ banc_set_token <- function(user, pwd, url = "https://cloud.seatable.io/"){
}

#' @export
#' @rdname banctable
#' @rdname banctable_query
banctable_login <- function(url = "https://cloud.seatable.io/",
token = Sys.getenv("BANCTABLE_TOKEN", unset = NA_character_)){
fafbseg::flytable_login(url=url, token=token)
}


#' @export
#' @rdname banctable
#' @rdname banctable_query
banctable_update_rows <- function (df, table, base = NULL, append_allowed = TRUE, chunksize = 1000L, ...) {
if (is.character(base) || is.null(base))
base = banctable_base(base_name = base, table = table)
Expand Down
23 changes: 14 additions & 9 deletions man/banctable.Rd → man/banctable_query.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 36e9ae3

Please sign in to comment.