Categorygithub.com/tommzn/go-strava
modulepackage
1.0.1
Repository: https://github.com/tommzn/go-strava.git
Documentation: pkg.go.dev

# README

Go Reference GitHub go.mod Go version GitHub release (latest by date) Go Report Card Actions Status Strava API Version

Strava API Client

A client to access APIs provided by Strava.

API Version

This client is implemented for Strave API v3.

Authtication

Strave uses OAuth2 for their APIs. This client uses TokenSource from oauth2 for authentication. Have a look at Getting Started with the Strava API to get details about how to authenticate your app to access the API. Base of OAuth2 authentication is oauth2.Config where you specifiy your client id, client secret and scopes.

Helper

There're to helper to create required token source. Both methods expect a oauth2.Config.

TokenSourceFromAuthorizationCode

This method uses Exchange method on oauth2 config to get access and refresh token for an authorization code. You should persist your refresh token somewhere, because an authorization code can be used only once.

TokenSourceFromRefreshToken

If you already have a refresh token you can use this method to create a token source for it.

What about all the other models and endpoints?

Scope of this client is limited to models and endpoints I'm using in my project atm. Feel free to create an enhancement issue to request an extension.

Links

# Functions

New returna an api client with BASE_URL as default.
NewPagination returns a pagination struct.
TokenSourceFromAuthorizationCode is a helper to get a token source for an athorization code.
TokenSourceFromRefreshToken is a helper to create a token source for an existing refresh token.

# Constants

BASE_URL for Strava API v3.
TOKEN_ENDPOINT is used to convert authorization code to token or retrieve a new access token.

# Structs

A set of rolled-up statistics and totals for an athlete.
A roll-up of metrics pertaining to a set of activities.
StravaClient handles request to Strava APIs.
DetailedAthlete contains defail information of an athlete.
Error occurred in an api call.
Encapsulates the errors that may be returned from the API.
Pagination for api calls to define how much records should be returns in an api response or which page of a list of records should be returned.
Description of a single activity.
TimeFilter to restrict api requests with before and after values.