Example usage for com.google.gson.reflect TypeToken TypeToken

List of usage examples for com.google.gson.reflect TypeToken TypeToken

Introduction

In this page you can find the example usage for com.google.gson.reflect TypeToken TypeToken.

Prototype

@SuppressWarnings("unchecked")
protected TypeToken() 

Source Link

Document

Constructs a new type literal.

Usage

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

License:Apache License

/**
 * Create a new task for one or more devices (asynchronously)
 * Create a new task for one or more devices
 * @param taskPayload Task object to be created (required)
 * @param callback The callback to be executed when the API call finishes
 * @return The request call// ww w  .j  a va  2s.c o m
 * @throws ApiException If fail to process the API call, e.g. serializing the request body object
 */
public com.squareup.okhttp.Call createTasksAsync(TaskRequest taskPayload,
        final ApiCallback<TaskEnvelope> callback) throws ApiException {

    ProgressResponseBody.ProgressListener progressListener = null;
    ProgressRequestBody.ProgressRequestListener progressRequestListener = null;

    if (callback != null) {
        progressListener = new ProgressResponseBody.ProgressListener() {
            @Override
            public void update(long bytesRead, long contentLength, boolean done) {
                callback.onDownloadProgress(bytesRead, contentLength, done);
            }
        };

        progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
            @Override
            public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
                callback.onUploadProgress(bytesWritten, contentLength, done);
            }
        };
    }

    com.squareup.okhttp.Call call = createTasksCall(taskPayload, progressListener, progressRequestListener);
    Type localVarReturnType = new TypeToken<TaskEnvelope>() {
    }.getType();
    apiClient.executeAsync(call, localVarReturnType, callback);
    return call;
}

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

License:Apache License

/**
 * Deletes a device&#39;s properties.
 * Deletes a device&#39;s properties.
 * @param did Device ID. (required)/*www  . j  av a  2s  .c o  m*/
 * @return ApiResponse&lt;MetadataEnvelope&gt;
 * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
 */
public ApiResponse<MetadataEnvelope> deleteServerPropertiesWithHttpInfo(String did) throws ApiException {
    com.squareup.okhttp.Call call = deleteServerPropertiesCall(did, null, null);
    Type localVarReturnType = new TypeToken<MetadataEnvelope>() {
    }.getType();
    return apiClient.execute(call, localVarReturnType);
}

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

License:Apache License

/**
 * Deletes a device&#39;s properties. (asynchronously)
 * Deletes a device&#39;s properties.
 * @param did Device ID. (required)/* w w  w.j  a  v  a  2 s  . c  o m*/
 * @param callback The callback to be executed when the API call finishes
 * @return The request call
 * @throws ApiException If fail to process the API call, e.g. serializing the request body object
 */
public com.squareup.okhttp.Call deleteServerPropertiesAsync(String did,
        final ApiCallback<MetadataEnvelope> callback) throws ApiException {

    ProgressResponseBody.ProgressListener progressListener = null;
    ProgressRequestBody.ProgressRequestListener progressRequestListener = null;

    if (callback != null) {
        progressListener = new ProgressResponseBody.ProgressListener() {
            @Override
            public void update(long bytesRead, long contentLength, boolean done) {
                callback.onDownloadProgress(bytesRead, contentLength, done);
            }
        };

        progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
            @Override
            public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
                callback.onUploadProgress(bytesWritten, contentLength, done);
            }
        };
    }

    com.squareup.okhttp.Call call = deleteServerPropertiesCall(did, progressListener, progressRequestListener);
    Type localVarReturnType = new TypeToken<MetadataEnvelope>() {
    }.getType();
    apiClient.executeAsync(call, localVarReturnType, callback);
    return call;
}

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

License:Apache License

/**
 * Returns the list of tasks for a particular device id with optional status filter.
 * Returns the list of tasks for a particular device id with optional status filter.
 * @param did Device ID. (required)//from  w  w w  . j  av a2  s.co m
 * @param count Max results count. (optional)
 * @param offset Result starting offset. (optional)
 * @param status Status filter. Comma-separated statuses. (optional)
 * @param order Sort results by a field. Valid fields: createdOn. (optional)
 * @param sort Sort order. Valid values: asc or desc. (optional)
 * @return ApiResponse&lt;TaskByDidListEnvelope&gt;
 * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
 */
public ApiResponse<TaskByDidListEnvelope> getAllByDidWithHttpInfo(String did, Integer count, Integer offset,
        String status, String order, String sort) throws ApiException {
    com.squareup.okhttp.Call call = getAllByDidCall(did, count, offset, status, order, sort, null, null);
    Type localVarReturnType = new TypeToken<TaskByDidListEnvelope>() {
    }.getType();
    return apiClient.execute(call, localVarReturnType);
}

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

License:Apache License

/**
 * Returns the list of tasks for a particular device id with optional status filter. (asynchronously)
 * Returns the list of tasks for a particular device id with optional status filter.
 * @param did Device ID. (required)//from w ww.j a v a  2  s.c  om
 * @param count Max results count. (optional)
 * @param offset Result starting offset. (optional)
 * @param status Status filter. Comma-separated statuses. (optional)
 * @param order Sort results by a field. Valid fields: createdOn. (optional)
 * @param sort Sort order. Valid values: asc or desc. (optional)
 * @param callback The callback to be executed when the API call finishes
 * @return The request call
 * @throws ApiException If fail to process the API call, e.g. serializing the request body object
 */
public com.squareup.okhttp.Call getAllByDidAsync(String did, Integer count, Integer offset, String status,
        String order, String sort, final ApiCallback<TaskByDidListEnvelope> callback) throws ApiException {

    ProgressResponseBody.ProgressListener progressListener = null;
    ProgressRequestBody.ProgressRequestListener progressRequestListener = null;

    if (callback != null) {
        progressListener = new ProgressResponseBody.ProgressListener() {
            @Override
            public void update(long bytesRead, long contentLength, boolean done) {
                callback.onDownloadProgress(bytesRead, contentLength, done);
            }
        };

        progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
            @Override
            public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
                callback.onUploadProgress(bytesWritten, contentLength, done);
            }
        };
    }

    com.squareup.okhttp.Call call = getAllByDidCall(did, count, offset, status, order, sort, progressListener,
            progressRequestListener);
    Type localVarReturnType = new TypeToken<TaskByDidListEnvelope>() {
    }.getType();
    apiClient.executeAsync(call, localVarReturnType, callback);
    return call;
}

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

License:Apache License

/**
 * Read a device type device management information.
 * Read a device type device management information.
 * @param dtid Device type ID. (required)
 * @return ApiResponse&lt;DeviceTypesInfoEnvelope&gt;
 * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
 *//*  w  w w  .ja  va 2s  .  c  o  m*/
public ApiResponse<DeviceTypesInfoEnvelope> getDeviceTypesInfoWithHttpInfo(String dtid) throws ApiException {
    com.squareup.okhttp.Call call = getDeviceTypesInfoCall(dtid, null, null);
    Type localVarReturnType = new TypeToken<DeviceTypesInfoEnvelope>() {
    }.getType();
    return apiClient.execute(call, localVarReturnType);
}

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

License:Apache License

/**
 * Read a device type device management information. (asynchronously)
 * Read a device type device management information.
 * @param dtid Device type ID. (required)
 * @param callback The callback to be executed when the API call finishes
 * @return The request call/*w w  w  .  ja v a  2s. c  o  m*/
 * @throws ApiException If fail to process the API call, e.g. serializing the request body object
 */
public com.squareup.okhttp.Call getDeviceTypesInfoAsync(String dtid,
        final ApiCallback<DeviceTypesInfoEnvelope> callback) throws ApiException {

    ProgressResponseBody.ProgressListener progressListener = null;
    ProgressRequestBody.ProgressRequestListener progressRequestListener = null;

    if (callback != null) {
        progressListener = new ProgressResponseBody.ProgressListener() {
            @Override
            public void update(long bytesRead, long contentLength, boolean done) {
                callback.onDownloadProgress(bytesRead, contentLength, done);
            }
        };

        progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
            @Override
            public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
                callback.onUploadProgress(bytesWritten, contentLength, done);
            }
        };
    }

    com.squareup.okhttp.Call call = getDeviceTypesInfoCall(dtid, progressListener, progressRequestListener);
    Type localVarReturnType = new TypeToken<DeviceTypesInfoEnvelope>() {
    }.getType();
    apiClient.executeAsync(call, localVarReturnType, callback);
    return call;
}

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

License:Apache License

/**
 * Get a device type&#39;s device management manifest properties
 * Get a device type&#39;s device management manifest properties
 * @param dtid Device Type ID. (required)
 * @return ApiResponse&lt;MetadataPropertiesEnvelope&gt;
 * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
 *///from ww w  . jav a2 s .  co  m
public ApiResponse<MetadataPropertiesEnvelope> getManifestPropertiesWithHttpInfo(String dtid)
        throws ApiException {
    com.squareup.okhttp.Call call = getManifestPropertiesCall(dtid, null, null);
    Type localVarReturnType = new TypeToken<MetadataPropertiesEnvelope>() {
    }.getType();
    return apiClient.execute(call, localVarReturnType);
}

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

License:Apache License

/**
 * Get a device type&#39;s device management manifest properties (asynchronously)
 * Get a device type&#39;s device management manifest properties
 * @param dtid Device Type ID. (required)
 * @param callback The callback to be executed when the API call finishes
 * @return The request call// w w w . jav a  2 s.  c  o  m
 * @throws ApiException If fail to process the API call, e.g. serializing the request body object
 */
public com.squareup.okhttp.Call getManifestPropertiesAsync(String dtid,
        final ApiCallback<MetadataPropertiesEnvelope> callback) throws ApiException {

    ProgressResponseBody.ProgressListener progressListener = null;
    ProgressRequestBody.ProgressRequestListener progressRequestListener = null;

    if (callback != null) {
        progressListener = new ProgressResponseBody.ProgressListener() {
            @Override
            public void update(long bytesRead, long contentLength, boolean done) {
                callback.onDownloadProgress(bytesRead, contentLength, done);
            }
        };

        progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
            @Override
            public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
                callback.onUploadProgress(bytesWritten, contentLength, done);
            }
        };
    }

    com.squareup.okhttp.Call call = getManifestPropertiesCall(dtid, progressListener, progressRequestListener);
    Type localVarReturnType = new TypeToken<MetadataPropertiesEnvelope>() {
    }.getType();
    apiClient.executeAsync(call, localVarReturnType, callback);
    return call;
}