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

Latest commit

 

History

History
1013 lines (785 loc) · 30.8 KB

API.md

File metadata and controls

1013 lines (785 loc) · 30.8 KB

Classes

Client
Dashboard
FatalErrorBaseError
APIErrorBaseError
ParseErrorBaseError
PiggyBox

Client

Kind: global class

new Client()

The EarnApp client

Example

const client = new Client();

client.CLIENT_API_URL : string

The client API URL

Kind: instance property of Client

client.dashboard : Dashboard

The EarnApp dashboard client

Kind: instance property of Client

client.piggybox : PiggyBox

The PiggyBox dashboard client

Kind: instance property of Client

client.registerDevice(uuid, version, arch, appid) ⇒ Promise.<Object>

Register a new device on EarnApp database. Use client.linkDevice to link it to your account.

Kind: instance method of Client

Param Type Description
uuid string device uuid
version string app version
arch string device arch: arm, arm64, x64, android
appid string app id: node_earnapp.com, win_earnapp.com, com.eapp, mac_com.earnapp

Example

client.registerDevice("sdk-win-7744606f9f7b42d5b99d11e80f70886c", "1.295.874", "x64", "win_earnapp.com");

Example

client.registerDevice("sdk-node-6fd29568de6f481887ccf0ddea29dcca", "1.293.301", "x64", "node_earnapp.com");

client.deviceStats(uuid, version, arch, appid) ⇒ Promise.<Object>

Get a device stats on EarnApp database.

Kind: instance method of Client

Param Type Description
uuid string device uuid
version string app version
arch string device arch: arm, arm64, x64, android
appid string app id: node_earnapp.com, win_earnapp.com, com.eapp, mac_com.earnapp

Example

client.deviceStats("sdk-win-7744606f9f7b42d5b99d11e80f70886c", "1.295.874", "x64", "win_earnapp.com");

Example

client.deviceStats("sdk-node-6fd29568de6f481887ccf0ddea29dcca", "1.293.301", "x64", "node_earnapp.com");

Dashboard

Kind: global class

new Dashboard()

The EarnApp dashboard client

Example

const dashboard = new Dashboard();

dashboard.API_URL : string

The base API URL

Kind: instance property of Dashboard

dashboard.login(authCookies) ⇒ Object

Log into the dashboard.

Kind: instance method of Dashboard

Param Type Description
authCookies Object
authCookies.authMethod string authentication method
authCookies.oauthRefreshToken string OAuth refresh token
authCookies.xsrfToken string CSRF token

Example

client.dashboard.login({ authMethod: "google", oauthRefreshToken: "1%2F%2F0dx...mfz75", xsrfToken: "uE9Tm4sXtk4wHEz4tZFJyANB" });

dashboard.getCSRF(authCookies) ⇒ Promise.<Object>

Get the CSRF token from the dashboard. Automatically sets the CSRF token for future requests.

Kind: instance method of Dashboard

Param Type Description
authCookies Object
authCookies.authMethod string authentication method
authCookies.oauthRefreshToken string OAuth refresh token

Example

client.dashboard.getCSRF({ authMethod: "google", oauthRefreshToken: "1%2F%2F0dx...mfz75" });

dashboard.downloads() ⇒ Promise.<Object>

Get the app versions.

Kind: instance method of Dashboard
Example

client.dashboard.downloads();

dashboard.paymentMethods() ⇒ Promise.<Object>

Get the available payment methods.

Kind: instance method of Dashboard
Example

client.dashboard.paymentMethods();

dashboard.userData() ⇒ Promise.<Object>

Get your user data.

Kind: instance method of Dashboard
Example

client.dashboard.userData();

dashboard.devices() ⇒ Promise.<Object>

Get user devices.

Kind: instance method of Dashboard
Example

client.dashboard.devices();

dashboard.transactions() ⇒ Promise.<Object>

Get user transactions.

Kind: instance method of Dashboard
Example

client.dashboard.transactions();

dashboard.stats() ⇒ Promise.<Object>

Get user stats.

Kind: instance method of Dashboard
Example

client.dashboard.stats();

dashboard.referrals() ⇒ Promise.<Object>

Get user referrals.

Kind: instance method of Dashboard
Example

client.dashboard.referrals();

dashboard.counters() ⇒ Promise.<Object>

Get counters before balances update and auto redeem.

Kind: instance method of Dashboard
Example

client.dashboard.stats();

dashboard.promotions() ⇒ Promise.<Object>

Get user promotions.

Kind: instance method of Dashboard
Example

client.dashboard.offers();

dashboard.notifications() ⇒ Promise.<Object>

Get EarnApp current notifications.

Kind: instance method of Dashboard
Example

client.dashboard.notifications();

dashboard.linkDevice(uuid) ⇒ Promise.<Object>

Link a new device to your account.

Kind: instance method of Dashboard

Param Type Description
uuid string device uuid

Example

client.dashboard.linkDevice("sdk-win-7744606f9f7b42d5b99d11e80f70886c");

dashboard.setPaymentDetails(email, method) ⇒ Promise.<Object>

Set your payment details.

Kind: instance method of Dashboard

Param Type Description
email string paypal / amazon email
method string methods: to see methods do client.dashboard.paymentMethods

Example

client.dashboard.setPaymentDetails("[email protected]", "paypal.com");

Example

client.dashboard.setPaymentDetails("[email protected]", "amazon.com (US/Global)");

dashboard.redeem(email, method) ⇒ Promise.<Object>

Redeem your balance.

Kind: instance method of Dashboard

Param Type Description
email string paypal / amazon email
method string methods: to see methods do client.dashboard.paymentMethods

Example

client.dashboard.redeem("[email protected]", "paypal.com");

Example

client.dashboard.redeem("[email protected]", "amazon.com (US/Global)");

dashboard.removeAutoRedeem() ⇒ Promise.<Object>

Remove auto redeem.

Kind: instance method of Dashboard
Example

client.dashboard.removeAutoRedeem();

dashboard.logout() ⇒ Promise.<Object>

Log out of your account.

Kind: instance method of Dashboard
Example

client.dashboard.logout();

dashboard.check(ip) ⇒ Promise.<Object>

Check an ip for EarnApp.

Kind: instance method of Dashboard

Param Type Description
ip string ip to check

Example

client.dashboard.check("1.1.1.1");

dashboard.rename(uuid, name) ⇒ Promise.<Object>

Rename a device.

Kind: instance method of Dashboard

Param Type Description
uuid string device uuid
name string new device name

Example

client.dashboard.rename("sdk-win-7744606f9f7b42d5b99d11e80f70886c", "new name");

dashboard.remove(uuid) ⇒ Promise.<Object>

Remove a device.

Kind: instance method of Dashboard

Param Type Description
uuid string device uuid

Example

client.dashboard.remove("sdk-win-7744606f9f7b42d5b99d11e80f70886c");

dashboard.hide(uuid) ⇒ Promise.<Object>

Hide a device.

Kind: instance method of Dashboard

Param Type Description
uuid string device uuid

Example

client.dashboard.hide("sdk-win-7744606f9f7b42d5b99d11e80f70886c");

dashboard.show(uuid) ⇒ Promise.<Object>

Show a device.

Kind: instance method of Dashboard

Param Type Description
uuid string device uuid

Example

client.dashboard.show("sdk-win-7744606f9f7b42d5b99d11e80f70886c");

dashboard.usage(step) ⇒ Promise.<Object>

Get user devices usage.

Kind: instance method of Dashboard

Param Type Description
step string usage step: daily, weekly, monthly

Example

client.dashboard.usage("daily");

dashboard.devicesStatus(list) ⇒ Promise.<Object>

Get user devices status.

Kind: instance method of Dashboard

Param Type Description
list Array devices list

Example

client.dashboard.devicesStatus([ "sdk-win-7744606f9f7b42d5b99d11e80f70886c" ]);

dashboard.brightvpnReferrals() ⇒ Promise.<Object>

Get user BrightVPN referrals.

Kind: instance method of Dashboard
Example

client.dashboard.brightvpnReferrals();

dashboard.speedtests() ⇒ Promise.<Object>

Get speedtests.

Kind: instance method of Dashboard
Example

client.dashboard.speedtest();

dashboard.deleteAccount(reason) ⇒ Promise.<Object>

Delete your account. CANNOT BE UNDONE

Kind: instance method of Dashboard

Param Type Description
reason string deletion reason

Example

client.dashboard.deleteAccount("some reason here");

dashboard.disableAccount() ⇒ Promise.<Object>

Disable your account.

Kind: instance method of Dashboard
Example

client.dashboard.disableAccount();

dashboard.restoreAccount() ⇒ Promise.<Object>

Restore your account.

Kind: instance method of Dashboard
Example

client.dashboard.restoreAccount();

FatalError ⇐ BaseError

Kind: global class
Extends: BaseError

new FatalError(error)

Represents a fatal error from the Client.

Param Type Description
error string | error error object or message

fatalError.type : string

error type

Kind: instance property of FatalError

APIError ⇐ BaseError

Kind: global class
Extends: BaseError

new APIError(error, response, status, method, url)

Represents an error from the API.

Param Type Description
error string | error error message
response object error response
status string status type of the request
method string method used for the request
url string url of the request to the endpoint

apiError.status : string

status type of the request

Kind: instance property of APIError

apiError.method : string

method used for the request

Kind: instance property of APIError

apiError.url : string

url of the request to the endpoint

Kind: instance property of APIError

apiError.type : string

error type

Kind: instance property of APIError

ParseError ⇐ BaseError

Kind: global class
Extends: BaseError

new ParseError(message, status, method, url)

Represents a parsing error.

Param Type Description
message String error message
status String status type of the request
method String method used for the request
url String url of the request to the endpoint

parseError.status : string

status type of the request

Kind: instance property of ParseError

parseError.method : string

method used for the request

Kind: instance property of ParseError

parseError.url : string

url of the request to the endpoint

Kind: instance property of ParseError

parseError.type : string

error type

Kind: instance property of ParseError

PiggyBox

Kind: global class

new PiggyBox()

The PiggyBox dashboard client

Example

const dashboard = new PiggyBox();

piggyBox.API_URL : string

The base API URL

Kind: instance property of PiggyBox

piggyBox.login(authCookies) ⇒ Object

Log into the dashboard.

Kind: instance method of PiggyBox

Param Type Description
authCookies Object
authCookies.authMethod string authentication method
authCookies.oauthRefreshToken string OAuth refresh token
authCookies.xsrfToken string CSRF token

Example

client.dashboard.login({ authMethod: "google", oauthRefreshToken: "1%2F%2F0dx...mfz75", xsrfToken: "uE9Tm4sXtk4wHEz4tZFJyANB" });

piggyBox.getCSRF(authCookies) ⇒ Promise.<Object>

Get the CSRF token from the dashboard. Automatically sets the CSRF token for future requests.

Kind: instance method of PiggyBox

Param Type Description
authCookies Object
authCookies.authMethod string authentication method
authCookies.oauthRefreshToken string OAuth refresh token

Example

client.dashboard.getCSRF({ authMethod: "google", oauthRefreshToken: "1%2F%2F0dx...mfz75" });

piggyBox.downloads() ⇒ Promise.<Object>

Get the app versions.

Kind: instance method of PiggyBox
Example

client.dashboard.downloads();

piggyBox.paymentMethods() ⇒ Promise.<Object>

Get the available payment methods.

Kind: instance method of PiggyBox
Example

client.dashboard.paymentMethods();

piggyBox.userData() ⇒ Promise.<Object>

Get your user data.

Kind: instance method of PiggyBox
Example

client.dashboard.userData();

piggyBox.devices() ⇒ Promise.<Object>

Get user devices.

Kind: instance method of PiggyBox
Example

client.dashboard.devices();

piggyBox.transactions() ⇒ Promise.<Object>

Get user transactions.

Kind: instance method of PiggyBox
Example

client.dashboard.transactions();

piggyBox.stats() ⇒ Promise.<Object>

Get user stats.

Kind: instance method of PiggyBox
Example

client.dashboard.stats();

piggyBox.referrals() ⇒ Promise.<Object>

Get user referrals.

Kind: instance method of PiggyBox
Example

client.dashboard.referrals();

piggyBox.counters() ⇒ Promise.<Object>

Get counters before balances update and auto redeem.

Kind: instance method of PiggyBox
Example

client.dashboard.stats();

piggyBox.promotions() ⇒ Promise.<Object>

Get user promotions.

Kind: instance method of PiggyBox
Example

client.dashboard.offers();

piggyBox.notifications() ⇒ Promise.<Object>

Get EarnApp current notifications.

Kind: instance method of PiggyBox
Example

client.dashboard.notifications();

piggyBox.linkDevice(uuid) ⇒ Promise.<Object>

Link a new device to your account.

Kind: instance method of PiggyBox

Param Type Description
uuid string device uuid

Example

client.dashboard.linkDevice("sdk-win-7744606f9f7b42d5b99d11e80f70886c");

piggyBox.setPaymentDetails(email, method) ⇒ Promise.<Object>

Set your payment details.

Kind: instance method of PiggyBox

Param Type Description
email string paypal / amazon email
method string methods: to see methods do client.dashboard.paymentMethods

Example

client.dashboard.setPaymentDetails("[email protected]", "paypal.com");

Example

client.dashboard.setPaymentDetails("[email protected]", "amazon.com (US/Global)");

piggyBox.redeem(email, method) ⇒ Promise.<Object>

Redeem your balance.

Kind: instance method of PiggyBox

Param Type Description
email string paypal / amazon email
method string methods: to see methods do client.dashboard.paymentMethods

Example

client.dashboard.redeem("[email protected]", "paypal.com");

Example

client.dashboard.redeem("[email protected]", "amazon.com (US/Global)");

piggyBox.removeAutoRedeem() ⇒ Promise.<Object>

Remove auto redeem.

Kind: instance method of PiggyBox
Example

client.dashboard.removeAutoRedeem();

piggyBox.logout() ⇒ Promise.<Object>

Log out of your account.

Kind: instance method of PiggyBox
Example

client.dashboard.logout();

piggyBox.rename(uuid, name) ⇒ Promise.<Object>

Rename a device.

Kind: instance method of PiggyBox

Param Type Description
uuid string device uuid
name string new device name

Example

client.dashboard.rename("sdk-win-7744606f9f7b42d5b99d11e80f70886c", "new name");

piggyBox.remove(uuid) ⇒ Promise.<Object>

Remove a device.

Kind: instance method of PiggyBox

Param Type Description
uuid string device uuid

Example

client.dashboard.remove("sdk-win-7744606f9f7b42d5b99d11e80f70886c");

piggyBox.hide(uuid) ⇒ Promise.<Object>

Hide a device.

Kind: instance method of PiggyBox

Param Type Description
uuid string device uuid

Example

client.dashboard.hide("sdk-win-7744606f9f7b42d5b99d11e80f70886c");

piggyBox.show(uuid) ⇒ Promise.<Object>

Show a device.

Kind: instance method of PiggyBox

Param Type Description
uuid string device uuid

Example

client.dashboard.show("sdk-win-7744606f9f7b42d5b99d11e80f70886c");

piggyBox.usage(step) ⇒ Promise.<Object>

Get user devices usage.

Kind: instance method of PiggyBox

Param Type Description
step string usage step: daily, weekly, monthly

Example

client.dashboard.usage("daily");

piggyBox.devicesStatus(list) ⇒ Promise.<Object>

Get user devices status.

Kind: instance method of PiggyBox

Param Type Description
list string devices list

Example

client.dashboard.devicesStatus([ "sdk-node-7744606f9f7b42d5b99d11e80f70886c" ]);

piggyBox.brightvpnReferrals() ⇒ Promise.<Object>

Get user BrightVPN referrals.

Kind: instance method of PiggyBox
Example

client.dashboard.brightvpnReferrals();