strava-cz-sdk
v0.2.2
Published
Node.js API wrapper for strava.cz.
Downloads
3
Readme
strava-cz-sdk
Node.js API wrapper for strava.cz. This library uses the new JSON API of strava.cz.
This package is not affiliated with strava.cz in any way.
Installation
To install the package, run:
npm install strava-cz-sdk
Usage
Using auth credentials
First we need to login to strava.cz with our username, password and we need our canteeen number. You can find your canteen number on strava.cz website.
import { login } from 'strava-cz-sdk';
// login to strava.cz
const stravaAuth = await login({
username: 'username',
password: 'password',
canteenNumber: 'canteenNumber'
}); // returns AuthStore object
After we are logged in, we can use the stravaAuth
object to get our orders.
import { login, getOrders } from 'strava-cz-sdk';
const stravaAuth = await login({
username: 'username',
password: 'password',
canteenNumber: 'canteenNumber'
});
const orders = await getOrders(stravaAuth); // returns array of orders
To get the dispense information, we need to use the getDispense
function.
import { login, getDispense } from 'strava-cz-sdk';
const stravaAuth = await login({
username: 'username',
password: 'password',
canteenNumber: 'canteenNumber'
});
const dispense = await getDispense(stravaAuth); // returns dispense object
To get payment information, we need to use the getPayments
function.
import { login, getPayments } from 'strava-cz-sdk';
const stravaAuth = await login({
username: 'username',
password: 'password',
canteenNumber: 'canteenNumber'
});
const payments = await getPayments(stravaAuth); // returns array of payments
To get the canteen information, we need to use the getCanteenInfo
function.
import { login, getCanteenInfo } from 'strava-cz-sdk';
const stravaAuth = await login({
username: 'username',
password: 'password',
canteenNumber: 'canteenNumber'
});
const canteenInfo = await getCanteenInfo(stravaAuth); // returns canteen info object
Without auth credentials
If you want to get the public information about the canteen, you can use the getPublicCanteenInfo
function.
import { getPublicCanteenInfo } from 'strava-cz-sdk';
const canteenInfo = await getPublicCanteenInfo('canteenNumber'); // returns canteen info object
To get the public canteen menu, you can use the getPublicMenu
function.
import { getPublicMenu } from 'strava-cz-sdk';
const menu = await getPublicMenu('canteenNumber'); // returns array of menu items
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contributing
Feel free to contribute to this project. Just create a pull request and I will review it as soon as possible.