Documentation
¶
Index ¶
- Variables
- func DeserializeBikeFromResponse(resp *http.Response) (*models.Bike, error)
- func DeserializeBikesFromResponse(resp *http.Response) ([]models.Bike, error)
- func DeserializeTripFromResponse(resp *http.Response) (*models.Trip, error)
- func EndTrip(ctx context.Context, tripID string, lat, lng float64) (*models.Trip, error)
- func EndTripFromGateway(ctx context.Context, conf configuration.GatewayConfiguration, tripID string, ...) (*models.Trip, error)
- func GatewayEndTrip(ctx context.Context, conf configuration.GatewayConfiguration, tripID string, ...) (*models.Trip, error)
- func GatewayGetBikeByID(ctx context.Context, conf configuration.GatewayConfiguration, bikeID string) (*models.Bike, error)
- func GatewayListOfBikes(ctx context.Context, conf configuration.GatewayConfiguration, cursor string, ...) ([]models.Bike, error)
- func GatewayStartTrip(ctx context.Context, conf configuration.GatewayConfiguration, bikeID string, ...) (*models.Trip, error)
- func GetBikeByID(ctx context.Context, bikeID string) (*models.Bike, error)
- func ListOfBikes(ctx context.Context, cursor string, limit int64) ([]models.Bike, error)
- func ListenerToBikeEvent(ctx context.Context, conf configuration.BikeConfiguration, ...) (messaging.Consumer, error)
- func ListenerToTripEvent(ctx context.Context, conf configuration.TripConfiguration, ...) (messaging.Consumer, error)
- func LockBikeByID(ctx context.Context, bikeID string) (*models.Bike, error)
- func LockBikeFromGateway(ctx context.Context, conf configuration.GatewayConfiguration, bikeID string) (*models.Bike, error)
- func PopulateDatabase(ctx context.Context, db storage.BikeStore) error
- func StartTrip(ctx context.Context, bikeID string, lat, lng float64) (*models.Trip, error)
- func StartTripFromGateway(ctx context.Context, conf configuration.GatewayConfiguration, bikeID string, ...) (*models.Trip, error)
- func TrackTrip(ctx context.Context, messenger messaging.Emitter, hearbeat TrackTripPayload) error
- func UnLockBikeByID(ctx context.Context, bikeID string) (*models.Bike, error)
- func UnLockBikeFromGateway(ctx context.Context, conf configuration.GatewayConfiguration, bikeID string) error
- type EndTripPayload
- type Location
- type StartTripPayload
- type TrackTripPayload
Constants ¶
This section is empty.
Variables ¶
var ( ErrBikeInUse = errors.New("bike already in use") ErrEmptyBody = errors.New("empty body") ErrUnexpected = errors.New("unexpected error") )
Domain based errors.
Functions ¶
func DeserializeBikeFromResponse ¶
DeserializeBikeFromResponse tries to extract a bike for an http Response.
func DeserializeBikesFromResponse ¶
DeserializeBikesFromResponse tries to extract an array of bikes for an http Response.
func DeserializeTripFromResponse ¶
DeserializeTripFromResponse tries to extract a trip for an http Response.
func EndTripFromGateway ¶
func EndTripFromGateway(ctx context.Context, conf configuration.GatewayConfiguration, tripID string, lat, lng float64) (*models.Trip, error)
EndTripFromGateway calls the trip service to end a trip.
func GatewayEndTrip ¶
func GatewayEndTrip(ctx context.Context, conf configuration.GatewayConfiguration, tripID string, lat, lng float64) (*models.Trip, error)
GatewayEndTrip unsuprisingly starts a trip when possible.
func GatewayGetBikeByID ¶
func GatewayGetBikeByID(ctx context.Context, conf configuration.GatewayConfiguration, bikeID string) (*models.Bike, error)
GatewayGetBikeByID returns a bike given an valid ID.
func GatewayListOfBikes ¶
func GatewayListOfBikes(ctx context.Context, conf configuration.GatewayConfiguration, cursor string, limit int64) ([]models.Bike, error)
GatewayListOfBikes lists bikes with pagination.
func GatewayStartTrip ¶
func GatewayStartTrip(ctx context.Context, conf configuration.GatewayConfiguration, bikeID string, lat, lng float64) (*models.Trip, error)
GatewayStartTrip unsuprisingly starts a trip when possible.
func GetBikeByID ¶
GetBikeByID returns a bike given an valid ID.
func ListOfBikes ¶
ListOfBikes lists bikes with pagination.
func ListenerToBikeEvent ¶
func ListenerToBikeEvent(ctx context.Context, conf configuration.BikeConfiguration, logger logging.Logger, database storage.BikeStore) (messaging.Consumer, error)
ListenerToBikeEvent for bike events.
func ListenerToTripEvent ¶
func ListenerToTripEvent(ctx context.Context, conf configuration.TripConfiguration, logger logging.Logger, database storage.TripStore) (messaging.Consumer, error)
ListenerToTripEvent for trip events.
func LockBikeByID ¶
LockBikeByID locks a bike given an valid ID.
func LockBikeFromGateway ¶
func LockBikeFromGateway(ctx context.Context, conf configuration.GatewayConfiguration, bikeID string) (*models.Bike, error)
LockBikeFromGateway locks a bike.
func PopulateDatabase ¶
PopulateDatabase put stuff in Database if empty
func StartTripFromGateway ¶
func StartTripFromGateway(ctx context.Context, conf configuration.GatewayConfiguration, bikeID string, lat, lng float64) (*models.Trip, error)
StartTripFromGateway calls the trip service to start a trip.
func UnLockBikeByID ¶
UnLockBikeByID unlocks a bike given an valid ID.
func UnLockBikeFromGateway ¶
func UnLockBikeFromGateway(ctx context.Context, conf configuration.GatewayConfiguration, bikeID string) error
UnLockBikeFromGateway unlocks a bike.
Types ¶
type EndTripPayload ¶
EndTripPayload specifies the expected http body for ending a trip.
type StartTripPayload ¶
StartTripPayload specifies the expected http body for starting a trip.
type TrackTripPayload ¶
TrackTripPayload for messaging.