Documentation
¶
Index ¶
- func ValuesBetween[T any](filter T, fieldName, min, max string, extrmeIncluded bool) (string, error)
- type Client
- func (c *Client) Driver(filter types.DriverFilter) ([]types.Driver, error)
- func (c *Client) DriverFastestLap(sessionKey string, driverNumber int) (types.Lap, error)
- func (c *Client) DriverFastestLapTelemetry(sessionKey string, driverNumber int) ([]types.CarData, error)
- func (c *Client) DriverNumbersBySession(sessionKey string) ([]int, error)
- func (c *Client) DriverStints(sessionKey string, driverNumber int) ([]types.Stint, error)
- func (c *Client) FiaComunications(sessionKey string) ([]types.RaceControl, error)
- func (c *Client) Flag(flagColor, sessionKey string) ([]types.RaceControl, error)
- func (c *Client) GetSessionKey(cityName, sessionName, year string) (int, error)
- func (c *Client) Intervals(filter types.IntervalFilter) ([]types.Interval, error)
- func (c *Client) LappedDrivers(sessionKey string) ([]types.Driver, error)
- func (c *Client) Laps(filter types.LapFilter) ([]types.Lap, error)
- func (c *Client) Location(filter types.LocationFilter) ([]types.Location, error)
- func (c *Client) LocationByLap(sessionKey, lap string, driverNumber int) ([]types.Location, error)
- func (c *Client) Meetings(filter types.MeetingFilter) ([]types.Meeting, error)
- func (c *Client) Overtakes(filter types.OvertakeFilter) ([]types.Overtake, error)
- func (c *Client) Pit(filter types.PitFilter) ([]types.Pit, error)
- func (c *Client) Position(filter types.PositionFilter) ([]types.Position, error)
- func (c *Client) QualifyingResult(cityName, year string, isSprintRace bool) ([]types.SessionResult, error)
- func (c *Client) RaceControl(filter types.RaceControlFilter) ([]types.RaceControl, error)
- func (c *Client) RaceResult(cityName, year string, isSprintRace bool) ([]types.SessionResult, error)
- func (c *Client) RainySessionsForYear(year int) ([]types.Session, error)
- func (c *Client) SafetyCar(sessionKey string) ([]types.RaceControl, error)
- func (c *Client) SessionFastestLap(sessionKey string) (types.Lap, error)
- func (c *Client) SessionResult(filter types.SessionResultFilter) ([]types.SessionResult, error)
- func (c *Client) Sessions(filter types.SessionFilter) ([]types.Session, error)
- func (c *Client) SetAPIVersion(version string)
- func (c *Client) SetHTTPClient(hc *http.Client)
- func (c *Client) SetPath(path string)
- func (c *Client) StartingCompound(sessionKey string) ([]types.Stint, error)
- func (c *Client) StartingGrid(filter types.StartingGridFilter) ([]types.StartingGrid, error)
- func (c *Client) StartingGridGP(cityName, year string, isSprintRace bool) ([]types.StartingGrid, error)
- func (c *Client) Stints(filter types.StintFilter) ([]types.Stint, error)
- func (c *Client) TeamRadio(filter types.TeamRadioFilter) ([]types.TeamRadio, error)
- func (c *Client) Telemetry(filter types.CarDataFilter) ([]types.CarData, error)
- func (c *Client) TelemetryByLap(sessionKey, lap string, driverNumber int) ([]types.CarData, error)
- func (c *Client) Weather(filter types.WeatherFilter) ([]types.Weather, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValuesBetween ¶
func ValuesBetween[T any](filter T, fieldName, min, max string, extrmeIncluded bool) (string, error)
valuesBetween takes a generic filter struct and returns a query string representing a range condition for a specific field.
Parameters:
- filter: A struct of any type T representing the filter (e.g., CarDataFilter{}, DriverFilter{}).
- fieldName: The name (case sensitive) of the struct field to filter on (e.g., "DriverNumber").
- min: The lower bound of the range.
- max: The upper bound of the range.
- extrmeIncluded: A boolean indicating whether the range endpoints are inclusive.
Returns:
- A string representing the range condition (e.g., "DriverNumber>=1&DriverNumber<=3").
- An error if the field does not exist or cannot be accessed.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) Driver ¶
Driver retrieves driver informations based on the given user filter. An incorrect filter parameters resulting in no results will raise an error. Excessive data requests may result in an error.
func (*Client) DriverFastestLap ¶
DriverFastestLap retrieves the fastest lap of the given driver in the specified session.
func (*Client) DriverFastestLapTelemetry ¶
func (*Client) DriverNumbersBySession ¶
DriverNumbersBySession returns a slice of driver numbers who participated in the specified session. Only the numeric driver identifiers are returned, not full driver details.
func (*Client) DriverStints ¶
DriverStints returns a list of stints for the specified driver in the given session.
func (*Client) FiaComunications ¶
func (c *Client) FiaComunications(sessionKey string) ([]types.RaceControl, error)
FIACommunications retrieves all race control events related to FIA communications for the specified session key, such as investigations, track conditions, lap time deletions during qualifying, etc.
func (*Client) Flag ¶
func (c *Client) Flag(flagColor, sessionKey string) ([]types.RaceControl, error)
Flag retrieves race control flag events for a specified flag color and session key.
func (*Client) GetSessionKey ¶
The sessionName combinations vary depending on the Grand Prix format. Note: The query is case-sensitive.
Classic GP | Sprint GP -----------|------------------- Practice 1 | Practice 1 Practice 2 | Sprint Qualifying Practice 3 | Sprint Qualifying | Qualifying Race | Race
func (*Client) Intervals ¶
Intervals retrieves the gap to leader and driver ahead data based on the given user filter. An incorrect filter parameters resulting in no results will raise an error. Excessive data requests may result in an error.
func (*Client) LappedDrivers ¶
LappedDrivers returns information about lapped drivers for the given session key.
func (*Client) Laps ¶
Laps retrieves laps data based on the given user filter. An incorrect filter parameters resulting in no results will raise an error. Excessive data requests may result in an error.
func (*Client) Location ¶
Location retrieves The approximate location of the cars on the circuit data based on the given user filter, at a sample rate of about 3.7 Hz. Useful for gauging their progress along the track, but lacks details about lateral placement — i.e. whether the car is on the left or right side of the track. The origin point (0, 0, 0) appears to be arbitrary and not tied to any specific location on the track. An incorrect filter parameters resulting in no results will raise an error. Excessive data requests may result in an error.
func (*Client) LocationByLap ¶
func (*Client) Meetings ¶
Meetings retrieves meetings data based on the given user filter. A meeting refers to a Grand Prix or testing weekend and usually includes multiple sessions (practice, qualifying, race, ...). An incorrect filter parameters resulting in no results will raise an error. Excessive data requests may result in an error.
func (*Client) Overtakes ¶
As reported in the openf1 api, this is a BETA endpoint. This data is only available during races and may be incomplete. Overtakes retrieves overtakes data based on the given user filter. An incorrect filter parameters resulting in no results will raise an error. Excessive data requests may result in an error.
func (*Client) Pit ¶
Pits retrieves pits data based on the given user filter. An incorrect filter parameters resulting in no results will raise an error. Excessive data requests may result in an error.
func (*Client) Position ¶
Position retrieves driver positions throughout a session, including initial placement and subsequent changes based on the given user filter. An incorrect filter parameters resulting in no results will raise an error. Excessive data requests may result in an error.
func (*Client) QualifyingResult ¶
func (*Client) RaceControl ¶
func (c *Client) RaceControl(filter types.RaceControlFilter) ([]types.RaceControl, error)
RaceControl retrieves race control data based on the given user filter. An incorrect filter parameters resulting in no results will raise an error. Excessive data requests may result in an error.
func (*Client) RaceResult ¶
func (*Client) RainySessionsForYear ¶
RainySessionsForYear retrieves all the sessions that experienced rain during the specified year.
func (*Client) SafetyCar ¶
func (c *Client) SafetyCar(sessionKey string) ([]types.RaceControl, error)
SafetyCar retrieves all race control events related to the safety car for the specified session key. The message field specifies whether it is a virtual safety car or not.
func (*Client) SessionFastestLap ¶
SessionFastestLap retrieves the fastest lap in the specified session.
func (*Client) SessionResult ¶
func (c *Client) SessionResult(filter types.SessionResultFilter) ([]types.SessionResult, error)
As reported in the openf1 api, this is a BETA endpoint SessionResult retrieves standings after a session based on the given user filter. An incorrect filter parameters resulting in no results will raise an error. Excessive data requests may result in an error.
func (*Client) Sessions ¶
Sessions retrieves sessions data based on the given user filter. A session refers to a distinct period of track activity during a Grand Prix or testing weekend (practice, qualifying, sprint, race, ...) An incorrect filter parameters resulting in no results will raise an error. Excessive data requests may result in an error.
func (*Client) SetAPIVersion ¶
SetAPIVersion sets the version of the OpenF1 API to use (e.g. "v1")
func (*Client) SetHTTPClient ¶
SetHTTPClient allows user to provide their own http.Client
func (*Client) SetPath ¶
SetPath sets the specific API path (e.g. "/car_data") to be appended to the base URL
func (*Client) StartingCompound ¶
StartingCompound returns the starting tyre compound for each driver in the grid for the specified session. By checking TyreAgeAtStart, you can identify drivers who started with fresh tyres.
func (*Client) StartingGrid ¶
func (c *Client) StartingGrid(filter types.StartingGridFilter) ([]types.StartingGrid, error)
As reported in the openf1 api, this is a BETA endpoint StartingGrid retrieves the starting grid for the upcoming race based on user filter. Need to pass the qualifying session_key to get the race starting grid! An incorrect filter parameters resulting in no results will raise an error. Excessive data requests may result in an error.
func (*Client) StartingGridGP ¶
func (c *Client) StartingGridGP(cityName, year string, isSprintRace bool) ([]types.StartingGrid, error)
StartingGridGP returns the starting grid for a specific Grand Prix, including both sprint and classic races.
func (*Client) Stints ¶
Stints retrieves stints data based on the given user filter. A stint refers to a period of continuous driving by a driver during a session. An incorrect filter parameters resulting in no results will raise an error. Excessive data requests may result in an error.
func (*Client) TeamRadio ¶
TeamRadio retrieves team radio data based on the given user filter. Only a limited selection of communications are included, not the complete record of radio interactions. An incorrect filter parameters resulting in no results will raise an error. Excessive data requests may result in an error.
func (*Client) Telemetry ¶
Telemetry retrieves telemetry data based on the given user filter. An incorrect filter parameters resulting in no results will raise an error. Excessive data requests may result in an error.