use of com.fanap.podchat.chat.assistant.request_model.RegisterAssistantRequest in project pod-chat-android-sdk by FanapSoft.
the class ChatTestSandbox method registerAssistant.
private void registerAssistant() {
// 63253 kheirkhah
// 63254 sajadi
// //63255 anvari
// 63256 amjadi
// 63257 zhiani
// invite list
// 52987 khodam
// 103187 nemati
Invitee invite = new Invitee("52987", InviteType.Constants.TO_BE_USER_CONTACT_ID);
// roles
ArrayList<String> typeRoles = new ArrayList<>();
typeRoles.add(RoleType.Constants.READ_THREAD);
typeRoles.add(RoleType.Constants.EDIT_THREAD);
typeRoles.add(RoleType.Constants.ADD_ROLE_TO_USER);
List<AssistantVo> assistantVos = new ArrayList<>();
AssistantVo assistantVo = new AssistantVo();
assistantVo.setInvitees(invite);
assistantVo.setContactType("default");
assistantVo.setRoles(typeRoles);
assistantVos.add(assistantVo);
RegisterAssistantRequest request = new RegisterAssistantRequest.Builder(assistantVos).build();
presenter.registerAssistant(request);
pauseProcess();
}
use of com.fanap.podchat.chat.assistant.request_model.RegisterAssistantRequest in project pod-chat-android-sdk by FanapSoft.
the class AssistantCacheTest method checkRegisteredAssistantInCache.
// Register new assistant and check if it is in cache
@LargeTest
@Test
public void checkRegisteredAssistantInCache() {
populateContactsFromServer();
assert contacts.size() > 0;
Collections.shuffle(contacts);
Contact contact = getValidContact();
print("Selected contact for register as assistant " + App.getGson().toJson(contact));
ArrayList<String> typeRoles = new ArrayList<>();
typeRoles.add(RoleType.Constants.ADD_ROLE_TO_USER);
typeRoles.add(RoleType.Constants.READ_THREAD);
typeRoles.add(RoleType.Constants.EDIT_THREAD);
List<AssistantVo> assistantVos = new ArrayList<>();
AssistantVo assistantVo = new AssistantVo();
Invitee invite = new Invitee(contact.getId(), InviteType.Constants.TO_BE_USER_CONTACT_ID);
assistantVo.setInvitees(invite);
assistantVo.setContactType("default");
assistantVo.setRoles(typeRoles);
assistantVos.add(assistantVo);
final AssistantVo[] registeredAssistant = new AssistantVo[1];
ChatListener mListener = new ChatListener() {
@Override
public void onRegisterAssistant(ChatResponse<List<AssistantVo>> response) {
registeredAssistant[0] = response.getResult().get(0);
chat.removeListener(this);
resumeProcess();
}
};
chat.setListener(mListener);
RegisterAssistantRequest request = new RegisterAssistantRequest.Builder(assistantVos).build();
chat.registerAssistant(request);
pauseProcess();
ChatListener mTestListener = Mockito.mock(ChatListener.class);
chat.addListener(mTestListener);
GetAssistantRequest requestGet = new GetAssistantRequest.Builder().setCount(25).setOffset(0).build();
chat.getAssistants(requestGet);
Mockito.verify(mTestListener, Mockito.after(2000).atLeastOnce()).onGetAssistants(Mockito.argThat((ChatResponse<List<AssistantVo>> response) -> (response.isCache() && validateAssistantsAreSame(registeredAssistant[0], response.getResult()))));
}
use of com.fanap.podchat.chat.assistant.request_model.RegisterAssistantRequest in project pod-chat-android-sdk by FanapSoft.
the class AssistantCacheTest method registerNewAssistant.
@Test
public void registerNewAssistant() {
populateContactsFromServer();
ChatListener mTestListener = Mockito.mock(ChatListener.class);
chat.addListener(mTestListener);
assert contacts.size() > 0;
Contact contact = getValidContact();
print("Selected contact for register as assistant " + App.getGson().toJson(contact));
ArrayList<String> typeRoles = new ArrayList<>();
typeRoles.add(RoleType.Constants.ADD_ROLE_TO_USER);
typeRoles.add(RoleType.Constants.READ_THREAD);
typeRoles.add(RoleType.Constants.EDIT_THREAD);
List<AssistantVo> assistantVos = new ArrayList<>();
AssistantVo assistantVo = new AssistantVo();
Invitee invite = new Invitee(contact.getId(), InviteType.Constants.TO_BE_USER_CONTACT_ID);
assistantVo.setInvitees(invite);
assistantVo.setContactType("default");
assistantVo.setRoles(typeRoles);
assistantVos.add(assistantVo);
RegisterAssistantRequest request = new RegisterAssistantRequest.Builder(assistantVos).build();
chat.registerAssistant(request);
Mockito.verify(mTestListener, Mockito.after(5000).atLeastOnce()).onRegisterAssistant(Mockito.argThat((ChatResponse<List<AssistantVo>> response) -> response.getResult().stream().anyMatch(assistantVo1 -> assistantVo1.getParticipantVO().getCoreUserId() == contact.getLinkedUser().getCoreUserId())));
}
use of com.fanap.podchat.chat.assistant.request_model.RegisterAssistantRequest in project pod-chat-android-sdk by FanapSoft.
the class ChatTestIntegration method registerAssistant.
private void registerAssistant() {
// 63253 kheirkhah
// 63254 sajadi
// //63255 anvari
// 63256 amjadi
// 63257 zhiani
// invite list
// 52987 khodam
// 103187 nemati
Invitee invite = new Invitee("63253", InviteType.Constants.TO_BE_USER_CONTACT_ID);
// roles
ArrayList<String> typeRoles = new ArrayList<>();
typeRoles.add(RoleType.Constants.READ_THREAD);
typeRoles.add(RoleType.Constants.EDIT_THREAD);
typeRoles.add(RoleType.Constants.ADD_ROLE_TO_USER);
List<AssistantVo> assistantVos = new ArrayList<>();
AssistantVo assistantVo = new AssistantVo();
assistantVo.setInvitees(invite);
assistantVo.setContactType("default");
assistantVo.setRoles(typeRoles);
assistantVos.add(assistantVo);
RegisterAssistantRequest request = new RegisterAssistantRequest.Builder(assistantVos).build();
presenter.registerAssistant(request);
pauseProcess();
}
use of com.fanap.podchat.chat.assistant.request_model.RegisterAssistantRequest in project pod-chat-android-sdk by FanapSoft.
the class ChatActivity method registerAssistant.
private void registerAssistant() {
// 63263 kheirkhah
// //63264 anvari
// 63254 sajadi
// 63256 amjadi
// 63257 zhiani
// invite list
// 103187 nemati sandbox
// 52987 sajadi 9063 sandbox
Invitee invite = new Invitee("63256", InviteType.Constants.TO_BE_USER_CONTACT_ID);
// roles
ArrayList<String> typeRoles = new ArrayList<>();
typeRoles.add(RoleType.Constants.REMOVE_ROLE_FROM_USER);
List<AssistantVo> assistantVos = new ArrayList<>();
AssistantVo assistantVo = new AssistantVo();
assistantVo.setInvitees(invite);
assistantVo.setContactType("default");
assistantVo.setRoles(typeRoles);
assistantVos.add(assistantVo);
RegisterAssistantRequest request = new RegisterAssistantRequest.Builder(assistantVos).build();
presenter.registerAssistant(request);
}
Aggregations