Example usage for com.squareup.okhttp Response newBuilder

List of usage examples for com.squareup.okhttp Response newBuilder

Introduction

In this page you can find the example usage for com.squareup.okhttp Response newBuilder.

Prototype

public Builder newBuilder() 

Source Link

Usage

From source file:com.onfido.api.DefaultApi.java

License:Apache License

private com.squareup.okhttp.Call uploadLivePhotoCall(String applicantId, File file, Boolean advancedValidation,
        final ProgressResponseBody.ProgressListener progressListener,
        final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
    Object localVarPostBody = null;

    // verify the required parameter 'applicantId' is set
    if (applicantId == null) {
        throw new ApiException(
                "Missing the required parameter 'applicantId' when calling uploadLivePhoto(Async)");
    }/*  w w w  .j  a  v  a2  s  .  co  m*/

    // verify the required parameter 'file' is set
    if (file == null) {
        throw new ApiException("Missing the required parameter 'file' when calling uploadLivePhoto(Async)");
    }

    // create path and map variables
    String localVarPath = "/live_photos".replaceAll("\\{format\\}", "json");

    List<Pair> localVarQueryParams = new ArrayList<Pair>();

    Map<String, String> localVarHeaderParams = new HashMap<String, String>();

    Map<String, Object> localVarFormParams = new HashMap<String, Object>();
    if (applicantId != null)
        localVarFormParams.put("applicant_id", applicantId);
    if (file != null)
        localVarFormParams.put("file", file);
    if (advancedValidation != null)
        localVarFormParams.put("advanced_validation", advancedValidation);

    final String[] localVarAccepts = { "application/json" };
    final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
    if (localVarAccept != null)
        localVarHeaderParams.put("Accept", localVarAccept);

    final String[] localVarContentTypes = { "multipart/form-data" };
    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[] { "Token" };
    return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody,
            localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}

From source file:com.oracle.bdcs.bdm.client.api.Clusters.java

License:Apache License

private com.squareup.okhttp.Call getClusterCall(String clusterName, String tenantName,
        final ProgressResponseBody.ProgressListener progressListener,
        final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
    Object localVarPostBody = null;

    // verify the required parameter 'clusterName' is set
    if (clusterName == null) {
        throw new ApiException("Missing the required parameter 'clusterName' when calling getCluster(Async)");
    }/*from w w  w. j  a  v a2  s.  c o m*/

    // verify the required parameter 'tenantName' is set
    if (tenantName == null) {
        throw new ApiException("Missing the required parameter 'tenantName' when calling getCluster(Async)");
    }

    // create path and map variables
    String localVarPath = "/v1.0/tenants/{tenantName}/clusters/{clusterName}".replaceAll("\\{format\\}", "json")
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.toString()))
            .replaceAll("\\{" + "tenantName" + "\\}", apiClient.escapeString(tenantName.toString()));

    List<Pair> localVarQueryParams = new ArrayList<Pair>();

    Map<String, String> localVarHeaderParams = new HashMap<String, String>();

    Map<String, Object> localVarFormParams = new HashMap<String, Object>();

    final String[] localVarAccepts = {

    };
    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[] {};
    return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams,
            localVarFormParams, localVarAuthNames, progressRequestListener);
}

From source file:com.oracle.bdcs.bdm.client.api.Clusters.java

License:Apache License

private com.squareup.okhttp.Call listAllClustersCall(String tenantName, Integer offset, Integer limit,
        final ProgressResponseBody.ProgressListener progressListener,
        final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
    Object localVarPostBody = null;

    // verify the required parameter 'tenantName' is set
    if (tenantName == null) {
        throw new ApiException(
                "Missing the required parameter 'tenantName' when calling listAllClusters(Async)");
    }/* ww  w  . j a  v a2  s.  c om*/

    // create path and map variables
    String localVarPath = "/v1.0/tenants/{tenantName}/clusters".replaceAll("\\{format\\}", "json")
            .replaceAll("\\{" + "tenantName" + "\\}", apiClient.escapeString(tenantName.toString()));

    List<Pair> localVarQueryParams = new ArrayList<Pair>();
    if (offset != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "offset", offset));
    if (limit != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "limit", limit));

    Map<String, String> localVarHeaderParams = new HashMap<String, String>();

    Map<String, Object> localVarFormParams = new HashMap<String, Object>();

    final String[] localVarAccepts = {

    };
    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[] {};
    return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams,
            localVarFormParams, localVarAuthNames, progressRequestListener);
}

From source file:com.oracle.bdcs.bdm.client.api.Clusters.java

License:Apache License

private com.squareup.okhttp.Call registerNewClusterCall(Cluster body, String tenantName,
        final ProgressResponseBody.ProgressListener progressListener,
        final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
    Object localVarPostBody = body;

    // verify the required parameter 'body' is set
    if (body == null) {
        throw new ApiException("Missing the required parameter 'body' when calling registerNewCluster(Async)");
    }/*from  w w w.j  a v  a2  s .  co  m*/

    // verify the required parameter 'tenantName' is set
    if (tenantName == null) {
        throw new ApiException(
                "Missing the required parameter 'tenantName' when calling registerNewCluster(Async)");
    }

    // create path and map variables
    String localVarPath = "/v1.0/tenants/{tenantName}/clusters".replaceAll("\\{format\\}", "json")
            .replaceAll("\\{" + "tenantName" + "\\}", apiClient.escapeString(tenantName.toString()));

    List<Pair> localVarQueryParams = new ArrayList<Pair>();

    Map<String, String> localVarHeaderParams = new HashMap<String, String>();

    Map<String, Object> localVarFormParams = new HashMap<String, Object>();

    final String[] localVarAccepts = {

    };
    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[] {};
    return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody,
            localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}

From source file:com.oracle.bdcs.bdm.client.api.Clusters.java

License:Apache License

private com.squareup.okhttp.Call unregisterClusterCall(String clusterName, String tenantName,
        final ProgressResponseBody.ProgressListener progressListener,
        final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
    Object localVarPostBody = null;

    // verify the required parameter 'clusterName' is set
    if (clusterName == null) {
        throw new ApiException(
                "Missing the required parameter 'clusterName' when calling unregisterCluster(Async)");
    }/*from   ww  w  . j  a va 2  s .  c  o m*/

    // verify the required parameter 'tenantName' is set
    if (tenantName == null) {
        throw new ApiException(
                "Missing the required parameter 'tenantName' when calling unregisterCluster(Async)");
    }

    // create path and map variables
    String localVarPath = "/v1.0/tenants/{tenantName}/clusters/{clusterName}".replaceAll("\\{format\\}", "json")
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.toString()))
            .replaceAll("\\{" + "tenantName" + "\\}", apiClient.escapeString(tenantName.toString()));

    List<Pair> localVarQueryParams = new ArrayList<Pair>();

    Map<String, String> localVarHeaderParams = new HashMap<String, String>();

    Map<String, Object> localVarFormParams = new HashMap<String, Object>();

    final String[] localVarAccepts = {

    };
    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[] {};
    return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarPostBody,
            localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}

From source file:com.oracle.bdcs.bdm.client.api.Clusters.java

License:Apache License

private com.squareup.okhttp.Call updateClusterCall(String clusterName, Cluster body, String tenantName,
        final ProgressResponseBody.ProgressListener progressListener,
        final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
    Object localVarPostBody = body;

    // verify the required parameter 'clusterName' is set
    if (clusterName == null) {
        throw new ApiException(
                "Missing the required parameter 'clusterName' when calling updateCluster(Async)");
    }/*  w  w  w . j  a  va2  s . c o  m*/

    // verify the required parameter 'body' is set
    if (body == null) {
        throw new ApiException("Missing the required parameter 'body' when calling updateCluster(Async)");
    }

    // verify the required parameter 'tenantName' is set
    if (tenantName == null) {
        throw new ApiException("Missing the required parameter 'tenantName' when calling updateCluster(Async)");
    }

    // create path and map variables
    String localVarPath = "/v1.0/tenants/{tenantName}/clusters/{clusterName}".replaceAll("\\{format\\}", "json")
            .replaceAll("\\{" + "clusterName" + "\\}", apiClient.escapeString(clusterName.toString()))
            .replaceAll("\\{" + "tenantName" + "\\}", apiClient.escapeString(tenantName.toString()));

    List<Pair> localVarQueryParams = new ArrayList<Pair>();

    Map<String, String> localVarHeaderParams = new HashMap<String, String>();

    Map<String, Object> localVarFormParams = new HashMap<String, Object>();

    final String[] localVarAccepts = {

    };
    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[] {};
    return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams,
            localVarFormParams, localVarAuthNames, progressRequestListener);
}

From source file:com.oracle.bdcs.bdm.client.api.Configs.java

License:Apache License

private com.squareup.okhttp.Call getConfigurationCall(String tenantName,
        final ProgressResponseBody.ProgressListener progressListener,
        final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
    Object localVarPostBody = null;

    // verify the required parameter 'tenantName' is set
    if (tenantName == null) {
        throw new ApiException(
                "Missing the required parameter 'tenantName' when calling getConfiguration(Async)");
    }/*  w ww . j a  v  a 2s  .  co m*/

    // create path and map variables
    String localVarPath = "/v1.0/tenants/{tenantName}/config".replaceAll("\\{format\\}", "json")
            .replaceAll("\\{" + "tenantName" + "\\}", apiClient.escapeString(tenantName.toString()));

    List<Pair> localVarQueryParams = new ArrayList<Pair>();

    Map<String, String> localVarHeaderParams = new HashMap<String, String>();

    Map<String, Object> localVarFormParams = new HashMap<String, Object>();

    final String[] localVarAccepts = {

    };
    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[] {};
    return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams,
            localVarFormParams, localVarAuthNames, progressRequestListener);
}

From source file:com.oracle.bdcs.bdm.client.api.DataMovements.java

License:Apache License

private com.squareup.okhttp.Call manageDataRequestCall(String tenantName, DataMovementRequest body,
        final ProgressResponseBody.ProgressListener progressListener,
        final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
    Object localVarPostBody = body;

    // verify the required parameter 'tenantName' is set
    if (tenantName == null) {
        throw new ApiException("Missing the required parameter 'tenantName' when calling create(Async)");
    }/*from w w  w.  jav  a  2  s  .  c o m*/

    // verify the required parameter 'body' is set
    if (body == null) {
        throw new ApiException("Missing the required parameter 'body' when calling create(Async)");
    }

    // create path and map variables
    String localVarPath = "/v1.0/tenants/{tenantName}/datamovements".replaceAll("\\{format\\}", "json")
            .replaceAll("\\{" + "tenantName" + "\\}", apiClient.escapeString(tenantName.toString()));

    List<Pair> localVarQueryParams = new ArrayList<Pair>();

    Map<String, String> localVarHeaderParams = new HashMap<String, String>();

    Map<String, Object> localVarFormParams = new HashMap<String, Object>();

    final String[] localVarAccepts = {

    };
    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[] {};
    return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody,
            localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}

From source file:com.oracle.bdcs.bdm.client.api.DataSources.java

License:Apache License

private com.squareup.okhttp.Call createDataSourceCall(DataSource body, String tenantName,
        final ProgressResponseBody.ProgressListener progressListener,
        final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
    Object localVarPostBody = body;

    // verify the required parameter 'body' is set
    if (body == null) {
        throw new ApiException("Missing the required parameter 'body' when calling createDataSource(Async)");
    }/*from w  w w.j a  v  a2 s. c  o m*/

    // verify the required parameter 'tenantName' is set
    if (tenantName == null) {
        throw new ApiException(
                "Missing the required parameter 'tenantName' when calling createDataSource(Async)");
    }

    // create path and map variables
    String localVarPath = "/v1.0/tenants/{tenantName}/dataSources".replaceAll("\\{format\\}", "json")
            .replaceAll("\\{" + "tenantName" + "\\}", apiClient.escapeString(tenantName.toString()));

    List<Pair> localVarQueryParams = new ArrayList<Pair>();

    Map<String, String> localVarHeaderParams = new HashMap<String, String>();

    Map<String, Object> localVarFormParams = new HashMap<String, Object>();

    final String[] localVarAccepts = {

    };
    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[] {};
    return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody,
            localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}

From source file:com.oracle.bdcs.bdm.client.api.DataSources.java

License:Apache License

private com.squareup.okhttp.Call deleteDataSourceCall(String dataSourceName, String tenantName,
        final ProgressResponseBody.ProgressListener progressListener,
        final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
    Object localVarPostBody = null;

    // verify the required parameter 'dataSourceName' is set
    if (dataSourceName == null) {
        throw new ApiException(
                "Missing the required parameter 'dataSourceName' when calling deleteDataSource(Async)");
    }//from  w  w  w  .j a  va  2s. c om

    // verify the required parameter 'tenantName' is set
    if (tenantName == null) {
        throw new ApiException(
                "Missing the required parameter 'tenantName' when calling deleteDataSource(Async)");
    }

    // create path and map variables
    String localVarPath = "/v1.0/tenants/{tenantName}/dataSources/{dataSourceName}"
            .replaceAll("\\{format\\}", "json")
            .replaceAll("\\{" + "dataSourceName" + "\\}", apiClient.escapeString(dataSourceName.toString()))
            .replaceAll("\\{" + "tenantName" + "\\}", apiClient.escapeString(tenantName.toString()));

    List<Pair> localVarQueryParams = new ArrayList<Pair>();

    Map<String, String> localVarHeaderParams = new HashMap<String, String>();

    Map<String, Object> localVarFormParams = new HashMap<String, Object>();

    final String[] localVarAccepts = {

    };
    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[] {};
    return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarPostBody,
            localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}