All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.twitter.clientlib.api.GeneralApi Maven / Gradle / Ivy

There is a newer version: 2.0.3
Show newest version
/*
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 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 GeneralApi extends ApiCommon {

    private okhttp3.Call getOpenApiSpecCall(final ApiCallback _callback) throws ApiException {
        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/2/openapi.json";

        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"
        };
        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[] {  };
        return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, reduceAuthNames(localVarAuthNames), _callback);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call getOpenApiSpecValidateBeforeCall(final ApiCallback _callback) throws ApiException {
        

        okhttp3.Call localVarCall = getOpenApiSpecCall(_callback);
        return localVarCall;

    }


    private ApiResponse getOpenApiSpecWithHttpInfo() throws ApiException {
        okhttp3.Call localVarCall = getOpenApiSpecValidateBeforeCall(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 getOpenApiSpecAsync(final ApiCallback _callback) throws ApiException {

        okhttp3.Call localVarCall = getOpenApiSpecValidateBeforeCall(_callback);
        Type localVarReturnType = new TypeToken(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }

    public class APIgetOpenApiSpecRequest {

        private APIgetOpenApiSpecRequest() {
        }

        /**
         * Build call for getOpenApiSpec
         * @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 was successful -
*/ public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { return getOpenApiSpecCall(_callback); } /** * Execute getOpenApiSpec request * @return Object * @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 -
*/ public Object execute() throws ApiException { ApiResponse localVarResp = getOpenApiSpecWithHttpInfo(); return localVarResp.getData(); } /** * Calls the API using a retry mechanism to handle rate limits errors. * */ public Object execute(Integer retries) throws ApiException { Object localVarResp; try{ localVarResp = execute(); } catch (ApiException e) { if(handleRateLimit(e, retries)) { return execute(retries - 1); } else { throw e; } } return localVarResp; } /** * Execute getOpenApiSpec request with HTTP info returned * @return ApiResponse<Object> * @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 -
*/ public ApiResponse executeWithHttpInfo() throws ApiException { return getOpenApiSpecWithHttpInfo(); } /** * Execute getOpenApiSpec 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 was successful -
*/ public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { return getOpenApiSpecAsync(_callback); } } /** * Returns the OpenAPI Specification document. * Full OpenAPI Specification in JSON format. (See https://github.com/OAI/OpenAPI-Specification/blob/master/README.md) * @return APIgetOpenApiSpecRequest * @http.response.details
Status Code Description Response Headers
200 The request was successful -
*/ public APIgetOpenApiSpecRequest getOpenApiSpec() { return new APIgetOpenApiSpecRequest(); } }