Skip to content

Commit

Permalink
Updated documentation for example_id function (#53)
Browse files Browse the repository at this point in the history
* Updated documentation for example_id function

* Updated example_id docs and code with suggestions from PR
  • Loading branch information
rmbielby authored Oct 22, 2024
1 parent 33972a4 commit 5023237
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 11 deletions.
33 changes: 28 additions & 5 deletions R/examples.R
Original file line number Diff line number Diff line change
@@ -1,16 +1,37 @@
#' Example ID
#' @description
#' This function returns examples of working IDs that can be used with the API.
#' This function returns examples of working IDs that can be used with the eesyapi functions, such
#' as query_dataset().
#'
#' @param level Level of ID example to return: "publication" or "data set"
#' @param environment Environment to return a working example for
#' @param group Choose the publication group of examples to use. Can be "attendance".
#' @param level Level of ID example to return. A range are available, although not every example
#' group necessarily contains all possible examples. The following are generally available.
#' - "all": Return full list of example options for given group.
#' - "publication": Return example publication ID
#' - "dataset": Return example data set ID
#' - "time_period" / "time_periods": Return example time_period(s)
#' - "location_id" / "location_ids": Return example location ID(s)
#' - "location_code / location_codes": Return example location code(s)
#' - "filter": Return example filter column ID
#' - "filter_item" / "filter_items_short" / "filter_items_long": Return example filter ID or
#' example short / long filter query list.
#' - "indicator": Return example indicator ID
#' @param environment Environment to return a working example for: "dev" or "test"
#' @param group Choose the publication group of examples to use. Options are:
#' - "attendance": Large example data set, careful what you ask for
#' - "public-api-testing": Smaller example data set
#'
#' @return String containing an example ID present in the API
#' @return String, vector or list containing example ID(s) present in the API
#' @export
#'
#' @examples
#' example_id("all")
#' example_id()
#' example_id("publication")
#' example_id("publication", group = "attendance")
#' example_id("time_period", group = "attendance")
#' example_id("location_ids", group = "attendance")
#' example_id("filter_items_short", group = "attendance")
#' example_id("indicator", group = "attendance")
example_id <- function(
level = "dataset",
environment = "dev",
Expand All @@ -25,6 +46,7 @@ example_id <- function(
location_id = "NAT|id|dP0Zw",
location_ids = c("NAT|id|dP0Zw", "REG|id|rg3Nj"),
location_code = "NAT|code|E92000001",
location_codes = c("REG|code|E12000001", "REG|code|E12000002"),
filter = "4kdUZ",
filter_item = "5UNdi",
filter_items_long = list(
Expand All @@ -50,6 +72,7 @@ example_id <- function(
dataset = "830f9201-9e11-ad75-8dcd-d2efe2834457",
location_id = "LA|id|ml79K",
location_code = "NAT|code|E92000001",
location_codes = c("REG|code|E12000001", "REG|code|E12000002"),
filter = "01tT5",
filter_item = "wEZcb",
indicator = "PbNeb"
Expand Down
6 changes: 5 additions & 1 deletion man/example_data_raw.Rd

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

35 changes: 30 additions & 5 deletions man/example_id.Rd

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

0 comments on commit 5023237

Please sign in to comment.