/* * NiFi Rest Api * The Rest Api provides programmatic access to command and control a NiFi instance in real time. Start and stop processors, monitor queues, query provenance data, and more. Each endpoint below includes a description, definitions of the expected input and output, potential response codes, and the authorizations required to invoke each service. * * OpenAPI spec version: 1.5.0 * Contact: [email protected] * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ package com.github.hermannpencole.nifi.swagger.client; import com.github.hermannpencole.nifi.swagger.ApiCallback; import com.github.hermannpencole.nifi.swagger.ApiClient; import com.github.hermannpencole.nifi.swagger.ApiException; import com.github.hermannpencole.nifi.swagger.ApiResponse; import com.github.hermannpencole.nifi.swagger.Configuration; import com.github.hermannpencole.nifi.swagger.Pair; import com.github.hermannpencole.nifi.swagger.ProgressRequestBody; import com.github.hermannpencole.nifi.swagger.ProgressResponseBody; import com.google.gson.reflect.TypeToken; import java.io.IOException; import com.github.hermannpencole.nifi.swagger.client.model.FunnelEntity; import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class FunnelApi { private ApiClient apiClient; public FunnelApi() { this(Configuration.getDefaultApiClient()); } public FunnelApi(ApiClient apiClient) { this.apiClient = apiClient; } public ApiClient getApiClient() { return apiClient; } public void setApiClient(ApiClient apiClient) { this.apiClient = apiClient; } /** * Build call for getFunnel * @param id The funnel id. (required) * @param progressListener Progress listener * @param progressRequestListener Progress request listener * @return Call to execute * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call getFunnelCall(String id, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/funnels/{id}" .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { "*/*" }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); } }); } String[] localVarAuthNames = new String[] { "auth" }; return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") private com.squareup.okhttp.Call getFunnelValidateBeforeCall(String id, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling getFunnel(Async)"); } com.squareup.okhttp.Call call = getFunnelCall(id, progressListener, progressRequestListener); return call; } /** * Gets a funnel * * @param id The funnel id. (required) * @return FunnelEntity * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public FunnelEntity getFunnel(String id) throws ApiException { ApiResponse<FunnelEntity> resp = getFunnelWithHttpInfo(id); return resp.getData(); } /** * Gets a funnel * * @param id The funnel id. (required) * @return ApiResponse<FunnelEntity> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<FunnelEntity> getFunnelWithHttpInfo(String id) throws ApiException { com.squareup.okhttp.Call call = getFunnelValidateBeforeCall(id, null, null); Type localVarReturnType = new TypeToken<FunnelEntity>(){}.getType(); return apiClient.execute(call, localVarReturnType); } /** * Gets a funnel (asynchronously) * * @param id The funnel id. (required) * @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 */ public com.squareup.okhttp.Call getFunnelAsync(String id, final ApiCallback<FunnelEntity> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = getFunnelValidateBeforeCall(id, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<FunnelEntity>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /** * Build call for removeFunnel * @param id The funnel id. (required) * @param version The revision is used to verify the client is working with the latest version of the flow. (optional) * @param clientId If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response. (optional) * @param progressListener Progress listener * @param progressRequestListener Progress request listener * @return Call to execute * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call removeFunnelCall(String id, String version, String clientId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/funnels/{id}" .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); if (version != null) localVarQueryParams.addAll(apiClient.parameterToPair("version", version)); if (clientId != null) localVarQueryParams.addAll(apiClient.parameterToPair("clientId", clientId)); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { "*/*" }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); } }); } String[] localVarAuthNames = new String[] { "auth" }; return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") private com.squareup.okhttp.Call removeFunnelValidateBeforeCall(String id, String version, String clientId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling removeFunnel(Async)"); } com.squareup.okhttp.Call call = removeFunnelCall(id, version, clientId, progressListener, progressRequestListener); return call; } /** * Deletes a funnel * * @param id The funnel id. (required) * @param version The revision is used to verify the client is working with the latest version of the flow. (optional) * @param clientId If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response. (optional) * @return FunnelEntity * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public FunnelEntity removeFunnel(String id, String version, String clientId) throws ApiException { ApiResponse<FunnelEntity> resp = removeFunnelWithHttpInfo(id, version, clientId); return resp.getData(); } /** * Deletes a funnel * * @param id The funnel id. (required) * @param version The revision is used to verify the client is working with the latest version of the flow. (optional) * @param clientId If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response. (optional) * @return ApiResponse<FunnelEntity> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<FunnelEntity> removeFunnelWithHttpInfo(String id, String version, String clientId) throws ApiException { com.squareup.okhttp.Call call = removeFunnelValidateBeforeCall(id, version, clientId, null, null); Type localVarReturnType = new TypeToken<FunnelEntity>(){}.getType(); return apiClient.execute(call, localVarReturnType); } /** * Deletes a funnel (asynchronously) * * @param id The funnel id. (required) * @param version The revision is used to verify the client is working with the latest version of the flow. (optional) * @param clientId If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response. (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 */ public com.squareup.okhttp.Call removeFunnelAsync(String id, String version, String clientId, final ApiCallback<FunnelEntity> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = removeFunnelValidateBeforeCall(id, version, clientId, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<FunnelEntity>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /** * Build call for updateFunnel * @param id The funnel id. (required) * @param body The funnel configuration details. (required) * @param progressListener Progress listener * @param progressRequestListener Progress request listener * @return Call to execute * @throws ApiException If fail to serialize the request body object */ public com.squareup.okhttp.Call updateFunnelCall(String id, FunnelEntity body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // create path and map variables String localVarPath = "/funnels/{id}" .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { "application/json" }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); } }); } String[] localVarAuthNames = new String[] { "auth" }; return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") private com.squareup.okhttp.Call updateFunnelValidateBeforeCall(String id, FunnelEntity body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling updateFunnel(Async)"); } // verify the required parameter 'body' is set if (body == null) { throw new ApiException("Missing the required parameter 'body' when calling updateFunnel(Async)"); } com.squareup.okhttp.Call call = updateFunnelCall(id, body, progressListener, progressRequestListener); return call; } /** * Updates a funnel * * @param id The funnel id. (required) * @param body The funnel configuration details. (required) * @return FunnelEntity * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public FunnelEntity updateFunnel(String id, FunnelEntity body) throws ApiException { ApiResponse<FunnelEntity> resp = updateFunnelWithHttpInfo(id, body); return resp.getData(); } /** * Updates a funnel * * @param id The funnel id. (required) * @param body The funnel configuration details. (required) * @return ApiResponse<FunnelEntity> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<FunnelEntity> updateFunnelWithHttpInfo(String id, FunnelEntity body) throws ApiException { com.squareup.okhttp.Call call = updateFunnelValidateBeforeCall(id, body, null, null); Type localVarReturnType = new TypeToken<FunnelEntity>(){}.getType(); return apiClient.execute(call, localVarReturnType); } /** * Updates a funnel (asynchronously) * * @param id The funnel id. (required) * @param body The funnel configuration details. (required) * @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 */ public com.squareup.okhttp.Call updateFunnelAsync(String id, FunnelEntity body, final ApiCallback<FunnelEntity> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = updateFunnelValidateBeforeCall(id, body, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<FunnelEntity>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } }