115 lines
3.3 KiB
Go
115 lines
3.3 KiB
Go
package crawlers
|
|
|
|
import "time"
|
|
|
|
// Driver represents a structure of driver entry in the Eargast API.
|
|
type Driver struct {
|
|
GivenName string `json:"givenName,omitemtpy"`
|
|
FamilyName string `json:"familyName,omitemtpy"`
|
|
DateOfBirth Date `json:"dateOfBirth,omitemtpy"`
|
|
Nationality string `json:"nationality,omitemtpy"`
|
|
}
|
|
|
|
// Drivers represents an array of driver in the Eargast API.
|
|
type Drivers struct {
|
|
Drivers []Driver `json:"Drivers,omitemtpy"`
|
|
}
|
|
|
|
// DriverTable reprensts a table of drivers in the Eargast API.
|
|
type DriverTable struct {
|
|
DriverTable Drivers `json:"DriverTable,omitemtpy"`
|
|
}
|
|
|
|
// MRData is the general wrapper from Eargast API.
|
|
type MRData struct {
|
|
MRData RaceTable `json:"MRData,omitempty"`
|
|
}
|
|
|
|
// MRDriverData is the wrapper for the datta in the Eargast API.
|
|
type MRDriverData struct {
|
|
MRData DriverTable `json:"MRData,omitemtpy"`
|
|
}
|
|
|
|
// Location represents the details of a circuit.
|
|
type Location struct {
|
|
Country string `json:"country,omitempty"`
|
|
Latitude string `json:"lat,omitempty"`
|
|
Locality string `json:"locality,omitempty"`
|
|
Longitude string `json:"long,omitempty"`
|
|
}
|
|
|
|
// Circuit represents the details of a circuit.
|
|
type Circuit struct {
|
|
CircuitID string `json:"circuitID,omitempty"`
|
|
URL string `json:"url,omitempty"`
|
|
Name string `json:"circuitName,omitempty"`
|
|
Location Location `json:"Location,omitempty"`
|
|
}
|
|
|
|
// Race represents the details of a race.
|
|
type Race struct {
|
|
Season string `json:"season,omitempty"`
|
|
Round string `json:"round,omitempty"`
|
|
RaceName string `json:"raceName,omitempty"`
|
|
Circuit Circuit `json:"Circuit,omitempty"`
|
|
Date Date `json:"Date,omitempty"`
|
|
Time Time `json:"Time,omitempty"`
|
|
URL string `json:"url,omitempty"`
|
|
Results []Result `json:"Results,omitempty"`
|
|
}
|
|
|
|
// Races is the list of races.
|
|
type Races struct {
|
|
Races []Race `json:"Races,omitempty"`
|
|
// Season string `json:"season,omitempty"`
|
|
}
|
|
|
|
// RaceTable is the list of races.
|
|
type RaceTable struct {
|
|
RaceTable Races `json:"RaceTable,omitempty"`
|
|
}
|
|
|
|
// Date is the date struct.
|
|
type Date struct{ time.Time }
|
|
|
|
type Constructor struct {
|
|
ConstructorID string `json:"constructorID,omitempty"`
|
|
URL string `json:"url,omitempty"`
|
|
Name string `json:"name,omitempty"`
|
|
Nationality string `json:"nationality,omitempty"`
|
|
}
|
|
|
|
type FastestLap struct {
|
|
Rank string `json:"rank,omitempty"`
|
|
Lap string `json:"lap,omitempty"`
|
|
Time Time `json:"Time,omitempty"`
|
|
}
|
|
|
|
type Time struct {
|
|
Millis string `json:"millis,omitempty"`
|
|
Time string `json:"time,omitempty"`
|
|
}
|
|
|
|
type AverageSpeed struct {
|
|
Units string `json:"units,omitempty"`
|
|
Speed string `json:"speed,omitempty"`
|
|
}
|
|
|
|
type Result struct {
|
|
Number string `json:"number,omitemptyr"`
|
|
Position string `json:"position,omitempty"`
|
|
Points string `json:"points,omitempty"`
|
|
Driver Driver `json:"Driver,omitempty"`
|
|
Constructor Constructor `json:"Constructor,omitempty"`
|
|
Grid string `json:"grid,omitempty"`
|
|
Laps string `json:"laps,omitempty"`
|
|
Status string `json:"status,omitempty"`
|
|
Time Time `json:"Time,omitempty"`
|
|
FastestLap FastestLap `json:"FastestLap,omitempty"`
|
|
AverageSpeed AverageSpeed `json:"AverageSpeed,omitempty"`
|
|
}
|
|
|
|
type Results struct {
|
|
Results []Result `json:"Result,omitempty"`
|
|
}
|