draconode
TypeScript icon, indicating that this package has built-in type declarations

0.8.6 • Public • Published

npm version downloads Donate Build Status Known Vulnerabilities Greenkeeper badge

DracoNode: a node draco api

API to communicate with Draconius GO server.
Writing in TypeScript, compiled into full JavaScript for Node 8.x.

Include main API calls as well s Google login.

This is still a work in progress, not everything is implemented.
Ask for feature or report bugs here: https://github.com/dracoapi/nodedracoapi/issues

How to use

All api calls can be done manuall using the .call(service, method, args) method.

import * as DracoNode from 'draconode';
 
const draco = new DracoNode.Client();
const response = await draco.call('AuthService', 'trySingIn', [
    new objects.AuthData({
        authType: enums.AuthType.DEVICE,
        profileId: this.user.deviceId,
    }),
    this.clientInfo,
    new objects.FRegistrationInfo({
        regType: 'dv',
    }),
]);

More high level methods also exists, here is a more complete example that get user items:

import * as DracoNode from 'draconode';
 
const draco = new DracoNode.Client();
const ping = await draco.ping();
await draco.boot({
    userId,
    deviceId,
});
await draco.login();
await draco.load();
const response = await draco.getUserItems();
for (const item of response.items) {
    console.log(`Item type ${enums.ItemType[item.type]}, count = ${item.count}`);
}

More example can be found here: https://github.com/dracoapi/nodedracoapi/tree/master/src/examples

FAQ

I'm using an old version of node, can I use it?

Not directly but your can get it from GitHub, and change tsconfig.json to compile if for an old version of node (use ES2016 or ES2015).

/draconode/

    Package Sidebar

    Install

    npm i draconode

    Weekly Downloads

    12

    Version

    0.8.6

    License

    MIT

    Unpacked Size

    305 kB

    Total Files

    25

    Last publish

    Collaborators

    • niico