2.2.2 • Published 23 days ago

tenbis-api v2.2.2

Weekly downloads
-
License
MIT
Repository
-
Last release
23 days ago

10BIS API wrapper

Overview

This repo contains a fully functional typescript api wrapper to the 10bis api to be able to automate making 10bis orders.

Get started

Install library

yarn add tenbis-api

Full Example Usage

import api from 'tenbis-api'
const { getPayments, getTransactionReport, getUser, loadTenbisCredit } = './core'

// Example to load user credit with api
// More functionality is implemented - searching for restaurants, adding to cart, submiting orders
try {
    // Login with User Token
    const user = await getUser('***************')

    // Get User's id, address, token and current shopping cart id
    const { userId: assignedUserId, userToken } = user.Data
    const { refreshToken, authToken } = user
    const shoppingCartId = user.ShoppingCartGuid

    // Get moneycards
    const moneycards = await getPayments(shoppingCartId)
    console.log(moneycards)

    // load credit of remaining usage diff 50 shekels
    const transactionReport = await getTransactionReport(userToken)
    const usage = transactionReport.Data.moneycards[0].usage.daily
    await loadTenbisCredit(100 - usage, moneycards.Data[0].cardId)

} catch (e) {
    console.log(e.message)
}
2.2.1

23 days ago

2.2.2

23 days ago

2.1.1

6 months ago

2.1.0

6 months ago

2.0.1

6 months ago

2.0.0

6 months ago

1.0.1

1 year ago

1.0.0

1 year ago