import { Dict } from 'epdoc-util'; import { Activity, ActivityFilter } from './models/activity'; import { Athlete } from './models/athlete'; import { RefreshOpts, SegmentCacheDict, SegmentCacheFile } from './segment-cache-file'; import { ServerOpts } from './server'; import { StravaApi, StravaClientSecret } from './strava-api'; import { StravaCreds } from './strava-creds'; import { EpochSeconds, FilePath, LogOpts } from './util'; export type AthleteID = number; export type DateRange = { before: EpochSeconds; after: EpochSeconds; }; export type GetSegmentsOpts = RefreshOpts & { cacheFilePath?: FilePath; }; export declare function newStravaContext(client: StravaClientSecret, credentials: StravaCreds, opts: ServerOpts): StravaContext; /** * Strava Context object to hold any context needed during a session. */ export declare class StravaContext { api: StravaApi; segCacheFile?: SegmentCacheFile; bikes: Dict; activities: Activity[]; athlete: Athlete; segments: Dict[]; aliases: Dict; private _log; private _serverOpts; constructor(client: StravaClientSecret, credentials: StravaCreds, opts: ServerOpts); auth(): Promise; getAthlete(id: AthleteID): Promise; private registerBikes; get cachedSegments(): SegmentCacheDict; getSegments(segCachPath: FilePath, opts: GetSegmentsOpts): Promise; getStarredSegments(opts: GetSegmentsOpts): Promise; clearActivities(): Promise; /** * Get activities within the date ranges for the logged-in user. * @param dateRanges * @param opts * @returns */ getActivities(dateRanges: DateRange[], opts: LogOpts): Promise; filterActivities(filter: ActivityFilter): Promise; private getActivitiesForDateRange; /** * Read more information using the DetailedActivity object and add these * details to the Activity object. */ addActivitiesDetails(): Promise; private addActivityDetail; /** * Add coordinates for the activity or segment. Limits to REQ_LIMIT parallel requests. */ addActivitiesCoordinates(): Promise; /** * Call only when generating KML file with all segments */ private addStarredSegmentsCoordinates; }