func Register(client routing_api.Client, tokenFetcher token_fetcher.TokenFetcher, routes []db.Route) error { token, err := tokenFetcher.FetchToken() if err != nil { return err } client.SetToken(token.AccessToken) return client.UpsertRoutes(routes) }
func List(client routing_api.Client, tokenFetcher token_fetcher.TokenFetcher) ([]db.Route, error) { token, err := tokenFetcher.FetchToken() if err != nil { return nil, err } client.SetToken(token.AccessToken) return client.Routes() }
func Events(client routing_api.Client, tokenFetcher token_fetcher.TokenFetcher) (routing_api.EventSource, error) { token, err := tokenFetcher.FetchToken() if err != nil { return nil, err } client.SetToken(token.AccessToken) return client.SubscribeToEvents() }