New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

kilometrikisa

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kilometrikisa

Provides access to Kilometrikisa.fi information

  • 0.6.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-77.78%
Maintainers
1
Weekly downloads
 
Created
Source

Kilometrikisa

This module will enable you to easily access information on the Kilometrikisa site.

Usage

Before using the library, you might need to configure a cookie jar for storing the cookies needed for logging in.

import * as Kilometrikisa from 'kilometrikisa';
import axiosCookieJarSupport from '@3846masa/axios-cookiejar-support';
import * as tough from 'tough-cookie';

// Setup cookie jar
const cookieJar = new tough.CookieJar();
Kilometrikisa.setupAxiosCookieJar(axiosCookieJarSupport, cookieJar);

// Use library
Kilometrikisa.login('username', 'password')
  .then(user => ...);

Log in and fetch basic user information

const user = await Kilometrikisa.login('username', 'password');
console.log(user);

Fetch results for user

Kilometrikisa.login(kktestLogin, kktestPw)
  .then(() => Kilometrikisa.getUserResults())
  .then(results => {
    const totalKm = results.reduce((s, v) => s + v.km, 0);
    console.log(totalKm + " km driven");
});
// Example output
[
  ...
  { date: '2017-06-27', km: 10.7 },
  { date: '2017-06-28', km: 28 },
  { date: '2017-06-29', km: 24.6 },
  { date: '2017-06-30', km: 0 },
  { date: '2017-07-01', km: 21.7 },
  { date: '2017-07-02', km: 26.2 },
  { date: '2017-07-03', km: 12.4 },
  ...
]

Fetch top 100 statistics

const n = 2;
const page = await Kilometrikisa.allTeamsTopListPage();
const teams = await Kilometrikisa.getTeamInfoPages(page, n);
console.log(teams);

Fetch detailed information for the team where the user belongs to

Kilometrikisa.login('username', 'password')
  .then(() => Kilometrikisa.getContests())
  .then((contests) => Kilometrikisa.fetchTeamResults(contests[0]))
  .then(teamResults => {
    console.log(teamResults.name);
    console.log(teamResults.results);
});

Update information to the contest log

Note that this API will only work when the contest is active.

Kilometrikisa.login('username', 'password')
  .then(() => Kilometrikisa.updateLog('2021-08-22', 100.5))
  .then(() => console.log('Log updated'));

Get the contests user has participated in

Kilometrikisa.login('username', 'password')
  .then(() => Kilometrikisa.getContests())
  .then((result) => {
    console.log(result[0].teamName + ' ' result[0].contest + ' ' + result[0].time);
    console.log(result[0].link);
});

Get the latest contest information

const contests = await Kilometrikisa.getAllContests();
const latest = contests[0];
console.log(latest.name); //  Talvikilometrikisa 2021
console.log(latest.link); // /contests/talvikilometrikisa-2021/teams/

Keywords

FAQs

Package last updated on 15 Aug 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc