2.2.0 • Published 2 years ago

earnapp.js v2.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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

2.2.0

2 years ago

2.1.0

2 years ago

1.4.2

2 years ago

1.4.1

2 years ago

1.4.0

2 years ago

2.0.0

2 years ago

1.2.0

2 years ago

1.0.5

2 years ago

1.3.1

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

3 years ago