R/get_meter_gsp.R

Defines functions get_meter_gsp

Documented in get_meter_gsp

#' Get the GSP of a meter-point.
#'
#' @description This endpoint can be used to get the GSP
#' of a given meter-point.
#'
#' @param mpan The electricity meter-point's MPAN
#'
#' @return a character of the meter-points GSP.
#' @export
get_meter_gsp <- function(mpan = get_meter_details("electricity")[["mpan_mprn"]]) {
  path <- glue::glue(
    "/v1",
    "electricity-meter-points",
    mpan,
    .sep = "/"
  )

  resp <- octopus_api(
    path = path
  )

  meter_gsp <- resp[["content"]][["gsp"]]

  return(meter_gsp)
}

Try the octopusR package in your browser

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

octopusR documentation built on July 9, 2023, 6:04 p.m.