Learn R Programming

stattleshipR (version 0.0.5)

ss_get_result: Interface with the Stattleship API

Description

A simple, generic function to query data from the Stattleship API

Usage

ss_get_result(token, sport = "hockey", league = "nhl", ep = "teams", query = list(), version = 1, walk = FALSE, page = NA, verbose = TRUE)

Arguments

sport
character. The sport, such as hockey, basketball, football, and baseball. Default is hockey.
league
character. NHL, NBA, NFL, and MLB. Default is nhl.
ep
character. The endpoint. Default is teams.
query
list. A list that defines the query parameters. Default is empty list.
version
numeric. The API version. Current version is 1 and is the default value.
walk
logical. If TRUE, walks through and returns all results if there is more than one page of results. Default is FALSE.
page
numeric. The page number to request. Default is NA.
verbose
logical. For debugging, prints status messages to the console, which can be helpful for walking through results. Default is TRUE.

Value

a list of lists. If `walk=FALSE`, it will be a list of length 1. If `walk=TRUE`, a list of lists may be returned depending on how many pages are returned.

Examples

Run this code
## Not run: 
# set_token("insert-your-token-here")
# results <- ss_get_result(sport="hockey", 
#                          league="nhl",
#                          ep = "teams",
#                          query = list()
#                          version = 1,
#                          walk = FALSE,
#                          page = NA,
#                          verbose = TRUE)
# ## End(Not run)

Run the code above in your browser using DataLab