public class CreateManagerRequestExecutor extends RequestExecutor<Manager>
ManagersApi
. Use this class if you want to create
managers through fluent API in chained fashion, for instance:
IKontaktCloud kontaktCloud = KontaktCloud.newInstance();
Manager manager = new Manager.Builder()
.firstName("Superb")
.lastName("Kontakter")
.email("superb.kontakter@kontakt.io")
.role(Manager.Role.SUPERUSER)
.build();
kontaktCloud.managers().create(manager).execute();
Keep in mind that new manager instance that we want to create must have initialized the following
fields: first name, last name, email address and role. Otherwise an exception will be thrown.Constructor and Description |
---|
CreateManagerRequestExecutor(ManagersService managersService,
Manager manager)
Constructs request executor initialized with corresponding service class and manager object.
|
Modifier and Type | Method and Description |
---|---|
Manager |
execute()
Executes created request synchronously.
|
void |
execute(CloudCallback<Manager> callback)
Executes created request asynchronously and invokes callback with the result.
|
protected java.util.Map<java.lang.String,java.lang.String> |
params()
Composes the request's parameters in map.
|
protected retrofit2.Call<Manager> |
prepareCall()
Prepares a request to execute.
|
public CreateManagerRequestExecutor(ManagersService managersService, Manager manager)
managersService
- the managers API service.manager
- the manager entity.protected retrofit2.Call<Manager> prepareCall()
prepareCall
in class RequestExecutor<Manager>
public Manager execute() throws java.io.IOException, KontaktCloudException
execute
in class RequestExecutor<Manager>
java.io.IOException
- exceptionKontaktCloudException
- exceptionpublic void execute(CloudCallback<Manager> callback)
execute
in class RequestExecutor<Manager>
callback
- the callback object.protected java.util.Map<java.lang.String,java.lang.String> params()
params
in class RequestExecutor<Manager>