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:io.swagger.client.api.ApiApi.java

License:Apache License

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

    // create path and map variables
    String localVarPath = "/workflows/graphs".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>();

    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//w  ww . j av  a  2s  .com
            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:io.swagger.client.api.ApiApi.java

License:Apache License

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

    // create path and map variables
    String localVarPath = "/workflows/tasks".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>();

    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//from   w  w  w . j  a v  a2 s  .  com
            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:io.swagger.client.api.AssociationApi.java

License:Apache License

private com.squareup.okhttp.Call getAssociationObjectCall(String id, Integer rows, Boolean flExcludesEvidence,
        String evidence, Integer page, String object, String subject, String subjectTaxon, Boolean graphize,
        String mapIdentifiers, final ProgressResponseBody.ProgressListener progressListener,
        final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
    Object localVarPostBody = null;

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

    // create path and map variables
    String localVarPath = "/association/{id}".replaceAll("\\{format\\}", "json")
            .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));

    List<Pair> localVarQueryParams = new ArrayList<Pair>();
    if (rows != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "rows", rows));
    if (flExcludesEvidence != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "fl_excludes_evidence", flExcludesEvidence));
    if (evidence != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "evidence", evidence));
    if (page != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page));
    if (object != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "object", object));
    if (subject != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "subject", subject));
    if (subjectTaxon != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "subject_taxon", subjectTaxon));
    if (graphize != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "graphize", graphize));
    if (mapIdentifiers != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "map_identifiers", mapIdentifiers));

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

From source file:io.swagger.client.api.AssociationApi.java

License:Apache License

private com.squareup.okhttp.Call getAssociationSearchCall(Integer rows, Boolean flExcludesEvidence,
        String evidence, Integer page, String object, String subject, String subjectTaxon, Boolean graphize,
        String mapIdentifiers, final ProgressResponseBody.ProgressListener progressListener,
        final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
    Object localVarPostBody = null;

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

    List<Pair> localVarQueryParams = new ArrayList<Pair>();
    if (rows != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "rows", rows));
    if (flExcludesEvidence != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "fl_excludes_evidence", flExcludesEvidence));
    if (evidence != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "evidence", evidence));
    if (page != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page));
    if (object != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "object", object));
    if (subject != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "subject", subject));
    if (subjectTaxon != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "subject_taxon", subjectTaxon));
    if (graphize != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "graphize", graphize));
    if (mapIdentifiers != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "map_identifiers", mapIdentifiers));

    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// w  w w .  jav a 2  s.  c  om
            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:io.swagger.client.api.AssociationApi.java

License:Apache License

private com.squareup.okhttp.Call getAssociationSearch_0Call(String objectCategory, String subjectCategory,
        Integer rows, Boolean flExcludesEvidence, String evidence, Integer page, String object, String subject,
        String subjectTaxon, Boolean graphize, String mapIdentifiers,
        final ProgressResponseBody.ProgressListener progressListener,
        final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
    Object localVarPostBody = null;

    // verify the required parameter 'objectCategory' is set
    if (objectCategory == null) {
        throw new ApiException(
                "Missing the required parameter 'objectCategory' when calling getAssociationSearch_0(Async)");
    }//www  .  j  av a  2s.  c o  m

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

    // create path and map variables
    String localVarPath = "/association/find/{subject_category}/".replaceAll("\\{format\\}", "json")
            .replaceAll("\\{" + "object_category" + "\\}", apiClient.escapeString(objectCategory.toString()))
            .replaceAll("\\{" + "subject_category" + "\\}", apiClient.escapeString(subjectCategory.toString()));

    List<Pair> localVarQueryParams = new ArrayList<Pair>();
    if (rows != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "rows", rows));
    if (flExcludesEvidence != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "fl_excludes_evidence", flExcludesEvidence));
    if (evidence != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "evidence", evidence));
    if (page != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page));
    if (object != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "object", object));
    if (subject != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "subject", subject));
    if (subjectTaxon != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "subject_taxon", subjectTaxon));
    if (graphize != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "graphize", graphize));
    if (mapIdentifiers != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "map_identifiers", mapIdentifiers));

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

From source file:io.swagger.client.api.AssociationApi.java

License:Apache License

private com.squareup.okhttp.Call getAssociationSearch_1Call(String objectCategory, String subjectCategory,
        Integer rows, Boolean flExcludesEvidence, String evidence, Integer page, String object, String subject,
        String subjectTaxon, Boolean graphize, String mapIdentifiers,
        final ProgressResponseBody.ProgressListener progressListener,
        final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
    Object localVarPostBody = null;

    // verify the required parameter 'objectCategory' is set
    if (objectCategory == null) {
        throw new ApiException(
                "Missing the required parameter 'objectCategory' when calling getAssociationSearch_1(Async)");
    }//from www.  j  ava2 s .c o  m

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

    // create path and map variables
    String localVarPath = "/association/find/{subject_category}/{object_category}/"
            .replaceAll("\\{format\\}", "json")
            .replaceAll("\\{" + "object_category" + "\\}", apiClient.escapeString(objectCategory.toString()))
            .replaceAll("\\{" + "subject_category" + "\\}", apiClient.escapeString(subjectCategory.toString()));

    List<Pair> localVarQueryParams = new ArrayList<Pair>();
    if (rows != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "rows", rows));
    if (flExcludesEvidence != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "fl_excludes_evidence", flExcludesEvidence));
    if (evidence != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "evidence", evidence));
    if (page != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page));
    if (object != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "object", object));
    if (subject != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "subject", subject));
    if (subjectTaxon != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "subject_taxon", subjectTaxon));
    if (graphize != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "graphize", graphize));
    if (mapIdentifiers != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "map_identifiers", mapIdentifiers));

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

From source file:io.swagger.client.api.AssociationApi.java

License:Apache License

private com.squareup.okhttp.Call getAssociationsFromCall(String object, String subject, String objectCategory,
        String mapIdentifiers, String evidence, String subjectCategory, Integer page,
        Boolean flExcludesEvidence, String subjectTaxon, Boolean graphize, Integer rows,
        Boolean useCompactAssociations, final ProgressResponseBody.ProgressListener progressListener,
        final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
    Object localVarPostBody = null;

    // verify the required parameter 'object' is set
    if (object == null) {
        throw new ApiException(
                "Missing the required parameter 'object' when calling getAssociationsFrom(Async)");
    }/*from ww  w .  ja  va 2s .co m*/

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

    // create path and map variables
    String localVarPath = "/association/between/{subject}/{object}".replaceAll("\\{format\\}", "json")
            .replaceAll("\\{" + "object" + "\\}", apiClient.escapeString(object.toString()))
            .replaceAll("\\{" + "subject" + "\\}", apiClient.escapeString(subject.toString()));

    List<Pair> localVarQueryParams = new ArrayList<Pair>();
    if (objectCategory != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "object_category", objectCategory));
    if (mapIdentifiers != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "map_identifiers", mapIdentifiers));
    if (evidence != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "evidence", evidence));
    if (subjectCategory != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "subject_category", subjectCategory));
    if (page != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page));
    if (flExcludesEvidence != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "fl_excludes_evidence", flExcludesEvidence));
    if (subjectTaxon != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "subject_taxon", subjectTaxon));
    if (graphize != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "graphize", graphize));
    if (rows != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "rows", rows));
    if (useCompactAssociations != null)
        localVarQueryParams
                .addAll(apiClient.parameterToPairs("", "use_compact_associations", useCompactAssociations));

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

From source file:io.swagger.client.api.AssociationApi.java

License:Apache License

private com.squareup.okhttp.Call getAssociationsFrom_0Call(String subject, String objectCategory,
        String mapIdentifiers, String evidence, String subjectCategory, Integer page,
        Boolean flExcludesEvidence, String subjectTaxon, Boolean graphize, Integer rows,
        Boolean useCompactAssociations, final ProgressResponseBody.ProgressListener progressListener,
        final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
    Object localVarPostBody = null;

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

    // create path and map variables
    String localVarPath = "/association/from/{subject}".replaceAll("\\{format\\}", "json")
            .replaceAll("\\{" + "subject" + "\\}", apiClient.escapeString(subject.toString()));

    List<Pair> localVarQueryParams = new ArrayList<Pair>();
    if (objectCategory != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "object_category", objectCategory));
    if (mapIdentifiers != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "map_identifiers", mapIdentifiers));
    if (evidence != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "evidence", evidence));
    if (subjectCategory != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "subject_category", subjectCategory));
    if (page != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page));
    if (flExcludesEvidence != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "fl_excludes_evidence", flExcludesEvidence));
    if (subjectTaxon != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "subject_taxon", subjectTaxon));
    if (graphize != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "graphize", graphize));
    if (rows != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "rows", rows));
    if (useCompactAssociations != null)
        localVarQueryParams
                .addAll(apiClient.parameterToPairs("", "use_compact_associations", useCompactAssociations));

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

From source file:io.swagger.client.api.AssociationApi.java

License:Apache License

private com.squareup.okhttp.Call getAssociationsToCall(String object, String objectCategory,
        String mapIdentifiers, String evidence, String subjectCategory, Integer page,
        Boolean flExcludesEvidence, String subjectTaxon, Boolean graphize, Integer rows,
        Boolean useCompactAssociations, final ProgressResponseBody.ProgressListener progressListener,
        final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
    Object localVarPostBody = null;

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

    // create path and map variables
    String localVarPath = "/association/to/{object}".replaceAll("\\{format\\}", "json")
            .replaceAll("\\{" + "object" + "\\}", apiClient.escapeString(object.toString()));

    List<Pair> localVarQueryParams = new ArrayList<Pair>();
    if (objectCategory != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "object_category", objectCategory));
    if (mapIdentifiers != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "map_identifiers", mapIdentifiers));
    if (evidence != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "evidence", evidence));
    if (subjectCategory != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "subject_category", subjectCategory));
    if (page != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page));
    if (flExcludesEvidence != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "fl_excludes_evidence", flExcludesEvidence));
    if (subjectTaxon != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "subject_taxon", subjectTaxon));
    if (graphize != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "graphize", graphize));
    if (rows != null)
        localVarQueryParams.addAll(apiClient.parameterToPairs("", "rows", rows));
    if (useCompactAssociations != null)
        localVarQueryParams
                .addAll(apiClient.parameterToPairs("", "use_compact_associations", useCompactAssociations));

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

From source file:io.swagger.client.api.AttachmentsApi.java

License:Apache License

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

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

    // create path and map variables
    String localVarPath = "/attachments/{attachment-id}".replaceAll("\\{format\\}", "json")
            .replaceAll("\\{" + "attachment-id" + "\\}", apiClient.escapeString(attachmentId.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 = { "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[] {};
    return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarPostBody,
            localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}