# College Football Data API
#
# This is an API for accessing all sorts of college football data. It currently has a wide array of data ranging from play by play to player statistics to game scores and more.
#
# OpenAPI spec version: 2.3.5
# Contact: admin@collegefootballdata.com
# Generated by: https://github.com/swagger-api/swagger-codegen.git
#' @title Teams operations
#' @description swagger.Teams
#'
#' @field path Stores url path of the request.
#' @field apiClient Handles the client-server communication.
#' @field userAgent Set the user agent of the request.
#'
#' @importFrom R6 R6Class
#'
#' @section Methods:
#' \describe{
#'
#' get_fbs_teams FBS team list
#'
#'
#' get_roster Team rosters
#'
#'
#' get_talent Team talent composite rankings
#'
#'
#' get_team_matchup Team matchup history
#'
#'
#' get_teams Team information
#'
#' }
#'
#' @export
TeamsApi <- R6::R6Class(
'TeamsApi',
public = list(
userAgent = "Swagger-Codegen/1.0.0/r",
apiClient = NULL,
initialize = function(apiClient){
if (!missing(apiClient)) {
self$apiClient <- apiClient
}
else {
self$apiClient <- ApiClient$new()
}
},
get_fbs_teams = function(year, ...){
args <- list(...)
queryParams <- list()
headerParams <- character()
if (!missing(`year`)) {
queryParams['year'] <- year
}
urlPath <- "/teams/fbs"
resp <- self$apiClient$callApi(url = paste0(self$apiClient$basePath, urlPath),
method = "GET",
queryParams = queryParams,
headerParams = headerParams,
body = body,
...)
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
returnObject <- Team$new()
result <- returnObject$fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
Response$new(returnObject, resp)
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
Response$new("API client error", resp)
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
Response$new("API server error", resp)
}
},
get_roster = function(team, year, ...){
args <- list(...)
queryParams <- list()
headerParams <- character()
if (!missing(`team`)) {
queryParams['team'] <- team
}
if (!missing(`year`)) {
queryParams['year'] <- year
}
urlPath <- "/roster"
resp <- self$apiClient$callApi(url = paste0(self$apiClient$basePath, urlPath),
method = "GET",
queryParams = queryParams,
headerParams = headerParams,
body = body,
...)
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
returnObject <- Player$new()
result <- returnObject$fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
Response$new(returnObject, resp)
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
Response$new("API client error", resp)
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
Response$new("API server error", resp)
}
},
get_talent = function(year, ...){
args <- list(...)
queryParams <- list()
headerParams <- character()
if (!missing(`year`)) {
queryParams['year'] <- year
}
urlPath <- "/talent"
resp <- self$apiClient$callApi(url = paste0(self$apiClient$basePath, urlPath),
method = "GET",
queryParams = queryParams,
headerParams = headerParams,
body = body,
...)
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
returnObject <- TeamTalent$new()
result <- returnObject$fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
Response$new(returnObject, resp)
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
Response$new("API client error", resp)
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
Response$new("API server error", resp)
}
},
get_team_matchup = function(team1, team2, min_year, max_year, ...){
args <- list(...)
queryParams <- list()
headerParams <- character()
if (!missing(`team1`)) {
queryParams['team1'] <- team1
}
if (!missing(`team2`)) {
queryParams['team2'] <- team2
}
if (!missing(`min_year`)) {
queryParams['minYear'] <- min_year
}
if (!missing(`max_year`)) {
queryParams['maxYear'] <- max_year
}
urlPath <- "/teams/matchup"
resp <- self$apiClient$callApi(url = paste0(self$apiClient$basePath, urlPath),
method = "GET",
queryParams = queryParams,
headerParams = headerParams,
body = body,
...)
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
returnObject <- TeamMatchup$new()
result <- returnObject$fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
Response$new(returnObject, resp)
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
Response$new("API client error", resp)
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
Response$new("API server error", resp)
}
},
get_teams = function(conference, ...){
args <- list(...)
queryParams <- list()
headerParams <- character()
if (!missing(`conference`)) {
queryParams['conference'] <- conference
}
urlPath <- "/teams"
resp <- self$apiClient$callApi(url = paste0(self$apiClient$basePath, urlPath),
method = "GET",
queryParams = queryParams,
headerParams = headerParams,
body = body,
...)
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
returnObject <- Team$new()
result <- returnObject$fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
Response$new(returnObject, resp)
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
Response$new("API client error", resp)
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
Response$new("API server error", resp)
}
}
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.