dot-GetLocalData: Extract FIRST data from a local file.

Description Usage Arguments Details Value Examples

Description

.GetLocalData is an internal function that is not intended to be called by the user. It is called by other FIRST API methods.

Usage

1
.GetLocalData(url, data_format)

Arguments

url

A character vector containing the portion of the FIRST API url that follows the season path parameter, not including the '/' that follows the season.

data_format

A character vector containing either "json" or "xml".

Details

.GetLocalData extracts archived FIRST data from the packages local R/sysdata.rda file. The data is archived as JSON text or as an XML::XMLDocument object.

Normally, .GetLocalData will not be used. However, if the user sets the authorization key in the Session object to the literal value "key", then .GetHTTP() will call .GetLocalData() instead of sending the HTTP request. As a result, .GetHTTP and all other firstapiR functions that depend on .GetHTTP will skip the HTTP request and return the archived, local data.

This feature allows users to experiment with firstapiR features even if they don't have an official authorization key issued by FIRST. It also enables the examples in the firstapiR documentation to work. The actual HTTP request, HTTP error code check, and extraction of text data from the body of the HTTP response are the only parts of the code that are bypassed.

Value

While the local data will be of the same type as what was requested (i.e., if called via GetTeams a list of teams will be returned, GetSchedule) will return schedule data, etc.) arguments such as team or event will be ignored. Refer to the data-raw/data.R file to see the firstapiR commands that were used to download the data from the FIRST API server.

Examples

1
content <- .GetLocalData(url, session$format)

irwinsnet/FIRST_api_R documentation built on Dec. 22, 2020, 5:12 p.m.