1.0.0 • Published 4 years ago

eve-asset v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

Eve Asset

Module to fetch assets from ESI. Uses eve-esi-client to manage tokens.

Example

Convoluted example to show off the asset handler. See the eve-esi-client documentation to learn about the client and token management.

import ESI from 'eve-esi-client'

import AssetHandler, {
  Source
} from 'eve-asset'

const provider = new Provider()
const esi = new ESI({ provider })

async function run () {
  // We assume the provider has a token for the given
  // character ID and scope combo
  const token = await provider.getToken(
    1234, // character ID
    'esi-assets.read_assets.v1' // scope(s)
  )
  
  const handler = new AssetHandler(
    esi,
    Source.CHARACTER, // contract source, character or corporation
    1234, // contract source ID
    {
      token // token to use
    }
  )
  
  for await (const asset of handler.fetch()) {
    console.log(asset.type_id)
  }
}

License

Copyright 2020 Michiel van der Velde.

This software is licensed under the MIT License.