Skip to content

Latest commit

 

History

History
314 lines (231 loc) · 25.1 KB

File metadata and controls

314 lines (231 loc) · 25.1 KB

Tweets.Engagement

Overview

Available Operations

retweeters

Retrieve retweeters in a single request. Automatically paginates until count is reached or no more results. Minimum 10, maximum 5000 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.tweets.engagement.retweeters({
    tweetId: "<id>",
    targetCount: 100,
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { XApiScraperCore } from "@twexapi-dev/x-api-scraper/core.js";
import { tweetsEngagementRetweeters } from "@twexapi-dev/x-api-scraper/funcs/tweets-engagement-retweeters.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 tweetsEngagementRetweeters(xApiScraper, {
    tweetId: "<id>",
    targetCount: 100,
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("tweetsEngagementRetweeters failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.TweetsEngagementRetweetersRequest ✔️ 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.SearchUserResponse>

Errors

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

retweetersPage

Retrieve retweeters using cursor-based pagination. Each page returns up to 20 users. Pass next_cursor from the previous response to continue.

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.tweets.engagement.retweetersPage({
    tweetId: "<id>",
    nextCursor: "eyJpZCI6IjIwNjAwNTE1Mzg3OTQ0Mzg2NzciLCJmbG9ja0N1cnNvciI6IjQ2MTE2ODYwMTg2Mjg5ODcxNzkiLCJvcmlnaW5hbERpcmVjdGlvbiI6IkRlc2NlbmRpbmcifQ==-999995",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { XApiScraperCore } from "@twexapi-dev/x-api-scraper/core.js";
import { tweetsEngagementRetweetersPage } from "@twexapi-dev/x-api-scraper/funcs/tweets-engagement-retweeters-page.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 tweetsEngagementRetweetersPage(xApiScraper, {
    tweetId: "<id>",
    nextCursor: "eyJpZCI6IjIwNjAwNTE1Mzg3OTQ0Mzg2NzciLCJmbG9ja0N1cnNvciI6IjQ2MTE2ODYwMTg2Mjg5ODcxNzkiLCJvcmlnaW5hbERpcmVjdGlvbiI6IkRlc2NlbmRpbmcifQ==-999995",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("tweetsEngagementRetweetersPage failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request models.GetRetweetersCursorQuery ✔️ 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.GetRetweetersCursorResponse>

Errors

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

quotes

Retrieve quote tweets in a single request. Automatically paginates until count is reached or no more results. Use Latest for chronological order or Top for ranked results. Minimum 10, maximum 5000 tweets.

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.tweets.engagement.quotes({
    tweetId: "<id>",
    count: 100,
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { XApiScraperCore } from "@twexapi-dev/x-api-scraper/core.js";
import { tweetsEngagementQuotes } from "@twexapi-dev/x-api-scraper/funcs/tweets-engagement-quotes.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 tweetsEngagementQuotes(xApiScraper, {
    tweetId: "<id>",
    count: 100,
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("tweetsEngagementQuotes failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request models.GetQuotesQuery ✔️ 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.GetQuotesResponse>

Errors

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

quotesPage

Retrieve quote tweets using cursor-based pagination. Each page returns up to 20 tweets. Use Latest for chronological order or Top for ranked results. Pass next_cursor from the previous response to continue.

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.tweets.engagement.quotesPage({
    tweetId: "<id>",
    nextCursor: "scroll:thGQYTMwMjU5NDA4ODc4ODc6MjU5NDA4ODc4ODc6",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { XApiScraperCore } from "@twexapi-dev/x-api-scraper/core.js";
import { tweetsEngagementQuotesPage } from "@twexapi-dev/x-api-scraper/funcs/tweets-engagement-quotes-page.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 tweetsEngagementQuotesPage(xApiScraper, {
    tweetId: "<id>",
    nextCursor: "scroll:thGQYTMwMjU5NDA4ODc4ODc6MjU5NDA4ODc4ODc6",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("tweetsEngagementQuotesPage failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request models.GetQuotesCursorQuery ✔️ 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.GetQuotesCursorResponse>

Errors

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