public class UpdateDeviceRequestExecutor extends RequestExecutor<java.lang.String>
DevicesApi
. Use this class if you want to update
devices through fluent API in chained fashion. Example of use:
IKontaktCloud kontaktCloud = KontaktCloud.newInstance();
// define updated device object
kontaktCloud.devices().update(ID)
.with(updatedDevice)
.execute();
Keep in mind that device must be specified so invocation of with
method is mandatory.
Otherwise an exception will be thrown.Constructor and Description |
---|
UpdateDeviceRequestExecutor(DevicesService devicesService,
java.lang.String uniqueId)
Constructs request executor initialized with corresponding service class and device unique ID.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
execute()
Executes created request synchronously.
|
void |
execute(CloudCallback<java.lang.String> callback)
Executes created request asynchronously and invokes callback with the result.
|
UpdateDeviceRequestExecutor |
force(boolean force)
Ignore this parameter if updating device with firmware 4.0 or higher.
Normally the update request for devices with firmware lower than 4.0 will be revoked if there is a pending config available. Setting force to true will overcome this restriction, update device and remove pending config. |
protected java.util.Map<java.lang.String,java.lang.String> |
params()
Composes the request's parameters in map.
|
protected retrofit2.Call<java.lang.String> |
prepareCall()
Prepares a request to execute.
|
UpdateDeviceRequestExecutor |
with(Device device)
Specifies device data to update.
|
public UpdateDeviceRequestExecutor(DevicesService devicesService, java.lang.String uniqueId)
devicesService
- the devices API service.uniqueId
- device unique identifier.public UpdateDeviceRequestExecutor with(Device device)
device
- updated device data.public UpdateDeviceRequestExecutor force(boolean force)
force
- true or falsepublic java.lang.String execute() throws java.io.IOException, KontaktCloudException
execute
in class RequestExecutor<java.lang.String>
java.io.IOException
- exceptionKontaktCloudException
- exceptionpublic void execute(CloudCallback<java.lang.String> callback)
execute
in class RequestExecutor<java.lang.String>
callback
- the callback object.protected retrofit2.Call<java.lang.String> prepareCall()
prepareCall
in class RequestExecutor<java.lang.String>
protected java.util.Map<java.lang.String,java.lang.String> params()
params
in class RequestExecutor<java.lang.String>