Skip to content
This repository has been archived by the owner on Feb 22, 2024. It is now read-only.

Latest commit

 

History

History
executable file
·
109 lines (75 loc) · 2.67 KB

README.md

File metadata and controls

executable file
·
109 lines (75 loc) · 2.67 KB

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