Skip to content

Latest commit

 

History

History
85 lines (62 loc) · 6.19 KB

File metadata and controls

85 lines (62 loc) · 6.19 KB

Users.Following

Overview

Available Operations

  • list - Get Following (v3)

list

Get following list of a user. Page size 10-100; use cursor for more pages. $0.10/1000 users.

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.users.following.list({
    username: "elonmusk",
    count: 20,
    cursor: "1870681402093130182|2076960004551737340",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { XApiScraperCore } from "@twexapi-dev/x-api-scraper/core.js";
import { usersFollowingList } from "@twexapi-dev/x-api-scraper/funcs/users-following-list.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 usersFollowingList(xApiScraper, {
    username: "elonmusk",
    count: 20,
    cursor: "1870681402093130182|2076960004551737340",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("usersFollowingList failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request models.FollowersFollowingV3Query ✔️ The request object to use for the request.
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.VerifiedFollowersResponse>

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.XAPIScraperDefaultError 4XX, 5XX */*