-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
48 changed files
with
855 additions
and
36 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
export enum ActivityType { | ||
AlpineSki = 'AlpineSki', | ||
BackcountrySki = 'BackcountrySki', | ||
Canoeing = 'Canoeing', | ||
Crossfit = 'Crossfit', | ||
EBikeRide = 'EBikeRide', | ||
Elliptical = 'Elliptical', | ||
Golf = 'Golf', | ||
Handcycle = 'Handcycle', | ||
Hike = 'Hike', | ||
IceSkate = 'IceSkate', | ||
InlineSkate = 'InlineSkate', | ||
Kayaking = 'Kayaking', | ||
Kitesurf = 'Kitesurf', | ||
NordicSki = 'NordicSki', | ||
Ride = 'Ride', | ||
RockClimbing = 'RockClimbing', | ||
RollerSki = 'RollerSki', | ||
Rowing = 'Rowing', | ||
Run = 'Run', | ||
Sail = 'Sail', | ||
Skateboard = 'Skateboard', | ||
Snowboard = 'Snowboard', | ||
Snowshoe = 'Snowshoe', | ||
Soccer = 'Soccer', | ||
StairStepper = 'StairStepper', | ||
StandUpPaddling = 'StandUpPaddling', | ||
Surfing = 'Surfing', | ||
Swim = 'Swim', | ||
Velomobile = 'Velomobile', | ||
VirtualRide = 'VirtualRide', | ||
VirtualRun = 'VirtualRun', | ||
Walk = 'Walk', | ||
WeightTraining = 'WeightTraining', | ||
Wheelchair = 'Wheelchair', | ||
Windsurf = 'Windsurf', | ||
Workout = 'Workout', | ||
Yoga = 'Yoga', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export enum ActivityZoneType { | ||
Heartrate = 'heartrate', | ||
Power = 'power', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export enum FollowerStatus { | ||
Pending = 'pending', | ||
Accepted = 'accepted', | ||
Blocked = 'blocked', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export * from './activityType' | ||
export * from './activityZoneType' | ||
export * from './followerStatus' | ||
export * from './resourceState' | ||
export * from './sex' | ||
export * from './sportType' | ||
export * from './streamKeys' | ||
export * from './unitSystem' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export enum ResourceState { | ||
Meta = 1, | ||
Summary = 2, | ||
Detail = 3, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export enum Sex { | ||
Female = 'F', | ||
Male = 'M', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export enum SportType { | ||
Cycling = 'cycling', | ||
Running = 'running', | ||
Triathlon = 'triathlon', | ||
Other = 'other', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
export enum StreamKeys { | ||
Time = 'time', | ||
Distance = 'distance', | ||
LatLng = 'latlng', | ||
Altitude = 'altitude', | ||
VelocitySmooth = 'velocity_smooth', | ||
Heartrate = 'heartrate', | ||
Cadence = 'cadence', | ||
Watts = 'watts', | ||
Temp = 'temp', | ||
Moving = 'moving', | ||
GradeSmooth = 'grade_smooth', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export enum UnitSystem { | ||
Feet = 'feet', | ||
Meters = 'meters', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
export class StravaError { | ||
errors: any | ||
message: string | ||
status: number | ||
statusText: string | ||
|
||
constructor(error: Response, data: any) { | ||
this.errors = data.errors | ||
this.message = data.message | ||
this.status = error.status | ||
this.statusText = error.statusText | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
import { OAuth } from './oauth' | ||
import { Request } from './request' | ||
import { Activities } from './resources' | ||
import { Config } from './types' | ||
|
||
export default class Strava { | ||
export class Strava { | ||
private readonly request: Request | ||
oauth: OAuth | ||
activities: Activities | ||
|
||
constructor(apiKey: string) { | ||
this.request = new Request() | ||
this.oauth = new OAuth(this.request) | ||
constructor(config: Config) { | ||
this.request = new Request(config) | ||
this.activities = new Activities(this.request) | ||
} | ||
} | ||
|
||
export default Strava |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { ActivityTotal } from '.' | ||
|
||
export interface ActivityStats { | ||
biggest_ride_distance: number | ||
biggest_climb_elevation_gain: number | ||
recent_ride_totals: ActivityTotal | ||
recent_run_totals: ActivityTotal | ||
recent_swim_totals: ActivityTotal | ||
ytd_ride_totals: ActivityTotal | ||
ytd_run_totals: ActivityTotal | ||
ytd_swim_totals: ActivityTotal | ||
all_ride_totals: ActivityTotal | ||
all_run_totals: ActivityTotal | ||
all_swim_totals: ActivityTotal | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export interface ActivityTotal { | ||
count: number | ||
distance: number | ||
moving_time: number | ||
elapsed_time: number | ||
elevation_gain: number | ||
achievement_count: number | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { ActivityZoneType } from '../enums' | ||
|
||
import { TimedZoneRange } from '.' | ||
|
||
export interface ActivityZone { | ||
score: number | ||
distribution_buckets: TimedZoneRange[] | ||
type: ActivityZoneType | ||
sensor_based: boolean | ||
points: number | ||
custom_zones: boolean | ||
max: number | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { SummaryAthlete } from '.' | ||
|
||
export interface Comment { | ||
id: number | ||
activity_id: number | ||
text: string | ||
athlete: SummaryAthlete | ||
created_at: Date | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { ActivityType } from '../enums' | ||
|
||
import { | ||
DetailedSegmentEffort, | ||
Lap, | ||
MetaAthlete, | ||
PhotoSummary, | ||
PolylineMap, | ||
Split, | ||
SummaryGear, | ||
} from '.' | ||
|
||
export interface DetailedActivity { | ||
id: number | ||
external_id: string | ||
upload_id: number | ||
athlete: MetaAthlete | ||
name: string | ||
distance: number | ||
moving_time: number | ||
elapsed_time: number | ||
total_elevation_gain: number | ||
elev_high: number | ||
elev_low: number | ||
type: ActivityType | ||
start_date: Date | ||
start_date_local: Date | ||
timezone: string | ||
start_latlng: number[] | ||
end_latlng: number[] | ||
achievement_count: number | ||
kudos_count: number | ||
comment_count: number | ||
athlete_count: number | ||
photo_count: number | ||
total_photo_count: number | ||
map: PolylineMap | ||
trainer: boolean | ||
commute: boolean | ||
manual: boolean | ||
private: boolean | ||
flagged: boolean | ||
workout_type: number | ||
average_speed: number | ||
max_speed: number | ||
has_kudoed: boolean | ||
description: string | ||
photos: PhotoSummary | ||
gear: SummaryGear | ||
calories: number | ||
segment_efforts: DetailedSegmentEffort[] | ||
device_name: string | ||
embed_token: string | ||
splits_metric: Split | ||
splits_standard: Split | ||
laps: Lap[] | ||
best_efforts: DetailedSegmentEffort[] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { FollowerStatus, ResourceState, UnitSystem } from '../enums' | ||
|
||
import { SummaryClub, SummaryGear } from '.' | ||
|
||
export interface DetailedAthlete { | ||
id: number | ||
resource_state: ResourceState | ||
firstname: string | ||
lastname: string | ||
profile_medium: string | ||
profile: string | ||
city: string | ||
state: string | ||
country: string | ||
sex: string | ||
friend: FollowerStatus | ||
follower: FollowerStatus | ||
premium: boolean | ||
created_at: Date | ||
updated_at: Date | ||
follower_count: number | ||
friend_count: number | ||
mutual_friend_count: number | ||
measurement_preference: UnitSystem | ||
email: string | ||
ftp: number | ||
weight: number | ||
clubs: SummaryClub | ||
bikes: SummaryGear | ||
shoes: SummaryGear | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { ResourceState } from '../enums' | ||
|
||
export interface DetailedGear { | ||
id: string | ||
resource_state: ResourceState | ||
primary: boolean | ||
name: string | ||
distance: number | ||
brand_name: string | ||
model_name: string | ||
frame_type: number | ||
description: string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { MetaActivity, MetaAthlete, SummarySegment } from '.' | ||
|
||
export interface DetailedSegmentEffort { | ||
id: number | ||
elapsed_time: number | ||
start_date: Date | ||
start_date_local: Date | ||
distance: number | ||
is_kom: boolean | ||
name: string | ||
activity: MetaActivity | ||
athlete: MetaAthlete | ||
moving_time: number | ||
start_index: number | ||
end_index: number | ||
average_cadence: number | ||
average_watts: number | ||
device_watts: boolean | ||
average_heartrate: number | ||
max_heartrate: number | ||
segment: SummarySegment | ||
kom_rank: number | ||
pr_rank: number | ||
hidden: boolean | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { ZoneRange } from '.' | ||
|
||
export interface HeartRateZoneRanges { | ||
custom_zones: boolean | ||
zones: ZoneRange[] | ||
} |
Oops, something went wrong.