Documentation ¶
Index ¶
- type APIClient
- func (c *APIClient) GetAllNextDepartures(stopCode, lineCode, destinationCode string) (GetAllNextDeparturesResponse, error)
- func (c *APIClient) GetDisruptions() (GetDisruptionsResponse, error)
- func (c *APIClient) GetLinesColor() (GetLinesResponse, error)
- func (c *APIClient) GetNextDeparturesForLines(linesCodes, destinationsCodes []string) (GetNextDeparturesResponse, error)
- func (c *APIClient) GetNextDeparturesForStop(stopCode, departureCode string) (GetNextDeparturesResponse, error)
- func (c *APIClient) GetPhysicalStopsByName(name string) (GetPhysicalStopsResponse, error)
- func (c *APIClient) GetPhysicalStopsFromCodes(codes []string) (GetPhysicalStopsResponse, error)
- func (c *APIClient) GetStops() (GetStopResponse, error)
- func (c *APIClient) GetStopsByLine(name string) (GetStopResponse, error)
- func (c *APIClient) GetStopsByName(name string) (GetStopResponse, error)
- func (c *APIClient) GetStopsClosedToLatLng(pos LatLng) (GetStopResponse, error)
- func (c *APIClient) GetStopsFromCodes(codes []string) (GetStopResponse, error)
- func (c *APIClient) GetThermometer(departureCode string) (GetThermometerResponse, error)
- func (c *APIClient) GetThermometerPhysicalStops(departureCode string) (GetThermometerResponse, error)
- type APIError
- type APITime
- type Connection
- type Coordinates
- type Departure
- type Deviation
- type Disruption
- type GetAllNextDeparturesResponse
- type GetDisruptionsResponse
- type GetLinesResponse
- type GetNextDeparturesResponse
- type GetPhysicalStopsResponse
- type GetStopResponse
- type GetThermometerResponse
- type LatLng
- type LineColor
- type NextDeparture
- type PhysicalStop
- type PhysicalStopInfos
- type Step
- type Stop
- type UnknownResponseError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIClient ¶
type APIClient struct {
// contains filtered or unexported fields
}
APIClient is an HTTP client for the TPG API.
func NewClientWithClient ¶
NewClientWithClient offer the possibility to provide a custom http client to use.
func (*APIClient) GetAllNextDepartures ¶
func (c *APIClient) GetAllNextDepartures(stopCode, lineCode, destinationCode string) (GetAllNextDeparturesResponse, error)
GetAllNextDepartures returns the next departures.
func (*APIClient) GetDisruptions ¶
func (c *APIClient) GetDisruptions() (GetDisruptionsResponse, error)
GetDisruptions returns the list of the disruptions on the network.
func (*APIClient) GetLinesColor ¶
func (c *APIClient) GetLinesColor() (GetLinesResponse, error)
GetLinesColor returns visual informations about the lines
func (*APIClient) GetNextDeparturesForLines ¶
func (c *APIClient) GetNextDeparturesForLines(linesCodes, destinationsCodes []string) (GetNextDeparturesResponse, error)
GetNextDeparturesForLines returns the list of departures corresponding to the provided lines and destinations codes.
func (*APIClient) GetNextDeparturesForStop ¶
func (c *APIClient) GetNextDeparturesForStop(stopCode, departureCode string) (GetNextDeparturesResponse, error)
GetNextDeparturesForStop returns the list of departures for the providedstop. If departure code is an empty value, all the next departure corresponding to the stop code will be returned.
func (*APIClient) GetPhysicalStopsByName ¶
func (c *APIClient) GetPhysicalStopsByName(name string) (GetPhysicalStopsResponse, error)
GetPhysicalStopsByName returns the list of physical stops whose stopCode is contained in the `codes` list. Results are send by ascending order regarding the stop code.
func (*APIClient) GetPhysicalStopsFromCodes ¶
func (c *APIClient) GetPhysicalStopsFromCodes(codes []string) (GetPhysicalStopsResponse, error)
GetPhysicalStopsFromCodes returns the list of physicalstops whose stopCode is contained in the `codes` list. Results are send by ascending order regarding the stop code.
func (*APIClient) GetStops ¶
func (c *APIClient) GetStops() (GetStopResponse, error)
GetStops returns the list of all the stops. Results are send by ascending order regarding the stop code.
func (*APIClient) GetStopsByLine ¶
func (c *APIClient) GetStopsByLine(name string) (GetStopResponse, error)
GetStopsByLine returns the list of stops on the provided line. Results are send by ascending order regarding the stop code.
func (*APIClient) GetStopsByName ¶
func (c *APIClient) GetStopsByName(name string) (GetStopResponse, error)
GetStopsByName returns the list of stops whose name include the substring `name`. Results are send by ascending order regarding the stop code.
func (*APIClient) GetStopsClosedToLatLng ¶
func (c *APIClient) GetStopsClosedToLatLng(pos LatLng) (GetStopResponse, error)
GetStopsClosedToLatLng returns all the stops located inside a 500 meter range from the provided position. Results are send by descending distance from the provided position.
func (*APIClient) GetStopsFromCodes ¶
func (c *APIClient) GetStopsFromCodes(codes []string) (GetStopResponse, error)
GetStopsFromCodes returns the list of stops whose stopCode is contained in the `codes` list. Results are send by ascending order regarding the stop code.
func (*APIClient) GetThermometer ¶
func (c *APIClient) GetThermometer(departureCode string) (GetThermometerResponse, error)
GetThermometer returns the list of stops with the disruptions and deviations.
func (*APIClient) GetThermometerPhysicalStops ¶
func (c *APIClient) GetThermometerPhysicalStops(departureCode string) (GetThermometerResponse, error)
GetThermometerPhysicalStops returns the list of stops with the disruptions and deviations.
type APIError ¶
type APIError struct { Timestamp APITime `json:"timestamp"` ErrorCode int `json:"errorCode"` ErrorMessage string `json:"errorMessage"` }
APIError returns the information about the failing request
type Connection ¶
type Coordinates ¶
type Disruption ¶
type GetDisruptionsResponse ¶
type GetDisruptionsResponse struct { Disruptions []Disruption `json:"disruptions"` Timestamp APITime `json:"timestamp"` }
type GetLinesResponse ¶
type GetLinesResponse struct { Timestamp APITime `json:"timestamp"` Colors []LineColor `json:"colors"` }
GetLinesResponse is the response to a get lines response.
type GetNextDeparturesResponse ¶
type GetNextDeparturesResponse struct { Departures []NextDeparture `json:"departures"` Stop Stop `json:"stop"` Timestamp APITime `json:"timestamp"` }
type GetPhysicalStopsResponse ¶
type GetPhysicalStopsResponse struct { Stops []PhysicalStopInfos `json:"stops"` Timestamp APITime `json:"timestamp"` }
type GetStopResponse ¶
GetStopResponse contains the response of the API for any GetStops methods.
type GetThermometerResponse ¶
type GetThermometerResponse struct { DestinationCode string `json:"destinationCode"` DestinationName string `json:"destinationName"` LineCode string `json:"lineCode"` Steps []Step `json:"steps"` Stop Stop `json:"stop"` Timestamp APITime `json:"timestamp"` Disruption Disruption `json:"disruptions"` Deviations []Deviation `json:"deviations"` }
type LineColor ¶
type LineColor struct { LineCode string `json:"lineCode"` Hexa string `json:"hexa"` Background string `json:"background"` Text string `json:"text"` }
LineColor contains the visual information about a line.
type NextDeparture ¶
type NextDeparture struct { Departure Characteristics string `json:"characteristics"` Disruptions []Disruption `json:"disruptions"` VehiculeNo int64 `json:"vehiculeNo"` VehiculeType string `json:"vehiculeType"` Deviation Deviation `json:"deviation,omitempty"` ConnectionWaitingTime int `json:"connectionWaitingTime,omitempty"` }
type PhysicalStop ¶
type PhysicalStop struct { Connections []Connection `json:"connections"` Coordinates Coordinates `json:"coordinates"` PhysicalStopCode string `json:"physicalStopCode"` StopName string `json:"stopName"` }
type PhysicalStopInfos ¶
type PhysicalStopInfos struct { PhysicalStops []PhysicalStop `json:"physicalStops"` StopCode string `json:"stopCode"` StopName string `json:"stopName"` }
type Stop ¶
type Stop struct { Connections []Connection `json:"connections"` Code string `json:"stopCode"` Name string `json:"stopName"` Distance int `json:"distance"` }
type UnknownResponseError ¶
type UnknownResponseError struct {
// contains filtered or unexported fields
}
UnknownResponseError represents an unknown server error
func (UnknownResponseError) Error ¶
func (e UnknownResponseError) Error() string