Documentation ¶
Overview ¶
Package v1dot1 contains the type definitions for TrainPosition v1.1.
All types have accessor methods to access fields which can be chained on nils. This makes it possible to easily drill down into deeply nested data.
Index ¶
- func ObjectType() trv.ObjectType
- type Position
- type Response
- type Status
- type Train
- func (x *Train) AdvertisedTrainNumber() *string
- func (x *Train) JourneyPlanDepartureDate() *time.Time
- func (x *Train) JourneyPlanNumber() *string
- func (x *Train) OperationalTrainDepartureDate() *time.Time
- func (x *Train) OperationalTrainNumber() *string
- func (x *Train) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
- type TrainPosition
- func (x *TrainPosition) Bearing() *int
- func (x *TrainPosition) Deleted() *bool
- func (x *TrainPosition) ModifiedTime() *time.Time
- func (x *TrainPosition) Position() *Position
- func (x *TrainPosition) Speed() *int
- func (x *TrainPosition) Status() *Status
- func (x *TrainPosition) TimeStamp() *time.Time
- func (x *TrainPosition) Train() *Train
- func (x *TrainPosition) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
- func (x *TrainPosition) VersionNumber() *int64
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ObjectType ¶
func ObjectType() trv.ObjectType
Types ¶
type Position ¶
type Position struct {
// contains filtered or unexported fields
}
func (*Position) SWEREF99TM ¶
SV: Koordinater uttryckt i formatet sweref99tm EN: Coordinates in sweref99tm format
func (*Position) UnmarshalXML ¶
type Response ¶
type Response struct { XMLName xml.Name `xml:"RESPONSE"` Results []struct { Info struct { LastModified trv.LastModified `xml:"LASTMODIFIED"` LastChangeID string `xml:"LASTCHANGEID"` EvalResult []any `xml:"EVALRESULT"` SSEURL string `xml:"SSEURL"` } `xml:"INFO"` Error *trv.APIError `xml:"ERROR"` Data []TrainPosition `xml:"TrainPosition"` } `xml:"RESULT"` }
Response can be used to decode the response from the API.
For example:
package main import ( "encoding/xml" api "code.dny.dev/trafikinfo/trv/trainposition/v1dot1" ) func main() { var res api.Response err := xml.Unmarshal(data, &res) }
type Status ¶
type Status struct {
// contains filtered or unexported fields
}
func (*Status) Active ¶
SV: Flagga som visar om tåget är aktivt EN: A flag that shows whether or not the train is active
func (*Status) UnmarshalXML ¶
type Train ¶
type Train struct {
// contains filtered or unexported fields
}
func (*Train) AdvertisedTrainNumber ¶
SV: Tågets annonserade tågnummer (tågnumret som står på biljetten) EN: The train's advertised train number
func (*Train) JourneyPlanDepartureDate ¶
SV: Tåguppdragets utgångsdag EN: Daily journey plan departure day
func (*Train) JourneyPlanNumber ¶
SV: Tågets uppdragsnummer EN: The train's daily journey plan number
func (*Train) OperationalTrainDepartureDate ¶
SV: Det operativa tågets utgångsdag EN: The operational train's departure day
func (*Train) OperationalTrainNumber ¶
SV: Operativt tågnummer EN: Operational train number
func (*Train) UnmarshalXML ¶
type TrainPosition ¶
type TrainPosition struct {
// contains filtered or unexported fields
}
func (*TrainPosition) Bearing ¶
func (x *TrainPosition) Bearing() *int
SV: Tågets bäring i grader EN: The train's bearing in degrees
func (*TrainPosition) Deleted ¶
func (x *TrainPosition) Deleted() *bool
func (*TrainPosition) ModifiedTime ¶
func (x *TrainPosition) ModifiedTime() *time.Time
EN: Specifies when the object is stored. SV: Anger när objektet är sparat.
func (*TrainPosition) Position ¶
func (x *TrainPosition) Position() *Position
SV: Senast registrerade position för tåget EN: Last known position of the train
func (*TrainPosition) Speed ¶
func (x *TrainPosition) Speed() *int
SV: Tågets hastighet i kilometer per timme EN: The train's speed in kilometers per hour
func (*TrainPosition) Status ¶
func (x *TrainPosition) Status() *Status
SV: Tågets aktuell status EN: The train's current status
func (*TrainPosition) TimeStamp ¶
func (x *TrainPosition) TimeStamp() *time.Time
SV: Tiden då positionen uppmättes EN: The time when the position was measured
func (*TrainPosition) Train ¶
func (x *TrainPosition) Train() *Train
SV: Tåginformation EN: Train information
func (*TrainPosition) UnmarshalXML ¶
func (x *TrainPosition) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
func (*TrainPosition) VersionNumber ¶
func (x *TrainPosition) VersionNumber() *int64
SV: Versionsnumret för ett tågs position EN: The version number for a train's position