public class CreateContentActionRequestExecutor extends RequestExecutor<Action>
ActionsApi
. Use this class if you want to create
content actions through fluent API in chained fashion, for example:
IKontaktCloud kontaktCloud = KontaktCloud.newInstance();
Action contentAction = kontaktCloud.actions().createContentAction()
.forDevices("AxT7")
.withProximity(Proximity.NEAR)
.withMediaFile(new File(fileName))
.execute();
Modifier and Type | Field and Description |
---|---|
protected ActionsService |
actionsService |
protected Action.Type |
actionType |
protected Proximity |
proximity |
protected java.lang.String[] |
uniqueIds |
Constructor and Description |
---|
CreateContentActionRequestExecutor(ActionsService actionsService)
Constructs request executor initialized with corresponding service class.
|
Modifier and Type | Method and Description |
---|---|
protected void |
checkPreconditions()
Checks if all pre conditions are satisfied before sending the request.
|
Action |
execute()
Executes created request synchronously.
|
void |
execute(CloudCallback<Action> callback)
Executes created request asynchronously and invokes callback with the result.
|
CreateContentActionRequestExecutor |
forDevices(java.util.List<java.lang.String> uniqueIds)
Specifies associated devices.
|
CreateContentActionRequestExecutor |
forDevices(java.lang.String... uniqueIds)
Specifies associated devices.
|
CreateContentActionRequestExecutor |
multipart(boolean isMultipart)
Indicates if create action with multipart or not.
|
protected java.util.Map<java.lang.String,java.lang.String> |
params()
Composes the request's parameters in map.
|
protected retrofit2.Call<Action> |
prepareCall()
Prepares a request to execute.
|
CreateContentActionRequestExecutor |
withMediaFile(java.io.File file)
Specifies a media file of newly created action.
|
CreateContentActionRequestExecutor |
withProximity(Proximity proximity)
Specifies the proximity of newly created action.
|
protected final ActionsService actionsService
protected java.lang.String[] uniqueIds
protected Action.Type actionType
protected Proximity proximity
public CreateContentActionRequestExecutor(ActionsService actionsService)
actionsService
- the actions API service.public CreateContentActionRequestExecutor withMediaFile(java.io.File file) throws java.io.IOException
file
- the media file.java.io.IOException
- instance of IOExceptionpublic CreateContentActionRequestExecutor multipart(boolean isMultipart)
isMultipart
- true or falsepublic CreateContentActionRequestExecutor forDevices(java.lang.String... uniqueIds)
uniqueIds
- the device unique identifiers.public CreateContentActionRequestExecutor forDevices(java.util.List<java.lang.String> uniqueIds)
uniqueIds
- the device unique identifiers.public CreateContentActionRequestExecutor withProximity(Proximity proximity)
proximity
- the proximity.protected retrofit2.Call<Action> prepareCall()
protected void checkPreconditions()
protected java.util.Map<java.lang.String,java.lang.String> params()
public Action execute() throws java.io.IOException, KontaktCloudException
execute
in class RequestExecutor<Action>
java.io.IOException
- exceptionKontaktCloudException
- exceptionpublic void execute(CloudCallback<Action> callback)
execute
in class RequestExecutor<Action>
callback
- the callback object.