Skip to content

Latest commit

 

History

History
75 lines (52 loc) · 5.05 KB

File metadata and controls

75 lines (52 loc) · 5.05 KB

Account

Overview

Available Operations

balance

Get Balance

Example Usage

import { XApiScraper } from "@twexapi-dev/x-api-scraper";

const xApiScraper = new XApiScraper({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await xApiScraper.account.balance();

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { XApiScraperCore } from "@twexapi-dev/x-api-scraper/core.js";
import { accountBalance } from "@twexapi-dev/x-api-scraper/funcs/account-balance.js";

// Use `XApiScraperCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const xApiScraper = new XApiScraperCore({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await accountBalance(xApiScraper);
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("accountBalance failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<models.StandardResponse>

Errors

Error Type Status Code Content Type
errors.XAPIScraperDefaultError 4XX, 5XX */*