Skip to content

Latest commit

 

History

History
265 lines (183 loc) · 10.8 KB

File metadata and controls

265 lines (183 loc) · 10.8 KB

Trending

Overview

Available Operations

countries

Get the supported country and global options that can be used to filter trending tweets.

Example Usage

package hello.world;

import io.twexapi.sdk.XapiScraper;
import io.twexapi.sdk.models.operations.TrendingCountriesResponse;
import java.lang.Exception;

public class Application {

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

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

        TrendingCountriesResponse res = sdk.trending().countries()
                .call();

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

Response

TrendingCountriesResponse

Errors

Error Type Status Code Content Type
models/errors/APIException 4XX, 5XX */*

topics

Get the topic categories available for filtering global trending tweets.

Example Usage

package hello.world;

import io.twexapi.sdk.XapiScraper;
import io.twexapi.sdk.models.operations.TrendingTopicsResponse;
import java.lang.Exception;

public class Application {

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

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

        TrendingTopicsResponse res = sdk.trending().topics()
                .call();

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

Response

TrendingTopicsResponse

Errors

Error Type Status Code Content Type
models/errors/APIException 4XX, 5XX */*

contents

Get content tags for a selected country and topic so tweets can be filtered more precisely.

Example Usage

package hello.world;

import io.twexapi.sdk.XapiScraper;
import io.twexapi.sdk.models.errors.HTTPValidationError;
import io.twexapi.sdk.models.operations.TrendingContentsRequest;
import io.twexapi.sdk.models.operations.TrendingContentsResponse;
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();

        TrendingContentsRequest req = TrendingContentsRequest.builder()
                .country("Monaco")
                .topic("<value>")
                .build();

        TrendingContentsResponse res = sdk.trending().contents()
                .request(req)
                .call();

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

Parameters

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

Response

TrendingContentsResponse

Errors

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

tweets

Get trending tweets for a country, with optional topic and content tag filters.

Example Usage

package hello.world;

import io.twexapi.sdk.XapiScraper;
import io.twexapi.sdk.models.errors.HTTPValidationError;
import io.twexapi.sdk.models.operations.TrendingTweetsRequest;
import io.twexapi.sdk.models.operations.TrendingTweetsResponse;
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();

        TrendingTweetsRequest req = TrendingTweetsRequest.builder()
                .country("Lithuania")
                .build();

        TrendingTweetsResponse res = sdk.trending().tweets()
                .request(req)
                .call();

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

Parameters

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

Response

TrendingTweetsResponse

Errors

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

byCountry

Get X Explore trending topics for a given country. Use 'worldwide' for account-default trends or a country slug such as 'united-states'.

Example Usage

package hello.world;

import io.twexapi.sdk.XapiScraper;
import io.twexapi.sdk.models.errors.HTTPValidationError;
import io.twexapi.sdk.models.operations.Country;
import io.twexapi.sdk.models.operations.TrendingByCountryRequest;
import io.twexapi.sdk.models.operations.TrendingByCountryResponse;
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();

        TrendingByCountryRequest req = TrendingByCountryRequest.builder()
                .country(Country.WORLDWIDE)
                .build();

        TrendingByCountryResponse res = sdk.trending().byCountry()
                .request(req)
                .call();

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

Parameters

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

Response

TrendingByCountryResponse

Errors

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