https://github.com/kiambogo/scrava
A Scala client for the Strava API
https://github.com/kiambogo/scrava
lift-json scala scala-client scalaj-http strava strava-api
Last synced: 8 months ago
JSON representation
A Scala client for the Strava API
- Host: GitHub
- URL: https://github.com/kiambogo/scrava
- Owner: kiambogo
- License: mit
- Created: 2014-09-15T16:29:27.000Z (almost 12 years ago)
- Default Branch: main
- Last Pushed: 2021-03-03T07:34:08.000Z (over 5 years ago)
- Last Synced: 2025-02-02T04:24:40.590Z (over 1 year ago)
- Topics: lift-json, scala, scala-client, scalaj-http, strava, strava-api
- Language: Scala
- Size: 135 KB
- Stars: 20
- Watchers: 3
- Forks: 6
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

A lightweight Scala client for the Strava API built upon ScalaJ-HTTP library and Lift JSON.
[](https://travis-ci.org/kiambogo/scrava)
[](https://badge.fury.io/gh/kiambogo%2Fscrava)
### Installation
Scrava is currently built for Scala 2.11 and 2.12. To use scrava in an sbt project, add the following to your project file:
libraryDependencies += "com.github.kiambogo" %% "scrava" % "1.3.0"
### Sample Code
val client = new ScravaClient("[accessToken]")
val athlete = client.retrieveAthlete()
**Note:** Most functions have optional ID parameters (i.e, `retrieveAthlete()`). If no ID is provided, the function will operate based on the currently authenticated user. Therefore, `retrieveAthlete()` will return the athlete profile of the currently authenticated user (based on the access token provided), and `listAthleteFriends()` will return the list of friends of the currently authenticated athlete.
To retrieve perform these functions for a particular athlete/activity/etc, simply pass in the respective ID: `retrieveAthlete(Some([athleteID]))` or `listAthleteFriends(Some([athleteID]))`.
### Auto-Pagination
The Strava API offers the ability to page through result sets when the corresponding result set to a request is very large. Scrava offers the ability to perform auto-pagination, fetching the entire result set and merging into a single List. To utilize this, simply pass in `retrieveAll = true` into the respective function. Note that this will use additional requests to the API, and may exhaust rate limits in some cases.
-----------------------------
**Note:** The functions requiring Write permissions (`updateAthlete()`, `createActivity()`, `updateActivity()`, etc) are untested at this time.
If any errors or problems are found, feel free to open a pull request or issue.