Skip to content

Latest commit

 

History

History
314 lines (223 loc) · 10.6 KB

API.md

File metadata and controls

314 lines (223 loc) · 10.6 KB

Classes

v0.Auth
Transactions

Handle Tillhub Transactions from the v0 Model

VoucherLogs

Handle Tillhub Voucher Logs.

Vouchers

Handle Tillhub Vouchers.

Auth"v0.Auth"

Authenticate an app via different auth strategies

Carts

Handle Tillhub Carts from the v1 Model

Products

Handle Tillhub Products from the v1 Model

Templates

Handle Tillhub Templates from the v1 Model.

Templates will drive email and document behaviours and layouts.

Typedefs

authResponseStruct : Object

Object that is returned by all authentication methods.

authCallback : function

Callback that will be passed by all authentication methods.

v0.Auth

Kind: global class

new v0.Auth()

Authenticate an app via different auth strategies

Example

const Auth = require('@tillhub/node-sdk').v0.Auth
const auth = new Auth ()

auth.loginUsername('[email protected]', '123455', (err, body) => {
  if (err) throw err
  console.log(body.token)
  console.log(body.user)
})

Transactions

Handle Tillhub Transactions from the v0 Model

Kind: global class

transactions.getAll([queryOrCallback], [callback])

Get all transactions from client account.

Kind: instance method of Transactions

Param Type Description
[queryOrCallback] Object | function query for transactions with allowed paramaters, or specify an optional callback
[callback] function optional callback. If not specified, this function returns a promise

VoucherLogs

Handle Tillhub Voucher Logs.

Kind: global class

voucherLogs.getAll([queryOrCallback], [callback])

Get all voucher logs for a client account.

Kind: instance method of VoucherLogs

Param Type Description
[queryOrCallback] Object | function query for voucher logs with allowed paramaters, or specify an optional callback
[callback] function optional callback. If not specified, this function returns a promise

Vouchers

Handle Tillhub Vouchers.

Kind: global class

vouchers.create(body, [optionsOrCallback], [callback])

Create a voucher.

Kind: instance method of Vouchers

Param Type Description
body Object object defining a voucher
[optionsOrCallback] Object | function options for voucher with allowed paramaters, or specify an optional callback
[callback] function optional callback. If not specified, this function returns a promise

vouchers.put(body, [optionsOrCallback], [callback])

Replace propertise on a voucher.

Kind: instance method of Vouchers

Param Type Description
body Object object defining voucher properties
[optionsOrCallback] Object | function options for vouchers with allowed paramaters, or specify an optional callback
[callback] function optional callback. If not specified, this function returns a promise

vouchers.getAll([queryOrCallback], [callback])

Get all vouchers from client account.

Kind: instance method of Vouchers

Param Type Description
[queryOrCallback] Object | function query for vouchers with allowed paramaters, or specify an optional callback
[callback] function optional callback. If not specified, this function returns a promise

Auth ⇐ "v0.Auth"

Authenticate an app via different auth strategies

Kind: global class
Extends: "v0.Auth"

auth.loginUsername(username, password, [callback])

Authenticate by username

Kind: instance method of Auth

Param Type Description
username String the tillhub client account e-mail address
password String the password corresponding to the tillhub client account\
[callback] authCallback optional callback

auth.loginServiceAccount(clientAccount, apiKey, [callback])

Authenticate as headless service account.

Kind: instance method of Auth

Param Type Description
clientAccount String tillhub client account uuid
apiKey String name of service account (a type of user in the registered in the client account)
[callback] authCallback optional callback

Carts

Handle Tillhub Carts from the v1 Model

Kind: global class

carts.getAll([queryOrCallback], [callback])

Get all carts from client account.

Kind: instance method of Carts

Param Type Description
[queryOrCallback] Object | function query for carts with allowed paramaters, or specify an optional callback
[callback] function optional callback. If not specified, this function returns a promise

carts.create(cart, [optionsOrCallback], [callback])

Create a cart to consume in Tillhub Clients.

Kind: instance method of Carts

Param Type Description
cart Object the cart body
[optionsOrCallback] Object | function query for carts with allowed paramaters, or specify an optional callback
[callback] function optional callback. If not specified, this function returns a promise

Products

Handle Tillhub Products from the v1 Model

Kind: global class

products.getAll([queryOrCallback], [callback])

Get all products from client account.

Kind: instance method of Products

Param Type Description
[queryOrCallback] Object | function query for products with allowed paramaters, or specify an optional callback
[callback] function optional callback. If not specified, this function returns a promise

Templates

Handle Tillhub Templates from the v1 Model.

Templates will drive email and document behaviours and layouts.

Kind: global class

templates.create(body, [optionsOrCallback], [callback])

Create a template.

Kind: instance method of Templates

Param Type Description
body Object object defining a template
[optionsOrCallback] Object | function options for templates with allowed paramaters, or specify an optional callback
[callback] function optional callback. If not specified, this function returns a promise

templates.put(body, [optionsOrCallback], [callback])

Replace propertise on a template.

Kind: instance method of Templates

Param Type Description
body Object object defining template properties
[optionsOrCallback] Object | function options for templates with allowed paramaters, or specify an optional callback
[callback] function optional callback. If not specified, this function returns a promise

templates.getAll([queryOrCallback], [callback])

Get all templates from client account.

Kind: instance method of Templates

Param Type Description
[queryOrCallback] Object | function query for templates with allowed paramaters, or specify an optional callback
[callback] function optional callback. If not specified, this function returns a promise

authResponseStruct : Object

Object that is returned by all authentication methods.

Kind: global typedef
Properties

Name Type Description
token String JWT token that will be used as Bearer Token in subsequent requests
user boolean the alphanumeric client account ID that will be used in most routes

authCallback : function

Callback that will be passed by all authentication methods.

Kind: global typedef

Param Type
body authResponseStruct