Exemple #1
0
func main() {
	workoutsRequest := endpoint.JawboneRequest{
		"@me",
		endpoint.JawboneWorkoutsEndpoint,
		url.Values{
			"date": {"20140704"},
		},
	}

	userToken, err := auth.LoadUserToken("./user_tokens.json")
	if err != nil {
		log.Fatal(err)
	}

	workouts := endpoint.JawboneResponseWorkout{}
	err = workoutsRequest.MakeRequest(userToken, &workouts)
	if err != nil {
		log.Fatal(err)
	}
	log.Println(workouts)
}
Exemple #2
0
func main() {
	userToken, err := auth.LoadUserToken(userTokensFile)
	if err != nil {
		log.Fatal(err)
	}

	log.Println("Starting Dashboard Service")

	http.HandleFunc("/dashboard/workouts/streak", makeWorkoutStreakHandler(userToken))
	http.HandleFunc("/dashboard/workouts/biked/thisweek", makeWeekBikeDurationsHandler(userToken))
	http.HandleFunc("/dashboard/sleeps/durations", makeSleepDurationsHandler(userToken))
	http.HandleFunc("/dashboard/moves/today", makeMovesDurationsHandler(userToken))
	http.HandleFunc("/dashboard/meals/coffees_today", makeCoffeesTodayHandler(userToken))

	server := http.Server{
		Addr:           ":8080",
		Handler:        nil,
		ReadTimeout:    10 * time.Second,
		WriteTimeout:   10 * time.Second,
		MaxHeaderBytes: 1 << 20,
	}
	log.Fatal(server.ListenAndServe())
}