diff --git a/R/entrata_request.R b/R/entrata_request.R index a40b2e6..130c9c5 100644 --- a/R/entrata_request.R +++ b/R/entrata_request.R @@ -177,18 +177,11 @@ entrata <- function( validate_entrata_endpoint_method(endpoint, method) validate_entrata_method_params(endpoint, method, method_params) - req_body <- list( - auth = list( - type = "basic" - ), - requestId = 15, - method = list( - name = method, - version = method_version, - params = method_params - ) - ) |> - purrr::compact() + req_body <- derive_req_body( + method = method, + method_version = method_version, + method_params = method_params + ) username <- config$username password <- config$password @@ -253,3 +246,32 @@ entrata <- function( res <- req |> httr2::req_perform(verbosity = verbosity) return(res) } + +#' Derive Entrata API Request Body +#' +#' @description +#' Derives the request body for an Entrata API request. +#' +#' @param method The Entrata API method to use. +#' @param method_version The version of the API method to use. +#' @param method_params A named list of parameters to include in the request body. +#' +#' @return A list representing the request body. +#' +#' @export +#' +#' @importFrom purrr compact +derive_req_body <- function(method, method_version, method_params) { + list( + auth = list( + type = "basic" + ), + requestId = 15, + method = list( + name = method, + version = method_version, + params = method_params + ) + ) |> + purrr::compact() +} diff --git a/man/entrata.Rd b/man/entrata.Rd index f4edf59..27347d1 100644 --- a/man/entrata.Rd +++ b/man/entrata.Rd @@ -115,6 +115,56 @@ by appending to the request's URL path the provided endpoint, assigning the \code{POST} \code{HTTP} Method, adding the necessary authentication, populating the necessary request headers, and deriving the request's body using the provided \code{method} name and \code{params} parameters. See below for details. + +This is the raw format of the base template request: + +\if{html}{\out{