nhl_url_schedule: Create an NHL API URL for schedules

Description Usage Arguments Value Examples

View source: R/nhl_schedule.R

Description

Create an NHL API URL for schedules

Usage

1
2
3
4
5
6
7
8
nhl_url_schedule(
  seasons = NULL,
  teamIds = NULL,
  startDate = NULL,
  endDate = NULL,
  gameTypes = NULL,
  expand = NULL
)

Arguments

seasons

numeric(), integer() or character(), vector of starting years of desired seasons in YYYY format, e.g. 1995 or "1995" for season 1995-1996. Accepts vectors such as c(1995:2000, 2010) to generate multiple seasons.

Alternatively, also accepts character() with seasons in the format "YYYYZZZZ", where ZZZZ = YYYY + 1, e.g. "19951996". This is the format that ultimately gets sent to the NHL API.

Some API endpoints, notably seasons exposed via nhl_seasons() also allow the value "current" to passed. This value will be returned unchanged.

teamIds

integer(), ids of the teams or NULL (default) for all teams. As of end of 2019, the valid team ids seem to be in the 1:54 range.

startDate

character(1), date in the format "YYYY-MM-DD" defining the start of the date interval for which the schedule is to be retrieved.

endDate

character(1), date in the format "YYYY-MM-DD" defining the end of the date interval for which the schedule is to be retrieved.

gameTypes

character(), defining the game types to retrieve. Valid game types are for example "R" for regular season or "P" for playoffs. See nhl_md_game_types() for all values and their descriptions.

expand

character(), of parameters passed as expand to the API URL. Some valid examples seem to be "round.series" and "schedule.broadcasts", "schedule.linescore", "schedule.ticket". NULL for no expand parameter.

Value

character(), vector of URLs.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
 nhlapi:::nhl_url_schedule(seasons = 2015:2016)
 nhlapi:::nhl_url_schedule(
   startDate = "2018-01-02",
   endDate = "2018-01-02"
 )
 nhlapi:::nhl_url_schedule(
   startDate = "2018-01-02",
   endDate = "2018-01-02",
   teamIds = c(29, 30),
   expand = "schedule.linescore"
 )

nhlapi documentation built on Feb. 20, 2021, 9:06 a.m.