Skip to content

Commit

Permalink
update get_item_metadata() examples to not display API key
Browse files Browse the repository at this point in the history
  • Loading branch information
cyu12 committed May 6, 2024
1 parent fd33da7 commit 45c8904
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 34 deletions.
3 changes: 2 additions & 1 deletion R/get_item_metadata.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
#' @examples
#' \dontrun{
#' # Get metadata for NHS Continuing Health Care (CHC) Data Set - JSON Schema
#' get_item_metadata(1760, latest_only = TRUE)
#' get_item_metadata(1760) |>
#' purrr::map_at("releases", \(release) purrr::map(release, names))
#' }
get_item_metadata <- function(item,
TRUD_API_KEY = NULL,
Expand Down
3 changes: 1 addition & 2 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,8 @@ trud_items()
Get metadata for an item:

```{r get-item-metadata}
# default is to retrieve metadata for the latest release only
get_item_metadata(1760) |>
lobstr::tree()
purrr::map_at("releases", \(release) purrr::map(release, names))
```

Download an item:
Expand Down
56 changes: 26 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

<!-- badges: start -->

[![pkgdown](https://github.com/rmgpanw/trud/actions/workflows/pkgdown.yaml/badge.svg)](https://github.com/rmgpanw/trud/actions/workflows/pkgdown.yaml) [![Codecov test
[![pkgdown](https://github.com/rmgpanw/trud/actions/workflows/pkgdown.yaml/badge.svg)](https://github.com/rmgpanw/trud/actions/workflows/pkgdown.yaml)
[![Codecov test
coverage](https://codecov.io/gh/rmgpanw/trud/branch/main/graph/badge.svg)](https://app.codecov.io/gh/rmgpanw/trud?branch=main)

<!-- badges: end -->
Expand Down Expand Up @@ -60,35 +61,30 @@ trud_items()
Get metadata for an item:

``` r
# default is to retrieve metadata for the latest release only
get_item_metadata(1760) |>
lobstr::tree()
#> <list>
#> ├─apiVersion: "1"
#> ├─releases: <list>
#> │ └─CHC_JSON_v1.0.2.zip: <list>
#> │ ├─id: "CHC_JSON_v1.0.2.zip"
#> │ ├─name: "Release 1.0.2 preview 1"
#> │ ├─releaseDate: "2022-02-02"
#> │ ├─archiveFileUrl: "https://isd.digital.nhs.uk/downl..."
#> │ ├─archiveFileName: "CHC_JSON_v1.0.2.zip"
#> │ ├─archiveFileSizeBytes: 22107
#> │ ├─archiveFileSha256: "B2801BA1944157CA63F0FE82802FD862..."
#> │ ├─archiveFileLastModifiedTimestamp: "2022-02-02T09:13:27.000Z"
#> │ ├─checksumFileUrl: "https://isd.digital.nhs.uk/downl..."
#> │ ├─checksumFileName: "trud_CHC_JSON_v1.0.2.xml"
#> │ ├─checksumFileSizeBytes: 160
#> │ ├─checksumFileLastModifiedTimestamp: "2022-02-02T09:21:58.000Z"
#> │ ├─signatureFileUrl: "https://isd.digital.nhs.uk/downl..."
#> │ ├─signatureFileName: "trud_CHC_JSON_v1.0.2.sig"
#> │ ├─signatureFileSizeBytes: 488
#> │ ├─signatureFileLastModifiedTimestamp: "2022-02-02T09:21:58.000Z"
#> │ ├─publicKeyFileUrl: "https://isd.digital.nhs.uk/downl..."
#> │ ├─publicKeyFileName: "trud-public-key-2013-04-01.pgp"
#> │ ├─publicKeyFileSizeBytes: 1736
#> │ └─publicKeyId: 6
#> ├─httpStatus: 200
#> └─message: "OK"
purrr::map_at("releases", \(release) purrr::map(release, names))
#> $apiVersion
#> [1] "1"
#>
#> $releases
#> $releases$CHC_JSON_v1.0.2.zip
#> [1] "id" "name"
#> [3] "releaseDate" "archiveFileUrl"
#> [5] "archiveFileName" "archiveFileSizeBytes"
#> [7] "archiveFileSha256" "archiveFileLastModifiedTimestamp"
#> [9] "checksumFileUrl" "checksumFileName"
#> [11] "checksumFileSizeBytes" "checksumFileLastModifiedTimestamp"
#> [13] "signatureFileUrl" "signatureFileName"
#> [15] "signatureFileSizeBytes" "signatureFileLastModifiedTimestamp"
#> [17] "publicKeyFileUrl" "publicKeyFileName"
#> [19] "publicKeyFileSizeBytes" "publicKeyId"
#>
#>
#> $httpStatus
#> [1] 200
#>
#> $message
#> [1] "OK"
```

Download an item:
Expand All @@ -97,7 +93,7 @@ Download an item:
# by default this will be downloaded to `tempdir()`
x <- download_item(1760)
#> ⠙ Downloading archive file for TRUD item 1760...
#> ✔ Downloading archive file for TRUD item 1760... [137ms]
#> ✔ Downloading archive file for TRUD item 1760... [126ms]
#>
#> ℹ Successfully downloaded `CHC_JSON_v1.0.2.zip` to '/var/folders/3_/pbrb8ydn6_q…
#> ✔ Successfully downloaded `CHC_JSON_v1.0.2.zip` to '/var/folders/3_/pbrb8ydn6_q…
Expand Down
3 changes: 2 additions & 1 deletion man/get_item_metadata.Rd

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

0 comments on commit 45c8904

Please sign in to comment.