Skip to content

crsantos/stravaapiclient-swift

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

StravaAPIClient

MIT Licence CocoaPods Compatible Platform CircleCI Coveralls github Maintainability

Simple and lightweight NSURLSession wrapper around Strava API.

Motivation

When I first searched for any StravaAPI clients for iOS I found some old-fashioned obj-c like frameworks, but implemented in Swift, but not newer Swift. They were like Swift1 😔 They were old abandoned frameworks, so I decided to implement a newer Swift 4+ implementation.

API

Usage

Create and pass a valid config object to StravaAPIClient and use the available methods to fetch anything from Strava API.

let config = StravaConfig(
  clientId: Constants.clientId,
  clientSecret: Constants.clientSecret,
  redirectURL: Constants.redirectURL,
  accessToken: Constants.accessToken
)
let client = StravaAPIClient(with: config)

// get current auth'd athlete
self.client.requestCurrentAthlete { result in

    if case let .success(athlete) = result {

        // use athlete
    }
}

// or get activities

self.client.requestCurrentAthleteActivities { result in

    if case let .success(activities) = result {

        // use list of activities
    }
}

Endpoints

This is still a WIP, but I'm adding new requests. Feel free to contribute with some more.

GET /athlete

  • Returns the authenticated athlete, retrieving an Athlete object

GET /athlete/activities

  • Returns the authenticated athlete's activity summaries, retrieving an SummaryActivity list

GET /athletes/:id/stats

  • Returns the target athlete's stats, retrieving an AthleteStats object

TODO

Please check TODO.md doc

About

Swift Strava API Client

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published