List of usage examples for com.google.gson.reflect TypeToken TypeToken
@SuppressWarnings("unchecked") protected TypeToken()
From source file:cloud.artik.api.DevicesApi.java
License:Apache License
/** * Get Device (asynchronously)//from w ww . j ava 2 s . c o m * Retrieves a device * @param deviceId deviceId (required) * @param callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ public com.squareup.okhttp.Call getDeviceAsync(String deviceId, final ApiCallback<DeviceEnvelope> 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 = getDeviceCall(deviceId, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<DeviceEnvelope>() { }.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
From source file:cloud.artik.api.DevicesApi.java
License:Apache License
/** * Get device presence information/*from ww w . j a va 2s. c o m*/ * Return the presence status of the given device along with the time it was last seen * @param deviceId Device ID. (required) * @return ApiResponse<PresenceEnvelope> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<PresenceEnvelope> getDevicePresenceWithHttpInfo(String deviceId) throws ApiException { com.squareup.okhttp.Call call = getDevicePresenceCall(deviceId, null, null); Type localVarReturnType = new TypeToken<PresenceEnvelope>() { }.getType(); return apiClient.execute(call, localVarReturnType); }
From source file:cloud.artik.api.DevicesApi.java
License:Apache License
/** * Get device presence information (asynchronously) * Return the presence status of the given device along with the time it was last seen * @param deviceId Device ID. (required) * @param callback The callback to be executed when the API call finishes * @return The request call/*from ww w. ja v a 2 s . co m*/ * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ public com.squareup.okhttp.Call getDevicePresenceAsync(String deviceId, final ApiCallback<PresenceEnvelope> 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 = getDevicePresenceCall(deviceId, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<PresenceEnvelope>() { }.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
From source file:cloud.artik.api.DevicesApi.java
License:Apache License
/** * Get Device Token// w w w . ja va 2 s . c om * Retrieves a device's token * @param deviceId deviceId (required) * @return ApiResponse<DeviceTokenEnvelope> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<DeviceTokenEnvelope> getDeviceTokenWithHttpInfo(String deviceId) throws ApiException { com.squareup.okhttp.Call call = getDeviceTokenCall(deviceId, null, null); Type localVarReturnType = new TypeToken<DeviceTokenEnvelope>() { }.getType(); return apiClient.execute(call, localVarReturnType); }
From source file:cloud.artik.api.DevicesApi.java
License:Apache License
/** * Get Device Token (asynchronously)//from ww w. j a v a 2 s . co m * Retrieves a device's token * @param deviceId deviceId (required) * @param callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ public com.squareup.okhttp.Call getDeviceTokenAsync(String deviceId, final ApiCallback<DeviceTokenEnvelope> 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 = getDeviceTokenCall(deviceId, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<DeviceTokenEnvelope>() { }.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
From source file:cloud.artik.api.DevicesApi.java
License:Apache License
/** * Update Device// www . j ava2s .co m * Updates a device * @param deviceId deviceId (required) * @param device Device to be updated (required) * @return ApiResponse<DeviceEnvelope> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<DeviceEnvelope> updateDeviceWithHttpInfo(String deviceId, Device device) throws ApiException { com.squareup.okhttp.Call call = updateDeviceCall(deviceId, device, null, null); Type localVarReturnType = new TypeToken<DeviceEnvelope>() { }.getType(); return apiClient.execute(call, localVarReturnType); }
From source file:cloud.artik.api.DevicesApi.java
License:Apache License
/** * Update Device (asynchronously)//from ww w . ja v a 2 s. com * Updates a device * @param deviceId deviceId (required) * @param device Device to be updated (required) * @param callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ public com.squareup.okhttp.Call updateDeviceAsync(String deviceId, Device device, final ApiCallback<DeviceEnvelope> 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 = updateDeviceCall(deviceId, device, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<DeviceEnvelope>() { }.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
From source file:cloud.artik.api.DevicesApi.java
License:Apache License
/** * Update Device Token//from w w w . j a v a2 s.c o m * Updates a device's token * @param deviceId deviceId (required) * @return ApiResponse<DeviceTokenEnvelope> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<DeviceTokenEnvelope> updateDeviceTokenWithHttpInfo(String deviceId) throws ApiException { com.squareup.okhttp.Call call = updateDeviceTokenCall(deviceId, null, null); Type localVarReturnType = new TypeToken<DeviceTokenEnvelope>() { }.getType(); return apiClient.execute(call, localVarReturnType); }
From source file:cloud.artik.api.DevicesApi.java
License:Apache License
/** * Update Device Token (asynchronously)/*w ww .j a v a 2s. com*/ * Updates a device's token * @param deviceId deviceId (required) * @param callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ public com.squareup.okhttp.Call updateDeviceTokenAsync(String deviceId, final ApiCallback<DeviceTokenEnvelope> 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 = updateDeviceTokenCall(deviceId, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<DeviceTokenEnvelope>() { }.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
From source file:cloud.artik.api.DevicesManagementApi.java
License:Apache License
/** * Create a new task for one or more devices * Create a new task for one or more devices * @param taskPayload Task object to be created (required) * @return ApiResponse<TaskEnvelope> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */// ww w.j av a2 s. c o m public ApiResponse<TaskEnvelope> createTasksWithHttpInfo(TaskRequest taskPayload) throws ApiException { com.squareup.okhttp.Call call = createTasksCall(taskPayload, null, null); Type localVarReturnType = new TypeToken<TaskEnvelope>() { }.getType(); return apiClient.execute(call, localVarReturnType); }