Documentation ¶
Index ¶
- func BodyToHTML(body *Body) (string, error)
- type Body
- type EmailFlightsNotifier
- type FlightFetcher
- type FlightSearch
- type FlightSearchByMinDepartureTime
- type FlightSearchStates
- type FlightState
- type FlightStateByDepartureLocalTime
- type FlightStateChange
- type FlightStates
- type SearchGroup
- type SearchStateUpdater
- type SearchUpdateNotifier
- type SearchUpdateNotifierChain
- type StdoutNotifier
- type Trip
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BodyToHTML ¶
Types ¶
type Body ¶
type Body struct {
SearchGroups []*SearchGroup
}
Structs that map to templates
func NewBody ¶
func NewBody(searches FlightSearchStates) *Body
type EmailFlightsNotifier ¶
func (*EmailFlightsNotifier) Notify ¶
func (e *EmailFlightsNotifier) Notify(searchStates FlightSearchStates) error
type FlightFetcher ¶
type FlightFetcher struct {
// contains filtered or unexported fields
}
func NewFlightFetcher ¶
func NewFlightFetcher(swClient *client.Client) *FlightFetcher
func (*FlightFetcher) Fetch ¶
func (f *FlightFetcher) Fetch(search *FlightSearch) ([]*model.Flight, error)
Fetch all flights that match a given search
type FlightSearch ¶
type FlightSearch struct { OriginAirports []string `json:"origin_airports"` DestinationAirports []string `json:"destination_airports"` MinDepartureTime time.Time `json:"min_departure_time"` MaxArrivalTime time.Time `json:"max_arrival_time"` MaxFareCents *uint32 `json:"max_fare_cents"` MaxNumberStops *uint8 `json:"max_number_stops"` Note *string `json:"note"` }
Config JSON representation of flight search
func FlightSearchesFromFile ¶
func FlightSearchesFromFile(filename string) ([]*FlightSearch, error)
func FlightSearchesFromJson ¶
func FlightSearchesFromJson(data []byte) ([]*FlightSearch, error)
func (*FlightSearch) String ¶
func (f *FlightSearch) String() string
type FlightSearchByMinDepartureTime ¶
type FlightSearchByMinDepartureTime []*FlightSearch
Helper to sort FlightSearch by MinDepartureTime
func (FlightSearchByMinDepartureTime) Len ¶
func (b FlightSearchByMinDepartureTime) Len() int
func (FlightSearchByMinDepartureTime) Less ¶
func (b FlightSearchByMinDepartureTime) Less(i, j int) bool
func (FlightSearchByMinDepartureTime) Swap ¶
func (b FlightSearchByMinDepartureTime) Swap(i, j int)
type FlightSearchStates ¶
type FlightSearchStates map[*FlightSearch]FlightStates
func NewFlightSearchStates ¶
func NewFlightSearchStates() FlightSearchStates
func (FlightSearchStates) OnlyAvailable ¶
func (f FlightSearchStates) OnlyAvailable() (available FlightSearchStates, improved bool)
func (FlightSearchStates) Update ¶
func (f FlightSearchStates) Update(search *FlightSearch, flights []*model.Flight)
type FlightState ¶
type FlightState struct { Flight *model.Flight Update FlightStateChange }
type FlightStateByDepartureLocalTime ¶
type FlightStateByDepartureLocalTime []FlightState
Helper to sort FlightState by flight DepartureLocalTime
func (FlightStateByDepartureLocalTime) Len ¶
func (b FlightStateByDepartureLocalTime) Len() int
func (FlightStateByDepartureLocalTime) Less ¶
func (b FlightStateByDepartureLocalTime) Less(i, j int) bool
func (FlightStateByDepartureLocalTime) Swap ¶
func (b FlightStateByDepartureLocalTime) Swap(i, j int)
type FlightStateChange ¶
type FlightStateChange int
const ( Unchanged FlightStateChange = iota FareIncrease FareDecrease Added Removed )
type FlightStates ¶
type FlightStates map[model.FlightId]FlightState
func (FlightStates) OnlyAvailable ¶
func (s FlightStates) OnlyAvailable() (available FlightStates, improved bool)
func (FlightStates) Update ¶
func (s FlightStates) Update(flights []*model.Flight)
type SearchGroup ¶
type SearchStateUpdater ¶
type SearchStateUpdater struct {
// contains filtered or unexported fields
}
Container to keep and update flight state.
func NewSearchStateUpdater ¶
func NewSearchStateUpdater(searches []*FlightSearch, fetcher *FlightFetcher, notifier SearchUpdateNotifier) *SearchStateUpdater
func (*SearchStateUpdater) Update ¶
func (c *SearchStateUpdater) Update() error
Fetch latest flight info, update state, and send updates to the notifier.
type SearchUpdateNotifier ¶
type SearchUpdateNotifier interface {
Notify(searchStates FlightSearchStates) error
}
type SearchUpdateNotifierChain ¶
type SearchUpdateNotifierChain []SearchUpdateNotifier
func (SearchUpdateNotifierChain) Notify ¶
func (s SearchUpdateNotifierChain) Notify(searchStates FlightSearchStates) error
type StdoutNotifier ¶
type StdoutNotifier struct{}
func (*StdoutNotifier) Notify ¶
func (s *StdoutNotifier) Notify(searchStates FlightSearchStates) error
Click to show internal directories.
Click to hide internal directories.