api

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 7, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Circuit

type Circuit struct {
	CircuitID   string   `xml:"circuitId,attr"`
	URL         string   `xml:"url,attr"`
	CircuitName string   `xml:"CircuitName"`
	Location    Location `xml:"Location"`
}

type Constructor

type Constructor struct {
	ConstructorId string `xml:"constructorId,attr"`
	URL           string `xml:"url,attr"`
	Name          string `xml:"Name"`
	Nationality   string `xml:"Nationality"`
}

type ConstructorStanding added in v0.2.0

type ConstructorStanding struct {
	Position    string      `xml:"position,attr"`
	Points      string      `xml:"points,attr"`
	Wins        string      `xml:"wins,attr"`
	Constructor Constructor `xml:"Constructor"`
}

type Driver

type Driver struct {
	DriverId        string `xml:"driverId,attr"`
	Code            string `xml:"code,attr"`
	URL             string `xml:"url,attr"`
	PermanentNumber string `xml:"PermanentNumber"`
	GivenName       string `xml:"GivenName"`
	FamilyName      string `xml:"FamilyName"`
	DateOfBirth     string `xml:"DateOfBirth"`
	Nationality     string `xml:"Nationality"`
}

type DriverStanding

type DriverStanding struct {
	Position    string      `xml:"position,attr"`
	Points      string      `xml:"points,attr"`
	Wins        string      `xml:"wins,attr"`
	Driver      Driver      `xml:"Driver"`
	Constructor Constructor `xml:"Constructor"`
}

type Ergast

type Ergast struct {
	BaseURL    string
	HTTPClient *http.Client
}

Ergast represents the Ergast Developer API.

func New

func New() *Ergast

func (*Ergast) ConstructorStandings added in v0.2.0

func (ergast *Ergast) ConstructorStandings(ctx context.Context, year int) ([]ConstructorStanding, error)

ConstructorStandings retrieves the constructors standings for a given season `year`.

func (*Ergast) DriverStandings

func (ergast *Ergast) DriverStandings(ctx context.Context, year int) ([]DriverStanding, error)

DriverStandings retrieves the driver standings for a given season `year`.

func (*Ergast) Laps

func (ergast *Ergast) Laps(ctx context.Context, year int, round string) ([]Lap, error)

func (*Ergast) QualifyingResults added in v0.2.0

func (ergast *Ergast) QualifyingResults(ctx context.Context, year int, round string) ([]QualifyingResult, error)

func (*Ergast) Results

func (ergast *Ergast) Results(ctx context.Context, year int, round string) ([]Result, error)

func (*Ergast) Schedule

func (ergast *Ergast) Schedule(ctx context.Context, year int) ([]Race, error)

Schedule retrieves the schedule for a season in a giver `year`.

type Lap

type Lap struct {
	Number int      `xml:"number,attr"`
	Timing []Timing `xml:"Timing"`
}

type Location

type Location struct {
	Lat      string `xml:"lat"`
	Long     string `xml:"long"`
	Locality string `xml:"Locality"`
	Country  string `xml:"Country"`
}

type MRData

type MRData struct {
	XMLName        xml.Name       `xml:"MRData"`
	Total          int            `xml:"total,attr"`
	RaceTable      RaceTable      `xml:"RaceTable"`
	StandingsTable StandingsTable `xml:"StandingsTable"`
	Limit          int            `xml:"limit,attr"`
	Offset         int            `xml:"offset,attr"`
}

type QualifyingResult added in v0.2.0

type QualifyingResult struct {
	Number      string      `xml:"number,attr"`
	Position    string      `xml:"position,attr"`
	Driver      Driver      `xml:"Driver"`
	Constructor Constructor `xml:"Constructor"`
	Q1          string      `xml:"Q1"`
	Q2          string      `xml:"Q2"`
	Q3          string      `xml:"Q3"`
}

type Race

type Race struct {
	Season           string             `xml:"season,attr"`
	Round            string             `xml:"round,attr"`
	URL              string             `xml:"url,attr"`
	RaceName         string             `xml:"RaceName"`
	Circuit          Circuit            `xml:"Circuit"`
	Date             string             `xml:"Date"`
	Time             string             `xml:"Time"`
	Results          []Result           `xml:"ResultsList>Result"`
	Laps             []Lap              `xml:"LapsList>Lap"`
	QualifyingResult []QualifyingResult `xml:"QualifyingList>QualifyingResult"`
}

type RaceTable

type RaceTable struct {
	Season string `xml:"season,attr"`
	Races  []Race `xml:"Race"`
}

type Result

type Result struct {
	Number      string      `xml:"number,attr"`
	Position    string      `xml:"position,attr"`
	Points      string      `xml:"points,attr"`
	Driver      Driver      `xml:"Driver"`
	Constructor Constructor `xml:"Constructor"`
}

type StandingsTable

type StandingsTable struct {
	Season               string                `xml:"season,attr"`
	DriverStandings      []DriverStanding      `xml:"StandingsList>DriverStanding"`
	ConstructorStandings []ConstructorStanding `xml:"StandingsList>ConstructorStanding"`
}

type Timing

type Timing struct {
	DriverID string `xml:"driverId,attr"`
	Lap      int    `xml:"lap,attr"`
	Position int    `xml:"position,attr"`
	Time     string `xml:"time,attr"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL