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

com.konfigthis.newscatcherapi.client.api.SourcesApiGenerated Maven / Gradle / Ivy

/*
 * NewsCatcher-V3 Production API
 *  

Visit our website https://newscatcherapi.com * * The version of the OpenAPI document: 3.2.16 * Contact: [email protected] * * 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.SourceResponse; import com.konfigthis.newscatcherapi.client.model.SourcesRequest; 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 SourcesApiGenerated { private ApiClient localVarApiClient; private int localHostIndex; private String localCustomBaseUrl; public SourcesApiGenerated() throws IllegalArgumentException { this(Configuration.getDefaultApiClient()); } public SourcesApiGenerated(ApiClient apiClient) throws IllegalArgumentException { if (apiClient.getApiKey() == null) { throw new IllegalArgumentException("\"x-api-token\" is required but no API key was provided. Please set \"x-api-token\" with ApiClient#setApiKey(String)."); } 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; } private okhttp3.Call getCall(Object lang, Object countries, Object predefinedSources, Boolean includeAdditionalInfo, Integer fromRank, Integer toRank, Object sourceName, Object sourceUrl, Boolean isNewsDomain, Object newsDomainType, Object newsType, 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 = "/api/sources"; List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); if (lang != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("lang", lang)); } if (countries != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("countries", countries)); } if (predefinedSources != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("predefined_sources", predefinedSources)); } if (includeAdditionalInfo != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("include_additional_info", includeAdditionalInfo)); } if (fromRank != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("from_rank", fromRank)); } if (toRank != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("to_rank", toRank)); } if (sourceName != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("source_name", sourceName)); } if (sourceUrl != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("source_url", sourceUrl)); } if (isNewsDomain != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("is_news_domain", isNewsDomain)); } if (newsDomainType != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("news_domain_type", newsDomainType)); } if (newsType != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("news_type", newsType)); } 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[] { "apiKey" }; return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call getValidateBeforeCall(Object lang, Object countries, Object predefinedSources, Boolean includeAdditionalInfo, Integer fromRank, Integer toRank, Object sourceName, Object sourceUrl, Boolean isNewsDomain, Object newsDomainType, Object newsType, final ApiCallback _callback) throws ApiException { return getCall(lang, countries, predefinedSources, includeAdditionalInfo, fromRank, toRank, sourceName, sourceUrl, isNewsDomain, newsDomainType, newsType, _callback); } private ApiResponse getWithHttpInfo(Object lang, Object countries, Object predefinedSources, Boolean includeAdditionalInfo, Integer fromRank, Integer toRank, Object sourceName, Object sourceUrl, Boolean isNewsDomain, Object newsDomainType, Object newsType) throws ApiException { okhttp3.Call localVarCall = getValidateBeforeCall(lang, countries, predefinedSources, includeAdditionalInfo, fromRank, toRank, sourceName, sourceUrl, isNewsDomain, newsDomainType, newsType, null); Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } private okhttp3.Call getAsync(Object lang, Object countries, Object predefinedSources, Boolean includeAdditionalInfo, Integer fromRank, Integer toRank, Object sourceName, Object sourceUrl, Boolean isNewsDomain, Object newsDomainType, Object newsType, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = getValidateBeforeCall(lang, countries, predefinedSources, includeAdditionalInfo, fromRank, toRank, sourceName, sourceUrl, isNewsDomain, newsDomainType, newsType, _callback); Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } public abstract class GetRequestBuilderGenerated { Object lang; Object countries; Object predefinedSources; Boolean includeAdditionalInfo; Integer fromRank; Integer toRank; Object sourceName; Object sourceUrl; Boolean isNewsDomain; Object newsDomainType; Object newsType; public GetRequestBuilderGenerated() { } /** * Set lang * @param lang (optional) * @return SourcesApi.GetRequestBuilder */ public SourcesApi.GetRequestBuilder lang(Object lang) { this.lang = lang; return (SourcesApi.GetRequestBuilder) this; } /** * Set countries * @param countries (optional) * @return SourcesApi.GetRequestBuilder */ public SourcesApi.GetRequestBuilder countries(Object countries) { this.countries = countries; return (SourcesApi.GetRequestBuilder) this; } /** * Set predefinedSources * @param predefinedSources (optional) * @return SourcesApi.GetRequestBuilder */ public SourcesApi.GetRequestBuilder predefinedSources(Object predefinedSources) { this.predefinedSources = predefinedSources; return (SourcesApi.GetRequestBuilder) this; } /** * Set includeAdditionalInfo * @param includeAdditionalInfo (optional) * @return SourcesApi.GetRequestBuilder */ public SourcesApi.GetRequestBuilder includeAdditionalInfo(Boolean includeAdditionalInfo) { this.includeAdditionalInfo = includeAdditionalInfo; return (SourcesApi.GetRequestBuilder) this; } /** * Set fromRank * @param fromRank (optional) * @return SourcesApi.GetRequestBuilder */ public SourcesApi.GetRequestBuilder fromRank(Integer fromRank) { this.fromRank = fromRank; return (SourcesApi.GetRequestBuilder) this; } /** * Set toRank * @param toRank (optional) * @return SourcesApi.GetRequestBuilder */ public SourcesApi.GetRequestBuilder toRank(Integer toRank) { this.toRank = toRank; return (SourcesApi.GetRequestBuilder) this; } /** * Set sourceName * @param sourceName (optional) * @return SourcesApi.GetRequestBuilder */ public SourcesApi.GetRequestBuilder sourceName(Object sourceName) { this.sourceName = sourceName; return (SourcesApi.GetRequestBuilder) this; } /** * Set sourceUrl * @param sourceUrl (optional) * @return SourcesApi.GetRequestBuilder */ public SourcesApi.GetRequestBuilder sourceUrl(Object sourceUrl) { this.sourceUrl = sourceUrl; return (SourcesApi.GetRequestBuilder) this; } /** * Set isNewsDomain * @param isNewsDomain (optional) * @return SourcesApi.GetRequestBuilder */ public SourcesApi.GetRequestBuilder isNewsDomain(Boolean isNewsDomain) { this.isNewsDomain = isNewsDomain; return (SourcesApi.GetRequestBuilder) this; } /** * Set newsDomainType * @param newsDomainType (optional) * @return SourcesApi.GetRequestBuilder */ public SourcesApi.GetRequestBuilder newsDomainType(Object newsDomainType) { this.newsDomainType = newsDomainType; return (SourcesApi.GetRequestBuilder) this; } /** * Set newsType * @param newsType (optional) * @return SourcesApi.GetRequestBuilder */ public SourcesApi.GetRequestBuilder newsType(Object newsType) { this.newsType = newsType; return (SourcesApi.GetRequestBuilder) this; } /** * Build call for get * @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 Successful Response -
*/ public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { return getCall(lang, countries, predefinedSources, includeAdditionalInfo, fromRank, toRank, sourceName, sourceUrl, isNewsDomain, newsDomainType, newsType, _callback); } /** * Execute get request * @return SourceResponse * @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 Successful Response -
*/ public SourceResponse execute() throws ApiException { ApiResponse localVarResp = getWithHttpInfo(lang, countries, predefinedSources, includeAdditionalInfo, fromRank, toRank, sourceName, sourceUrl, isNewsDomain, newsDomainType, newsType); return localVarResp.getResponseBody(); } /** * Execute get request with HTTP info returned * @return ApiResponse<SourceResponse> * @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 Successful Response -
*/ public ApiResponse executeWithHttpInfo() throws ApiException { return getWithHttpInfo(lang, countries, predefinedSources, includeAdditionalInfo, fromRank, toRank, sourceName, sourceUrl, isNewsDomain, newsDomainType, newsType); } /** * Execute get 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 Successful Response -
*/ public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { return getAsync(lang, countries, predefinedSources, includeAdditionalInfo, fromRank, toRank, sourceName, sourceUrl, isNewsDomain, newsDomainType, newsType, _callback); } } /** * [Get] Search For Sources Request * This endpoint allows you to get the list of sources that are available in the database. You can filter the sources by language and country. The maximum number of sources displayed is set according to your plan. You can find the list of plans and their features here: https://newscatcherapi.com/news-api#news-api-pricing * @return GetRequestBuilder * @http.response.details
Status Code Description Response Headers
200 Successful Response -
*/ public SourcesApi.GetRequestBuilder get() throws IllegalArgumentException { return ((SourcesApi) this).new GetRequestBuilder(); } private okhttp3.Call postCall(SourcesRequest sourcesRequest, 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 = sourcesRequest; // create path and map variables String localVarPath = "/api/sources"; 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 = { "application/json" }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } String[] localVarAuthNames = new String[] { "apiKey" }; return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call postValidateBeforeCall(SourcesRequest sourcesRequest, final ApiCallback _callback) throws ApiException { // verify the required parameter 'sourcesRequest' is set if (sourcesRequest == null) { throw new ApiException("Missing the required parameter 'sourcesRequest' when calling post(Async)"); } return postCall(sourcesRequest, _callback); } private ApiResponse postWithHttpInfo(SourcesRequest sourcesRequest) throws ApiException { okhttp3.Call localVarCall = postValidateBeforeCall(sourcesRequest, null); Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } private okhttp3.Call postAsync(SourcesRequest sourcesRequest, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = postValidateBeforeCall(sourcesRequest, _callback); Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } public abstract class PostRequestBuilderGenerated { Object lang; Object countries; Object predefinedSources; Boolean includeAdditionalInfo; Integer fromRank; Integer toRank; Object sourceName; Object sourceUrl; Boolean isNewsDomain; Object newsDomainType; Object newsType; public PostRequestBuilderGenerated() { } /** * Set lang * @param lang (optional) * @return SourcesApi.PostRequestBuilder */ public SourcesApi.PostRequestBuilder lang(Object lang) { this.lang = lang; return (SourcesApi.PostRequestBuilder) this; } /** * Set countries * @param countries (optional) * @return SourcesApi.PostRequestBuilder */ public SourcesApi.PostRequestBuilder countries(Object countries) { this.countries = countries; return (SourcesApi.PostRequestBuilder) this; } /** * Set predefinedSources * @param predefinedSources (optional) * @return SourcesApi.PostRequestBuilder */ public SourcesApi.PostRequestBuilder predefinedSources(Object predefinedSources) { this.predefinedSources = predefinedSources; return (SourcesApi.PostRequestBuilder) this; } /** * Set includeAdditionalInfo * @param includeAdditionalInfo (optional) * @return SourcesApi.PostRequestBuilder */ public SourcesApi.PostRequestBuilder includeAdditionalInfo(Boolean includeAdditionalInfo) { this.includeAdditionalInfo = includeAdditionalInfo; return (SourcesApi.PostRequestBuilder) this; } /** * Set fromRank * @param fromRank (optional) * @return SourcesApi.PostRequestBuilder */ public SourcesApi.PostRequestBuilder fromRank(Integer fromRank) { this.fromRank = fromRank; return (SourcesApi.PostRequestBuilder) this; } /** * Set toRank * @param toRank (optional) * @return SourcesApi.PostRequestBuilder */ public SourcesApi.PostRequestBuilder toRank(Integer toRank) { this.toRank = toRank; return (SourcesApi.PostRequestBuilder) this; } /** * Set sourceName * @param sourceName (optional) * @return SourcesApi.PostRequestBuilder */ public SourcesApi.PostRequestBuilder sourceName(Object sourceName) { this.sourceName = sourceName; return (SourcesApi.PostRequestBuilder) this; } /** * Set sourceUrl * @param sourceUrl (optional) * @return SourcesApi.PostRequestBuilder */ public SourcesApi.PostRequestBuilder sourceUrl(Object sourceUrl) { this.sourceUrl = sourceUrl; return (SourcesApi.PostRequestBuilder) this; } /** * Set isNewsDomain * @param isNewsDomain (optional) * @return SourcesApi.PostRequestBuilder */ public SourcesApi.PostRequestBuilder isNewsDomain(Boolean isNewsDomain) { this.isNewsDomain = isNewsDomain; return (SourcesApi.PostRequestBuilder) this; } /** * Set newsDomainType * @param newsDomainType (optional) * @return SourcesApi.PostRequestBuilder */ public SourcesApi.PostRequestBuilder newsDomainType(Object newsDomainType) { this.newsDomainType = newsDomainType; return (SourcesApi.PostRequestBuilder) this; } /** * Set newsType * @param newsType (optional) * @return SourcesApi.PostRequestBuilder */ public SourcesApi.PostRequestBuilder newsType(Object newsType) { this.newsType = newsType; return (SourcesApi.PostRequestBuilder) this; } /** * Build call for post * @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 Successful Response -
*/ public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { SourcesRequest sourcesRequest = buildBodyParams(); return postCall(sourcesRequest, _callback); } private SourcesRequest buildBodyParams() { SourcesRequest sourcesRequest = new SourcesRequest(); sourcesRequest.lang(this.lang); sourcesRequest.countries(this.countries); sourcesRequest.predefinedSources(this.predefinedSources); sourcesRequest.includeAdditionalInfo(this.includeAdditionalInfo); sourcesRequest.fromRank(this.fromRank); sourcesRequest.toRank(this.toRank); sourcesRequest.sourceName(this.sourceName); sourcesRequest.sourceUrl(this.sourceUrl); sourcesRequest.isNewsDomain(this.isNewsDomain); sourcesRequest.newsDomainType(this.newsDomainType); sourcesRequest.newsType(this.newsType); return sourcesRequest; } /** * Execute post request * @return SourceResponse * @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 Successful Response -
*/ public SourceResponse execute() throws ApiException { SourcesRequest sourcesRequest = buildBodyParams(); ApiResponse localVarResp = postWithHttpInfo(sourcesRequest); return localVarResp.getResponseBody(); } /** * Execute post request with HTTP info returned * @return ApiResponse<SourceResponse> * @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 Successful Response -
*/ public ApiResponse executeWithHttpInfo() throws ApiException { SourcesRequest sourcesRequest = buildBodyParams(); return postWithHttpInfo(sourcesRequest); } /** * Execute post 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 Successful Response -
*/ public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { SourcesRequest sourcesRequest = buildBodyParams(); return postAsync(sourcesRequest, _callback); } } /** * [Post] Search For Sources Request * This endpoint allows you to get the list of sources that are available in the database. You can filter the sources by language and country. The maximum number of sources displayed is set according to your plan. You can find the list of plans and their features here: https://newscatcherapi.com/news-api#news-api-pricing * @param sourcesRequest (required) * @return PostRequestBuilder * @http.response.details
Status Code Description Response Headers
200 Successful Response -
*/ public SourcesApi.PostRequestBuilder post() throws IllegalArgumentException { return ((SourcesApi) this).new PostRequestBuilder(); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy