Documentation ¶
Index ¶
- Constants
- type Filter
- func And(f1, f2 Filter, rest ...Filter) Filter
- func ElementMatch(f1, f2 Filter, rest ...Filter) Filter
- func Equal(name, value string) Filter
- func Exists(name string, exists bool) Filter
- func GreaterThan(name, value string) Filter
- func GreaterThanOrEqual(name, value string) Filter
- func In(name, value string) Filter
- func Intersects(name, value string) Filter
- func LessThan(name, value string) Filter
- func LessThanOrEqual(name, value string) Filter
- func Like(name, value string) Filter
- func Near(name, value string, minDistance, maxDistance int) Filter
- func Not(f1, f2 Filter, rest ...Filter) Filter
- func NotEqual(name, value string) Filter
- func NotIn(name, value string) Filter
- func NotLike(name, value string) Filter
- func Or(f1, f2 Filter, rest ...Filter) Filter
- func Within(name, value, shape string, radius float64) Filter
- type ObjectType
- type Query
- type Request
Constants ¶
const Endpoint = "https://api.trafikinfo.trafikverket.se/v2/data.json"
Endpoint is the current recommended endpoint for the Trafikinfo API
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Filter ¶
type Filter struct {
// contains filtered or unexported fields
}
Filter represents a filter element in the query.
func ElementMatch ¶
ElementMatch builds an ELEMENTMATCH filter
func GreaterThan ¶
GreaterThan filters by whether the field specified by name is greater than the specified value
func GreaterThanOrEqual ¶
GreaterThanOrEqual filters by whether the field specified by name is greater than or equal to the specified value
func Intersects ¶
Intersects filters by if te field specified in name intersects with the coordinates provided in value
func LessThan ¶
LessThan filters by whether the field specified by name is less than the specified value
func LessThanOrEqual ¶
LessThanOrEqual filters by whether the field specified by name is less than or equal to the specified value
func Near ¶
Near filters by if the field specified in name is within the specified min/max dinstance from the point coordinates sepcified in value
func Within ¶
Within filters by if the field specified in name falls within the specified shape, radius and the coordinates in value
func (*Filter) MarshalXML ¶
type ObjectType ¶
type ObjectType string
ObjectType is a type of object you can retrieve from the API
const ( RailCrossing ObjectType = "RailCrossing" ReasonCode ObjectType = "ReasonCode" TrainAnnouncement ObjectType = "TrainAnnouncement" TrainMessage ObjectType = "TrainMessage" TrainStation ObjectType = "TrainStation" TrainStationMessage ObjectType = "TrainStationMessage" TrainPosition ObjectType = "TrainPosition" Camera ObjectType = "Camera" FerryAnnouncement ObjectType = "FerryAnnouncement" FerryRoute ObjectType = "FerryRoute" Icon ObjectType = "Icon" Parking ObjectType = "Parking" RoadCondition ObjectType = "RoadCondition" RoadConditionOverview ObjectType = "RoadConditionOverview" Situation ObjectType = "Situation" TrafficFlow ObjectType = "TrafficFlow" TrafficSafetyCamera ObjectType = "TrafficSafetyCamera" TravelTimeRoute ObjectType = "TravelTimeRoute" WeatherMeasurePoint ObjectType = "WeatherMeasurePoint" WeatherObservation ObjectType = "WeatherObservation" WeatherStation ObjectType = "WeatherStation" MeasurementData100 ObjectType = "MeasurementData100" MeasurementData20 ObjectType = "MeasurementData20" PavementData ObjectType = "PavementData" RoadData ObjectType = "RoadData" RoadGeometry ObjectType = "RoadGeometry" )
type Query ¶
type Query struct {
// contains filtered or unexported fields
}
Query is used to request information from the Trafikinfo API
func NewQuery ¶
func NewQuery(objectType ObjectType, schemaVersion float64) *Query
NewQuery returns a query with the provided filters
func (*Query) MarshalXML ¶
type Request ¶
type Request struct { XMLName string `xml:"REQUEST"` Login *login `xml:"LOGIN"` Queries []*Query `xml:"QUERY"` }
Request tells the API what we're interested in
It must include the Login information and at least one Query.
func NewRequest ¶
func NewRequest() *Request
NewRequest returns a Request using the specified API authentication key and the data to be retrieved and filtered by the specified queries. At least 1 query needs to be provided.