## ----setup, include = FALSE---------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment  = "#>",
  eval     = FALSE
)

## ----auth---------------------------------------------------------------------
# library(ukbflow)
# 
# auth_login()
# auth_select_project("project-XXXXXXXXXXXX")

## ----fetch-ls-----------------------------------------------------------------
# # List project root
# fetch_ls()
# #>                  name   type    size            modified
# #> 1  Showcase metadata folder    <NA>                <NA>
# #> 2             results folder    <NA>                <NA>
# #> 3        analysis.log   file  4.2 KB 2024-11-01 10:22:03
# 
# # List a specific folder
# fetch_ls("Showcase metadata/")
# #>          name  type     size            modified
# #> 1   field.tsv  file  12.3 MB 2024-10-15 08:01:44
# #> 2 esimpint.tsv  file   3.1 MB 2024-10-15 08:01:50
# 
# # Filter by type
# fetch_ls("results/", type = "file")
# 
# # Filter by name pattern
# fetch_ls("results/", pattern = "\\.csv$")

## ----fetch-tree---------------------------------------------------------------
# # Top-level overview
# fetch_tree()
# 
# # Drill into a subfolder
# fetch_tree("results/", max_depth = 2)

## ----fetch-url----------------------------------------------------------------
# # Single file
# fetch_url("Showcase metadata/field.tsv")
# 
# # Entire folder (returns a named character vector)
# fetch_url("Showcase metadata/", duration = "7d")

## ----fetch-file---------------------------------------------------------------
# # Download a single file
# fetch_file("Showcase metadata/field.tsv", dest_dir = "data/")
# 
# # Download an entire folder
# fetch_file("Showcase metadata/", dest_dir = "data/metadata/")
# 
# # Resume an interrupted download
# fetch_file("results/summary_stats.csv", dest_dir = "data/", resume = TRUE)

## ----fetch-meta---------------------------------------------------------------
# # Download all Showcase metadata files (field.tsv, encoding.tsv, etc.)
# fetch_metadata(dest_dir = "data/metadata")
# 
# # Download the field dictionary only
# fetch_field(dest_dir = "data/metadata")

