Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

the-traveler

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

the-traveler

A Node.js API wrapper for the Destiny 2 API

  • 0.1.5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6
increased by500%
Maintainers
1
Weekly downloads
 
Created
Source

Table of Contents

The Traveler

The Traveler is a small npm package which wraps around the Destiny 2 API. It uses Promises for a modern workflow in your application.

Getting Started

npm install the-traveler
# or
yarn add the-traveler

Prerequisites

To use this package you will need to obtain an API access key from the Bungie.net developer webiste. Please visit https://www.bungie.net/en/Application to obtain your access token.

After obtaining your access token you are ready for using the Destiny 2 API in your next awesome project.

import Traveler from 'the-traveler';
import { ComponentType, anyOtherEnum} from 'the-traveler/build/enums';

const traveler = new Traveler({
    apikey: 'pasteYourAPIkey',
    userAgent: 'yourUserAgent' //used to identify your request to the API
});

If you want to use this package inside a ES5 project you can import it like so:

var Traveler = require('the-traveler').default;
const Enums = require('the-traveler/build/enums')

const traveler = new Traveler({
    apikey: 'yourAPIkey',
    userAgent: 'yourUserAgent' //used to identify your request to the API
});

//Access the enums (example componentType profiles)
var profilesType = Enums.ComponentType.Profiles;

If you want to show the URLs the API wrapper is requesting, just add debug: true to the configuration array when instantiate a Traveler object

const traveler = new Traveler({
    apikey: 'pasteYourAPIkey',
    userAgent: 'yourUserAgent', //used to identify your request to the API
    debug: true 
});

Notices

There are some noteworthy information which could help to resolve some issues with the Destiny 2 API.

Typical Response

The response object from the API is always constructed like the following snippet indicates. The Response will contain the actual request data, while ErrorCode, ThrottleSeconds, ErrorStatus, Message and MessageData will hold additional data about the sucess of our request.

{ Response: Array or Object,
  ErrorCode: 1,
  ThrottleSeconds: 0,
  ErrorStatus: 'Success',
  Message: 'Ok',
  MessageData: {} }

Privacy

Some information in the Destiny API is privacy protected. If the user set the pricacy settings it is not possible to obtain specific information through the API. The different pricacy indicators are the following:

  • None: 0
  • Public: 1
  • Private: 2

Documentation

Examples

Search for an Destiny Account on PSN

Query:

traveler
    .searchDestinyPlayer('2', 'playername')
    .then(player => {
        console.log(player);
    }).catch(err => {
        //do something with the error
    })

Response

{ Response:
   [ { iconPath: '/img/theme/destiny/icons/icon_psn.png',
       membershipType: 2,
       membershipId: '4611686018433838874',
       displayName: 'Playername' } ],
  ErrorCode: 1,
  ThrottleSeconds: 0,
  ErrorStatus: 'Success',
  Message: 'Ok',

Get a character for an PSN Account

Here all character specific components are queried. You can either use normal strings or use the integrated enums for a better naming.

Query:

import Traveler from 'the-traveler';
import {ComponentType} from 'the-traveler/build/enums' 

const traveler = new Traveler({
    apikey: 'pasteYourAPIkey',
    userAgent: 'yourUserAgent' //used to identify your request to the API
});

traveler.getCharacter('2', '4611686018452033461', '2305843009265042115', { components: ['200', '201', '202', '203', '204', '205'] }).then(result => {
    console.log(result);
}).catch(err => {
    console.log(err);
});

// OR

traveler.getCharacter('2', '4611686018452033461', '2305843009265042115', {
    components:
    [
        ComponentType.Characters,
        ComponentType.CharacterInventories,
        ComponentType.CharacterProgressions,
        ComponentType.CharacterRenderData,
        ComponentType.CharacterActivities,
        ComponentType.CharacterEquipment
    ]
}).then(result => {
    console.log(result);
}).catch(err => {
    console.log(err);
});



Response (First level):

{ Response:
   { inventory: { privacy: 2 },
     character: { data: [Object], privacy: 1 },
     progressions: { privacy: 2 },
     renderData: { data: [Object], privacy: 1 },
     activities: { privacy: 2 },
     equipment: { data: [Object], privacy: 1 },
     itemComponents: {} },
  ErrorCode: 1,
  ThrottleSeconds: 0,
  ErrorStatus: 'Success',
  Message: 'Ok',
  MessageData: {} }

Progress

Please visit the official documentation for the API to check if the endpoints are working or if they are still in preview. If you find endpoints in preview, please bear in mind that errors can occur quite often. If the endpoints get finalized also this package will adopt changes and test the functionalities.

EndpointImplementedUnlocked in API
Destiny2.GetDestinyManifestalt textalt text
Destiny2.SearchDestinyPlayeralt textalt text
Destiny2.GetProfilealt textalt text
Destiny2.GetCharacteralt textalt text
Destiny2.GetClanWeeklyRewardStatealt textalt text
Destiny2.GetItemalt textalt text
Destiny2.GetVendorsalt textalt text
Destiny2.GetVendoralt textalt text
Destiny2.TransferItemalt textalt text
Destiny2.EquipItemalt textalt text
Destiny2.EquipItemsalt textalt text
Destiny2.SetItemLockStatealt textalt text
Destiny2.InsertSocketPlugalt textalt text
Destiny2.ActivateTalentNodealt textalt text
Destiny2.GetPostGameCarnageReportalt textalt text
Destiny2.GetHistoricalStatsDefinitionalt textalt text
Destiny2.GetClanLeaderboardsalt textalt text
Destiny2.GetClanAggregateStatsalt textalt text
Destiny2.GetLeaderboardsalt textalt text
Destiny2.GetLeaderboardsForCharacteralt textalt text
Destiny2.SearchDestinyEntitiesalt textalt text
Destiny2.GetHistoricalStatsalt textalt text
Destiny2.GetHistoricalStatsForAccountalt textalt text
Destiny2.GetActivityHistoryalt textalt text
Destiny2.GetUniqueWeaponHistoryalt textalt text
Destiny2.GetDestinyAggregateActivityStatsalt textalt text
Destiny2.GetPublicMilestoneContentalt textalt text
Destiny2.GetPublicMilestonesalt textalt text

Built With

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Issues

Do you have any issues or recommendations for this package ? Feel free to open an issue in the isse section :)

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

the-traveler package isn't endorsed by Bunge and doesn't reflect the views or opinions of Bungies or anyone officially involved in producing or managing Destiny 2. Destiny 2 and Bungie are trademarks or registered trademarks of Bungie, Inc. Destiny 2 © Bungie.

Keywords

FAQs

Package last updated on 13 Sep 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc