public class ShareDeviceRequestExecutor extends RequestExecutor<java.lang.String>
DevicesApi
. Use this class if you want to share
devices with managers through fluent API in chained fashion. Example of use:
IKontaktCloud kontaktCloud = KontaktCloud.newInstance();
kontaktCloud.devices().share(IDs)
.toManagers(managerEmails)
.withAccess(Access.VIEWER)
.expirationDate(date)
.execute();
Keep in mind that managers and access must be specified so invocations of toManagers
and
withAccess
methods are mandatory. Moreover, the Access.OWNER
and
Access.SUPERVISOR
values are prohibited as an input parameters of withAccess
method.
All conditions must be fulfilled, otherwise an exception will be thrown at runtime.Constructor and Description |
---|
ShareDeviceRequestExecutor(DevicesService devicesService,
java.util.List<java.lang.String> uniqueIds)
Constructs request executor initialized with corresponding service class and device unique IDs.
|
ShareDeviceRequestExecutor(DevicesService devicesService,
java.lang.String... uniqueIds)
Constructs request executor initialized with corresponding service class and device unique IDs.
|
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.
|
ShareDeviceRequestExecutor |
expirationDate(long expirationDate)
Specifies an expiration date.
|
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.
|
ShareDeviceRequestExecutor |
toManagers(java.util.List<java.lang.String> managerEmails)
Specifies managers.
|
ShareDeviceRequestExecutor |
toManagers(java.lang.String... managerEmails)
Specifies managers.
|
ShareDeviceRequestExecutor |
withAccess(Access access)
Specifies an access.
|
ShareDeviceRequestExecutor |
withMetaData(boolean withMetaData)
Indicates if we want to share devices with metadata or not.
|
public ShareDeviceRequestExecutor(DevicesService devicesService, java.lang.String... uniqueIds)
devicesService
- the devices API service.uniqueIds
- device unique identifiers.public ShareDeviceRequestExecutor(DevicesService devicesService, java.util.List<java.lang.String> uniqueIds)
devicesService
- the devices API service.uniqueIds
- device unique identifiers.public ShareDeviceRequestExecutor toManagers(java.lang.String... managerEmails)
managerEmails
- managers email addresses.public ShareDeviceRequestExecutor toManagers(java.util.List<java.lang.String> managerEmails)
managerEmails
- managers email addresses.public ShareDeviceRequestExecutor withAccess(Access access)
OWNER
nor SUPERVISOR
.access
- the access.public ShareDeviceRequestExecutor expirationDate(long expirationDate)
expirationDate
- the expiration date in millis.public ShareDeviceRequestExecutor withMetaData(boolean withMetaData)
withMetaData
- 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>