{"id":37109558,"url":"https://github.com/marvell/strava-go","last_synced_at":"2026-01-14T13:01:32.099Z","repository":{"id":254901210,"uuid":"846630995","full_name":"marvell/strava-go","owner":"marvell","description":"A Go client library for the Strava API with flexible token storage, rate limiting, and OAuth2 support.","archived":false,"fork":false,"pushed_at":"2025-05-24T08:39:46.000Z","size":77,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-24T09:32:00.695Z","etag":null,"topics":["go","golang","strava","strava-api","strava-oauth"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marvell.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-08-23T16:05:02.000Z","updated_at":"2025-02-15T12:12:51.000Z","dependencies_parsed_at":"2024-11-03T18:22:44.200Z","dependency_job_id":"96ec6245-5dc6-405a-baa9-d5cc34d1ab47","html_url":"https://github.com/marvell/strava-go","commit_stats":null,"previous_names":["marvell/strava-go"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/marvell/strava-go","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marvell%2Fstrava-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marvell%2Fstrava-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marvell%2Fstrava-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marvell%2Fstrava-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marvell","download_url":"https://codeload.github.com/marvell/strava-go/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marvell%2Fstrava-go/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28420816,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T10:47:48.104Z","status":"ssl_error","status_checked_at":"2026-01-14T10:46:19.031Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","golang","strava","strava-api","strava-oauth"],"created_at":"2026-01-14T13:01:31.438Z","updated_at":"2026-01-14T13:01:32.088Z","avatar_url":"https://github.com/marvell.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# strava-go\n\n[![Strava API Docs](https://img.shields.io/badge/Strava%20API-Reference-orange)](https://developers.strava.com/docs/reference/)\n\nstrava-go is a Go library for interacting with the Strava API. It provides a simple and efficient way to authenticate and make requests to Strava's API endpoints. The library is designed to work with the official Strava API, which is documented in the [Strava API and SDK Reference](https://developers.strava.com/docs/reference/). For interactive exploration and testing of API endpoints, you can use the [Strava API Playground](https://developers.strava.com/playground/), which provides a user-friendly interface to try out various API calls and see their responses.\n\n## Features\n\n- OAuth2 authentication\n- Multiple token storage options\n- Rate limiting support\n- Configurable retries\n- Debugging options\n\n## Installation\n\nTo install strava-go, use `go get`:\n\n```\ngo get github.com/marvell/strava-go\n```\n\n## Usage\n\nHere's a basic example of how to use the strava-go library:\n\n```go\nimport (\n    \"context\"\n    \"fmt\"\n    \"log/slog\"\n\n    \"github.com/marvell/strava-go\"\n    \"github.com/marvell/strava-go/file\"\n)\n\nfunc main() {\n    ctx := context.Background()\n\n    // Create a token storage\n    ts, err := file.NewTokenStorage(\"./tokens\")\n    if err != nil {\n        panic(err)\n    }\n\n    // Create a new Strava client\n    cl := strava.NewClient(\n        \"your-client-id\",\n        \"your-client-secret\",\n        \"your-redirect-url\",\n        ts,\n        strava.WithDebug(), // Optional: Enable debug mode\n    )\n\n    // Authenticate (if needed)\n    athleteID := auth(ctx, cl)\n\n    // Get athlete information\n    ath, err := cl.GetAthlete(ctx, athleteID)\n    if err != nil {\n        panic(err)\n    }\n\n    slog.Info(fmt.Sprintf(\"athlete: %+v\", ath))\n}\n\nfunc auth(ctx context.Context, cl *strava.Client) uint {\n    // ... (authentication process)\n}\n```\n\n## Configuration\n\nThe `NewClient` function accepts several options to customize the client's behavior:\n\n- `WithLogger`: Set a custom logger\n- `WithRateLimiter`: Set a rate limiter\n- `WithRetries`: Configure retry behavior\n- `WithDebug`: Enable debug mode\n\n## Token Storage\n\nThe library provides several token storage implementations to suit different needs:\n\n### File-based Storage\n\nStore tokens in local files:\n\n```go\nimport \"github.com/marvell/strava-go/file\"\n\nts, err := file.NewTokenStorage(\"./tokens\")\n```\n\n### PostgreSQL Storage\n\nStore tokens in a PostgreSQL database:\n\n```go\nimport (\n    \"github.com/marvell/strava-go/postgres\"\n    \"gorm.io/gorm\"\n)\n\ndb, err := gorm.Open(/* your database connection */)\nts, err := postgres.NewTokenStorage(db)\n```\n\n### In-Memory Storage\n\nStore tokens in memory (useful for testing or short-lived applications):\n\n```go\nimport \"github.com/marvell/strava-go/inmemory\"\n\nts := \u0026inmemory.TokenStorage{}\n```\n\n### Custom Storage\n\nYou can implement your own token storage by satisfying the `TokenStorage` interface:\n\n```go\ntype TokenStorage interface {\n    Get(ctx context.Context, athleteID uint) (*oauth2.Token, error)\n    Save(ctx context.Context, athleteID uint, token *oauth2.Token) error\n}\n```\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarvell%2Fstrava-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarvell%2Fstrava-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarvell%2Fstrava-go/lists"}