Skip to content

Exports

Tumetsu edited this page May 7, 2022 · 13 revisions

kilometrikisa-client

Table of contents

Enumerations

Classes

Interfaces

Functions

Functions

getAllContestUrls

getAllContestUrls(): Promise<string[]>

Returns all contest urls from the kilometrikisa site navigation menu. To fetch the actual data of a single contest, use getContest.

Returns

Promise<string[]>

Defined in

contest/contest.ts:81


getContest

getContest(contestUrl): Promise<Contest>

Scrape Contest data from given contest page.

Parameters

Name Type Description
contestUrl string Url of a contest-page. For example https://www.kilometrikisa.fi/contests/kilometrikisa-2022/

Returns

Promise<Contest>

Defined in

contest/contest.ts:41


getContestByContestSlug

getContestByContestSlug(contestSlug): Promise<Contest>

An utility to fetch Contest with just contest page's slug.

Parameters

Name Type Description
contestSlug string Slug of the contest from contest page url. For example: kilometrikisa-2022

Returns

Promise<Contest>

Defined in

contest/contest.ts:32


getLatestContest

getLatestContest(): Promise<Contest>

Fetch latest Contest in Kilometrikisa.

Returns

Promise<Contest>

Defined in

contest/contest.ts:64


getTeamStatistics

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.

Parameters

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.

Returns

Promise<TeamStatistics[]>

Defined in

statistics/statistics.ts:20


getTeams

getTeams(contestSlug, series?, page?, sortOptions?): Promise<{ pagination: Pagination ; teams: Team[] }>

Get list of teams with their contest results. Supports rudimentary sorting options.

Parameters

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.

Returns

Promise<{ pagination: Pagination ; teams: Team[] }>

Defined in

statistics/statistics.ts:93


kilometrikisaSession

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.

Parameters

Name Type
credentials LoginCredentials | SessionCredentials

Returns

Promise<KilometrikisaSession>

Defined in

index.ts:35