Documentation ¶
Index ¶
- type ConvertibleBoolean
- type RDEXCost
- type RDEXDays
- type RDEXError
- type RDEXGeography
- type RDEXJourney
- type RDEXOperator
- type RDEXParamFrom
- type RDEXParamTo
- type RDEXParameters
- type RDEXPerson
- type RDEXRequest
- type RDEXSchedule
- type RDEXServer
- type RDEXServerHandler
- type RDEXTimeLimits
- type RDEXVehicle
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConvertibleBoolean ¶
type ConvertibleBoolean bool
func (*ConvertibleBoolean) MarshalJSON ¶
func (bit *ConvertibleBoolean) MarshalJSON(data []byte) ([]byte, error)
func (*ConvertibleBoolean) UnmarshalJSON ¶
func (bit *ConvertibleBoolean) UnmarshalJSON(data []byte) error
type RDEXCost ¶
type RDEXCost struct { Fixed float64 `json:"fixed,omitempty"` Variable float64 `json:"variable,omitempty"` }
RDEXCost is the cost of the journey, either fixed or variable
type RDEXDays ¶
type RDEXDays struct { Monday ConvertibleBoolean `json:"monday"` Tuesday ConvertibleBoolean `json:"tuesday"` Wednesday ConvertibleBoolean `json:"wednesday"` Thursday ConvertibleBoolean `json:"thursday"` Friday ConvertibleBoolean `json:"friday"` Saturday ConvertibleBoolean `json:"saturday"` Sunday ConvertibleBoolean `json:"sunday"` }
RDEXDays defines which days of the week the journey happens
type RDEXGeography ¶
type RDEXGeography struct { Address string `json:"address"` City string `json:"city"` Postalcode string `json:"postalcode,omitempty"` Country string `json:"country,omitempty"` Latitude float64 `json:"latitude"` Longitude float64 `json:"longitude"` StepDistance int64 `json:"step_distance,omitempty"` StepDuration time.Duration `json:"step_duration,omitempty"` Type string `json:"type,omitempty"` // pick-up or drop-point Mandatory *ConvertibleBoolean `json:"mandatory,omitempty"` }
RDEXGeography is a geographical point used in From, To or Waypoints
type RDEXJourney ¶
type RDEXJourney struct { UUID string `json:"uuid"` Operator string `json:"operator"` Origin string `json:"origin"` URL *string `json:"url,omitempty"` Driver *RDEXPerson `json:"driver,omitempty"` Passenger *RDEXPerson `json:"passenger,omitempty"` From RDEXGeography `json:"from"` To RDEXGeography `json:"to"` Distance int64 `json:"distance"` Duration time.Duration `json:"duration"` Route *string `json:"route,omitempty"` NumberOfWaypoints *int `json:"number_of_waypoints,omitempty"` Waypoints *[]RDEXGeography `json:"waypoints,omitempty"` Cost RDEXCost `json:"cost"` Details *string `json:"details,omitempty"` Vehicle *RDEXVehicle `json:"vehicle,omitempty"` Frequency string `json:"frequency"` // punctual or regular Type string `json:"type"` // one-way or round-trip Realtime *ConvertibleBoolean `json:"real_time,omitempty"` Stopped *ConvertibleBoolean `json:"stopped,omitempty"` Days RDEXDays `json:"days"` Outward RDEXSchedule `json:"outward"` Return *RDEXSchedule `json:"return,omitempty"` }
RDEXJourney is the carpooling journey base type of the RDEX protocol
type RDEXOperator ¶
func (*RDEXOperator) Signature ¶
func (o *RDEXOperator) Signature(url string) string
type RDEXParamFrom ¶
type RDEXParamFrom struct { Latitude float64 `json:"p[from][latitude]"` Longitude float64 `json:"p[from][longitude]"` }
RDEXParamFrom is a latitude/longitude parameter from the RDEX query origin
type RDEXParamTo ¶
type RDEXParamTo struct { Latitude float64 `json:"p[to][latitude]"` Longitude float64 `json:"p[to][longitude]"` }
RDEXParamTo is a latitude/longitude parameter from the RDEX query destination
type RDEXParameters ¶
type RDEXParameters struct { Driver bool `schema:"p[driver]"` Passenger bool `schema:"p[passenger]"` From RDEXParamFrom To RDEXParamTo Frequency string `schema:"p[frequency]"` // regular or punctal Outward RDEXSchedule }
RDEXParameters defines the RDEX parameters used to search a journey
type RDEXPerson ¶
type RDEXPerson struct { UUID *string `json:"uuid,omitempty"` Alias *string `json:"alias,omitempty"` Image *string `json:"image,omitempty"` Seats *int `json:"seats,omitempty"` State ConvertibleBoolean `json:"state,omitempty"` }
RDEXPerson defines a driver or a passenger
type RDEXRequest ¶
type RDEXRequest struct { Timestamp int64 `schema:"timestamp"` Apikey string `schema:"apikey"` P RDEXParameters // TODO handle both journeys and connections Signature string `schema:"signature"` }
RDEXRequest describes a base request as sent and received using RDEX protocol
func ParseRDEXRequest ¶
func ParseRDEXRequest(r *http.Request) (req RDEXRequest)
type RDEXSchedule ¶
type RDEXSchedule struct { MinDate string `json:"mindate" schema:"mindate"` MaxDate string `json:"maxdate" schema:"maxdate"` Monday *RDEXTimeLimits `json:"monday,omitempty"` Tuesday *RDEXTimeLimits `json:"tuesday,omitempty"` Wednesday *RDEXTimeLimits `json:"wednesday,omitempty"` Thursday *RDEXTimeLimits `json:"thursday,omitempty"` Friday *RDEXTimeLimits `json:"friday,omitempty"` Saturday *RDEXTimeLimits `json:"saturday,omitempty"` Sunday *RDEXTimeLimits `json:"sunday,omitempty"` }
RDEXSchedule is used to define outward and return datetimes
type RDEXServer ¶
type RDEXServer struct { BaseUrl string AuthorizedOperators []RDEXOperator Handler RDEXServerHandler }
RDEXServer is a handler to create a RDEX API server
func NewServer ¶
func NewServer(baseUrl string, handler RDEXServerHandler) (*RDEXServer, error)
NewServer creates a RDEX server handler
func (*RDEXServer) AddAuthorizedOperator ¶
func (s *RDEXServer) AddAuthorizedOperator(o RDEXOperator)
AddAuthorizedOperator adds credentials (public key / private key) for an operator accessing the API
func (*RDEXServer) AuthenticateOperator ¶
func (s *RDEXServer) AuthenticateOperator(r *http.Request) (*RDEXOperator, error)
func (RDEXServer) ServeHTTP ¶
func (s RDEXServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
type RDEXServerHandler ¶
type RDEXServerHandler interface {
Journeys(RDEXParameters) ([]RDEXJourney, error)
}
type RDEXTimeLimits ¶
RDEXTimeLimits defines the minimum time and maximum time for the journey in a day
type RDEXVehicle ¶
type RDEXVehicle struct { VehicleImage string `json:"vehicle_image,omitempty"` Model string `json:"model,omitempty"` Color string `json:"color,omitempty"` }
RDEXVehicle is the vehicle description