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

## ----auth, eval=FALSE---------------------------------------------------------
# library(tmdbR)
# tmdb_auth(path = file.path(tempdir(), "tmdbR-token.rds"))

## ----auth-environment, eval=FALSE---------------------------------------------
# Sys.setenv(TMDB_BEARER_TOKEN = "your-token")
# library(tmdbR)

## ----search, eval=FALSE-------------------------------------------------------
# hits <- search_movie(query = "Spirited Away", language = "en-AU")
# film <- movie(
#   id = hits$results$id[[1]],
#   append_to_response = "credits,videos"
# )

## ----pagination, eval=FALSE---------------------------------------------------
# popular <- movie_popular(
#   region = "AU",
#   paginate = TRUE,
#   max_pages = 3,
#   max_results = 50,
#   progress = TRUE
# )
# 
# popular$results
# popular$pages_fetched
# popular$truncated

## ----discover, eval=FALSE-----------------------------------------------------
# available <- discover_movie(
#   watch_region = "AU",
#   with_watch_providers = c(8, 9),
#   with_watch_monetization_types = "flatrate",
#   sort_by = "popularity.desc"
# )

## ----configuration, eval=FALSE------------------------------------------------
# cfg <- tmdb_config(timeout = 30, max_tries = 5)
# tmdb_request("movie/550", config = cfg)

