strava-api

module
v1.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 17, 2026 License: MIT

README

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"
)

func main() {
	key := "STRAVA_ACCESS_TOKEN"
	
	token := os.Getenv(key)
	if token == "" {
		log.Fatalf("%q not set", key)
	}

	apiClient, err := strava.NewAPIClient(token)
	if err != nil {
		log.Fatal(err)
	}

	ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
	defer cancel()

	athlete, err := apiClient.Athletes.GetLoggedInAthlete(ctx)
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println(athlete)
}

Directories

Path Synopsis
Package client provides a wrapper around the generated Strava API client.
Package client provides a wrapper around the generated Strava API client.
Package models exposes Strava API model types used by the public client API.
Package models exposes Strava API model types used by the public client API.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL