R/user.R

Defines functions uo_delete_user_delete uo_post_user_create

# (autogenerated content from swagger API)


#' Create a new user
#'
#'
#'  ### Description
#'  Create a new user with the given details - email, password, name and surname. After creation, an email is send to the email address to activate the acount.
#'  The user is required to accept the terms and conditions. The password needs to be at least 8 characters long.
#'
#'  ### Required Parameters
#'  - `email`: Email of the user. This is a unique field.
#'
#'  - `password`: Password of the user
#'
#'  - `terms_conditions`: Boolean field. Pass True to accept terms and conditions.
#'
#'
#'  ### Optional Parameters
#'  - `name`: Name of the user
#'
#'  - `surname`: Surname of the user
#'
#'  - `newsletter`: Boolean field. Pass True to subscribe to the newsletters.
#'
#'
#'  #### Request Examples
#'  ```
#'  {
#'    "email": "test@example.com",
#'    "password": "secret-password",
#'    "name": "User name",
#'    "surname": "User surname",
#'    "terms_conditions": true,
#'    "newsletter": false
#'  }
#'  ```
#'
#'  ```
#'  {
#'    "email": "test@example.com",
#'    "password": "secret-password",
#'    "terms_conditions": true,
#'    "newsletter": false
#'
#'  }
#'  ```
#'
#'  ### Response Structure
#'  Details of the created user
#'   - `email`: Email of the user
#'
#'   - `name`: Name of the user
#'
#'   - `surname`: Surname of the user
#'
#'  #### Response Examples
#'  ```
#'  {
#'    "email": "test@example.com",
#'    "name": "User name",
#'    "surname": "User surname"
#'  }
#'  ```
#'
#' @param email descriptionhere
#' @param password descriptionhere
#' @param name descriptionhere
#' @param surname descriptionhere
#' @param terms_conditions descriptionhere
#' @param newsletter descriptionhere
#' @param UBIOPS_TOKEN default NULL will search for token in environment
#' @return descriptionhere
#' @export
uo_post_user_create <- function(email, password, name, surname, terms_conditions, newsletter, UBIOPS_TOKEN=NULL){
    endpoint=glue::glue("{base}/user")
        tk <- check_ubiobstoken(UBIOPS_TOKEN)
        h  <- create_headers(tk)
    body<-'somethinghere'
    res <- httr::POST(url=endpoint,body=body,encode = "json",h)
    httr::stop_for_status(res)
    httr::content(res)
}

#' Delete user
#'
#'
#'  ### Description
#'  Delete the user that makes the request
#'
#' @param UBIOPS_TOKEN default NULL will search for token in environment
#' @return descriptionhere
#' @export
uo_delete_user_delete <- function(UBIOPS_TOKEN=NULL){
    endpoint=glue::glue("{base}/user")
        tk <- check_ubiobstoken(UBIOPS_TOKEN)
        h  <- create_headers(tk)
    body<-'somethinghere'
    res <- httr::DELETE(url=endpoint,body=body,encode = "json",h)
    httr::stop_for_status(res)
    httr::content(res)
}
RMHogervorst/ubiopscontroller documentation built on May 25, 2021, 5:26 p.m.