Documentation
¶
Index ¶
Constants ¶
View Source
const DefaultFetchSpacing = 100 * time.Millisecond
View Source
const DefaultMaxPages = 5
View Source
const DefaultPageSize = 10_000
Variables ¶
View Source
var ErrTooManyPages = errors.New("fetching operations takes too many pages")
Functions ¶
This section is empty.
Types ¶
type AffectedTrain ¶
type Disruption ¶
type Disruption struct {
ID int `json:"id"`
Type string `json:"tc"`
Title string `json:"tt"`
Message string `json:"msg"`
AffectedTrains []*AffectedTrain `json:"ar"`
}
type Disruptions ¶
type Disruptions struct {
Timestamp time.Time `json:"ts"`
Disruptions []*Disruption `json:"ds"`
DisruptionTypes map[string]string `json:"dt"`
}
type OperationTrain ¶
type OperationTrain struct {
TrainID
Status string `json:"s"`
Stops []*OperationTrainStop `json:"st"`
}
type OperationTrainStop ¶
type Operations ¶
type Operations struct {
Timestamp time.Time `json:"ts"`
Pages Pagination `json:"pg"`
Trains []*OperationTrain `json:"tr"`
}
func FetchOperations ¶
func FetchOperations(ctx context.Context, apikey string, client http2.Doer, options PageFetchOptions) (*Operations, error)
type PageFetchOptions ¶
func NewPageFetchOptions ¶
func NewPageFetchOptions() PageFetchOptions
type Pagination ¶
type TrimmedRoute ¶
type TrimmedRoute struct {
ScheduleID int `json:"sid"`
OrderID int `json:"oid"`
TrainOrderID int `json:"toid"`
OperatingDates []time2.Date `json:"od"`
CarrierCode string `json:"cc"`
Number string `json:"nn"`
InternationalDepNumber string `json:"idn"`
InternationalArrNumber string `json:"ian"`
}
func (*TrimmedRoute) GetNumber ¶
func (r *TrimmedRoute) GetNumber() string
func (*TrimmedRoute) TrainIDs ¶
func (r *TrimmedRoute) TrainIDs() []TrainID
type TrimmedSchedules ¶
type TrimmedSchedules struct {
Timestamp time.Time `json:"ts"`
Trains []*TrimmedRoute `json:"rt"`
}
Click to show internal directories.
Click to hide internal directories.