Skip to content

Latest commit

 

History

History
416 lines (294 loc) · 19.7 KB

File metadata and controls

416 lines (294 loc) · 19.7 KB

Communities

Overview

Available Operations

members

Get community members

Example Usage

package hello.world;

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

        CommunitiesMembersRequest req = CommunitiesMembersRequest.builder()
                .communityId("<id>")
                .targetCount(298640L)
                .build();

        CommunitiesMembersResponse res = sdk.communities().members()
                .request(req)
                .call();

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

Parameters

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

Response

CommunitiesMembersResponse

Errors

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

membersPage

Retrieve a paginated list of community members using cursor-based pagination. Each page returns up to 20 members. Pass next_cursor from the previous response to continue. Pricing: $0.10 per 1,000 members.

Example Usage

package hello.world;

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

        GetCommunityMembersCursorQuery req = GetCommunityMembersCursorQuery.builder()
                .communityId("<id>")
                .nextCursor("1234567890")
                .build();

        CommunitiesMembersPageResponse res = sdk.communities().membersPage()
                .request(req)
                .call();

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

Parameters

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

Response

CommunitiesMembersPageResponse

Errors

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

tweets

Get community tweets

Example Usage

package hello.world;

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

        CommunitiesTweetsRequest req = CommunitiesTweetsRequest.builder()
                .communityId("<id>")
                .tweetType(TweetType.MEDIA)
                .targetCount(682850L)
                .build();

        CommunitiesTweetsResponse res = sdk.communities().tweets()
                .request(req)
                .call();

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

Parameters

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

Response

CommunitiesTweetsResponse

Errors

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

tweetsPage

Retrieve a paginated list of community tweets using cursor-based pagination. Each page returns up to 20 tweets. Pass next_cursor from the previous response to continue. Pricing: $0.10 per 1,000 tweets.

Example Usage

package hello.world;

import io.twexapi.sdk.XapiScraper;
import io.twexapi.sdk.models.components.GetCommunityTweetsCursorQuery;
import io.twexapi.sdk.models.components.TweetType;
import io.twexapi.sdk.models.errors.HTTPValidationError;
import io.twexapi.sdk.models.operations.CommunitiesTweetsPageResponse;
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();

        GetCommunityTweetsCursorQuery req = GetCommunityTweetsCursorQuery.builder()
                .communityId("<id>")
                .tweetType(TweetType.TOP)
                .nextCursor("1234567890")
                .build();

        CommunitiesTweetsPageResponse res = sdk.communities().tweetsPage()
                .request(req)
                .call();

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

Parameters

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

Response

CommunitiesTweetsPageResponse

Errors

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

search

Search community

Example Usage

package hello.world;

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

        SearchCommunityQuery req = SearchCommunityQuery.builder()
                .query("<value>")
                .targetCount(761546L)
                .build();

        CommunitiesSearchResponse res = sdk.communities().search()
                .request(req)
                .call();

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

Parameters

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

Response

CommunitiesSearchResponse

Errors

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

get

Get community

Example Usage

package hello.world;

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

        CommunitiesGetRequest req = CommunitiesGetRequest.builder()
                .communityId("<id>")
                .build();

        CommunitiesGetResponse res = sdk.communities().get()
                .request(req)
                .call();

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

Parameters

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

Response

CommunitiesGetResponse

Errors

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

searchTweets

Search community tweets

Example Usage

package hello.world;

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

        SearchCommunityTweetsQuery req = SearchCommunityTweetsQuery.builder()
                .communityId("<id>")
                .targetCount(687977L)
                .query("<value>")
                .build();

        CommunitiesSearchTweetsResponse res = sdk.communities().searchTweets()
                .request(req)
                .call();

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

Parameters

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

Response

CommunitiesSearchTweetsResponse

Errors

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