v1dot1

package
v0.7.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 17, 2024 License: MIT Imports: 5 Imported by: 0

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

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

func (x *Position) SWEREF99TM() *string

SV: Koordinater uttryckt i formatet sweref99tm EN: Coordinates in sweref99tm format

func (*Position) UnmarshalXML

func (x *Position) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

func (*Position) WGS84

func (x *Position) WGS84() *string

SV: Koordinater uttryckt i formatet wgs84 EN: Coordinates in wgs84 format

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)
}

func (Response) ErrorMsg

func (r Response) ErrorMsg() string

Errors returns a slice of trv.Error, if any error was included in the response.

func (Response) HasErrors

func (r Response) HasErrors() bool

HasErrors returns whether any of the results includes an error.

type Status

type Status struct {
	// contains filtered or unexported fields
}

func (*Status) Active

func (x *Status) Active() *bool

SV: Flagga som visar om tåget är aktivt EN: A flag that shows whether or not the train is active

func (*Status) UnmarshalXML

func (x *Status) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type Train

type Train struct {
	// contains filtered or unexported fields
}

func (*Train) AdvertisedTrainNumber

func (x *Train) AdvertisedTrainNumber() *string

SV: Tågets annonserade tågnummer (tågnumret som står på biljetten) EN: The train's advertised train number

func (*Train) JourneyPlanDepartureDate

func (x *Train) JourneyPlanDepartureDate() *time.Time

SV: Tåguppdragets utgångsdag EN: Daily journey plan departure day

func (*Train) JourneyPlanNumber

func (x *Train) JourneyPlanNumber() *string

SV: Tågets uppdragsnummer EN: The train's daily journey plan number

func (*Train) OperationalTrainDepartureDate

func (x *Train) OperationalTrainDepartureDate() *time.Time

SV: Det operativa tågets utgångsdag EN: The operational train's departure day

func (*Train) OperationalTrainNumber

func (x *Train) OperationalTrainNumber() *string

SV: Operativt tågnummer EN: Operational train number

func (*Train) UnmarshalXML

func (x *Train) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL