diff --git a/NAMESPACE b/NAMESPACE index a035c13..9f93cfe 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,4 +1,5 @@ # Generated by roxygen2: do not edit by hand +export(check_api_key) export(get_sensor_data) export(get_sensors_data) diff --git a/R/check_api_key.R b/R/check_api_key.R index c518932..45d16d0 100644 --- a/R/check_api_key.R +++ b/R/check_api_key.R @@ -1,4 +1,15 @@ -# https://api.purpleair.com/#api-keys-check-api-key +#' check purple air api key +#' +#' Use the PurpleAir API to validate your Purple Air API Key. +#' Find more details on this function at https://api.purpleair.com/#api-keys-check-api-key +#' @param purple_air_api_key A character that is your PurpleAir API `READ` key +#' @returns if the key is valid, a message is emitted and the input is invisibly returned; +#' invalid keys will throw an R error which utilizes information from the underlying http error +#' to inform the user +#' @export +#' @examples +#' check_api_key() +#' try(check_api_key("foofy")) check_api_key <- function(purple_air_api_key = Sys.getenv("PURPLE_AIR_API_KEY")) { resp <- purple_air_request( purple_air_api_key = purple_air_api_key, diff --git a/R/get_sensors_data.R b/R/get_sensors_data.R index 11706c1..aba97db 100644 --- a/R/get_sensors_data.R +++ b/R/get_sensors_data.R @@ -4,7 +4,7 @@ #' Find more details on sensor fields at https://api.purpleair.com/#api-sensors-get-sensors-data. #' @param x an input object used to define multiple sensors #' - st_bbox object will select sensors geographically (`nwlat`, `nwlon`, `selat`, `selon`) -#' - integer vector will select sensors based on `sensor_index` (`show_only`) +#' - integer (or numeric or character?) vector will select sensors based on `sensor_index` (`show_only`) #' - POSIXct object will select sensors modified since then (`modified_since`) #' @param fields A character vector of which 'sensor data fields' to return #' @param location_type character; restrict to only "outside" or "inside" sensors (Outside: 0, Inside: 1) diff --git a/man/check_api_key.Rd b/man/check_api_key.Rd new file mode 100644 index 0000000..f4ced88 --- /dev/null +++ b/man/check_api_key.Rd @@ -0,0 +1,24 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/check_api_key.R +\name{check_api_key} +\alias{check_api_key} +\title{check purple air api key} +\usage{ +check_api_key(purple_air_api_key = Sys.getenv("PURPLE_AIR_API_KEY")) +} +\arguments{ +\item{purple_air_api_key}{A character that is your PurpleAir API \code{READ} key} +} +\value{ +if the key is valid, a message is emitted and the input is invisibly returned; +invalid keys will throw an R error which utilizes information from the underlying http error +to inform the user +} +\description{ +Use the PurpleAir API to validate your Purple Air API Key. +Find more details on this function at https://api.purpleair.com/#api-keys-check-api-key +} +\examples{ +check_api_key() +try(check_api_key("foofy")) +} diff --git a/man/get_sensors_data.Rd b/man/get_sensors_data.Rd index 7faf331..5fbd0b8 100644 --- a/man/get_sensors_data.Rd +++ b/man/get_sensors_data.Rd @@ -17,7 +17,7 @@ get_sensors_data( \item{x}{an input object used to define multiple sensors \itemize{ \item st_bbox object will select sensors geographically (\code{nwlat}, \code{nwlon}, \code{selat}, \code{selon}) -\item integer vector will select sensors based on \code{sensor_index} (\code{show_only}) +\item integer (or numeric or character?) vector will select sensors based on \code{sensor_index} (\code{show_only}) \item POSIXct object will select sensors modified since then (\code{modified_since}) }}