R/S2_user_info.R

Defines functions S2_user_info

Documented in S2_user_info

#' S2_user_info
#'
#' Returns information on a users coins budget
#'
#' @return list where 'userId' is the Id of the current user, 'coins' is the
#'   total number of coins acquired by the user, 'coinsUsed' the number of coins
#'   used so far and 'coinsRemain' the number of coins available to acquire
#'   database products
#' @export
S2_user_info = function(){
  credentials = get_credentials()
  srvrsp      = httr::GET(
    'https://s2.boku.eodc.eu/user/current',
    config = httr::authenticate(credentials['user'], credentials['password'])
  )

  srvrsp             = httr::content(srvrsp)
  srvrsp$coinsRemain = srvrsp$coins - srvrsp$coinsUsed
  srvrsp$admin       = NULL

  return(srvrsp)
}
IVFL-BOKU/sentinel2 documentation built on May 13, 2022, 11:15 p.m.