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

com.twitter.clientlib.api.ComplianceApi Maven / Gradle / Ivy

/*
Copyright 2020 Twitter, Inc.
SPDX-License-Identifier: Apache-2.0

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
https://openapi-generator.tech
Do not edit the class manually.
*/


package com.twitter.clientlib.api;

import com.twitter.clientlib.ApiCallback;
import com.twitter.clientlib.ApiClient;
import com.twitter.clientlib.auth.*;
import com.twitter.clientlib.ApiException;
import com.twitter.clientlib.ApiResponse;
import com.twitter.clientlib.Configuration;
import com.twitter.clientlib.Pair;
import com.twitter.clientlib.ProgressRequestBody;
import com.twitter.clientlib.ProgressResponseBody;

import com.github.scribejava.core.model.OAuth2AccessToken;
import com.google.gson.reflect.TypeToken;

import java.io.IOException;


import com.twitter.clientlib.model.ComplianceJobStatus;
import com.twitter.clientlib.model.ComplianceJobType;
import com.twitter.clientlib.model.CreateBatchComplianceJobRequest;
import com.twitter.clientlib.model.Error;
import com.twitter.clientlib.model.MultiComplianceJobResponse;
import com.twitter.clientlib.model.Problem;
import com.twitter.clientlib.model.SingleComplianceJobResponse;

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

import org.apache.commons.lang3.StringUtils;

public class ComplianceApi extends ApiCommon {

    /**
     * Build call for createBatchComplianceJob
     * @param createBatchComplianceJobRequest  (required)
     * @param _callback Callback for upload/download progress
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     * @http.response.details
     
Status Code Description Response Headers
200 The request was successful -
0 The request has failed. -
*/ public okhttp3.Call createBatchComplianceJobCall(CreateBatchComplianceJobRequest createBatchComplianceJobRequest, final ApiCallback _callback) throws ApiException { Object localVarPostBody = createBatchComplianceJobRequest; // create path and map variables String localVarPath = "/2/compliance/jobs"; 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", "application/problem+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[] { "BearerToken" }; return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, reduceAuthNames(localVarAuthNames), _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call createBatchComplianceJobValidateBeforeCall(CreateBatchComplianceJobRequest createBatchComplianceJobRequest, final ApiCallback _callback) throws ApiException { // verify the required parameter 'createBatchComplianceJobRequest' is set if (createBatchComplianceJobRequest == null) { throw new ApiException("Missing the required parameter 'createBatchComplianceJobRequest' when calling createBatchComplianceJob(Async)"); } okhttp3.Call localVarCall = createBatchComplianceJobCall(createBatchComplianceJobRequest, _callback); return localVarCall; } /** * Create compliance job * Creates a compliance for the given job type * @param createBatchComplianceJobRequest (required) * @return SingleComplianceJobResponse * @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 The request was successful -
0 The request has failed. -
*/ public SingleComplianceJobResponse createBatchComplianceJob(CreateBatchComplianceJobRequest createBatchComplianceJobRequest) throws ApiException { ApiResponse localVarResp = createBatchComplianceJobWithHttpInfo(createBatchComplianceJobRequest); return localVarResp != null ? localVarResp.getData() : null; } /** * Calls the API using a retry mechanism to handle rate limits errors. * */ public SingleComplianceJobResponse createBatchComplianceJob(Integer retries, CreateBatchComplianceJobRequest createBatchComplianceJobRequest) throws ApiException { SingleComplianceJobResponse localVarResp; try{ localVarResp = createBatchComplianceJob(createBatchComplianceJobRequest); } catch (ApiException e) { if(handleRateLimit(e, retries)) { return createBatchComplianceJob(retries - 1, createBatchComplianceJobRequest); } else { throw e; } } return localVarResp; } /** * Create compliance job * Creates a compliance for the given job type * @param createBatchComplianceJobRequest (required) * @return ApiResponse<SingleComplianceJobResponse> * @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 The request was successful -
0 The request has failed. -
*/ public ApiResponse createBatchComplianceJobWithHttpInfo(CreateBatchComplianceJobRequest createBatchComplianceJobRequest) throws ApiException { okhttp3.Call localVarCall = createBatchComplianceJobValidateBeforeCall(createBatchComplianceJobRequest, null); try { Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } catch (ApiException e) { e.setErrorObject(localVarApiClient.getJSON().getGson().fromJson(e.getResponseBody(), new TypeToken(){}.getType())); throw e; } } /** * Create compliance job (asynchronously) * Creates a compliance for the given job type * @param createBatchComplianceJobRequest (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 * @http.response.details
Status Code Description Response Headers
200 The request was successful -
0 The request has failed. -
*/ public okhttp3.Call createBatchComplianceJobAsync(CreateBatchComplianceJobRequest createBatchComplianceJobRequest, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = createBatchComplianceJobValidateBeforeCall(createBatchComplianceJobRequest, _callback); Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for getBatchComplianceJob * @param id ID of the compliance job to retrieve. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details
Status Code Description Response Headers
200 The request was successful -
0 The request has failed. -
*/ public okhttp3.Call getBatchComplianceJobCall(String id, final ApiCallback _callback) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/2/compliance/jobs/{id}" .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); 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", "application/problem+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[] { "BearerToken" }; return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, reduceAuthNames(localVarAuthNames), _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call getBatchComplianceJobValidateBeforeCall(String id, final ApiCallback _callback) throws ApiException { // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling getBatchComplianceJob(Async)"); } okhttp3.Call localVarCall = getBatchComplianceJobCall(id, _callback); return localVarCall; } /** * Get compliance job * Returns a single compliance job by ID * @param id ID of the compliance job to retrieve. (required) * @return SingleComplianceJobResponse * @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 The request was successful -
0 The request has failed. -
*/ public SingleComplianceJobResponse getBatchComplianceJob(String id) throws ApiException { ApiResponse localVarResp = getBatchComplianceJobWithHttpInfo(id); return localVarResp != null ? localVarResp.getData() : null; } /** * Calls the API using a retry mechanism to handle rate limits errors. * */ public SingleComplianceJobResponse getBatchComplianceJob(Integer retries, String id) throws ApiException { SingleComplianceJobResponse localVarResp; try{ localVarResp = getBatchComplianceJob(id); } catch (ApiException e) { if(handleRateLimit(e, retries)) { return getBatchComplianceJob(retries - 1, id); } else { throw e; } } return localVarResp; } /** * Get compliance job * Returns a single compliance job by ID * @param id ID of the compliance job to retrieve. (required) * @return ApiResponse<SingleComplianceJobResponse> * @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 The request was successful -
0 The request has failed. -
*/ public ApiResponse getBatchComplianceJobWithHttpInfo(String id) throws ApiException { okhttp3.Call localVarCall = getBatchComplianceJobValidateBeforeCall(id, null); try { Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } catch (ApiException e) { e.setErrorObject(localVarApiClient.getJSON().getGson().fromJson(e.getResponseBody(), new TypeToken(){}.getType())); throw e; } } /** * Get compliance job (asynchronously) * Returns a single compliance job by ID * @param id ID of the compliance job to retrieve. (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 * @http.response.details
Status Code Description Response Headers
200 The request was successful -
0 The request has failed. -
*/ public okhttp3.Call getBatchComplianceJobAsync(String id, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = getBatchComplianceJobValidateBeforeCall(id, _callback); Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for listBatchComplianceJobs * @param type Type of compliance job to list. (required) * @param status Status of compliance job to list. (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
Status Code Description Response Headers
200 List compliance jobs response -
0 The request has failed. -
*/ public okhttp3.Call listBatchComplianceJobsCall(ComplianceJobType type, ComplianceJobStatus status, final ApiCallback _callback) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/2/compliance/jobs"; List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); if (type != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("type", type)); } if (status != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("status", status)); } final String[] localVarAccepts = { "application/json", "application/problem+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[] { "BearerToken" }; return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, reduceAuthNames(localVarAuthNames), _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call listBatchComplianceJobsValidateBeforeCall(ComplianceJobType type, ComplianceJobStatus status, final ApiCallback _callback) throws ApiException { // verify the required parameter 'type' is set if (type == null) { throw new ApiException("Missing the required parameter 'type' when calling listBatchComplianceJobs(Async)"); } okhttp3.Call localVarCall = listBatchComplianceJobsCall(type, status, _callback); return localVarCall; } /** * List compliance jobs * Returns recent compliance jobs for a given job type and optional job status * @param type Type of compliance job to list. (required) * @param status Status of compliance job to list. (optional) * @return MultiComplianceJobResponse * @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 List compliance jobs response -
0 The request has failed. -
*/ public MultiComplianceJobResponse listBatchComplianceJobs(ComplianceJobType type, ComplianceJobStatus status) throws ApiException { ApiResponse localVarResp = listBatchComplianceJobsWithHttpInfo(type, status); return localVarResp != null ? localVarResp.getData() : null; } /** * Calls the API using a retry mechanism to handle rate limits errors. * */ public MultiComplianceJobResponse listBatchComplianceJobs(Integer retries, ComplianceJobType type, ComplianceJobStatus status) throws ApiException { MultiComplianceJobResponse localVarResp; try{ localVarResp = listBatchComplianceJobs(type, status); } catch (ApiException e) { if(handleRateLimit(e, retries)) { return listBatchComplianceJobs(retries - 1, type, status); } else { throw e; } } return localVarResp; } /** * List compliance jobs * Returns recent compliance jobs for a given job type and optional job status * @param type Type of compliance job to list. (required) * @param status Status of compliance job to list. (optional) * @return ApiResponse<MultiComplianceJobResponse> * @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 List compliance jobs response -
0 The request has failed. -
*/ public ApiResponse listBatchComplianceJobsWithHttpInfo(ComplianceJobType type, ComplianceJobStatus status) throws ApiException { okhttp3.Call localVarCall = listBatchComplianceJobsValidateBeforeCall(type, status, null); try { Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } catch (ApiException e) { e.setErrorObject(localVarApiClient.getJSON().getGson().fromJson(e.getResponseBody(), new TypeToken(){}.getType())); throw e; } } /** * List compliance jobs (asynchronously) * Returns recent compliance jobs for a given job type and optional job status * @param type Type of compliance job to list. (required) * @param status Status of compliance job to list. (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
Status Code Description Response Headers
200 List compliance jobs response -
0 The request has failed. -
*/ public okhttp3.Call listBatchComplianceJobsAsync(ComplianceJobType type, ComplianceJobStatus status, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = listBatchComplianceJobsValidateBeforeCall(type, status, _callback); Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy