Module: TokensApi

API for interacting with tokens.

More info: https://dashboard.seq.com/docs/tokens

Methods


<inner> list(params)

Get tokens matching the specified query.

Parameters:
Name Type Default Description
params Object {}

Filter information.

Properties
Name Type Description
filter String

Filter string, see https://dashboard.seq.com/docs/filters.

filterParams Array.<(String|Number)>

Parameter values for filter string (if needed).

Returns:

Query to retrieve results.

Type
Query
Examples

List all tokens after a certain time

async () => {
  await ledger.tokens
    .list({
      filter: 'timestamp > $1',
      filterParams: ['1985-10-26T01:21:00Z']
    })
    .all(token => {
      console.log(token)
    })
}

Paginate tokens

async () => {
  const page1 = await ledger.tokens
    .list({})
    .page({ size: 1 })
  const token = page1.items[0];
  console.log(token)
const page2 = await ledger.tokens
    .list({})
    .page({ cursor: page.cursor })
}

<inner> sum(params)

Get sums of tokens matching the specified query.

Parameters:
Name Type Default Description
params Object {}

Filter information.

Properties
Name Type Description
filter String

Filter string, see https://dashboard.seq.com/docs/filters.

filterParams Array.<(String|Number)>

Parameter values for filter string (if needed).

groupBy Array.<String>

Token object fields to group by.

Returns:

Query to retrieve results.

Type
Query
Examples

Sum all tokens after a certain time grouped by flavor ID

async () => {
  await ledger.tokens
    .sum({
      filter: 'timestamp > $1',
      filterParams: ['1985-10-26T01:21:00Z'],
      groupBy: ['flavorId']
    })
    .all(sum => {
      console.log(sum)
    })
}

Paginate sums of tokens grouped by flavor ID

async () => {
  const page1 = await ledger.tokens
    .sum({
      groupBy: ['flavorId']
    })
    .page({ size: 1 })
  const sum = page1.items[0];
  console.log(sum)
  const page2 = await ledger.tokens
    .sum({})
    .page({ cursor: page.cursor })
}