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

com.konfigthis.newscatcherapi.client.api.SearchLinkApiGenerated 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.DtoResponsesSearchResponseSearchResponse; import com.konfigthis.newscatcherapi.client.model.SearchURLRequest; 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 SearchLinkApiGenerated { private ApiClient localVarApiClient; private int localHostIndex; private String localCustomBaseUrl; public SearchLinkApiGenerated() throws IllegalArgumentException { this(Configuration.getDefaultApiClient()); } public SearchLinkApiGenerated(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 ids, Object links, Integer page, Integer pageSize, 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/search_by_link"; List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); if (ids != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("ids", ids)); } if (links != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("links", links)); } if (page != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("page", page)); } if (pageSize != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("page_size", pageSize)); } 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 ids, Object links, Integer page, Integer pageSize, final ApiCallback _callback) throws ApiException { return getCall(ids, links, page, pageSize, _callback); } private ApiResponse getWithHttpInfo(Object ids, Object links, Integer page, Integer pageSize) throws ApiException { okhttp3.Call localVarCall = getValidateBeforeCall(ids, links, page, pageSize, null); Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } private okhttp3.Call getAsync(Object ids, Object links, Integer page, Integer pageSize, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = getValidateBeforeCall(ids, links, page, pageSize, _callback); Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } public class GetRequestBuilder { private Object ids; private Object links; private Integer page; private Integer pageSize; private GetRequestBuilder() { } /** * Set ids * @param ids (optional) * @return GetRequestBuilder */ public GetRequestBuilder ids(Object ids) { this.ids = ids; return this; } /** * Set links * @param links (optional) * @return GetRequestBuilder */ public GetRequestBuilder links(Object links) { this.links = links; return this; } /** * Set page * @param page (optional, default to 1) * @return GetRequestBuilder */ public GetRequestBuilder page(Integer page) { this.page = page; return this; } /** * Set pageSize * @param pageSize (optional, default to 100) * @return GetRequestBuilder */ public GetRequestBuilder pageSize(Integer pageSize) { this.pageSize = pageSize; return 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(ids, links, page, pageSize, _callback); } /** * Execute get request * @return DtoResponsesSearchResponseSearchResponse * @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 DtoResponsesSearchResponseSearchResponse execute() throws ApiException { ApiResponse localVarResp = getWithHttpInfo(ids, links, page, pageSize); return localVarResp.getResponseBody(); } /** * Execute get request with HTTP info returned * @return ApiResponse<DtoResponsesSearchResponseSearchResponse> * @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(ids, links, page, pageSize); } /** * 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(ids, links, page, pageSize, _callback); } } /** * [Get] Search For Articles By Id Or Link * This endpoint allows you to search for articles. You can search for articles by id(s) or link(s). * @return GetRequestBuilder * @http.response.details
Status Code Description Response Headers
200 Successful Response -
*/ public GetRequestBuilder get() throws IllegalArgumentException { return new GetRequestBuilder(); } private okhttp3.Call postCall(SearchURLRequest searchURLRequest, 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 = searchURLRequest; // create path and map variables String localVarPath = "/api/search_by_link"; 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(SearchURLRequest searchURLRequest, final ApiCallback _callback) throws ApiException { // verify the required parameter 'searchURLRequest' is set if (searchURLRequest == null) { throw new ApiException("Missing the required parameter 'searchURLRequest' when calling post(Async)"); } return postCall(searchURLRequest, _callback); } private ApiResponse postWithHttpInfo(SearchURLRequest searchURLRequest) throws ApiException { okhttp3.Call localVarCall = postValidateBeforeCall(searchURLRequest, null); Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } private okhttp3.Call postAsync(SearchURLRequest searchURLRequest, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = postValidateBeforeCall(searchURLRequest, _callback); Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } public class PostRequestBuilder { private Object ids; private Object links; private Integer page; private Integer pageSize; private PostRequestBuilder() { } /** * Set ids * @param ids (optional) * @return PostRequestBuilder */ public PostRequestBuilder ids(Object ids) { this.ids = ids; return this; } /** * Set links * @param links (optional) * @return PostRequestBuilder */ public PostRequestBuilder links(Object links) { this.links = links; return this; } /** * Set page * @param page (optional, default to 1) * @return PostRequestBuilder */ public PostRequestBuilder page(Integer page) { this.page = page; return this; } /** * Set pageSize * @param pageSize (optional, default to 100) * @return PostRequestBuilder */ public PostRequestBuilder pageSize(Integer pageSize) { this.pageSize = pageSize; return 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 { SearchURLRequest searchURLRequest = buildBodyParams(); return postCall(searchURLRequest, _callback); } private SearchURLRequest buildBodyParams() { SearchURLRequest searchURLRequest = new SearchURLRequest(); searchURLRequest.ids(this.ids); searchURLRequest.links(this.links); searchURLRequest.page(this.page); searchURLRequest.pageSize(this.pageSize); return searchURLRequest; } /** * Execute post request * @return DtoResponsesSearchResponseSearchResponse * @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 DtoResponsesSearchResponseSearchResponse execute() throws ApiException { SearchURLRequest searchURLRequest = buildBodyParams(); ApiResponse localVarResp = postWithHttpInfo(searchURLRequest); return localVarResp.getResponseBody(); } /** * Execute post request with HTTP info returned * @return ApiResponse<DtoResponsesSearchResponseSearchResponse> * @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 { SearchURLRequest searchURLRequest = buildBodyParams(); return postWithHttpInfo(searchURLRequest); } /** * 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 { SearchURLRequest searchURLRequest = buildBodyParams(); return postAsync(searchURLRequest, _callback); } } /** * [Post] Search For Articles Request * This endpoint allows you to search for articles. You can search for articles by id(s) or link(s). * @param searchURLRequest (required) * @return PostRequestBuilder * @http.response.details
Status Code Description Response Headers
200 Successful Response -
*/ public PostRequestBuilder post() throws IllegalArgumentException { return new PostRequestBuilder(); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy