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.
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, String from, String to, 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 (from != null) {
localVarQueryParams.addAll(localVarApiClient.parameterToPair("from_", from));
}
if (to != null) {
localVarQueryParams.addAll(localVarApiClient.parameterToPair("to_", to));
}
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, String from, String to, Integer page, Integer pageSize, final ApiCallback _callback) throws ApiException {
return getCall(ids, links, from, to, page, pageSize, _callback);
}
private ApiResponse getWithHttpInfo(Object ids, Object links, String from, String to, Integer page, Integer pageSize) throws ApiException {
okhttp3.Call localVarCall = getValidateBeforeCall(ids, links, from, to, page, pageSize, null);
Type localVarReturnType = new TypeToken(){}.getType();
return localVarApiClient.execute(localVarCall, localVarReturnType);
}
private okhttp3.Call getAsync(Object ids, Object links, String from, String to, Integer page, Integer pageSize, final ApiCallback _callback) throws ApiException {
okhttp3.Call localVarCall = getValidateBeforeCall(ids, links, from, to, page, pageSize, _callback);
Type localVarReturnType = new TypeToken(){}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
public abstract class GetRequestBuilderGenerated {
Object ids;
Object links;
String from;
String to;
Integer page;
Integer pageSize;
public GetRequestBuilderGenerated() {
}
/**
* Set ids
* @param ids (optional)
* @return SearchLinkApi.GetRequestBuilder
*/
public SearchLinkApi.GetRequestBuilder ids(Object ids) {
this.ids = ids;
return (SearchLinkApi.GetRequestBuilder) this;
}
/**
* Set links
* @param links (optional)
* @return SearchLinkApi.GetRequestBuilder
*/
public SearchLinkApi.GetRequestBuilder links(Object links) {
this.links = links;
return (SearchLinkApi.GetRequestBuilder) this;
}
/**
* Set from
* @param from (optional)
* @return SearchLinkApi.GetRequestBuilder
*/
public SearchLinkApi.GetRequestBuilder from(String from) {
this.from = from;
return (SearchLinkApi.GetRequestBuilder) this;
}
/**
* Set to
* @param to (optional)
* @return SearchLinkApi.GetRequestBuilder
*/
public SearchLinkApi.GetRequestBuilder to(String to) {
this.to = to;
return (SearchLinkApi.GetRequestBuilder) this;
}
/**
* Set page
* @param page (optional, default to 1)
* @return SearchLinkApi.GetRequestBuilder
*/
public SearchLinkApi.GetRequestBuilder page(Integer page) {
this.page = page;
return (SearchLinkApi.GetRequestBuilder) this;
}
/**
* Set pageSize
* @param pageSize (optional, default to 100)
* @return SearchLinkApi.GetRequestBuilder
*/
public SearchLinkApi.GetRequestBuilder pageSize(Integer pageSize) {
this.pageSize = pageSize;
return (SearchLinkApi.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(ids, links, from, to, 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, from, to, 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, from, to, 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, from, to, 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 SearchLinkApi.GetRequestBuilder get() throws IllegalArgumentException {
return ((SearchLinkApi) this).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 abstract class PostRequestBuilderGenerated {
Object ids;
Object links;
String from;
String to;
Integer page;
Integer pageSize;
public PostRequestBuilderGenerated() {
}
/**
* Set ids
* @param ids (optional)
* @return SearchLinkApi.PostRequestBuilder
*/
public SearchLinkApi.PostRequestBuilder ids(Object ids) {
this.ids = ids;
return (SearchLinkApi.PostRequestBuilder) this;
}
/**
* Set links
* @param links (optional)
* @return SearchLinkApi.PostRequestBuilder
*/
public SearchLinkApi.PostRequestBuilder links(Object links) {
this.links = links;
return (SearchLinkApi.PostRequestBuilder) this;
}
/**
* Set from
* @param from (optional)
* @return SearchLinkApi.PostRequestBuilder
*/
public SearchLinkApi.PostRequestBuilder from(String from) {
this.from = from;
return (SearchLinkApi.PostRequestBuilder) this;
}
/**
* Set to
* @param to (optional)
* @return SearchLinkApi.PostRequestBuilder
*/
public SearchLinkApi.PostRequestBuilder to(String to) {
this.to = to;
return (SearchLinkApi.PostRequestBuilder) this;
}
/**
* Set page
* @param page (optional, default to 1)
* @return SearchLinkApi.PostRequestBuilder
*/
public SearchLinkApi.PostRequestBuilder page(Integer page) {
this.page = page;
return (SearchLinkApi.PostRequestBuilder) this;
}
/**
* Set pageSize
* @param pageSize (optional, default to 100)
* @return SearchLinkApi.PostRequestBuilder
*/
public SearchLinkApi.PostRequestBuilder pageSize(Integer pageSize) {
this.pageSize = pageSize;
return (SearchLinkApi.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 {
SearchURLRequest searchURLRequest = buildBodyParams();
return postCall(searchURLRequest, _callback);
}
private SearchURLRequest buildBodyParams() {
SearchURLRequest searchURLRequest = new SearchURLRequest();
searchURLRequest.ids(this.ids);
searchURLRequest.links(this.links);
searchURLRequest.from(this.from);
searchURLRequest.to(this.to);
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