-
Notifications
You must be signed in to change notification settings - Fork 1
Exports
- Contest
- LoginCredentials
- Pagination
- SessionCredentials
- Team
- TeamMemberDistanceStatistics
- TeamMemberTimeStatistics
- TeamSortOptions
- TeamStatistics
- getAllContestUrls
- getContest
- getContestByContestSlug
- getLatestContest
- getTeamStatistics
- getTeams
- kilometrikisaSession
▸ getAllContestUrls(): Promise
<string
[]>
Returns all contest urls from the kilometrikisa site navigation menu.
To fetch the actual data of a single contest, use getContest
.
Promise
<string
[]>
▸ getContest(contestUrl
): Promise
<Contest
>
Scrape Contest
data from given contest page.
Name | Type | Description |
---|---|---|
contestUrl |
string |
Url of a contest-page. For example https://www.kilometrikisa.fi/contests/kilometrikisa-2022/ |
Promise
<Contest
>
▸ getContestByContestSlug(contestSlug
): Promise
<Contest
>
An utility to fetch Contest
with just contest page's slug.
Name | Type | Description |
---|---|---|
contestSlug |
string |
Slug of the contest from contest page url. For example: kilometrikisa-2022
|
Promise
<Contest
>
▸ getLatestContest(): Promise
<Contest
>
Fetch latest Contest
in Kilometrikisa.
Promise
<Contest
>
▸ getTeamStatistics(teamSlug
): Promise
<TeamStatistics
[]>
Fetch team statistics from Kilometrikisa. Does not need authentication. Returns all statistic tables as separate data-objects. One team page might contain two statistic tables. One for regular cycling and one for electric bikes.
Name | Type | Description |
---|---|---|
teamSlug |
string |
The name of the team in "slugified" format. You can pick the value from team page url on the kilometrikisa website. |
Promise
<TeamStatistics
[]>
▸ getTeams(contestSlug
, series?
, page?
, sortOptions?
): Promise
<{ pagination
: Pagination
; teams
: Team
[] }>
Get list of teams with their contest results. Supports rudimentary sorting options.
Name | Type | Default value | Description |
---|---|---|---|
contestSlug |
string |
undefined |
Slug of the contest. E.g. "kilometrikisa-2021" |
series? |
null | TeamSeries
|
undefined |
Contest series. Small, large etc. null value returns all teams regardless of the series. |
page |
number |
1 |
Page to fetch. Should be >= 1. Defaults to first page. |
sortOptions? |
TeamSortOptions |
undefined |
Which criteria to use for sorting. |
Promise
<{ pagination
: Pagination
; teams
: Team
[] }>
▸ kilometrikisaSession(credentials
): Promise
<KilometrikisaSession
>
Get a client class with API-methods to access Kilometrikisa features which require authentication with user account. You can authenticate either with username and password or with token and sessionId.
For general once-off use and first time login you have to use username and password login. For subsequent use you can use session credentials if you save those to database etc. once authenticated. This way you can skip the Kilometrikisa login flow as long as your session credentials are still valid.
Name | Type |
---|---|
credentials |
LoginCredentials | SessionCredentials
|
Promise
<KilometrikisaSession
>