Skip to content

Repository files navigation

strava-api

Go Strava API client generated from API spec

Examples:

Usage examples

The examples are live integration tests and require a Strava access token:

STRAVA_ACCESS_TOKEN=... go test -tags=integration ./examples

Usage

package main
import (
"context""fmt""log""os""time"
strava "github.com/obalunenko/strava-api/client"
)
funcmain() {
key:="STRAVA_ACCESS_TOKEN"token:=os.Getenv(key)
iftoken=="" {
log.Fatalf("%q not set", key)
}
apiClient, err:=strava.NewAPIClient(token)
iferr!=nil {
log.Fatal(err)
}
ctx, cancel:=context.WithTimeout(context.Background(), 10*time.Second)
defercancel()
athlete, err:=apiClient.Athletes.GetLoggedInAthlete(ctx)
iferr!=nil {
log.Fatal(err)
}
fmt.Println(athlete)
}

Releases

Packages

Used by

Contributors

Languages