This commit is contained in:
Bastian Wagner
2026-06-17 15:10:26 +02:00
parent 486c8fff2e
commit 8c7a5cbb63
14 changed files with 953 additions and 39 deletions

View File

@@ -6,6 +6,7 @@ import { firstValueFrom } from 'rxjs';
import { StravaRateLimitError } from './strava-rate-limit.error';
import {
StravaActivityPayload,
StravaLapPayload,
StravaStreamPayload,
StravaStreamsResponse,
StravaTokenPayload,
@@ -61,12 +62,17 @@ export class StravaClientService {
accessToken: string,
page: number,
perPage = 100,
after?: number,
): Promise<StravaActivityPayload[]> {
return this.request<StravaActivityPayload[]>({
method: 'GET',
url: 'https://www.strava.com/api/v3/athlete/activities',
headers: this.authHeaders(accessToken),
params: { page, per_page: perPage },
params: {
page,
per_page: perPage,
...(after ? { after } : {}),
},
});
}
@@ -98,6 +104,17 @@ export class StravaClientService {
return this.normalizeStreamsResponse(streams);
}
async getActivityLaps(
accessToken: string,
stravaActivityId: string,
): Promise<StravaLapPayload[]> {
return this.request<StravaLapPayload[]>({
method: 'GET',
url: `https://www.strava.com/api/v3/activities/${stravaActivityId}/laps`,
headers: this.authHeaders(accessToken),
});
}
private async postToken(
body: Record<string, string>,
): Promise<StravaTokenPayload> {