Exemplo n.º 1
0
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)
}
Exemplo n.º 2
0
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()
}
Exemplo n.º 3
0
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()
}