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.BlockUserMutationResponse;
import com.twitter.clientlib.model.BlockUserRequest;
import com.twitter.clientlib.model.Error;
import com.twitter.clientlib.model.Get2ListsIdFollowersResponse;
import com.twitter.clientlib.model.Get2ListsIdMembersResponse;
import com.twitter.clientlib.model.Get2TweetsIdLikingUsersResponse;
import com.twitter.clientlib.model.Get2TweetsIdRetweetedByResponse;
import com.twitter.clientlib.model.Get2UsersByResponse;
import com.twitter.clientlib.model.Get2UsersByUsernameUsernameResponse;
import com.twitter.clientlib.model.Get2UsersIdBlockingResponse;
import com.twitter.clientlib.model.Get2UsersIdFollowersResponse;
import com.twitter.clientlib.model.Get2UsersIdFollowingResponse;
import com.twitter.clientlib.model.Get2UsersIdMutingResponse;
import com.twitter.clientlib.model.Get2UsersIdResponse;
import com.twitter.clientlib.model.Get2UsersMeResponse;
import com.twitter.clientlib.model.Get2UsersResponse;
import com.twitter.clientlib.model.MuteUserMutationResponse;
import com.twitter.clientlib.model.MuteUserRequest;
import com.twitter.clientlib.model.Problem;
import java.util.Set;
import com.twitter.clientlib.model.UsersFollowingCreateRequest;
import com.twitter.clientlib.model.UsersFollowingCreateResponse;
import com.twitter.clientlib.model.UsersFollowingDeleteResponse;
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 UsersApi extends ApiCommon {
private okhttp3.Call findMyUserCall(Set userFields, Set expansions, Set tweetFields, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/2/users/me";
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarCookieParams = new HashMap();
Map localVarFormParams = new HashMap();
if (userFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "user.fields", userFields));
}
if (expansions != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "expansions", expansions));
}
if (tweetFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "tweet.fields", tweetFields));
}
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, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, reduceAuthNames(localVarAuthNames), _callback);
}
@SuppressWarnings("rawtypes")
private okhttp3.Call findMyUserValidateBeforeCall(Set userFields, Set expansions, Set tweetFields, final ApiCallback _callback) throws ApiException {
okhttp3.Call localVarCall = findMyUserCall(userFields, expansions, tweetFields, _callback);
return localVarCall;
}
private ApiResponse findMyUserWithHttpInfo(Set userFields, Set expansions, Set tweetFields) throws ApiException {
okhttp3.Call localVarCall = findMyUserValidateBeforeCall(userFields, expansions, tweetFields, 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()));
throw e;
}
}
private okhttp3.Call findMyUserAsync(Set userFields, Set expansions, Set tweetFields, final ApiCallback _callback) throws ApiException {
okhttp3.Call localVarCall = findMyUserValidateBeforeCall(userFields, expansions, tweetFields, _callback);
Type localVarReturnType = new TypeToken(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
public class APIfindMyUserRequest {
private Set userFields;
private Set expansions;
private Set tweetFields;
private APIfindMyUserRequest() {
}
/**
* Set userFields
* @param userFields A comma separated list of User fields to display. (optional)
* @return APIfindMyUserRequest
*/
public APIfindMyUserRequest userFields(Set userFields) {
this.userFields = userFields;
return this;
}
/**
* Set expansions
* @param expansions A comma separated list of fields to expand. (optional)
* @return APIfindMyUserRequest
*/
public APIfindMyUserRequest expansions(Set expansions) {
this.expansions = expansions;
return this;
}
/**
* Set tweetFields
* @param tweetFields A comma separated list of Tweet fields to display. (optional)
* @return APIfindMyUserRequest
*/
public APIfindMyUserRequest tweetFields(Set tweetFields) {
this.tweetFields = tweetFields;
return this;
}
/**
* Build call for findMyUser
* @param _callback ApiCallback API callback
* @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 has succeeded.
-
0
The request has failed.
-
*/
public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException {
return findMyUserCall(userFields, expansions, tweetFields, _callback);
}
/**
* Execute findMyUser request
* @return Get2UsersMeResponse
* @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 has succeeded.
-
0
The request has failed.
-
*/
public Get2UsersMeResponse execute() throws ApiException {
ApiResponse localVarResp = findMyUserWithHttpInfo(userFields, expansions, tweetFields);
return localVarResp.getData();
}
/**
* Calls the API using a retry mechanism to handle rate limits errors.
*
*/
public Get2UsersMeResponse execute(Integer retries) throws ApiException {
Get2UsersMeResponse localVarResp;
try{
localVarResp = execute();
} catch (ApiException e) {
if(handleRateLimit(e, retries)) {
return execute(retries - 1);
} else {
throw e;
}
}
return localVarResp;
}
/**
* Execute findMyUser request with HTTP info returned
* @return ApiResponse<Get2UsersMeResponse>
* @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 has succeeded.
-
0
The request has failed.
-
*/
public ApiResponse executeWithHttpInfo() throws ApiException {
return findMyUserWithHttpInfo(userFields, expansions, tweetFields);
}
/**
* Execute findMyUser request (asynchronously)
* @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 has succeeded.
-
0
The request has failed.
-
*/
public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException {
return findMyUserAsync(userFields, expansions, tweetFields, _callback);
}
}
/**
* User lookup me
* This endpoint returns information about the requesting User.
* @return APIfindMyUserRequest
* @http.response.details
Status Code
Description
Response Headers
200
The request has succeeded.
-
0
The request has failed.
-
*/
public APIfindMyUserRequest findMyUser() {
return new APIfindMyUserRequest();
}
private okhttp3.Call findUserByIdCall(String id, Set userFields, Set expansions, Set tweetFields, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/2/users/{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 (userFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "user.fields", userFields));
}
if (expansions != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "expansions", expansions));
}
if (tweetFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "tweet.fields", tweetFields));
}
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 findUserByIdValidateBeforeCall(String id, Set userFields, Set expansions, Set tweetFields, 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 findUserById(Async)");
}
okhttp3.Call localVarCall = findUserByIdCall(id, userFields, expansions, tweetFields, _callback);
return localVarCall;
}
private ApiResponse findUserByIdWithHttpInfo(String id, Set userFields, Set expansions, Set tweetFields) throws ApiException {
okhttp3.Call localVarCall = findUserByIdValidateBeforeCall(id, userFields, expansions, tweetFields, 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()));
throw e;
}
}
private okhttp3.Call findUserByIdAsync(String id, Set userFields, Set expansions, Set tweetFields, final ApiCallback _callback) throws ApiException {
okhttp3.Call localVarCall = findUserByIdValidateBeforeCall(id, userFields, expansions, tweetFields, _callback);
Type localVarReturnType = new TypeToken(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
public class APIfindUserByIdRequest {
private final String id;
private Set userFields;
private Set expansions;
private Set tweetFields;
private APIfindUserByIdRequest(String id) {
this.id = id;
}
/**
* Set userFields
* @param userFields A comma separated list of User fields to display. (optional)
* @return APIfindUserByIdRequest
*/
public APIfindUserByIdRequest userFields(Set userFields) {
this.userFields = userFields;
return this;
}
/**
* Set expansions
* @param expansions A comma separated list of fields to expand. (optional)
* @return APIfindUserByIdRequest
*/
public APIfindUserByIdRequest expansions(Set expansions) {
this.expansions = expansions;
return this;
}
/**
* Set tweetFields
* @param tweetFields A comma separated list of Tweet fields to display. (optional)
* @return APIfindUserByIdRequest
*/
public APIfindUserByIdRequest tweetFields(Set tweetFields) {
this.tweetFields = tweetFields;
return this;
}
/**
* Build call for findUserById
* @param _callback ApiCallback API callback
* @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 has succeeded.
-
0
The request has failed.
-
*/
public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException {
return findUserByIdCall(id, userFields, expansions, tweetFields, _callback);
}
/**
* Execute findUserById request
* @return Get2UsersIdResponse
* @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 has succeeded.
-
0
The request has failed.
-
*/
public Get2UsersIdResponse execute() throws ApiException {
ApiResponse localVarResp = findUserByIdWithHttpInfo(id, userFields, expansions, tweetFields);
return localVarResp.getData();
}
/**
* Calls the API using a retry mechanism to handle rate limits errors.
*
*/
public Get2UsersIdResponse execute(Integer retries) throws ApiException {
Get2UsersIdResponse localVarResp;
try{
localVarResp = execute();
} catch (ApiException e) {
if(handleRateLimit(e, retries)) {
return execute(retries - 1);
} else {
throw e;
}
}
return localVarResp;
}
/**
* Execute findUserById request with HTTP info returned
* @return ApiResponse<Get2UsersIdResponse>
* @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 has succeeded.
-
0
The request has failed.
-
*/
public ApiResponse executeWithHttpInfo() throws ApiException {
return findUserByIdWithHttpInfo(id, userFields, expansions, tweetFields);
}
/**
* Execute findUserById request (asynchronously)
* @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 has succeeded.
-
0
The request has failed.
-
*/
public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException {
return findUserByIdAsync(id, userFields, expansions, tweetFields, _callback);
}
}
/**
* User lookup by ID
* This endpoint returns information about a User. Specify User by ID.
* @param id The ID of the User to lookup. (required)
* @return APIfindUserByIdRequest
* @http.response.details
Status Code
Description
Response Headers
200
The request has succeeded.
-
0
The request has failed.
-
*/
public APIfindUserByIdRequest findUserById(String id) {
return new APIfindUserByIdRequest(id);
}
private okhttp3.Call findUserByUsernameCall(String username, Set userFields, Set expansions, Set tweetFields, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/2/users/by/username/{username}"
.replaceAll("\\{" + "username" + "\\}", localVarApiClient.escapeString(username.toString()));
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarCookieParams = new HashMap();
Map localVarFormParams = new HashMap();
if (userFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "user.fields", userFields));
}
if (expansions != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "expansions", expansions));
}
if (tweetFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "tweet.fields", tweetFields));
}
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 findUserByUsernameValidateBeforeCall(String username, Set userFields, Set expansions, Set tweetFields, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'username' is set
if (username == null) {
throw new ApiException("Missing the required parameter 'username' when calling findUserByUsername(Async)");
}
okhttp3.Call localVarCall = findUserByUsernameCall(username, userFields, expansions, tweetFields, _callback);
return localVarCall;
}
private ApiResponse findUserByUsernameWithHttpInfo(String username, Set userFields, Set expansions, Set tweetFields) throws ApiException {
okhttp3.Call localVarCall = findUserByUsernameValidateBeforeCall(username, userFields, expansions, tweetFields, 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()));
throw e;
}
}
private okhttp3.Call findUserByUsernameAsync(String username, Set userFields, Set expansions, Set tweetFields, final ApiCallback _callback) throws ApiException {
okhttp3.Call localVarCall = findUserByUsernameValidateBeforeCall(username, userFields, expansions, tweetFields, _callback);
Type localVarReturnType = new TypeToken(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
public class APIfindUserByUsernameRequest {
private final String username;
private Set userFields;
private Set expansions;
private Set tweetFields;
private APIfindUserByUsernameRequest(String username) {
this.username = username;
}
/**
* Set userFields
* @param userFields A comma separated list of User fields to display. (optional)
* @return APIfindUserByUsernameRequest
*/
public APIfindUserByUsernameRequest userFields(Set userFields) {
this.userFields = userFields;
return this;
}
/**
* Set expansions
* @param expansions A comma separated list of fields to expand. (optional)
* @return APIfindUserByUsernameRequest
*/
public APIfindUserByUsernameRequest expansions(Set expansions) {
this.expansions = expansions;
return this;
}
/**
* Set tweetFields
* @param tweetFields A comma separated list of Tweet fields to display. (optional)
* @return APIfindUserByUsernameRequest
*/
public APIfindUserByUsernameRequest tweetFields(Set tweetFields) {
this.tweetFields = tweetFields;
return this;
}
/**
* Build call for findUserByUsername
* @param _callback ApiCallback API callback
* @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 has succeeded.
-
0
The request has failed.
-
*/
public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException {
return findUserByUsernameCall(username, userFields, expansions, tweetFields, _callback);
}
/**
* Execute findUserByUsername request
* @return Get2UsersByUsernameUsernameResponse
* @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 has succeeded.
-
0
The request has failed.
-
*/
public Get2UsersByUsernameUsernameResponse execute() throws ApiException {
ApiResponse localVarResp = findUserByUsernameWithHttpInfo(username, userFields, expansions, tweetFields);
return localVarResp.getData();
}
/**
* Calls the API using a retry mechanism to handle rate limits errors.
*
*/
public Get2UsersByUsernameUsernameResponse execute(Integer retries) throws ApiException {
Get2UsersByUsernameUsernameResponse localVarResp;
try{
localVarResp = execute();
} catch (ApiException e) {
if(handleRateLimit(e, retries)) {
return execute(retries - 1);
} else {
throw e;
}
}
return localVarResp;
}
/**
* Execute findUserByUsername request with HTTP info returned
* @return ApiResponse<Get2UsersByUsernameUsernameResponse>
* @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 has succeeded.
-
0
The request has failed.
-
*/
public ApiResponse executeWithHttpInfo() throws ApiException {
return findUserByUsernameWithHttpInfo(username, userFields, expansions, tweetFields);
}
/**
* Execute findUserByUsername request (asynchronously)
* @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 has succeeded.
-
0
The request has failed.
-
*/
public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException {
return findUserByUsernameAsync(username, userFields, expansions, tweetFields, _callback);
}
}
/**
* User lookup by username
* This endpoint returns information about a User. Specify User by username.
* @param username A username. (required)
* @return APIfindUserByUsernameRequest
* @http.response.details
Status Code
Description
Response Headers
200
The request has succeeded.
-
0
The request has failed.
-
*/
public APIfindUserByUsernameRequest findUserByUsername(String username) {
return new APIfindUserByUsernameRequest(username);
}
private okhttp3.Call findUsersByIdCall(List ids, Set userFields, Set expansions, Set tweetFields, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/2/users";
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 (userFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "user.fields", userFields));
}
if (expansions != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "expansions", expansions));
}
if (tweetFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "tweet.fields", tweetFields));
}
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 findUsersByIdValidateBeforeCall(List ids, Set userFields, Set expansions, Set tweetFields, 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 findUsersById(Async)");
}
okhttp3.Call localVarCall = findUsersByIdCall(ids, userFields, expansions, tweetFields, _callback);
return localVarCall;
}
private ApiResponse findUsersByIdWithHttpInfo(List ids, Set userFields, Set expansions, Set tweetFields) throws ApiException {
okhttp3.Call localVarCall = findUsersByIdValidateBeforeCall(ids, userFields, expansions, tweetFields, 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()));
throw e;
}
}
private okhttp3.Call findUsersByIdAsync(List ids, Set userFields, Set expansions, Set tweetFields, final ApiCallback _callback) throws ApiException {
okhttp3.Call localVarCall = findUsersByIdValidateBeforeCall(ids, userFields, expansions, tweetFields, _callback);
Type localVarReturnType = new TypeToken(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
public class APIfindUsersByIdRequest {
private final List ids;
private Set userFields;
private Set expansions;
private Set tweetFields;
private APIfindUsersByIdRequest(List ids) {
this.ids = ids;
}
/**
* Set userFields
* @param userFields A comma separated list of User fields to display. (optional)
* @return APIfindUsersByIdRequest
*/
public APIfindUsersByIdRequest userFields(Set userFields) {
this.userFields = userFields;
return this;
}
/**
* Set expansions
* @param expansions A comma separated list of fields to expand. (optional)
* @return APIfindUsersByIdRequest
*/
public APIfindUsersByIdRequest expansions(Set expansions) {
this.expansions = expansions;
return this;
}
/**
* Set tweetFields
* @param tweetFields A comma separated list of Tweet fields to display. (optional)
* @return APIfindUsersByIdRequest
*/
public APIfindUsersByIdRequest tweetFields(Set tweetFields) {
this.tweetFields = tweetFields;
return this;
}
/**
* Build call for findUsersById
* @param _callback ApiCallback API callback
* @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 has succeeded.
-
0
The request has failed.
-
*/
public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException {
return findUsersByIdCall(ids, userFields, expansions, tweetFields, _callback);
}
/**
* Execute findUsersById request
* @return Get2UsersResponse
* @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 has succeeded.
-
0
The request has failed.
-
*/
public Get2UsersResponse execute() throws ApiException {
ApiResponse localVarResp = findUsersByIdWithHttpInfo(ids, userFields, expansions, tweetFields);
return localVarResp.getData();
}
/**
* Calls the API using a retry mechanism to handle rate limits errors.
*
*/
public Get2UsersResponse execute(Integer retries) throws ApiException {
Get2UsersResponse localVarResp;
try{
localVarResp = execute();
} catch (ApiException e) {
if(handleRateLimit(e, retries)) {
return execute(retries - 1);
} else {
throw e;
}
}
return localVarResp;
}
/**
* Execute findUsersById request with HTTP info returned
* @return ApiResponse<Get2UsersResponse>
* @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 has succeeded.
-
0
The request has failed.
-
*/
public ApiResponse executeWithHttpInfo() throws ApiException {
return findUsersByIdWithHttpInfo(ids, userFields, expansions, tweetFields);
}
/**
* Execute findUsersById request (asynchronously)
* @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 has succeeded.
-
0
The request has failed.
-
*/
public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException {
return findUsersByIdAsync(ids, userFields, expansions, tweetFields, _callback);
}
}
/**
* User lookup by IDs
* This endpoint returns information about Users. Specify Users by their ID.
* @param ids A list of User IDs, comma-separated. You can specify up to 100 IDs. (required)
* @return APIfindUsersByIdRequest
* @http.response.details
Status Code
Description
Response Headers
200
The request has succeeded.
-
0
The request has failed.
-
*/
public APIfindUsersByIdRequest findUsersById(List ids) {
return new APIfindUsersByIdRequest(ids);
}
private okhttp3.Call findUsersByUsernameCall(List usernames, Set userFields, Set expansions, Set tweetFields, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/2/users/by";
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarCookieParams = new HashMap();
Map localVarFormParams = new HashMap();
if (usernames != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "usernames", usernames));
}
if (userFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "user.fields", userFields));
}
if (expansions != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "expansions", expansions));
}
if (tweetFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "tweet.fields", tweetFields));
}
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 findUsersByUsernameValidateBeforeCall(List usernames, Set userFields, Set expansions, Set tweetFields, final ApiCallback _callback) throws ApiException {
// verify the required parameter 'usernames' is set
if (usernames == null) {
throw new ApiException("Missing the required parameter 'usernames' when calling findUsersByUsername(Async)");
}
okhttp3.Call localVarCall = findUsersByUsernameCall(usernames, userFields, expansions, tweetFields, _callback);
return localVarCall;
}
private ApiResponse findUsersByUsernameWithHttpInfo(List usernames, Set userFields, Set expansions, Set tweetFields) throws ApiException {
okhttp3.Call localVarCall = findUsersByUsernameValidateBeforeCall(usernames, userFields, expansions, tweetFields, 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()));
throw e;
}
}
private okhttp3.Call findUsersByUsernameAsync(List usernames, Set userFields, Set expansions, Set tweetFields, final ApiCallback _callback) throws ApiException {
okhttp3.Call localVarCall = findUsersByUsernameValidateBeforeCall(usernames, userFields, expansions, tweetFields, _callback);
Type localVarReturnType = new TypeToken(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
public class APIfindUsersByUsernameRequest {
private final List usernames;
private Set userFields;
private Set expansions;
private Set tweetFields;
private APIfindUsersByUsernameRequest(List usernames) {
this.usernames = usernames;
}
/**
* Set userFields
* @param userFields A comma separated list of User fields to display. (optional)
* @return APIfindUsersByUsernameRequest
*/
public APIfindUsersByUsernameRequest userFields(Set userFields) {
this.userFields = userFields;
return this;
}
/**
* Set expansions
* @param expansions A comma separated list of fields to expand. (optional)
* @return APIfindUsersByUsernameRequest
*/
public APIfindUsersByUsernameRequest expansions(Set expansions) {
this.expansions = expansions;
return this;
}
/**
* Set tweetFields
* @param tweetFields A comma separated list of Tweet fields to display. (optional)
* @return APIfindUsersByUsernameRequest
*/
public APIfindUsersByUsernameRequest tweetFields(Set tweetFields) {
this.tweetFields = tweetFields;
return this;
}
/**
* Build call for findUsersByUsername
* @param _callback ApiCallback API callback
* @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 has succeeded.
-
0
The request has failed.
-
*/
public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException {
return findUsersByUsernameCall(usernames, userFields, expansions, tweetFields, _callback);
}
/**
* Execute findUsersByUsername request
* @return Get2UsersByResponse
* @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 has succeeded.
-
0
The request has failed.
-
*/
public Get2UsersByResponse execute() throws ApiException {
ApiResponse localVarResp = findUsersByUsernameWithHttpInfo(usernames, userFields, expansions, tweetFields);
return localVarResp.getData();
}
/**
* Calls the API using a retry mechanism to handle rate limits errors.
*
*/
public Get2UsersByResponse execute(Integer retries) throws ApiException {
Get2UsersByResponse localVarResp;
try{
localVarResp = execute();
} catch (ApiException e) {
if(handleRateLimit(e, retries)) {
return execute(retries - 1);
} else {
throw e;
}
}
return localVarResp;
}
/**
* Execute findUsersByUsername request with HTTP info returned
* @return ApiResponse<Get2UsersByResponse>
* @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 has succeeded.
-
0
The request has failed.
-
*/
public ApiResponse executeWithHttpInfo() throws ApiException {
return findUsersByUsernameWithHttpInfo(usernames, userFields, expansions, tweetFields);
}
/**
* Execute findUsersByUsername request (asynchronously)
* @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 has succeeded.
-
0
The request has failed.
-
*/
public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException {
return findUsersByUsernameAsync(usernames, userFields, expansions, tweetFields, _callback);
}
}
/**
* User lookup by usernames
* This endpoint returns information about Users. Specify Users by their username.
* @param usernames A list of usernames, comma-separated. (required)
* @return APIfindUsersByUsernameRequest
* @http.response.details
Status Code
Description
Response Headers
200
The request has succeeded.
-
0
The request has failed.
-
*/
public APIfindUsersByUsernameRequest findUsersByUsername(List usernames) {
return new APIfindUsersByUsernameRequest(usernames);
}
private okhttp3.Call listGetFollowersCall(String id, Integer maxResults, String paginationToken, Set userFields, Set expansions, Set tweetFields, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/2/lists/{id}/followers"
.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 (paginationToken != null) {
localVarQueryParams.addAll(localVarApiClient.parameterToPair("pagination_token", paginationToken));
}
if (userFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "user.fields", userFields));
}
if (expansions != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "expansions", expansions));
}
if (tweetFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "tweet.fields", tweetFields));
}
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 listGetFollowersValidateBeforeCall(String id, Integer maxResults, String paginationToken, Set userFields, Set expansions, Set tweetFields, 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 listGetFollowers(Async)");
}
okhttp3.Call localVarCall = listGetFollowersCall(id, maxResults, paginationToken, userFields, expansions, tweetFields, _callback);
return localVarCall;
}
private ApiResponse listGetFollowersWithHttpInfo(String id, Integer maxResults, String paginationToken, Set userFields, Set expansions, Set tweetFields) throws ApiException {
okhttp3.Call localVarCall = listGetFollowersValidateBeforeCall(id, maxResults, paginationToken, userFields, expansions, tweetFields, 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()));
throw e;
}
}
private okhttp3.Call listGetFollowersAsync(String id, Integer maxResults, String paginationToken, Set userFields, Set expansions, Set tweetFields, final ApiCallback _callback) throws ApiException {
okhttp3.Call localVarCall = listGetFollowersValidateBeforeCall(id, maxResults, paginationToken, userFields, expansions, tweetFields, _callback);
Type localVarReturnType = new TypeToken(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
public class APIlistGetFollowersRequest {
private final String id;
private Integer maxResults;
private String paginationToken;
private Set userFields;
private Set expansions;
private Set tweetFields;
private APIlistGetFollowersRequest(String id) {
this.id = id;
}
/**
* Set maxResults
* @param maxResults The maximum number of results. (optional, default to 100)
* @return APIlistGetFollowersRequest
*/
public APIlistGetFollowersRequest maxResults(Integer maxResults) {
this.maxResults = maxResults;
return this;
}
/**
* Set paginationToken
* @param paginationToken This parameter is used to get a specified 'page' of results. (optional)
* @return APIlistGetFollowersRequest
*/
public APIlistGetFollowersRequest paginationToken(String paginationToken) {
this.paginationToken = paginationToken;
return this;
}
/**
* Set userFields
* @param userFields A comma separated list of User fields to display. (optional)
* @return APIlistGetFollowersRequest
*/
public APIlistGetFollowersRequest userFields(Set userFields) {
this.userFields = userFields;
return this;
}
/**
* Set expansions
* @param expansions A comma separated list of fields to expand. (optional)
* @return APIlistGetFollowersRequest
*/
public APIlistGetFollowersRequest expansions(Set expansions) {
this.expansions = expansions;
return this;
}
/**
* Set tweetFields
* @param tweetFields A comma separated list of Tweet fields to display. (optional)
* @return APIlistGetFollowersRequest
*/
public APIlistGetFollowersRequest tweetFields(Set tweetFields) {
this.tweetFields = tweetFields;
return this;
}
/**
* Build call for listGetFollowers
* @param _callback ApiCallback API callback
* @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 has succeeded.
-
0
The request has failed.
-
*/
public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException {
return listGetFollowersCall(id, maxResults, paginationToken, userFields, expansions, tweetFields, _callback);
}
/**
* Execute listGetFollowers request
* @return Get2ListsIdFollowersResponse
* @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 has succeeded.
-
0
The request has failed.
-
*/
public Get2ListsIdFollowersResponse execute() throws ApiException {
ApiResponse localVarResp = listGetFollowersWithHttpInfo(id, maxResults, paginationToken, userFields, expansions, tweetFields);
return localVarResp.getData();
}
/**
* Calls the API using a retry mechanism to handle rate limits errors.
*
*/
public Get2ListsIdFollowersResponse execute(Integer retries) throws ApiException {
Get2ListsIdFollowersResponse localVarResp;
try{
localVarResp = execute();
} catch (ApiException e) {
if(handleRateLimit(e, retries)) {
return execute(retries - 1);
} else {
throw e;
}
}
return localVarResp;
}
/**
* Execute listGetFollowers request with HTTP info returned
* @return ApiResponse<Get2ListsIdFollowersResponse>
* @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 has succeeded.
-
0
The request has failed.
-
*/
public ApiResponse executeWithHttpInfo() throws ApiException {
return listGetFollowersWithHttpInfo(id, maxResults, paginationToken, userFields, expansions, tweetFields);
}
/**
* Execute listGetFollowers request (asynchronously)
* @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 has succeeded.
-
0
The request has failed.
-
*/
public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException {
return listGetFollowersAsync(id, maxResults, paginationToken, userFields, expansions, tweetFields, _callback);
}
}
/**
* Returns User objects that follow a List by the provided List ID
* Returns a list of Users that follow a List by the provided List ID
* @param id The ID of the List. (required)
* @return APIlistGetFollowersRequest
* @http.response.details
Status Code
Description
Response Headers
200
The request has succeeded.
-
0
The request has failed.
-
*/
public APIlistGetFollowersRequest listGetFollowers(String id) {
return new APIlistGetFollowersRequest(id);
}
private okhttp3.Call listGetMembersCall(String id, Integer maxResults, String paginationToken, Set userFields, Set expansions, Set tweetFields, final ApiCallback _callback) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/2/lists/{id}/members"
.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 (paginationToken != null) {
localVarQueryParams.addAll(localVarApiClient.parameterToPair("pagination_token", paginationToken));
}
if (userFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "user.fields", userFields));
}
if (expansions != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "expansions", expansions));
}
if (tweetFields != null) {
localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "tweet.fields", tweetFields));
}
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 listGetMembersValidateBeforeCall(String id, Integer maxResults, String paginationToken, Set userFields, Set expansions, Set tweetFields, 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 listGetMembers(Async)");
}
okhttp3.Call localVarCall = listGetMembersCall(id, maxResults, paginationToken, userFields, expansions, tweetFields, _callback);
return localVarCall;
}
private ApiResponse listGetMembersWithHttpInfo(String id, Integer maxResults, String paginationToken, Set userFields, Set expansions, Set tweetFields) throws ApiException {
okhttp3.Call localVarCall = listGetMembersValidateBeforeCall(id, maxResults, paginationToken, userFields, expansions, tweetFields, 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