Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
Copyright 2020 Twitter, Inc.
SPDX-License-Identifier: Apache-2.0
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
https://openapi-generator.tech
Do not edit the class manually.
*/
package com.twitter.clientlib.api;
import com.twitter.clientlib.ApiCallback;
import com.twitter.clientlib.ApiClient;
import com.twitter.clientlib.auth.*;
import com.twitter.clientlib.ApiException;
import com.twitter.clientlib.ApiResponse;
import com.twitter.clientlib.Configuration;
import com.twitter.clientlib.Pair;
import com.twitter.clientlib.ProgressRequestBody;
import com.twitter.clientlib.ProgressResponseBody;
import com.github.scribejava.core.model.OAuth2AccessToken;
import com.google.gson.reflect.TypeToken;
import java.io.IOException;
import com.twitter.clientlib.model.AddOrDeleteRulesRequest;
import com.twitter.clientlib.model.AddOrDeleteRulesResponse;
import com.twitter.clientlib.model.CreateTweetRequest;
import com.twitter.clientlib.model.Error;
import com.twitter.clientlib.model.FilteredStreamingTweet;
import com.twitter.clientlib.model.GenericTweetsTimelineResponse;
import com.twitter.clientlib.model.GetRulesResponse;
import com.twitter.clientlib.model.Granularity;
import com.twitter.clientlib.model.HideReplyByIdRequest;
import com.twitter.clientlib.model.HideReplyByIdResponse;
import com.twitter.clientlib.model.ListsIdTweetsResponse;
import com.twitter.clientlib.model.MultiTweetLookupResponse;
import com.twitter.clientlib.model.MultiUserLookupResponse;
import java.time.OffsetDateTime;
import com.twitter.clientlib.model.Problem;
import com.twitter.clientlib.model.QuoteTweetLookupResponse;
import java.util.Set;
import com.twitter.clientlib.model.SingleTweetLookupResponse;
import com.twitter.clientlib.model.StreamingTweet;
import com.twitter.clientlib.model.TweetCountsResponse;
import com.twitter.clientlib.model.TweetCreateResponse;
import com.twitter.clientlib.model.TweetDeleteResponse;
import com.twitter.clientlib.model.TweetSearchResponse;
import com.twitter.clientlib.model.UsersIdLikedTweetsResponse;
import com.twitter.clientlib.model.UsersLikesCreateRequest;
import com.twitter.clientlib.model.UsersLikesCreateResponse;
import com.twitter.clientlib.model.UsersLikesDeleteResponse;
import com.twitter.clientlib.model.UsersRetweetsCreateRequest;
import com.twitter.clientlib.model.UsersRetweetsCreateResponse;
import com.twitter.clientlib.model.UsersRetweetsDeleteResponse;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Arrays;
import java.io.InputStream;
import javax.ws.rs.core.GenericType;
import org.apache.commons.lang3.StringUtils;
public class TweetsApi extends ApiCommon {
/**
* Build call for addOrDeleteRules
* @param addOrDeleteRulesRequest (required)
* @param dryRun Dry Run can be used with both the add and delete action, with the expected result given, but without actually taking any action in the system (meaning the end state will always be as it was when the request was submitted). This is particularly useful to validate rule changes. (optional)
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
* @http.response.details
Status Code
Description
Response Headers
200
The request was successful
-
0
The request has failed.
-
*/
public okhttp3.Call addOrDeleteRulesCall(AddOrDeleteRulesRequest addOrDeleteRulesRequest, Boolean dryRun, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = addOrDeleteRulesRequest;
// create path and map variables
String localVarPath = "/2/tweets/search/stream/rules";
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarCookieParams = new HashMap();
Map localVarFormParams = new HashMap();
if (dryRun != null) {
localVarQueryParams.addAll(localVarApiClient.parameterToPair("dry_run", dryRun));
}
final String[] localVarAccepts = {
"application/json", "application/problem+json"
};
final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) {
localVarHeaderParams.put("Accept", localVarAccept);
}
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
if (localVarContentType != null) {
localVarHeaderParams.put("Content-Type", localVarContentType);
}
String[] localVarAuthNames = new String[] { "BearerToken" };
return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, reduceAuthNames(localVarAuthNames), _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call addOrDeleteRulesValidateBeforeCall(AddOrDeleteRulesRequest addOrDeleteRulesRequest, Boolean dryRun, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'addOrDeleteRulesRequest' is set
if (addOrDeleteRulesRequest == null) {
throw new ApiException("Missing the required parameter 'addOrDeleteRulesRequest' when calling addOrDeleteRules(Async)");
}
okhttp3.Call localVarCall = addOrDeleteRulesCall(addOrDeleteRulesRequest, dryRun, _callback);
return localVarCall;
}
/**
* Add/Delete rules
* Add or delete rules from a user's active rule set. Users can provide unique, optionally tagged rules to add. Users can delete their entire rule set or a subset specified by rule ids or values.
* @param addOrDeleteRulesRequest (required)
* @param dryRun Dry Run can be used with both the add and delete action, with the expected result given, but without actually taking any action in the system (meaning the end state will always be as it was when the request was submitted). This is particularly useful to validate rule changes. (optional)
* @return AddOrDeleteRulesResponse
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
* @http.response.details
Status Code
Description
Response Headers
200
The request was successful
-
0
The request has failed.
-
*/
public AddOrDeleteRulesResponse addOrDeleteRules(AddOrDeleteRulesRequest addOrDeleteRulesRequest, Boolean dryRun) throws ApiException {
ApiResponse localVarResp;
try{
localVarResp = addOrDeleteRulesWithHttpInfo(addOrDeleteRulesRequest, dryRun);
} catch (ApiException e) {
if (isOAUth2AutoRefreshToken() && e.getCode() == 401) {
refreshToken();
localVarResp = addOrDeleteRulesWithHttpInfo(addOrDeleteRulesRequest, dryRun);
} else {
throw e;
}
}
return localVarResp != null ? localVarResp.getData() : null;
}
/**
* Calls the API using a retry mechanism to handle rate limits errors.
*
*/
public AddOrDeleteRulesResponse addOrDeleteRules(Integer retries, AddOrDeleteRulesRequest addOrDeleteRulesRequest, Boolean dryRun) throws ApiException {
AddOrDeleteRulesResponse localVarResp;
try{
localVarResp = addOrDeleteRules(addOrDeleteRulesRequest, dryRun);
} catch (ApiException e) {
if(handleRateLimit(e, retries)) {
return addOrDeleteRules(retries - 1, addOrDeleteRulesRequest, dryRun);
} else {
throw e;
}
}
return localVarResp;
}
/**
* Add/Delete rules
* Add or delete rules from a user's active rule set. Users can provide unique, optionally tagged rules to add. Users can delete their entire rule set or a subset specified by rule ids or values.
* @param addOrDeleteRulesRequest (required)
* @param dryRun Dry Run can be used with both the add and delete action, with the expected result given, but without actually taking any action in the system (meaning the end state will always be as it was when the request was submitted). This is particularly useful to validate rule changes. (optional)
* @return ApiResponse<AddOrDeleteRulesResponse>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
* @http.response.details
Status Code
Description
Response Headers
200
The request was successful
-
0
The request has failed.
-
*/
public ApiResponse addOrDeleteRulesWithHttpInfo(AddOrDeleteRulesRequest addOrDeleteRulesRequest, Boolean dryRun) throws ApiException {
okhttp3.Call localVarCall = addOrDeleteRulesValidateBeforeCall(addOrDeleteRulesRequest, dryRun, null);
try {
Type localVarReturnType = new TypeToken(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
} catch (ApiException e) {
e.setErrorObject(localVarApiClient.getJSON().getGson().fromJson(e.getResponseBody(), new TypeToken(){}.getType()));
e.setErrorObjectType(new GenericType(){});
throw e;
}
}
/**
* Add/Delete rules (asynchronously)
* Add or delete rules from a user's active rule set. Users can provide unique, optionally tagged rules to add. Users can delete their entire rule set or a subset specified by rule ids or values.
* @param addOrDeleteRulesRequest (required)
* @param dryRun Dry Run can be used with both the add and delete action, with the expected result given, but without actually taking any action in the system (meaning the end state will always be as it was when the request was submitted). This is particularly useful to validate rule changes. (optional)
* @param _callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
* @http.response.details
Status Code
Description
Response Headers
200
The request was successful
-
0
The request has failed.
-
*/
public okhttp3.Call addOrDeleteRulesAsync(AddOrDeleteRulesRequest addOrDeleteRulesRequest, Boolean dryRun, final ApiCallback _callback) throws ApiException {
okhttp3.Call localVarCall = addOrDeleteRulesValidateBeforeCall(addOrDeleteRulesRequest, dryRun, _callback);
Type localVarReturnType = new TypeToken(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
/**
* Build call for createTweet
* @param createTweetRequest (optional)
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
* @http.response.details
Status Code
Description
Response Headers
201
The request was successful
-
0
The request has failed.
-
*/
public okhttp3.Call createTweetCall(CreateTweetRequest createTweetRequest, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = createTweetRequest;
// create path and map variables
String localVarPath = "/2/tweets";
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarCookieParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json", "application/problem+json"
};
final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) {
localVarHeaderParams.put("Accept", localVarAccept);
}
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
if (localVarContentType != null) {
localVarHeaderParams.put("Content-Type", localVarContentType);
}
String[] localVarAuthNames = new String[] { "OAuth2UserToken", "UserToken" };
return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, reduceAuthNames(localVarAuthNames), _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call createTweetValidateBeforeCall(CreateTweetRequest createTweetRequest, final ApiCallback _callback) throws ApiException {
okhttp3.Call localVarCall = createTweetCall(createTweetRequest, _callback);
return localVarCall;
}
/**
* Creation of a Tweet
* Causes the user to create a tweet under the authorized account.
* @param createTweetRequest (optional)
* @return TweetCreateResponse
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
* @http.response.details
Status Code
Description
Response Headers
201
The request was successful
-
0
The request has failed.
-
*/
public TweetCreateResponse createTweet(CreateTweetRequest createTweetRequest) throws ApiException {
ApiResponse localVarResp;
try{
localVarResp = createTweetWithHttpInfo(createTweetRequest);
} catch (ApiException e) {
if (isOAUth2AutoRefreshToken() && e.getCode() == 401) {
refreshToken();
localVarResp = createTweetWithHttpInfo(createTweetRequest);
} else {
throw e;
}
}
return localVarResp != null ? localVarResp.getData() : null;
}
/**
* Calls the API using a retry mechanism to handle rate limits errors.
*
*/
public TweetCreateResponse createTweet(Integer retries, CreateTweetRequest createTweetRequest) throws ApiException {
TweetCreateResponse localVarResp;
try{
localVarResp = createTweet(createTweetRequest);
} catch (ApiException e) {
if(handleRateLimit(e, retries)) {
return createTweet(retries - 1, createTweetRequest);
} else {
throw e;
}
}
return localVarResp;
}
/**
* Creation of a Tweet
* Causes the user to create a tweet under the authorized account.
* @param createTweetRequest (optional)
* @return ApiResponse<TweetCreateResponse>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
* @http.response.details
Status Code
Description
Response Headers
201
The request was successful
-
0
The request has failed.
-
*/
public ApiResponse createTweetWithHttpInfo(CreateTweetRequest createTweetRequest) throws ApiException {
okhttp3.Call localVarCall = createTweetValidateBeforeCall(createTweetRequest, null);
try {
Type localVarReturnType = new TypeToken(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
} catch (ApiException e) {
e.setErrorObject(localVarApiClient.getJSON().getGson().fromJson(e.getResponseBody(), new TypeToken(){}.getType()));
e.setErrorObjectType(new GenericType(){});
throw e;
}
}
/**
* Creation of a Tweet (asynchronously)
* Causes the user to create a tweet under the authorized account.
* @param createTweetRequest (optional)
* @param _callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
* @http.response.details
Status Code
Description
Response Headers
201
The request was successful
-
0
The request has failed.
-
*/
public okhttp3.Call createTweetAsync(CreateTweetRequest createTweetRequest, final ApiCallback _callback) throws ApiException {
okhttp3.Call localVarCall = createTweetValidateBeforeCall(createTweetRequest, _callback);
Type localVarReturnType = new TypeToken(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
/**
* Build call for deleteTweetById
* @param id The ID of the Tweet to be deleted. (required)
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
* @http.response.details
Status Code
Description
Response Headers
200
The request was successful
-
0
The request has failed.
-
*/
public okhttp3.Call deleteTweetByIdCall(String id, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/2/tweets/{id}"
.replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString()));
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarCookieParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json", "application/problem+json"
};
final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) {
localVarHeaderParams.put("Accept", localVarAccept);
}
final String[] localVarContentTypes = {
};
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
if (localVarContentType != null) {
localVarHeaderParams.put("Content-Type", localVarContentType);
}
String[] localVarAuthNames = new String[] { "OAuth2UserToken", "UserToken" };
return localVarApiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, reduceAuthNames(localVarAuthNames), _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call deleteTweetByIdValidateBeforeCall(String id, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'id' is set
if (id == null) {
throw new ApiException("Missing the required parameter 'id' when calling deleteTweetById(Async)");
}
okhttp3.Call localVarCall = deleteTweetByIdCall(id, _callback);
return localVarCall;
}
/**
* Tweet delete by Tweet ID
* Delete specified Tweet (in the path) by ID.
* @param id The ID of the Tweet to be deleted. (required)
* @return TweetDeleteResponse
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
* @http.response.details
Status Code
Description
Response Headers
200
The request was successful
-
0
The request has failed.
-
*/
public TweetDeleteResponse deleteTweetById(String id) throws ApiException {
ApiResponse localVarResp;
try{
localVarResp = deleteTweetByIdWithHttpInfo(id);
} catch (ApiException e) {
if (isOAUth2AutoRefreshToken() && e.getCode() == 401) {
refreshToken();
localVarResp = deleteTweetByIdWithHttpInfo(id);
} else {
throw e;
}
}
return localVarResp != null ? localVarResp.getData() : null;
}
/**
* Calls the API using a retry mechanism to handle rate limits errors.
*
*/
public TweetDeleteResponse deleteTweetById(Integer retries, String id) throws ApiException {
TweetDeleteResponse localVarResp;
try{
localVarResp = deleteTweetById(id);
} catch (ApiException e) {
if(handleRateLimit(e, retries)) {
return deleteTweetById(retries - 1, id);
} else {
throw e;
}
}
return localVarResp;
}
/**
* Tweet delete by Tweet ID
* Delete specified Tweet (in the path) by ID.
* @param id The ID of the Tweet to be deleted. (required)
* @return ApiResponse<TweetDeleteResponse>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
* @http.response.details
Status Code
Description
Response Headers
200
The request was successful
-
0
The request has failed.
-
*/
public ApiResponse deleteTweetByIdWithHttpInfo(String id) throws ApiException {
okhttp3.Call localVarCall = deleteTweetByIdValidateBeforeCall(id, null);
try {
Type localVarReturnType = new TypeToken(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
} catch (ApiException e) {
e.setErrorObject(localVarApiClient.getJSON().getGson().fromJson(e.getResponseBody(), new TypeToken(){}.getType()));
e.setErrorObjectType(new GenericType(){});
throw e;
}
}
/**
* Tweet delete by Tweet ID (asynchronously)
* Delete specified Tweet (in the path) by ID.
* @param id The ID of the Tweet to be deleted. (required)
* @param _callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
* @http.response.details
Status Code
Description
Response Headers
200
The request was successful
-
0
The request has failed.
-
*/
public okhttp3.Call deleteTweetByIdAsync(String id, final ApiCallback _callback) throws ApiException {
okhttp3.Call localVarCall = deleteTweetByIdValidateBeforeCall(id, _callback);
Type localVarReturnType = new TypeToken(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
/**
* Build call for findTweetById
* @param id A single Tweet ID. (required)
* @param expansions A comma separated list of fields to expand. (optional)
* @param tweetFields A comma separated list of Tweet fields to display. (optional)
* @param userFields A comma separated list of User fields to display. (optional)
* @param mediaFields A comma separated list of Media fields to display. (optional)
* @param placeFields A comma separated list of Place fields to display. (optional)
* @param pollFields A comma separated list of Poll fields to display. (optional)
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
* @http.response.details
Status Code
Description
Response Headers
200
The request was successful
-
0
The request has failed.
-
*/
public okhttp3.Call findTweetByIdCall(String id, Set expansions, Set tweetFields, Set userFields, Set mediaFields, Set placeFields, Set pollFields, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/2/tweets/{id}"
.replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString()));
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarCookieParams = new HashMap();
Map localVarFormParams = new HashMap();
if (expansions != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "expansions", expansions));
}
if (tweetFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "tweet.fields", tweetFields));
}
if (userFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "user.fields", userFields));
}
if (mediaFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "media.fields", mediaFields));
}
if (placeFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "place.fields", placeFields));
}
if (pollFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "poll.fields", pollFields));
}
final String[] localVarAccepts = {
"application/json", "application/problem+json"
};
final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) {
localVarHeaderParams.put("Accept", localVarAccept);
}
final String[] localVarContentTypes = {
};
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
if (localVarContentType != null) {
localVarHeaderParams.put("Content-Type", localVarContentType);
}
String[] localVarAuthNames = new String[] { "BearerToken", "OAuth2UserToken", "UserToken" };
return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, reduceAuthNames(localVarAuthNames), _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call findTweetByIdValidateBeforeCall(String id, Set expansions, Set tweetFields, Set userFields, Set mediaFields, Set placeFields, Set pollFields, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'id' is set
if (id == null) {
throw new ApiException("Missing the required parameter 'id' when calling findTweetById(Async)");
}
okhttp3.Call localVarCall = findTweetByIdCall(id, expansions, tweetFields, userFields, mediaFields, placeFields, pollFields, _callback);
return localVarCall;
}
/**
* Tweet lookup by Tweet ID
* Returns a variety of information about the Tweet specified by the requested ID.
* @param id A single Tweet ID. (required)
* @param expansions A comma separated list of fields to expand. (optional)
* @param tweetFields A comma separated list of Tweet fields to display. (optional)
* @param userFields A comma separated list of User fields to display. (optional)
* @param mediaFields A comma separated list of Media fields to display. (optional)
* @param placeFields A comma separated list of Place fields to display. (optional)
* @param pollFields A comma separated list of Poll fields to display. (optional)
* @return SingleTweetLookupResponse
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
* @http.response.details
Status Code
Description
Response Headers
200
The request was successful
-
0
The request has failed.
-
*/
public SingleTweetLookupResponse findTweetById(String id, Set expansions, Set tweetFields, Set userFields, Set mediaFields, Set placeFields, Set pollFields) throws ApiException {
ApiResponse localVarResp;
try{
localVarResp = findTweetByIdWithHttpInfo(id, expansions, tweetFields, userFields, mediaFields, placeFields, pollFields);
} catch (ApiException e) {
if (isOAUth2AutoRefreshToken() && e.getCode() == 401) {
refreshToken();
localVarResp = findTweetByIdWithHttpInfo(id, expansions, tweetFields, userFields, mediaFields, placeFields, pollFields);
} else {
throw e;
}
}
return localVarResp != null ? localVarResp.getData() : null;
}
/**
* Calls the API using a retry mechanism to handle rate limits errors.
*
*/
public SingleTweetLookupResponse findTweetById(Integer retries, String id, Set expansions, Set tweetFields, Set userFields, Set mediaFields, Set placeFields, Set pollFields) throws ApiException {
SingleTweetLookupResponse localVarResp;
try{
localVarResp = findTweetById(id, expansions, tweetFields, userFields, mediaFields, placeFields, pollFields);
} catch (ApiException e) {
if(handleRateLimit(e, retries)) {
return findTweetById(retries - 1, id, expansions, tweetFields, userFields, mediaFields, placeFields, pollFields);
} else {
throw e;
}
}
return localVarResp;
}
/**
* Tweet lookup by Tweet ID
* Returns a variety of information about the Tweet specified by the requested ID.
* @param id A single Tweet ID. (required)
* @param expansions A comma separated list of fields to expand. (optional)
* @param tweetFields A comma separated list of Tweet fields to display. (optional)
* @param userFields A comma separated list of User fields to display. (optional)
* @param mediaFields A comma separated list of Media fields to display. (optional)
* @param placeFields A comma separated list of Place fields to display. (optional)
* @param pollFields A comma separated list of Poll fields to display. (optional)
* @return ApiResponse<SingleTweetLookupResponse>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
* @http.response.details
Status Code
Description
Response Headers
200
The request was successful
-
0
The request has failed.
-
*/
public ApiResponse findTweetByIdWithHttpInfo(String id, Set expansions, Set tweetFields, Set userFields, Set mediaFields, Set placeFields, Set pollFields) throws ApiException {
okhttp3.Call localVarCall = findTweetByIdValidateBeforeCall(id, expansions, tweetFields, userFields, mediaFields, placeFields, pollFields, null);
try {
Type localVarReturnType = new TypeToken(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
} catch (ApiException e) {
e.setErrorObject(localVarApiClient.getJSON().getGson().fromJson(e.getResponseBody(), new TypeToken(){}.getType()));
e.setErrorObjectType(new GenericType(){});
throw e;
}
}
/**
* Tweet lookup by Tweet ID (asynchronously)
* Returns a variety of information about the Tweet specified by the requested ID.
* @param id A single Tweet ID. (required)
* @param expansions A comma separated list of fields to expand. (optional)
* @param tweetFields A comma separated list of Tweet fields to display. (optional)
* @param userFields A comma separated list of User fields to display. (optional)
* @param mediaFields A comma separated list of Media fields to display. (optional)
* @param placeFields A comma separated list of Place fields to display. (optional)
* @param pollFields A comma separated list of Poll fields to display. (optional)
* @param _callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
* @http.response.details
Status Code
Description
Response Headers
200
The request was successful
-
0
The request has failed.
-
*/
public okhttp3.Call findTweetByIdAsync(String id, Set expansions, Set tweetFields, Set userFields, Set mediaFields, Set placeFields, Set pollFields, final ApiCallback _callback) throws ApiException {
okhttp3.Call localVarCall = findTweetByIdValidateBeforeCall(id, expansions, tweetFields, userFields, mediaFields, placeFields, pollFields, _callback);
Type localVarReturnType = new TypeToken(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
/**
* Build call for findTweetsById
* @param ids A comma separated list of Tweet IDs. Up to 100 are allowed in a single request. (required)
* @param expansions A comma separated list of fields to expand. (optional)
* @param tweetFields A comma separated list of Tweet fields to display. (optional)
* @param userFields A comma separated list of User fields to display. (optional)
* @param mediaFields A comma separated list of Media fields to display. (optional)
* @param placeFields A comma separated list of Place fields to display. (optional)
* @param pollFields A comma separated list of Poll fields to display. (optional)
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
* @http.response.details
Status Code
Description
Response Headers
200
The request was successful
-
0
The request has failed.
-
*/
public okhttp3.Call findTweetsByIdCall(List ids, Set expansions, Set tweetFields, Set userFields, Set mediaFields, Set placeFields, Set pollFields, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/2/tweets";
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarCookieParams = new HashMap();
Map localVarFormParams = new HashMap();
if (ids != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "ids", ids));
}
if (expansions != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "expansions", expansions));
}
if (tweetFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "tweet.fields", tweetFields));
}
if (userFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "user.fields", userFields));
}
if (mediaFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "media.fields", mediaFields));
}
if (placeFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "place.fields", placeFields));
}
if (pollFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "poll.fields", pollFields));
}
final String[] localVarAccepts = {
"application/json", "application/problem+json"
};
final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) {
localVarHeaderParams.put("Accept", localVarAccept);
}
final String[] localVarContentTypes = {
};
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
if (localVarContentType != null) {
localVarHeaderParams.put("Content-Type", localVarContentType);
}
String[] localVarAuthNames = new String[] { "BearerToken", "OAuth2UserToken", "UserToken" };
return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, reduceAuthNames(localVarAuthNames), _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call findTweetsByIdValidateBeforeCall(List ids, Set expansions, Set tweetFields, Set userFields, Set mediaFields, Set placeFields, Set pollFields, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'ids' is set
if (ids == null) {
throw new ApiException("Missing the required parameter 'ids' when calling findTweetsById(Async)");
}
okhttp3.Call localVarCall = findTweetsByIdCall(ids, expansions, tweetFields, userFields, mediaFields, placeFields, pollFields, _callback);
return localVarCall;
}
/**
* Tweet lookup by Tweet IDs
* Returns a variety of information about the Tweet specified by the requested ID.
* @param ids A comma separated list of Tweet IDs. Up to 100 are allowed in a single request. (required)
* @param expansions A comma separated list of fields to expand. (optional)
* @param tweetFields A comma separated list of Tweet fields to display. (optional)
* @param userFields A comma separated list of User fields to display. (optional)
* @param mediaFields A comma separated list of Media fields to display. (optional)
* @param placeFields A comma separated list of Place fields to display. (optional)
* @param pollFields A comma separated list of Poll fields to display. (optional)
* @return MultiTweetLookupResponse
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
* @http.response.details
Status Code
Description
Response Headers
200
The request was successful
-
0
The request has failed.
-
*/
public MultiTweetLookupResponse findTweetsById(List ids, Set expansions, Set tweetFields, Set userFields, Set mediaFields, Set placeFields, Set pollFields) throws ApiException {
ApiResponse localVarResp;
try{
localVarResp = findTweetsByIdWithHttpInfo(ids, expansions, tweetFields, userFields, mediaFields, placeFields, pollFields);
} catch (ApiException e) {
if (isOAUth2AutoRefreshToken() && e.getCode() == 401) {
refreshToken();
localVarResp = findTweetsByIdWithHttpInfo(ids, expansions, tweetFields, userFields, mediaFields, placeFields, pollFields);
} else {
throw e;
}
}
return localVarResp != null ? localVarResp.getData() : null;
}
/**
* Calls the API using a retry mechanism to handle rate limits errors.
*
*/
public MultiTweetLookupResponse findTweetsById(Integer retries, List ids, Set expansions, Set tweetFields, Set userFields, Set mediaFields, Set placeFields, Set pollFields) throws ApiException {
MultiTweetLookupResponse localVarResp;
try{
localVarResp = findTweetsById(ids, expansions, tweetFields, userFields, mediaFields, placeFields, pollFields);
} catch (ApiException e) {
if(handleRateLimit(e, retries)) {
return findTweetsById(retries - 1, ids, expansions, tweetFields, userFields, mediaFields, placeFields, pollFields);
} else {
throw e;
}
}
return localVarResp;
}
/**
* Tweet lookup by Tweet IDs
* Returns a variety of information about the Tweet specified by the requested ID.
* @param ids A comma separated list of Tweet IDs. Up to 100 are allowed in a single request. (required)
* @param expansions A comma separated list of fields to expand. (optional)
* @param tweetFields A comma separated list of Tweet fields to display. (optional)
* @param userFields A comma separated list of User fields to display. (optional)
* @param mediaFields A comma separated list of Media fields to display. (optional)
* @param placeFields A comma separated list of Place fields to display. (optional)
* @param pollFields A comma separated list of Poll fields to display. (optional)
* @return ApiResponse<MultiTweetLookupResponse>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
* @http.response.details
Status Code
Description
Response Headers
200
The request was successful
-
0
The request has failed.
-
*/
public ApiResponse findTweetsByIdWithHttpInfo(List ids, Set expansions, Set tweetFields, Set userFields, Set mediaFields, Set placeFields, Set pollFields) throws ApiException {
okhttp3.Call localVarCall = findTweetsByIdValidateBeforeCall(ids, expansions, tweetFields, userFields, mediaFields, placeFields, pollFields, null);
try {
Type localVarReturnType = new TypeToken(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
} catch (ApiException e) {
e.setErrorObject(localVarApiClient.getJSON().getGson().fromJson(e.getResponseBody(), new TypeToken(){}.getType()));
e.setErrorObjectType(new GenericType(){});
throw e;
}
}
/**
* Tweet lookup by Tweet IDs (asynchronously)
* Returns a variety of information about the Tweet specified by the requested ID.
* @param ids A comma separated list of Tweet IDs. Up to 100 are allowed in a single request. (required)
* @param expansions A comma separated list of fields to expand. (optional)
* @param tweetFields A comma separated list of Tweet fields to display. (optional)
* @param userFields A comma separated list of User fields to display. (optional)
* @param mediaFields A comma separated list of Media fields to display. (optional)
* @param placeFields A comma separated list of Place fields to display. (optional)
* @param pollFields A comma separated list of Poll fields to display. (optional)
* @param _callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
* @http.response.details
Status Code
Description
Response Headers
200
The request was successful
-
0
The request has failed.
-
*/
public okhttp3.Call findTweetsByIdAsync(List ids, Set expansions, Set tweetFields, Set userFields, Set mediaFields, Set placeFields, Set pollFields, final ApiCallback _callback) throws ApiException {
okhttp3.Call localVarCall = findTweetsByIdValidateBeforeCall(ids, expansions, tweetFields, userFields, mediaFields, placeFields, pollFields, _callback);
Type localVarReturnType = new TypeToken(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
/**
* Build call for findTweetsThatQuoteATweet
* @param id The ID of the Quoted Tweet. (required)
* @param maxResults The maximum number of results to be returned. (optional, default to 10)
* @param exclude The set of entities to exclude (e.g. 'replies' or 'retweets') (optional)
* @param expansions A comma separated list of fields to expand. (optional)
* @param tweetFields A comma separated list of Tweet fields to display. (optional)
* @param userFields A comma separated list of User fields to display. (optional)
* @param mediaFields A comma separated list of Media fields to display. (optional)
* @param placeFields A comma separated list of Place fields to display. (optional)
* @param pollFields A comma separated list of Poll fields to display. (optional)
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
* @http.response.details
Status Code
Description
Response Headers
200
The request was successful
-
0
The request has failed.
-
*/
public okhttp3.Call findTweetsThatQuoteATweetCall(String id, Integer maxResults, Set exclude, Set expansions, Set tweetFields, Set userFields, Set mediaFields, Set placeFields, Set pollFields, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/2/tweets/{id}/quote_tweets"
.replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString()));
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarCookieParams = new HashMap();
Map localVarFormParams = new HashMap();
if (maxResults != null) {
localVarQueryParams.addAll(localVarApiClient.parameterToPair("max_results", maxResults));
}
if (exclude != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "exclude", exclude));
}
if (expansions != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "expansions", expansions));
}
if (tweetFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "tweet.fields", tweetFields));
}
if (userFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "user.fields", userFields));
}
if (mediaFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "media.fields", mediaFields));
}
if (placeFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "place.fields", placeFields));
}
if (pollFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "poll.fields", pollFields));
}
final String[] localVarAccepts = {
"application/json", "application/problem+json"
};
final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) {
localVarHeaderParams.put("Accept", localVarAccept);
}
final String[] localVarContentTypes = {
};
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
if (localVarContentType != null) {
localVarHeaderParams.put("Content-Type", localVarContentType);
}
String[] localVarAuthNames = new String[] { "BearerToken", "OAuth2UserToken", "UserToken" };
return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, reduceAuthNames(localVarAuthNames), _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call findTweetsThatQuoteATweetValidateBeforeCall(String id, Integer maxResults, Set exclude, Set expansions, Set tweetFields, Set userFields, Set mediaFields, Set placeFields, Set pollFields, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'id' is set
if (id == null) {
throw new ApiException("Missing the required parameter 'id' when calling findTweetsThatQuoteATweet(Async)");
}
okhttp3.Call localVarCall = findTweetsThatQuoteATweetCall(id, maxResults, exclude, expansions, tweetFields, userFields, mediaFields, placeFields, pollFields, _callback);
return localVarCall;
}
/**
* Retrieve tweets that quote a tweet.
* Returns a variety of information about each tweet that quotes the Tweet specified by the requested ID.
* @param id The ID of the Quoted Tweet. (required)
* @param maxResults The maximum number of results to be returned. (optional, default to 10)
* @param exclude The set of entities to exclude (e.g. 'replies' or 'retweets') (optional)
* @param expansions A comma separated list of fields to expand. (optional)
* @param tweetFields A comma separated list of Tweet fields to display. (optional)
* @param userFields A comma separated list of User fields to display. (optional)
* @param mediaFields A comma separated list of Media fields to display. (optional)
* @param placeFields A comma separated list of Place fields to display. (optional)
* @param pollFields A comma separated list of Poll fields to display. (optional)
* @return QuoteTweetLookupResponse
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
* @http.response.details
Status Code
Description
Response Headers
200
The request was successful
-
0
The request has failed.
-
*/
public QuoteTweetLookupResponse findTweetsThatQuoteATweet(String id, Integer maxResults, Set exclude, Set expansions, Set tweetFields, Set userFields, Set mediaFields, Set placeFields, Set pollFields) throws ApiException {
ApiResponse localVarResp;
try{
localVarResp = findTweetsThatQuoteATweetWithHttpInfo(id, maxResults, exclude, expansions, tweetFields, userFields, mediaFields, placeFields, pollFields);
} catch (ApiException e) {
if (isOAUth2AutoRefreshToken() && e.getCode() == 401) {
refreshToken();
localVarResp = findTweetsThatQuoteATweetWithHttpInfo(id, maxResults, exclude, expansions, tweetFields, userFields, mediaFields, placeFields, pollFields);
} else {
throw e;
}
}
return localVarResp != null ? localVarResp.getData() : null;
}
/**
* Calls the API using a retry mechanism to handle rate limits errors.
*
*/
public QuoteTweetLookupResponse findTweetsThatQuoteATweet(Integer retries, String id, Integer maxResults, Set exclude, Set expansions, Set tweetFields, Set userFields, Set mediaFields, Set placeFields, Set pollFields) throws ApiException {
QuoteTweetLookupResponse localVarResp;
try{
localVarResp = findTweetsThatQuoteATweet(id, maxResults, exclude, expansions, tweetFields, userFields, mediaFields, placeFields, pollFields);
} catch (ApiException e) {
if(handleRateLimit(e, retries)) {
return findTweetsThatQuoteATweet(retries - 1, id, maxResults, exclude, expansions, tweetFields, userFields, mediaFields, placeFields, pollFields);
} else {
throw e;
}
}
return localVarResp;
}
/**
* Retrieve tweets that quote a tweet.
* Returns a variety of information about each tweet that quotes the Tweet specified by the requested ID.
* @param id The ID of the Quoted Tweet. (required)
* @param maxResults The maximum number of results to be returned. (optional, default to 10)
* @param exclude The set of entities to exclude (e.g. 'replies' or 'retweets') (optional)
* @param expansions A comma separated list of fields to expand. (optional)
* @param tweetFields A comma separated list of Tweet fields to display. (optional)
* @param userFields A comma separated list of User fields to display. (optional)
* @param mediaFields A comma separated list of Media fields to display. (optional)
* @param placeFields A comma separated list of Place fields to display. (optional)
* @param pollFields A comma separated list of Poll fields to display. (optional)
* @return ApiResponse<QuoteTweetLookupResponse>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
* @http.response.details
Status Code
Description
Response Headers
200
The request was successful
-
0
The request has failed.
-
*/
public ApiResponse findTweetsThatQuoteATweetWithHttpInfo(String id, Integer maxResults, Set exclude, Set expansions, Set tweetFields, Set userFields, Set mediaFields, Set placeFields, Set pollFields) throws ApiException {
okhttp3.Call localVarCall = findTweetsThatQuoteATweetValidateBeforeCall(id, maxResults, exclude, expansions, tweetFields, userFields, mediaFields, placeFields, pollFields, null);
try {
Type localVarReturnType = new TypeToken(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
} catch (ApiException e) {
e.setErrorObject(localVarApiClient.getJSON().getGson().fromJson(e.getResponseBody(), new TypeToken(){}.getType()));
e.setErrorObjectType(new GenericType(){});
throw e;
}
}
/**
* Retrieve tweets that quote a tweet. (asynchronously)
* Returns a variety of information about each tweet that quotes the Tweet specified by the requested ID.
* @param id The ID of the Quoted Tweet. (required)
* @param maxResults The maximum number of results to be returned. (optional, default to 10)
* @param exclude The set of entities to exclude (e.g. 'replies' or 'retweets') (optional)
* @param expansions A comma separated list of fields to expand. (optional)
* @param tweetFields A comma separated list of Tweet fields to display. (optional)
* @param userFields A comma separated list of User fields to display. (optional)
* @param mediaFields A comma separated list of Media fields to display. (optional)
* @param placeFields A comma separated list of Place fields to display. (optional)
* @param pollFields A comma separated list of Poll fields to display. (optional)
* @param _callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
* @http.response.details
Status Code
Description
Response Headers
200
The request was successful
-
0
The request has failed.
-
*/
public okhttp3.Call findTweetsThatQuoteATweetAsync(String id, Integer maxResults, Set exclude, Set expansions, Set tweetFields, Set userFields, Set mediaFields, Set placeFields, Set pollFields, final ApiCallback _callback) throws ApiException {
okhttp3.Call localVarCall = findTweetsThatQuoteATweetValidateBeforeCall(id, maxResults, exclude, expansions, tweetFields, userFields, mediaFields, placeFields, pollFields, _callback);
Type localVarReturnType = new TypeToken(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
/**
* Build call for getRules
* @param ids A comma-separated list of Rule IDs. (optional)
* @param maxResults The maximum number of results (optional, default to 1000)
* @param paginationToken This value is populated by passing the 'next_token' returned in a request to paginate through results. (optional)
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
* @http.response.details
Status Code
Description
Response Headers
200
The request was successful
-
0
The request has failed.
-
*/
public okhttp3.Call getRulesCall(List ids, Integer maxResults, String paginationToken, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/2/tweets/search/stream/rules";
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarCookieParams = new HashMap();
Map localVarFormParams = new HashMap();
if (ids != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "ids", ids));
}
if (maxResults != null) {
localVarQueryParams.addAll(localVarApiClient.parameterToPair("max_results", maxResults));
}
if (paginationToken != null) {
localVarQueryParams.addAll(localVarApiClient.parameterToPair("pagination_token", paginationToken));
}
final String[] localVarAccepts = {
"application/json", "application/problem+json"
};
final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) {
localVarHeaderParams.put("Accept", localVarAccept);
}
final String[] localVarContentTypes = {
};
final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
if (localVarContentType != null) {
localVarHeaderParams.put("Content-Type", localVarContentType);
}
String[] localVarAuthNames = new String[] { "BearerToken" };
return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, reduceAuthNames(localVarAuthNames), _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call getRulesValidateBeforeCall(List ids, Integer maxResults, String paginationToken, final ApiCallback _callback) throws ApiException {
okhttp3.Call localVarCall = getRulesCall(ids, maxResults, paginationToken, _callback);
return localVarCall;
}
/**
* Rules lookup
* Returns rules from a user's active rule set. Users can fetch all of their rules or a subset, specified by the provided rule ids.
* @param ids A comma-separated list of Rule IDs. (optional)
* @param maxResults The maximum number of results (optional, default to 1000)
* @param paginationToken This value is populated by passing the 'next_token' returned in a request to paginate through results. (optional)
* @return GetRulesResponse
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
* @http.response.details
Status Code
Description
Response Headers
200
The request was successful
-
0
The request has failed.
-
*/
public GetRulesResponse getRules(List ids, Integer maxResults, String paginationToken) throws ApiException {
ApiResponse localVarResp;
try{
localVarResp = getRulesWithHttpInfo(ids, maxResults, paginationToken);
} catch (ApiException e) {
if (isOAUth2AutoRefreshToken() && e.getCode() == 401) {
refreshToken();
localVarResp = getRulesWithHttpInfo(ids, maxResults, paginationToken);
} else {
throw e;
}
}
return localVarResp != null ? localVarResp.getData() : null;
}
/**
* Calls the API using a retry mechanism to handle rate limits errors.
*
*/
public GetRulesResponse getRules(Integer retries, List ids, Integer maxResults, String paginationToken) throws ApiException {
GetRulesResponse localVarResp;
try{
localVarResp = getRules(ids, maxResults, paginationToken);
} catch (ApiException e) {
if(handleRateLimit(e, retries)) {
return getRules(retries - 1, ids, maxResults, paginationToken);
} else {
throw e;
}
}
return localVarResp;
}
/**
* Rules lookup
* Returns rules from a user's active rule set. Users can fetch all of their rules or a subset, specified by the provided rule ids.
* @param ids A comma-separated list of Rule IDs. (optional)
* @param maxResults The maximum number of results (optional, default to 1000)
* @param paginationToken This value is populated by passing the 'next_token' returned in a request to paginate through results. (optional)
* @return ApiResponse<GetRulesResponse>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
* @http.response.details
Status Code
Description
Response Headers
200
The request was successful
-
0
The request has failed.
-
*/
public ApiResponse getRulesWithHttpInfo(List ids, Integer maxResults, String paginationToken) throws ApiException {
okhttp3.Call localVarCall = getRulesValidateBeforeCall(ids, maxResults, paginationToken, null);
try {
Type localVarReturnType = new TypeToken(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
} catch (ApiException e) {
e.setErrorObject(localVarApiClient.getJSON().getGson().fromJson(e.getResponseBody(), new TypeToken(){}.getType()));
e.setErrorObjectType(new GenericType(){});
throw e;
}
}
/**
* Rules lookup (asynchronously)
* Returns rules from a user's active rule set. Users can fetch all of their rules or a subset, specified by the provided rule ids.
* @param ids A comma-separated list of Rule IDs. (optional)
* @param maxResults The maximum number of results (optional, default to 1000)
* @param paginationToken This value is populated by passing the 'next_token' returned in a request to paginate through results. (optional)
* @param _callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
* @http.response.details
Status Code
Description
Response Headers
200
The request was successful
-
0
The request has failed.
-
*/
public okhttp3.Call getRulesAsync(List ids, Integer maxResults, String paginationToken, final ApiCallback _callback) throws ApiException {
okhttp3.Call localVarCall = getRulesValidateBeforeCall(ids, maxResults, paginationToken, _callback);
Type localVarReturnType = new TypeToken(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
/**
* Build call for hideReplyById
* @param hideReplyByIdRequest (optional)
* @param id The ID of the reply that you want to hide or unhide. (required)
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
* @http.response.details
Status Code
Description
Response Headers
200
A successful response. The reply has been hidden or unhidden.
-
0
The request has failed.
-
*/
public okhttp3.Call hideReplyByIdCall(HideReplyByIdRequest hideReplyByIdRequest, String id, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = hideReplyByIdRequest;
// create path and map variables
String localVarPath = "/2/tweets/{id}/hidden"
.replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString()));
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map