public class CreateConfigRequestExecutor extends RequestExecutor<Config[]>
ConfigsApi. Use this class if you want to create
configs through fluent API in chained fashion, for example:
IKontaktCloud kontaktCloud = KontaktCloud.newInstance();
Config config = new Config.Builder().major(532).minor(111).build();
kontaktCloud.configs().create(config)
.forDevices("AxT7", "GVy6", "9KiJ")
.withType(DeviceType.BEACON)
.execute();
Keep in mind that devices and device type must be specified so invocations of forDevices
and withType methods are mandatory. Otherwise an exception will be thrown.| Constructor and Description |
|---|
CreateConfigRequestExecutor(ConfigsService configsService,
Config config)
Constructs request executor initialized with corresponding service class and new config object.
|
| Modifier and Type | Method and Description |
|---|---|
Config[] |
execute()
Executes created request synchronously.
|
void |
execute(CloudCallback<Config[]> callback)
Executes created request asynchronously and invokes callback with the result.
|
CreateConfigRequestExecutor |
forDevices(java.util.List<java.lang.String> uniqueIds)
Specifies devices.
|
CreateConfigRequestExecutor |
forDevices(java.lang.String... uniqueIds)
Specifies devices.
|
protected java.util.Map<java.lang.String,java.lang.String> |
params()
Composes the request's parameters in map.
|
protected retrofit2.Call<Config[]> |
prepareCall()
Prepares a request to execute.
|
CreateConfigRequestExecutor |
withType(DeviceType type)
Specifies device type.
|
public CreateConfigRequestExecutor(ConfigsService configsService, Config config)
configsService - the configs API service.config - new config.public CreateConfigRequestExecutor forDevices(java.lang.String... uniqueIds)
uniqueIds - the device unique identifiers.public CreateConfigRequestExecutor forDevices(java.util.List<java.lang.String> uniqueIds)
uniqueIds - the device unique identifiers.public CreateConfigRequestExecutor withType(DeviceType type)
type - the device type.public Config[] execute() throws java.io.IOException, KontaktCloudException
execute in class RequestExecutor<Config[]>java.io.IOException - exceptionKontaktCloudException - exceptionpublic void execute(CloudCallback<Config[]> callback)
execute in class RequestExecutor<Config[]>callback - the callback object.protected retrofit2.Call<Config[]> prepareCall()
prepareCall in class RequestExecutor<Config[]>protected java.util.Map<java.lang.String,java.lang.String> params()
params in class RequestExecutor<Config[]>