java/src/main/java/com/konfigthis/newscatcherapi/client/api/LatestHeadlinesApi.java
<filename>java/src/main/java/com/konfigthis/newscatcherapi/client/api/LatestHeadlinesApi.java/*
 * NewsCatcher News API V2
 * NewsCatcher is a data-as-a-service startup that has one main goal: to build the largest database of structured news articles published online. In other words, we're like Google for the news part of the web, which you can access as a source of data.  Some useful links: - [How NewsCatcher Works](https://docs.newscatcherapi.com/knowledge-base/how-newscatcher-works) - [GitHub for the Python SDK](https://github.com/NewscatcherAPI/newscatcherapi-sdk-python) 
 *
 * The version of the OpenAPI document: 1.0.1
 * Contact: efpyi@example.com
 *
 * NOTE: This class is auto generated by Konfig (https://konfigthis.com).
 * Do not edit the class manually.
 */


package com.konfigthis.newscatcherapi.client.api;

import com.konfigthis.newscatcherapi.client.ApiCallback;
import com.konfigthis.newscatcherapi.client.ApiClient;
import com.konfigthis.newscatcherapi.client.ApiException;
import com.konfigthis.newscatcherapi.client.ApiResponse;
import com.konfigthis.newscatcherapi.client.Configuration;
import com.konfigthis.newscatcherapi.client.Pair;
import com.konfigthis.newscatcherapi.client.ProgressRequestBody;
import com.konfigthis.newscatcherapi.client.ProgressResponseBody;

import com.google.gson.reflect.TypeToken;

import java.io.IOException;


import com.konfigthis.newscatcherapi.client.model.ErrorResponse;
import com.konfigthis.newscatcherapi.client.model.LatestHeadlines;
import com.konfigthis.newscatcherapi.client.model.Model200ResponseLatest;
import com.konfigthis.newscatcherapi.client.model.Topic;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.ws.rs.core.GenericType;

public class LatestHeadlinesApi {
    private ApiClient localVarApiClient;
    private int localHostIndex;
    private String localCustomBaseUrl;

    public LatestHeadlinesApi() {
        this(Configuration.getDefaultApiClient());
    }

    public LatestHeadlinesApi(ApiClient apiClient) {
        this.localVarApiClient = apiClient;
    }

    public ApiClient getApiClient() {
        return localVarApiClient;
    }

    public void setApiClient(ApiClient apiClient) {
        this.localVarApiClient = apiClient;
    }

    public int getHostIndex() {
        return localHostIndex;
    }

    public void setHostIndex(int hostIndex) {
        this.localHostIndex = hostIndex;
    }

    public String getCustomBaseUrl() {
        return localCustomBaseUrl;
    }

    public void setCustomBaseUrl(String customBaseUrl) {
        this.localCustomBaseUrl = customBaseUrl;
    }

    /**
     * Build call for get
     * @param lang Specifies the languages of the search. For example: &#x60;en&#x60;. The only accepted format is [ISO 639-1 — 2](https://en.wikipedia.org/wiki/ISO_639-1) letter code.  (optional)
     * @param notLang Inverse to the &#x60;lang&#x60; parameter  (optional)
     * @param countries Countries where the news publisher is located. **Important**: This parameter is not responsible for the countries mentioned in the news article. One or multiple countries can be used in the search. The only acceptable format is [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) For example, &#x60;US,CA,MX&#x60; or just &#x60;US&#x60;  (optional)
     * @param notCountries The inverse of the &#x60;countries&#x60; parameter.  (optional)
     * @param topic Accepted values: &#x60;news&#x60;, &#x60;sport&#x60;, &#x60;tech&#x60;, &#x60;world&#x60;, &#x60;finance&#x60;, &#x60;politics&#x60;, &#x60;business&#x60;, &#x60;economics&#x60;, &#x60;entertainment&#x60;, &#x60;beauty&#x60;, &#x60;travel&#x60;, &#x60;music&#x60;, &#x60;food&#x60;, &#x60;science&#x60;, &#x60;gaming&#x60; The topic to which you want to restrict the articles of your choice. Not all news articles are assigned with a topic, therefore, we cannot guarantee that 100% of topics talking about technology will be assigned a tech label.  (optional)
     * @param sources One or more news resources to filter your search. It should be the normal form of the URL, For example: &#x60;nytimes.com,theguardian.com&#x60;  (optional)
     * @param notSources One or more sources to be excluded from the search. Comma-separated list. For example: &#x60;nytimes.com,cnn.com,wsj.com&#x60;  (optional)
     * @param rankedOnly Default: &#x60;True&#x60; Limit the search only for the sources which are in the top 1 million online websites. Unranked sources are assigned a rank that equals &#x60;999999&#x60;  (optional)
     * @param pageSize &#x60;[1:100]&#x60; How many articles to return per page.  (optional)
     * @param page The number of the page. Use it to scroll through the results. This parameter is used to paginate: scroll through results because one API response cannot return more than 100 articles.  (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
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> OK </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> API is not put in headers </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> API Key not found </td><td>  -  </td></tr>
        <tr><td> 406 </td><td> Wrong parameter has been used </td><td>  -  </td></tr>
        <tr><td> 408 </td><td> Request Timeout </td><td>  -  </td></tr>
        <tr><td> 429 </td><td> Concurrency violated </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call getCall(String lang, String notLang, String countries, String notCountries, Topic topic, String sources, String notSources, Boolean rankedOnly, Integer pageSize, Integer page, final ApiCallback _callback) throws ApiException {
        String basePath = null;
        // Operation Servers
        String[] localBasePaths = new String[] {  };

        // Determine Base Path to Use
        if (localCustomBaseUrl != null){
            basePath = localCustomBaseUrl;
        } else if ( localBasePaths.length > 0 ) {
            basePath = localBasePaths[localHostIndex];
        } else {
            basePath = null;
        }

        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/latest_headlines";

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        Map<String, String> localVarHeaderParams = new HashMap<String, String>();
        Map<String, String> localVarCookieParams = new HashMap<String, String>();
        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        if (lang != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("lang", lang));
        }

        if (notLang != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("not_lang", notLang));
        }

        if (countries != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("countries", countries));
        }

        if (notCountries != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("not_countries", notCountries));
        }

        if (topic != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("topic", topic));
        }

        if (sources != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("sources", sources));
        }

        if (notSources != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("not_sources", notSources));
        }

        if (rankedOnly != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("ranked_only", rankedOnly));
        }

        if (pageSize != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("page_size", pageSize));
        }

        if (page != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("page", page));
        }

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

    @SuppressWarnings("rawtypes")
    private okhttp3.Call getValidateBeforeCall(String lang, String notLang, String countries, String notCountries, Topic topic, String sources, String notSources, Boolean rankedOnly, Integer pageSize, Integer page, final ApiCallback _callback) throws ApiException {
        return getCall(lang, notLang, countries, notCountries, topic, sources, notSources, rankedOnly, pageSize, page, _callback);

    }

    /**
     * Get Latest News Articles
     * Get the latest headlines given any topic, country, or language.
     * @param lang Specifies the languages of the search. For example: &#x60;en&#x60;. The only accepted format is [ISO 639-1 — 2](https://en.wikipedia.org/wiki/ISO_639-1) letter code.  (optional)
     * @param notLang Inverse to the &#x60;lang&#x60; parameter  (optional)
     * @param countries Countries where the news publisher is located. **Important**: This parameter is not responsible for the countries mentioned in the news article. One or multiple countries can be used in the search. The only acceptable format is [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) For example, &#x60;US,CA,MX&#x60; or just &#x60;US&#x60;  (optional)
     * @param notCountries The inverse of the &#x60;countries&#x60; parameter.  (optional)
     * @param topic Accepted values: &#x60;news&#x60;, &#x60;sport&#x60;, &#x60;tech&#x60;, &#x60;world&#x60;, &#x60;finance&#x60;, &#x60;politics&#x60;, &#x60;business&#x60;, &#x60;economics&#x60;, &#x60;entertainment&#x60;, &#x60;beauty&#x60;, &#x60;travel&#x60;, &#x60;music&#x60;, &#x60;food&#x60;, &#x60;science&#x60;, &#x60;gaming&#x60; The topic to which you want to restrict the articles of your choice. Not all news articles are assigned with a topic, therefore, we cannot guarantee that 100% of topics talking about technology will be assigned a tech label.  (optional)
     * @param sources One or more news resources to filter your search. It should be the normal form of the URL, For example: &#x60;nytimes.com,theguardian.com&#x60;  (optional)
     * @param notSources One or more sources to be excluded from the search. Comma-separated list. For example: &#x60;nytimes.com,cnn.com,wsj.com&#x60;  (optional)
     * @param rankedOnly Default: &#x60;True&#x60; Limit the search only for the sources which are in the top 1 million online websites. Unranked sources are assigned a rank that equals &#x60;999999&#x60;  (optional)
     * @param pageSize &#x60;[1:100]&#x60; How many articles to return per page.  (optional)
     * @param page The number of the page. Use it to scroll through the results. This parameter is used to paginate: scroll through results because one API response cannot return more than 100 articles.  (optional)
     * @return Model200ResponseLatest
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> OK </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> API is not put in headers </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> API Key not found </td><td>  -  </td></tr>
        <tr><td> 406 </td><td> Wrong parameter has been used </td><td>  -  </td></tr>
        <tr><td> 408 </td><td> Request Timeout </td><td>  -  </td></tr>
        <tr><td> 429 </td><td> Concurrency violated </td><td>  -  </td></tr>
     </table>
     */
    public Model200ResponseLatest get(String lang, String notLang, String countries, String notCountries, Topic topic, String sources, String notSources, Boolean rankedOnly, Integer pageSize, Integer page) throws ApiException {
        ApiResponse<Model200ResponseLatest> localVarResp = getWithHttpInfo(lang, notLang, countries, notCountries, topic, sources, notSources, rankedOnly, pageSize, page);
        return localVarResp.getData();
    }

    /**
     * Get Latest News Articles
     * Get the latest headlines given any topic, country, or language.
     * @param lang Specifies the languages of the search. For example: &#x60;en&#x60;. The only accepted format is [ISO 639-1 — 2](https://en.wikipedia.org/wiki/ISO_639-1) letter code.  (optional)
     * @param notLang Inverse to the &#x60;lang&#x60; parameter  (optional)
     * @param countries Countries where the news publisher is located. **Important**: This parameter is not responsible for the countries mentioned in the news article. One or multiple countries can be used in the search. The only acceptable format is [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) For example, &#x60;US,CA,MX&#x60; or just &#x60;US&#x60;  (optional)
     * @param notCountries The inverse of the &#x60;countries&#x60; parameter.  (optional)
     * @param topic Accepted values: &#x60;news&#x60;, &#x60;sport&#x60;, &#x60;tech&#x60;, &#x60;world&#x60;, &#x60;finance&#x60;, &#x60;politics&#x60;, &#x60;business&#x60;, &#x60;economics&#x60;, &#x60;entertainment&#x60;, &#x60;beauty&#x60;, &#x60;travel&#x60;, &#x60;music&#x60;, &#x60;food&#x60;, &#x60;science&#x60;, &#x60;gaming&#x60; The topic to which you want to restrict the articles of your choice. Not all news articles are assigned with a topic, therefore, we cannot guarantee that 100% of topics talking about technology will be assigned a tech label.  (optional)
     * @param sources One or more news resources to filter your search. It should be the normal form of the URL, For example: &#x60;nytimes.com,theguardian.com&#x60;  (optional)
     * @param notSources One or more sources to be excluded from the search. Comma-separated list. For example: &#x60;nytimes.com,cnn.com,wsj.com&#x60;  (optional)
     * @param rankedOnly Default: &#x60;True&#x60; Limit the search only for the sources which are in the top 1 million online websites. Unranked sources are assigned a rank that equals &#x60;999999&#x60;  (optional)
     * @param pageSize &#x60;[1:100]&#x60; How many articles to return per page.  (optional)
     * @param page The number of the page. Use it to scroll through the results. This parameter is used to paginate: scroll through results because one API response cannot return more than 100 articles.  (optional)
     * @return ApiResponse&lt;Model200ResponseLatest&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> OK </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> API is not put in headers </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> API Key not found </td><td>  -  </td></tr>
        <tr><td> 406 </td><td> Wrong parameter has been used </td><td>  -  </td></tr>
        <tr><td> 408 </td><td> Request Timeout </td><td>  -  </td></tr>
        <tr><td> 429 </td><td> Concurrency violated </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<Model200ResponseLatest> getWithHttpInfo(String lang, String notLang, String countries, String notCountries, Topic topic, String sources, String notSources, Boolean rankedOnly, Integer pageSize, Integer page) throws ApiException {
        okhttp3.Call localVarCall = getValidateBeforeCall(lang, notLang, countries, notCountries, topic, sources, notSources, rankedOnly, pageSize, page, null);
        Type localVarReturnType = new TypeToken<Model200ResponseLatest>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Get Latest News Articles (asynchronously)
     * Get the latest headlines given any topic, country, or language.
     * @param lang Specifies the languages of the search. For example: &#x60;en&#x60;. The only accepted format is [ISO 639-1 — 2](https://en.wikipedia.org/wiki/ISO_639-1) letter code.  (optional)
     * @param notLang Inverse to the &#x60;lang&#x60; parameter  (optional)
     * @param countries Countries where the news publisher is located. **Important**: This parameter is not responsible for the countries mentioned in the news article. One or multiple countries can be used in the search. The only acceptable format is [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) For example, &#x60;US,CA,MX&#x60; or just &#x60;US&#x60;  (optional)
     * @param notCountries The inverse of the &#x60;countries&#x60; parameter.  (optional)
     * @param topic Accepted values: &#x60;news&#x60;, &#x60;sport&#x60;, &#x60;tech&#x60;, &#x60;world&#x60;, &#x60;finance&#x60;, &#x60;politics&#x60;, &#x60;business&#x60;, &#x60;economics&#x60;, &#x60;entertainment&#x60;, &#x60;beauty&#x60;, &#x60;travel&#x60;, &#x60;music&#x60;, &#x60;food&#x60;, &#x60;science&#x60;, &#x60;gaming&#x60; The topic to which you want to restrict the articles of your choice. Not all news articles are assigned with a topic, therefore, we cannot guarantee that 100% of topics talking about technology will be assigned a tech label.  (optional)
     * @param sources One or more news resources to filter your search. It should be the normal form of the URL, For example: &#x60;nytimes.com,theguardian.com&#x60;  (optional)
     * @param notSources One or more sources to be excluded from the search. Comma-separated list. For example: &#x60;nytimes.com,cnn.com,wsj.com&#x60;  (optional)
     * @param rankedOnly Default: &#x60;True&#x60; Limit the search only for the sources which are in the top 1 million online websites. Unranked sources are assigned a rank that equals &#x60;999999&#x60;  (optional)
     * @param pageSize &#x60;[1:100]&#x60; How many articles to return per page.  (optional)
     * @param page The number of the page. Use it to scroll through the results. This parameter is used to paginate: scroll through results because one API response cannot return more than 100 articles.  (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
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> OK </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> API is not put in headers </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> API Key not found </td><td>  -  </td></tr>
        <tr><td> 406 </td><td> Wrong parameter has been used </td><td>  -  </td></tr>
        <tr><td> 408 </td><td> Request Timeout </td><td>  -  </td></tr>
        <tr><td> 429 </td><td> Concurrency violated </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call getAsync(String lang, String notLang, String countries, String notCountries, Topic topic, String sources, String notSources, Boolean rankedOnly, Integer pageSize, Integer page, final ApiCallback<Model200ResponseLatest> _callback) throws ApiException {

        okhttp3.Call localVarCall = getValidateBeforeCall(lang, notLang, countries, notCountries, topic, sources, notSources, rankedOnly, pageSize, page, _callback);
        Type localVarReturnType = new TypeToken<Model200ResponseLatest>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
    /**
     * Build call for post
     * @param latestHeadlines  (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
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> OK </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> API is not put in headers </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> API Key not found </td><td>  -  </td></tr>
        <tr><td> 406 </td><td> Wrong parameter has been used </td><td>  -  </td></tr>
        <tr><td> 408 </td><td> Request Timeout </td><td>  -  </td></tr>
        <tr><td> 429 </td><td> Concurrency violated </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call postCall(LatestHeadlines latestHeadlines, final ApiCallback _callback) throws ApiException {
        String basePath = null;
        // Operation Servers
        String[] localBasePaths = new String[] {  };

        // Determine Base Path to Use
        if (localCustomBaseUrl != null){
            basePath = localCustomBaseUrl;
        } else if ( localBasePaths.length > 0 ) {
            basePath = localBasePaths[localHostIndex];
        } else {
            basePath = null;
        }

        Object localVarPostBody = latestHeadlines;

        // create path and map variables
        String localVarPath = "/latest_headlines";

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        Map<String, String> localVarHeaderParams = new HashMap<String, String>();
        Map<String, String> localVarCookieParams = new HashMap<String, String>();
        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        final String[] localVarAccepts = {
            "application/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[] { "api_key" };
        return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call postValidateBeforeCall(LatestHeadlines latestHeadlines, final ApiCallback _callback) throws ApiException {
        return postCall(latestHeadlines, _callback);

    }

    /**
     * Get Latest News Articles
     * Get the latest headlines given any topic, country, or language.
     * @param latestHeadlines  (optional)
     * @return Model200ResponseLatest
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> OK </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> API is not put in headers </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> API Key not found </td><td>  -  </td></tr>
        <tr><td> 406 </td><td> Wrong parameter has been used </td><td>  -  </td></tr>
        <tr><td> 408 </td><td> Request Timeout </td><td>  -  </td></tr>
        <tr><td> 429 </td><td> Concurrency violated </td><td>  -  </td></tr>
     </table>
     */
    public Model200ResponseLatest post(LatestHeadlines latestHeadlines) throws ApiException {
        ApiResponse<Model200ResponseLatest> localVarResp = postWithHttpInfo(latestHeadlines);
        return localVarResp.getData();
    }

    /**
     * Get Latest News Articles
     * Get the latest headlines given any topic, country, or language.
     * @param latestHeadlines  (optional)
     * @return ApiResponse&lt;Model200ResponseLatest&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> OK </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> API is not put in headers </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> API Key not found </td><td>  -  </td></tr>
        <tr><td> 406 </td><td> Wrong parameter has been used </td><td>  -  </td></tr>
        <tr><td> 408 </td><td> Request Timeout </td><td>  -  </td></tr>
        <tr><td> 429 </td><td> Concurrency violated </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<Model200ResponseLatest> postWithHttpInfo(LatestHeadlines latestHeadlines) throws ApiException {
        okhttp3.Call localVarCall = postValidateBeforeCall(latestHeadlines, null);
        Type localVarReturnType = new TypeToken<Model200ResponseLatest>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Get Latest News Articles (asynchronously)
     * Get the latest headlines given any topic, country, or language.
     * @param latestHeadlines  (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
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> OK </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> API is not put in headers </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> API Key not found </td><td>  -  </td></tr>
        <tr><td> 406 </td><td> Wrong parameter has been used </td><td>  -  </td></tr>
        <tr><td> 408 </td><td> Request Timeout </td><td>  -  </td></tr>
        <tr><td> 429 </td><td> Concurrency violated </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call postAsync(LatestHeadlines latestHeadlines, final ApiCallback<Model200ResponseLatest> _callback) throws ApiException {

        okhttp3.Call localVarCall = postValidateBeforeCall(latestHeadlines, _callback);
        Type localVarReturnType = new TypeToken<Model200ResponseLatest>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
}
