Skip to content

Latest commit

 

History

History
238 lines (167 loc) · 11.6 KB

File metadata and controls

238 lines (167 loc) · 11.6 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

package hello.world;

import io.twexapi.sdk.XapiScraper;
import io.twexapi.sdk.models.errors.HTTPValidationError;
import io.twexapi.sdk.models.operations.TweetsEngagementRetweetersRequest;
import io.twexapi.sdk.models.operations.TweetsEngagementRetweetersResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws HTTPValidationError, Exception {

        XapiScraper sdk = XapiScraper.builder()
                .bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
            .build();

        TweetsEngagementRetweetersRequest req = TweetsEngagementRetweetersRequest.builder()
                .tweetId("<id>")
                .targetCount(100L)
                .build();

        TweetsEngagementRetweetersResponse res = sdk.tweets().engagement().retweeters()
                .request(req)
                .call();

        if (res.searchUserResponse().isPresent()) {
            System.out.println(res.searchUserResponse().get());
        }
    }
}

Parameters

Parameter Type Required Description
request TweetsEngagementRetweetersRequest ✔️ The request object to use for the request.

Response

TweetsEngagementRetweetersResponse

Errors

Error Type Status Code Content Type
models/errors/HTTPValidationError 422 application/json
models/errors/APIException 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

package hello.world;

import io.twexapi.sdk.XapiScraper;
import io.twexapi.sdk.models.components.GetRetweetersCursorQuery;
import io.twexapi.sdk.models.errors.HTTPValidationError;
import io.twexapi.sdk.models.operations.TweetsEngagementRetweetersPageResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws HTTPValidationError, Exception {

        XapiScraper sdk = XapiScraper.builder()
                .bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
            .build();

        GetRetweetersCursorQuery req = GetRetweetersCursorQuery.builder()
                .tweetId("<id>")
                .nextCursor("eyJpZCI6IjIwNjAwNTE1Mzg3OTQ0Mzg2NzciLCJmbG9ja0N1cnNvciI6IjQ2MTE2ODYwMTg2Mjg5ODcxNzkiLCJvcmlnaW5hbERpcmVjdGlvbiI6IkRlc2NlbmRpbmcifQ==-999995")
                .build();

        TweetsEngagementRetweetersPageResponse res = sdk.tweets().engagement().retweetersPage()
                .request(req)
                .call();

        if (res.getRetweetersCursorResponse().isPresent()) {
            System.out.println(res.getRetweetersCursorResponse().get());
        }
    }
}

Parameters

Parameter Type Required Description
request GetRetweetersCursorQuery ✔️ The request object to use for the request.

Response

TweetsEngagementRetweetersPageResponse

Errors

Error Type Status Code Content Type
models/errors/HTTPValidationError 422 application/json
models/errors/APIException 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

package hello.world;

import io.twexapi.sdk.XapiScraper;
import io.twexapi.sdk.models.components.GetQuotesQuery;
import io.twexapi.sdk.models.errors.HTTPValidationError;
import io.twexapi.sdk.models.operations.TweetsEngagementQuotesResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws HTTPValidationError, Exception {

        XapiScraper sdk = XapiScraper.builder()
                .bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
            .build();

        GetQuotesQuery req = GetQuotesQuery.builder()
                .tweetId("<id>")
                .count(100L)
                .build();

        TweetsEngagementQuotesResponse res = sdk.tweets().engagement().quotes()
                .request(req)
                .call();

        if (res.getQuotesResponse().isPresent()) {
            System.out.println(res.getQuotesResponse().get());
        }
    }
}

Parameters

Parameter Type Required Description
request GetQuotesQuery ✔️ The request object to use for the request.

Response

TweetsEngagementQuotesResponse

Errors

Error Type Status Code Content Type
models/errors/HTTPValidationError 422 application/json
models/errors/APIException 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

package hello.world;

import io.twexapi.sdk.XapiScraper;
import io.twexapi.sdk.models.components.GetQuotesCursorQuery;
import io.twexapi.sdk.models.errors.HTTPValidationError;
import io.twexapi.sdk.models.operations.TweetsEngagementQuotesPageResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws HTTPValidationError, Exception {

        XapiScraper sdk = XapiScraper.builder()
                .bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
            .build();

        GetQuotesCursorQuery req = GetQuotesCursorQuery.builder()
                .tweetId("<id>")
                .nextCursor("scroll:thGQYTMwMjU5NDA4ODc4ODc6MjU5NDA4ODc4ODc6")
                .build();

        TweetsEngagementQuotesPageResponse res = sdk.tweets().engagement().quotesPage()
                .request(req)
                .call();

        if (res.getQuotesCursorResponse().isPresent()) {
            System.out.println(res.getQuotesCursorResponse().get());
        }
    }
}

Parameters

Parameter Type Required Description
request GetQuotesCursorQuery ✔️ The request object to use for the request.

Response

TweetsEngagementQuotesPageResponse

Errors

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