Documentation
¶
Index ¶
- Constants
- Variables
- type CareerStatItem
- type CareerStats
- type CarsDriven
- type Client
- func (c *Client) CareerStats(custID *string) (*CareerStats, *http.Response, error)
- func (c *Client) CarsDriven(custID *string) (*CarsDriven, *http.Response, error)
- func (c *Client) DriverStats(opts *DriverStatsRequest) (*DriverStatsResult, *http.Response, error)
- func (c *Client) EventResults(opts *EventResultsRequest) (*EventResults, *http.Response, error)
- func (c *Client) LastRaceStats(custID *string) (*RaceStats, *http.Response, error)
- func (c *Client) SubSessionData(subSessionID *string, custID *string) (*SubSessionResult, *http.Response, error)
- func (c *Client) YearlyStats(custID *string) (*YearlyStats, *http.Response, error)
- type ClientOptionFunc
- type DriverStats
- type DriverStatsRequest
- type DriverStatsResult
- type EventResults
- type EventResultsRequest
- type RaceStats
- type RaceStatsItem
- type Result
- type SubSessionDriver
- type SubSessionResult
- type YearlyStats
- type YearlyStatsItem
Constants ¶
const ( SortAvgFinishingPosition = sortType("avgfinishingposition") SortAvgIncidents = sortType("avgincidents") SortAvgPoints = sortType("avgpoints") SortAvgStartingPosition = sortType("avgstartingposition") SortClass = sortType("class") SortClubName = sortType("clubname") SortClubpoints = sortType("clubpoints") SortCountryCode = sortType("countrycode") SortDisplayName = sortType("displayname") SortIRating = sortType("irating") SortLaps = sortType("laps") SortLapsLead = sortType("lapslead") SortPoints = sortType("points") SortSessionName = sortType("sessionname") SortStartTime = sortType("start_time") SortStarts = sortType("starts") SortTTRating = sortType("ttrating") SortTop25pcnt = sortType("top25pcnt") SortWins = sortType("wins") )
Request sorting values
const ( OrderDescending = order("desc") OrderAscending = order("asc") )
Request ordering values
const ( True = boolean(true) False = boolean(false) )
const ( CategoryOval category = iota + 1 CategoryRoad CategoryDirtOval CategoryDirtRoad )
Holds the index for each type of racing discipline
Variables ¶
var ( URLPathLogin = urlPath("/membersite/Login") URLPathSubSessionResults = urlPath(sitePath + "/GetSubsessionResults") URLPathLastRaceStats = urlPath(statsPath + "/GetLastRacesStats") URLPathCarsDriven = urlPath(statsPath + "/GetCarsDriven") URLPathCareerStats = urlPath(statsPath + "/GetCareerStats") URLPathYearlyStats = urlPath(statsPath + "/GetYearlyStats") URLPathDriverStats = urlPath(statsPath + "/GetDriverStats") URLPathResults = urlPath(statsPath + "/GetResults") )
iRacing API paths
var (
ErrAuthenticationFailed = errors.New("Failed to authenticate with iRacing")
)
Functions ¶
This section is empty.
Types ¶
type CareerStatItem ¶ added in v0.0.3
type CareerStatItem struct { AvgFinish int `json:"avgFinish"` AvgIncPerRace float64 `json:"avgIncPerRace"` AvgPtsPerRace int `json:"avgPtsPerRace"` AvgStart int `json:"avgStart"` Category string `json:"category"` LapsLed int `json:"lapsLed"` LapsLedPerC float64 `json:"lapsLedPerc"` Poles int `json:"poles"` Starts int `json:"starts"` Top5 int `json:"top5"` Top5PerC float64 `json:"top5Perc"` TotalLaps int `json:"totalLaps"` TotalClubPoints int `json:"totalclubpoints"` WinPerc float64 `json:"winPerc"` Wins int `json:"wins"` }
type CareerStats ¶ added in v0.0.3
type CareerStats = []CareerStatItem
type CarsDriven ¶
type CarsDriven = []int
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(username, password string, options ...ClientOptionFunc) (*Client, error)
func (*Client) CareerStats ¶ added in v0.0.3
CareerStats returns driver career stats as seen on the driver profile page.
E.g. Starts, Avg Inc., Win %, etc.
func (*Client) CarsDriven ¶
CarsDriven returns which cars (car_id) someone has driven
func (*Client) DriverStats ¶ added in v0.0.4
func (c *Client) DriverStats(opts *DriverStatsRequest) (*DriverStatsResult, *http.Response, error)
DriverStats returns a list of drivers that match the given parameters.
This is the backend source for /DriverLookup.Do AKA 'Driver Stats.'
func (*Client) EventResults ¶ added in v0.0.5
func (c *Client) EventResults(opts *EventResultsRequest) (*EventResults, *http.Response, error)
Results returns a list with an EventResults object for each of a driver's past events that meet the selected criteria.
func (*Client) LastRaceStats ¶
LastRaceStats returns stat summary for the driver's last 10 races as seen on the /CareerStats page.
func (*Client) SubSessionData ¶
func (c *Client) SubSessionData(subSessionID *string, custID *string) (*SubSessionResult, *http.Response, error)
SubSessionData returns extensive data about a session.
This endpoint contains data points about a session that is unavailable anywhere else.
func (*Client) YearlyStats ¶ added in v0.0.3
YearlyStats returns the breakdown of career stats by year, as seen on the /CareerStats driver profile.
type ClientOptionFunc ¶
ClientOptionFunc can be used customize a new iRacing Stats API client.
func WithBaseURL ¶
func WithBaseURL(s string) ClientOptionFunc
WithBaseURL sets the base URL for API requests to a custom endpoint.
func WithUserAgent ¶
func WithUserAgent(s string) ClientOptionFunc
WithUserAgent set the user agent to be used for API requests
type DriverStats ¶ added in v0.0.4
type DriverStats struct { AveFieldSize int `json:"avefieldsize"` AveFinishingPosition int `json:"avefinishingposition"` AveStartingPosition int `json:"avestartingposition"` AvgIncidents float64 `json:"avgincidents"` AvgPoints int `json:"avgpoints"` ClubID int `json:"clubid"` ClubName string `json:"clubname"` ClubPoints int `json:"clubpoints"` CountryCode string `json:"countrycode"` CustID int `json:"custid"` DisplayName string `json:"displayname"` GroupLetter string `json:"groupletter"` GroupName string `json:"groupname"` HelmColor1 string `json:"helmcolor1"` HelmColor2 string `json:"helmcolor2"` HelmColor3 string `json:"helmcolor3"` HelmFaceType int `json:"helmfacetype"` HelmHelmetType int `json:"helmhelmettype"` HelmPattern int `json:"helmpattern"` IRating int `json:"irating"` IRatingRank int `json:"irating_rank"` Laps int `json:"laps"` LapsLead int `json:"lapslead"` LicenseClass string `json:"licenseclass"` LicenseClassRank int `json:"licenseclass_rank"` LicenseGroup int `json:"licensegroup"` LicenseLevel int `json:"licenselevel"` Points int `json:"points"` RN int `json:"rn"` Rank int `json:"rank"` Region string `json:"region"` Starts int `json:"starts"` SubLevel int `json:"sublevel"` TTRating int `json:"ttrating"` TTRatingRank int `json:"ttrating_rank"` Top25Pcnt int `json:"top25pcnt"` Wins int `json:"wins"` }
func (*DriverStats) UnmarshalJSON ¶ added in v0.0.4
func (ds *DriverStats) UnmarshalJSON(b []byte) error
type DriverStatsRequest ¶ added in v0.0.4
type DriverStatsRequest struct { Search *string `form:"search"` Friend *string `form:"friend"` Watched *int `form:"watched"` Recent *int `form:"recent"` Country *string `form:"country"` Category category `form:"category"` ClassLow *int `form:"classlow"` ClassHigh *int `form:"classhigh"` IRatingLow *int `form:"iratinglow"` IRatingHigh *int `form:"iratinghigh"` TTRatingLow *int `form:"ttratinglow"` TTRatingHigh *int `form:"ttratinghigh"` AvgStartLow *int `form:"avgstartlow"` AvgStartHigh *int `form:"avgstarthigh"` AvgFinishLow *int `form:"avgfinishlow"` AvgFinishHigh *int `form:"avgfinishhigh"` AvgPointsLow *int `form:"avgpointslow"` AvgPointsHigh *int `form:"avgpointshigh"` AvgIncidentsLow *int `form:"avgincidentslow"` AvgIncidentsHigh *int `form:"avgincidentshigh"` CustID *string `form:"custid"` LowerBound *int `form:"lowerbound"` UpperBound *int `form:"upperbound"` Sort sortType `form:"sort"` Order order `form:"order"` Active *int `form:"active"` }
type DriverStatsResult ¶ added in v0.0.4
type DriverStatsResult struct { CustRow int RowCount int Drivers []DriverStats }
func (*DriverStatsResult) UnmarshalJSON ¶ added in v0.0.4
func (ds *DriverStatsResult) UnmarshalJSON(b []byte) error
type EventResults ¶ added in v0.0.5
func (*EventResults) UnmarshalJSON ¶ added in v0.0.5
func (r *EventResults) UnmarshalJSON(b []byte) error
type EventResultsRequest ¶ added in v0.0.5
type EventResultsRequest struct { CustID *string `form:"custid"` ShowRaces boolean `form:"showraces"` ShowQuals boolean `form:"showquals"` ShowTimeTrials boolean `form:"showtts"` ShowPractice boolean `form:"showops"` ShowOfficial boolean `form:"showofficial"` ShowUnofficial boolean `form:"showunofficial"` ShowRookie boolean `form:"showrookie"` ShowClassD boolean `form:"showclassd"` ShowClassC boolean `form:"showclassc"` ShowClassB boolean `form:"showclassb"` ShowClassA boolean `form:"showclassa"` ShowPro boolean `form:"showpro"` ShowProWC boolean `form:"showprowc"` LowerBound *int `form:"lowerbound"` UpperBound *int `form:"upperbound"` Sort sortType `form:"sort"` Order order `form:"order"` Format *int `form:"format"` Category []category `form:"category[]"` SeasonYear *int `form:"seasonyear"` SeasonQuarter *int `form:"seasonquarter"` RaceWeek *int `form:"raceweek"` TrackID *int `form:"trackid"` CarClassID *int `form:"carclassid"` CarID *int `form:"carid"` StartLow *int `form:"start_low"` StartHigh *int `form:"start_high"` StartTimeLow *int `form:"starttime_low"` StartTimeHigh *int `form:"starttime_high"` FinishLow *int `form:"finish_low"` FinishHigh *int `form:"finish_high"` IncidentsLow *int `form:"incidents_low"` IncidentsHigh *int `form:"incidents_high"` ChampPointsLow *int `form:"champpoints_low"` ChampPointsHigh *int `form:"champpoints_high"` }
type RaceStats ¶
type RaceStats = []RaceStatsItem
type RaceStatsItem ¶ added in v0.0.3
type RaceStatsItem struct { Date string `json:"date"` WinnerName string `json:"winnerName"` QualifyTime int `json:"qualifyTime"` TrackID int `json:"trackID"` LicenseLevel int `json:"licenseLevel"` Laps int `json:"laps"` TrackName string `json:"trackName"` SOF int `json:"sof"` CarID int `json:"carID"` CarColor1 string `json:"carColor1"` CarColor2 string `json:"carColor2"` CarColor3 string `json:"carColor3"` WinnerID int `json:"winnerID"` QualifyTimeFormatted string `json:"qualifyTimeFormatted"` Incidents int `json:"incidents"` ClubPoints int `json:"clubPoints"` SubSessionID int `json:"subsessionID"` ChampPoints int `json:"champPoints"` WinnerHC1 string `json:"winnerHC1"` WinnerHC3 string `json:"winnerHC3"` WinnerHC2 string `json:"winnerHC2"` CarClassID int `json:"carClassID"` SeriesID int `json:"seriesID"` WinnerHPattern int `json:"winnerHPattern"` StartPos int `json:"startPos"` CarPattern int `json:"carPattern"` WinnerLL int `json:"winnerLL"` SeasonID int `json:"seasonID"` LapsLed int `json:"lapsLed"` Time int64 `json:"time"` FinishPosition int `json:"finishPos"` }
type Result ¶ added in v0.0.5
type Result struct { HelmColor1 string `json:"helm_color1"` // 1 WinnerHelmColor2 string `json:"winnerhelmcolor2"` // 2 FinishingPosition int `json:"finishing_position"` // 3 WinnerHelmColor3 string `json:"winnerhelmcolor3"` // 4 WinnerHelmColor1 string `json:"winnerhelmcolor1"` // 5 BestQualLapTime string `json:"bestquallaptime"` // 6 SubsessionBestLapTime string `json:"subsession_bestlaptime"` // 7 RaceWeekNum int `json:"race_week_num"` // 8 SessionID int `json:"sessionid"` // 9 FinishedAt int `json:"finishedat"` // 10 RawStartTime int64 `json:"raw_start_time"` // 11 StartingPosition int `json:"starting_position"` // 12 HelmColor3 string `json:"helm_color3"` // 13 HelmColor2 string `json:"helm_color2"` // 14 Clubpoints int `json:"clubpoints"` // 16 DropracePoints int `json:"dropracepoints"` // 17 OfficialSession int `json:"officialsession"` // 18 GroupName string `json:"groupname"` // 19 SeriesID int `json:"seriesid"` // 20 StartTime string `json:"start_time"` // 21 SeasonID int `json:"seasonid"` // 22 CustID int `json:"custid"` // 23 HelmLicenseLevel int `json:"helm_licenselevel"` // 24 WinnerLicenseLevel int `json:"winnerlicenselevel"` // 25 RN int `json:"rn"` // 26 WinnersGroupID int `json:"winnersgroupid"` // 27 SesRank int `json:"sesrank"` // 28 CarClassID int `json:"carclassid"` // 29 TrackID int `json:"trackid"` // 30 WinnerDisplayName string `json:"winnerdisplayname"` // 31 CarID int `json:"carid"` // 32 CatID int `json:"catid"` // 33 SeasonQuarter int `json:"season_quarter"` // 34 LicenseGroup int `json:"licensegroup"` // 35 WinnerHelmPattern int `json:"winnerhelmpattern"` // 36 EvtType int `json:"evttype"` // 37 BestLaptime string `json:"bestlaptime"` // 38 Incidents int `json:"incidents"` // 39 ChampPoints int `json:"champpoints"` // 40 SubsessionID int `json:"subsessionid"` // 41 SeasonYear int `json:"season_year"` // 42 ChampPointsSort int `json:"champpointssort"` // 43 StartDate string `json:"start_date"` // 44 StrengthOfField int `json:"strengthoffield"` // 45 HelmPattern int `json:"helm_pattern"` // 46 ClubPointsSort int `json:"clubpointssort"` // 47 DisplayName string `json:"displayname"` // 48 }
func (*Result) UnmarshalJSON ¶ added in v0.0.5
type SubSessionDriver ¶
type SubSessionDriver struct { AggChampPoints int `json:"aggchamppoints"` AvgLap int `json:"avglap"` BestLapNum int `json:"bestlapnum"` BestLapTime int `json:"bestlaptime"` BestNLapsNum int `json:"bestnlapsnum"` BestNLapsTime int `json:"bestnlapstime"` BestQualLapAt int `json:"bestquallapat"` BestQualLapNum int `json:"bestquallapnum"` BestQualLapTime int `json:"bestquallaptime"` CarColor1 string `json:"car_color1"` CarColor2 string `json:"car_color2"` CarColor3 string `json:"car_color3"` CarNumberColor1 string `json:"car_number_color1"` CarNumberColor2 string `json:"car_number_color2"` CarNumberColor3 string `json:"car_number_color3"` CarPattern int `json:"car_pattern"` CarClassID int `json:"carclassid"` CarID int `json:"carid"` CarNum string `json:"carnum"` CarNumberFont int `json:"carnumberfont"` CarNumberSlant int `json:"carnumberslant"` CarSponsor1 int `json:"carsponsor1"` CarSponsor2 int `json:"carsponsor2"` CCName string `json:"ccName"` CCNameShort string `json:"ccNameShort"` ChampPoints int `json:"champpoints"` ClassInterval int `json:"classinterval"` ClubID int `json:"clubid"` ClubName string `json:"clubname"` ClubPoints int `json:"clubpoints"` ClubShortName string `json:"clubshortname"` CustomerID int `json:"custid"` DamageModel int `json:"damage_model"` DisplayName string `json:"displayname"` Division int `json:"division"` DivisionName string `json:"divisionname"` DropRacePoints int `json:"dropracepoints"` EvtTypeName string `json:"evttypename"` FinishPos int `json:"finishpos"` FinishPosInClass int `json:"finishposinclass"` GripCompoundPractice int `json:"grip_compound_practice"` GripCompoundQualify int `json:"grip_compound_qualify"` GripCompoundRace int `json:"grip_compound_race"` GripCompoundWarmup int `json:"grip_compound_warmup"` GroupID int `json:"groupid"` HeatInfoID int `json:"heatinfoid"` HelmColor1 string `json:"helm_color1"` HelmColor2 string `json:"helm_color2"` HelmColor3 string `json:"helm_color3"` HelmPattern int `json:"helm_pattern"` HostID string `json:"hostid"` Incidents int `json:"incidents"` Interval int `json:"interval"` LapsComplete int `json:"lapscomplete"` LapsLead int `json:"lapslead"` LeaguePoints string `json:"league_points"` LeagueAggPoints string `json:"leagueaggpoints"` LicenseChangeOval int `json:"license_change_oval"` LicenseChangeRoad int `json:"license_change_road"` LicenseCategory string `json:"licensecategory"` LicenseGroup int `json:"licensegroup"` MaxPctFuelFill int `json:"max_pct_fuel_fill"` Multiplier int `json:"multiplier"` NewCPI float64 `json:"newcpi"` NewIrating int `json:"newirating"` NewLicenseLevel int `json:"newlicenselevel"` NewSubLevel int `json:"newsublevel"` NewTTRating int `json:"newttrating"` OfficialSession int `json:"officialsession"` OldCPI float64 `json:"oldcpi"` OldIrating int `json:"oldirating"` OldLicenseLevel int `json:"oldlicenselevel"` OldSubLevel int `json:"oldsublevel"` OldTTRating int `json:"oldttrating"` OptLapsComplete int `json:"optlapscomplete"` Pos int `json:"pos"` QualLapTime int `json:"quallaptime"` ReasonOut string `json:"reasonout"` ReasonOutID int `json:"reasonoutid"` RestrictResults string `json:"restrictresults"` SessionStartTime int64 `json:"sessionstarttime"` SimSesName string `json:"simsesname"` SimSesNum int `json:"simsesnum"` SimSesTypeName string `json:"simsestypename"` StartPos int `json:"startpos"` SubsessionFinishedAt int64 `json:"subsessionfinishedat"` SuitColor1 string `json:"suit_color1"` SuitColor2 string `json:"suit_color2"` SuitColor3 string `json:"suit_color3"` SuitPattern int `json:"suit_pattern"` TrackCategory string `json:"track_category"` TrackCatID int `json:"track_catid"` VehicleKeyID int `json:"vehiclekeyid"` WeightPenaltyKG int `json:"weight_penalty_kg"` WheelChrome int `json:"wheel_chrome"` WheelColor string `json:"wheel_color"` }
type SubSessionResult ¶
type SubSessionResult struct { CategoryID int `json:"catid"` CautionType int `json:"cautiontype"` CornersPerLap int `json:"cornersperlap"` DriverChangeParam1 int `json:"driver_change_param1"` DriverChangeParam2 int `json:"driver_change_param2"` DriverChangeRule int `json:"driver_change_rule"` DriverChanges int `json:"driver_changes"` EventAverageLap int `json:"eventavglap"` EventLapsComplete int `json:"eventlapscomplete"` EventStrengthOfField int `json:"eventstrengthoffield"` EventType int `json:"evttype"` LeagueSeasonID string `json:"league_season_id"` LeagueID string `json:"leagueid"` LeaveMarbles int `json:"leavemarbles"` MaxTeamDrivers int `json:"max_team_drivers"` MaxWeeks int `json:"maxweeks"` MinTeamDrivers int `json:"min_team_drivers"` NcautionLaps int `json:"ncautionlaps"` Ncautions int `json:"ncautions"` NLapsForQualAVG int `json:"nlapsforqualavg"` NLapsForSoloAVG int `json:"nlapsforsoloavg"` NLeadChanges int `json:"nleadchanges"` PointsType string `json:"pointstype"` PrivateSessionID int `json:"privatesessionid"` RaceWeekNum int `json:"race_week_num"` Drivers []SubSessionDriver `json:"rows"` RservStatus string `json:"rserv_status"` RubberLevelPractice int `json:"rubberlevel_practice"` RubberLevelQualify int `json:"rubberlevel_qualify"` RubberLevelRace int `json:"rubberlevel_race"` RubberLevelWarmup int `json:"rubberlevel_warmup"` SeasonName string `json:"season_name"` SeasonQuarter int `json:"season_quarter"` SeasonShortname string `json:"season_shortname"` SeasonYear int `json:"season_year"` SeasonID int `json:"seasonid"` SeriesName string `json:"series_name"` SeriesShortname string `json:"series_shortname"` SeriesID int `json:"seriesid"` SessionID int `json:"sessionid"` SessionName string `json:"sessionname"` SimSessionType int `json:"simsestype"` SimulatedStartTime string `json:"simulatedstarttime"` SpecialEventType int `json:"specialeventtype"` SpecialEventTypeText string `json:"specialeventtypetext"` StartTime string `json:"start_time"` SubsessionID int `json:"subsessionid"` TimeOfDay int `json:"timeofday"` TrackConfigName string `json:"track_config_name"` TrackName string `json:"track_name"` TrackID int `json:"trackid"` WeatherFogDensity int `json:"weather_fog_density"` WeatherRh int `json:"weather_rh"` WeatherSkies int `json:"weather_skies"` WeatherTempUnits int `json:"weather_temp_units"` WeatherTempValue float64 `json:"weather_temp_value"` WeatherType int `json:"weather_type"` WeatherVarInitial int `json:"weather_var_initial"` WeatherVarOngoing int `json:"weather_var_ongoing"` WeatherWindDir int `json:"weather_wind_dir"` WeatherWindSpeedUnits int `json:"weather_wind_speed_units"` WeatherWindSpeedValue float64 `json:"weather_wind_speed_value"` }
type YearlyStats ¶ added in v0.0.3
type YearlyStats = []YearlyStatsItem
type YearlyStatsItem ¶ added in v0.0.3
type YearlyStatsItem struct { AvgFinish int `json:"avgFinish"` AvgIncPerRace float64 `json:"avgIncPerRace"` AvgPtsPerRace int `json:"avgPtsPerRace"` AvgStart int `json:"avgStart"` Category string `json:"category"` ClubPoints int `json:"clubpoints"` LapsLed int `json:"lapsLed"` LapsLedPerc float64 `json:"lapsLedPerc"` Poles int `json:"poles"` Starts int `json:"starts"` Top5 int `json:"top5"` Top5Perc float64 `json:"top5Perc"` TotalLaps int `json:"totalLaps"` WinPerc float64 `json:"winPerc"` Wins int `json:"wins"` Year string `json:"year"` }