strava-v3
Advanced tools
Comparing version 2.0.5 to 2.0.6
type Callback = (error: any, payload: any) => void; | ||
interface BaseArgs { | ||
access_token?: string; | ||
} | ||
export interface PushSubscriptionRoutes { | ||
list(args: any, done?: Callback): Promise<any>; | ||
list(done?: Callback): Promise<any>; | ||
create(args: any, done?: Callback): Promise<any>; | ||
@@ -46,12 +50,37 @@ delete(args: any, done?: Callback): Promise<any>; | ||
export interface ClubsRoutes { | ||
get(args: any, done?: Callback): Promise<any>; | ||
listMembers(args: any, done?: Callback): Promise<any>; | ||
listActivities(args: any, done?: Callback): Promise<any>; | ||
listAnnouncements(args: any, done?: Callback): Promise<any>; | ||
listEvents(args: any, done?: Callback): Promise<any>; | ||
listAdmins(args: any, done?: Callback): Promise<any>; | ||
joinClub(args: any, done?: Callback): Promise<any>; | ||
leaveClub(args: any, done?: Callback): Promise<any>; | ||
get(args: ClubsRoutesArgs, done?: Callback): Promise<any>; | ||
listMembers(args: ClubsRoutesListArgs, done?: Callback): Promise<any>; | ||
listActivities(args: ClubsRoutesListArgs, done?: Callback): Promise<ClubActivity[]>; | ||
listAnnouncements(args: ClubsRoutesListArgs, done?: Callback): Promise<any>; | ||
listEvents(args: ClubsRoutesListArgs, done?: Callback): Promise<any>; | ||
listAdmins(args: ClubsRoutesListArgs, done?: Callback): Promise<any>; | ||
joinClub(args: ClubsRoutesListArgs, done?: Callback): Promise<any>; | ||
leaveClub(args: ClubsRoutesListArgs, done?: Callback): Promise<any>; | ||
} | ||
export interface ClubsRoutesArgs extends BaseArgs { | ||
id: string; | ||
} | ||
export interface ClubsRoutesListArgs extends ClubsRoutesArgs { | ||
page?: number; | ||
per_page?: number; | ||
} | ||
export interface ClubActivity { | ||
resource_state: number; | ||
athlete: { | ||
resource_state: number; | ||
firstname: string; | ||
lastname: string; | ||
}; | ||
name: string; | ||
distance: number; | ||
moving_time: number; | ||
elapsed_time: number; | ||
total_elevation_gain: number; | ||
type: string; | ||
workout_type?: number | null; | ||
} | ||
export interface AthletesRoutes { | ||
@@ -87,6 +116,14 @@ get(args: any, done?: Callback): Promise<any>; | ||
getToken(code: string, done?: Callback): Promise<any>; | ||
refreshToken(code: string): Promise<any>; | ||
refreshToken(code: string): Promise<RefreshTokenResponse>; | ||
deauthorize(args: any, done?: Callback): Promise<any>; | ||
} | ||
export interface RefreshTokenResponse { | ||
token_type: string; | ||
access_token: string; | ||
expires_at: number; | ||
expires_in: number; | ||
refresh_token: string; | ||
} | ||
export interface RateLimiting { | ||
@@ -125,2 +162,2 @@ exceeded(): boolean; | ||
export default strava; | ||
export default strava; |
@@ -21,3 +21,4 @@ var activities = function (client) { | ||
'distance', | ||
'private' | ||
'private', | ||
'commute' | ||
] | ||
@@ -24,0 +25,0 @@ var _updateAllowedProps = [ |
@@ -196,3 +196,3 @@ /* eslint camelcase: 0 */ | ||
} | ||
return Promise.reject(e) | ||
@@ -199,0 +199,0 @@ }) |
{ | ||
"name": "strava-v3", | ||
"version": "2.0.5", | ||
"version": "2.0.6", | ||
"description": "Simple wrapper for strava v3 API", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -31,3 +31,2 @@ | ||
* `uploads` | ||
* `push_notifications` (webHooks) | ||
@@ -291,36 +290,10 @@ ## Installation | ||
These methods authenticate with a Client ID and Client Secret. Since they don't | ||
These methods Authenticate with a Client ID and Client Secret. Since they don't | ||
use OAuth, they are not available on the `client` object. | ||
* `strava.pushSubscriptions.list({},done)` | ||
While there can be only one push subscription per API token, the result | ||
is returned as an array. | ||
```json | ||
[{ | ||
"id": 1, | ||
"resource_state": 2, | ||
"application_id": 12345, | ||
"callback_url": "http://you.com/callback/", | ||
"created_at": "2015-04-29T18:11:09.400558047-07:00", | ||
"updated_at": "2015-04-29T18:11:09.400558047-07:00" | ||
}] | ||
``` | ||
* `strava.pushSubscriptions.create({callback_url:...},done)` | ||
We set 'object\_type to "activity" and "aspect\_type" to "create" for you. | ||
Upon success, returns a simple data structure with the ID of the push subscription, like: | ||
```json | ||
{ "id": 1 } | ||
``` | ||
If creating the push subscription fails, an error will be thrown. | ||
* We set 'object\_type to "activity" and "aspect\_type" to "create" for you. | ||
* `strava.pushSubscriptions.delete({id:...},done)` | ||
`delete` returns an empty response if successful, throws if there's a failure. | ||
#### Running Races | ||
@@ -327,0 +300,0 @@ |
138499
2479
419