Skip to content

Commit

Permalink
export check api key function
Browse files Browse the repository at this point in the history
  • Loading branch information
cole-brokamp committed Jul 5, 2024
1 parent 725cfdb commit 8df2a44
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 3 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Generated by roxygen2: do not edit by hand

export(check_api_key)
export(get_sensor_data)
export(get_sensors_data)
13 changes: 12 additions & 1 deletion R/check_api_key.R
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
2 changes: 1 addition & 1 deletion R/get_sensors_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
24 changes: 24 additions & 0 deletions man/check_api_key.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/get_sensors_data.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8df2a44

Please sign in to comment.