R/current_session.R

Defines functions current_session

Documented in current_session

#' @title Return current cached session
#' 
#' @description 
#' Returns the currently cached SB session. If there
#' is no authenticated session, returns NULL. Emits a
#' warning if the session has expired. 
#' 
#' 
#' 
#' @examples \donttest{
#' 
#' session = current_session()
#' #null unless currently authenticated
#' session
#' }
#'@export
current_session = function(){
	if(session_expired(pkg.env$session)){
		warning('SB authentication expired, SB interaction may fail. Please re-authenticate using authenticate_sb().')
	}
	return(pkg.env$session)
}

Try the sbtools package in your browser

Any scripts or data that you put into this service are public.

sbtools documentation built on May 1, 2023, 1:07 a.m.