earnapp.js

2.2.0 • Public • Published

Upgrading from version 1.X.X to version 2.X.X

All methods that requires authentication (dashboard API) are moved to client.dashboard.
example:

- client.stats()
+ client.dashboard.stats()

The methods left on client don't need authentication and are uuid bound.

EarnApp.js

axios

GitHub stars npm

earnapp.js is a Node.js module that allows you to easily interact with the EarnApp API.

  • Promise-based
  • Performant
  • 100% coverage of the EarnApp API

Installation

With GitHub:

  • Download or clone the project.
  • Go to the earnapp.js folder and run npm install.
  • Require client.js.

With npm:

  • Run npm install earnapp.js.
  • Require the library.

Documentation

Example usage

The library can be used in both CommonJS and ES Modules

Using the library

The library is async, be sure to use async functions or .then()

const { Client } = require("earnapp.js");
//OR
import { Client } from "earnapp.js";

const client = new Client();

client.dashboard.login({
    authMethod: "google",
    oauthRefreshToken: "1%2F%2F0dx...mfz75",
    xsrfToken: "uE9Tm4sXtk4wHEz4tZFJyANB",
    //needed for endpoints like linking a device / or making a payout
});

client.dashboard.stats().then((data) => {
    console.log(data);
});
//OR
const getStats = async () => {
    const data = await client.dashboard.stats();
    console.log(data);
};

getStats();

You can also get the CSRF token and login like this:

const main = async () => {
    const cookie = "1%2F%2F0dx...mfz75";

    const { token } = await client.dashboard.getCSRF({
        authMethod: "google",
        oauthRefreshToken: cookie,
    });

    client.dashboard.login({
        authMethod: "google",
        oauthRefreshToken: cookie,
        xsrfToken: token,
        //needed for endpoints like linking a device / or making a payout
    });
};

main();

Credits

EarnApp

Copyright

See the license

Readme

Keywords

Package Sidebar

Install

npm i earnapp.js

Weekly Downloads

69

Version

2.2.0

License

MIT

Unpacked Size

69.5 kB

Total Files

13

Last publish

Collaborators

  • lockblock-dev