Example usage for com.squareup.okhttp Response body

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

Introduction

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

Prototype

ResponseBody body

To view the source code for com.squareup.okhttp Response body.

Click Source Link

Usage

From source file:cloud.artik.api.DevicesManagementApi.java

License:Apache License

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

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

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

    // create path and map variables
    String localVarPath = "/devicemgmt/devices/{did}/serverproperties".replaceAll("\\{format\\}", "json")
            .replaceAll("\\{" + "did" + "\\}", apiClient.escapeString(did.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 = {

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

From source file:cloud.artik.api.DevicesManagementApi.java

License:Apache License

private com.squareup.okhttp.Call updateTaskCall(String tid, TaskUpdateRequest taskUpdateRequest,
        final ProgressResponseBody.ProgressListener progressListener,
        final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
    Object localVarPostBody = taskUpdateRequest;

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

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

    // create path and map variables
    String localVarPath = "/devicemgmt/tasks/{tid}".replaceAll("\\{format\\}", "json")
            .replaceAll("\\{" + "tid" + "\\}", apiClient.escapeString(tid.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 = {

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

From source file:cloud.artik.api.DevicesManagementApi.java

License:Apache License

private com.squareup.okhttp.Call updateTaskForDeviceCall(String tid, String did,
        DeviceTaskUpdateRequest deviceTaskUpdateRequest,
        final ProgressResponseBody.ProgressListener progressListener,
        final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
    Object localVarPostBody = deviceTaskUpdateRequest;

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

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

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

    // create path and map variables
    String localVarPath = "/devicemgmt/tasks/{tid}/devices/{did}".replaceAll("\\{format\\}", "json")
            .replaceAll("\\{" + "tid" + "\\}", apiClient.escapeString(tid.toString()))
            .replaceAll("\\{" + "did" + "\\}", apiClient.escapeString(did.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 = {

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

From source file:cloud.artik.api.DeviceTypesApi.java

License:Apache License

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

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

    // create path and map variables
    String localVarPath = "/devicetypes/{deviceTypeId}/availablemanifestversions"
            .replaceAll("\\{format\\}", "json")
            .replaceAll("\\{" + "deviceTypeId" + "\\}", apiClient.escapeString(deviceTypeId.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 = {

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

From source file:cloud.artik.api.DeviceTypesApi.java

License:Apache License

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

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

    // create path and map variables
    String localVarPath = "/devicetypes/{deviceTypeId}".replaceAll("\\{format\\}", "json")
            .replaceAll("\\{" + "deviceTypeId" + "\\}", apiClient.escapeString(deviceTypeId.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 = {

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

From source file:cloud.artik.api.DeviceTypesApi.java

License:Apache License

private com.squareup.okhttp.Call getDeviceTypesCall(String name, Integer offset, Integer count, String tags,
        final ProgressResponseBody.ProgressListener progressListener,
        final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
    Object localVarPostBody = null;

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

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

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

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

From source file:cloud.artik.api.DeviceTypesApi.java

License:Apache License

private com.squareup.okhttp.Call getDeviceTypesByApplicationCall(String appId, Boolean productInfo,
        Integer count, Integer offset, final ProgressResponseBody.ProgressListener progressListener,
        final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
    Object localVarPostBody = null;

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

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

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

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

From source file:cloud.artik.api.DeviceTypesApi.java

License:Apache License

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

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

    // create path and map variables
    String localVarPath = "/devicetypes/{deviceTypeId}/manifests/latest/properties"
            .replaceAll("\\{format\\}", "json")
            .replaceAll("\\{" + "deviceTypeId" + "\\}", apiClient.escapeString(deviceTypeId.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 = {

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

From source file:cloud.artik.api.DeviceTypesApi.java

License:Apache License

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

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

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

    // create path and map variables
    String localVarPath = "/devicetypes/{deviceTypeId}/manifests/{version}/properties"
            .replaceAll("\\{format\\}", "json")
            .replaceAll("\\{" + "deviceTypeId" + "\\}", apiClient.escapeString(deviceTypeId.toString()))
            .replaceAll("\\{" + "version" + "\\}", apiClient.escapeString(version.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 = {

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

From source file:cloud.artik.api.ExportApi.java

License:Apache License

private com.squareup.okhttp.Call exportRequestCall(ExportRequestInfo exportRequestInfo,
        final ProgressResponseBody.ProgressListener progressListener,
        final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
    Object localVarPostBody = exportRequestInfo;

    // verify the required parameter 'exportRequestInfo' is set
    if (exportRequestInfo == null) {
        throw new ApiException(
                "Missing the required parameter 'exportRequestInfo' when calling exportRequest(Async)");
    }/*from   www  . j  a  v  a 2 s  . c  om*/

    // create path and map variables
    String localVarPath = "/messages/export".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 = {

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