use of com.fanap.podchat.chat.assistant.model.AssistantVo in project pod-chat-android-sdk by FanapSoft.
the class AssistantCacheTest method getAndValidateAssistantHistoriesCache.
@Test
public void getAndValidateAssistantHistoriesCache() {
ArrayList<AssistantVo> assistantVoArrayList = new ArrayList<>();
chat.addListener(new ChatListener() {
@Override
public void onGetAssistants(ChatResponse<List<AssistantVo>> response) {
assistantVoArrayList.addAll(response.getResult());
chat.removeListener(this);
resumeProcess();
}
});
GetAssistantRequest request = new GetAssistantRequest.Builder().setCount(25).setOffset(0).build();
chat.getAssistants(request);
pauseProcess();
Collections.shuffle(assistantVoArrayList);
ArrayList<AssistantHistoryVo> assistantHistoryVos = new ArrayList<>();
ArrayList<AssistantHistoryVo> assistantHistoryVosCache = new ArrayList<>();
chat.addListener(new ChatListener() {
@Override
public void onGetAssistantHistory(ChatResponse<List<AssistantHistoryVo>> response) {
print("Received Assistant Histories cache: " + response.isCache());
prettyLog(App.getGson().toJson(response.getResult()));
if (response.isCache()) {
assistantHistoryVosCache.addAll(response.getResult());
} else {
assistantHistoryVos.addAll(response.getResult());
}
if (assistantHistoryVos.size() == assistantHistoryVosCache.size()) {
chat.removeListener(this);
resumeProcess();
}
}
});
GetAssistantHistoryRequest getAssistantHistoryRequest = new GetAssistantHistoryRequest.Builder().setCount(50).build();
chat.getAssistantHistory(getAssistantHistoryRequest);
pauseProcess();
Assert.assertTrue(true);
}
use of com.fanap.podchat.chat.assistant.model.AssistantVo in project pod-chat-android-sdk by FanapSoft.
the class ChatTestIntegration method deActiveAssistant.
private void deActiveAssistant() {
// 52987 khodam
// 103187 nemati
// invite
Invitee invite = new Invitee("63253", InviteType.Constants.TO_BE_USER_CONTACT_ID);
List<AssistantVo> assistantVos = new ArrayList<>();
AssistantVo assistantVo = new AssistantVo();
assistantVo.setInvitees(invite);
assistantVos.add(assistantVo);
DeActiveAssistantRequest request = new DeActiveAssistantRequest.Builder(assistantVos).build();
presenter.deActiveAssistant(request);
pauseProcess();
}
use of com.fanap.podchat.chat.assistant.model.AssistantVo in project pod-chat-android-sdk by FanapSoft.
the class ChatTestIntegration method registerAssistantsTest.
@Test
@LargeTest
public void registerAssistantsTest() {
ChatListener historyListeners = new ChatListener() {
@Override
public void onRegisterAssistant(ChatResponse<List<AssistantVo>> response) {
System.out.println("onRegisterAssistant: " + response.getJson());
Assert.assertTrue(true);
resumeProcess();
}
};
chat.addListener(historyListeners);
registerAssistant();
}
use of com.fanap.podchat.chat.assistant.model.AssistantVo 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.model.AssistantVo in project pod-chat-android-sdk by FanapSoft.
the class ChatTestSandbox method getAssistantTest.
@Test
@LargeTest
public void getAssistantTest() {
long startTime = System.currentTimeMillis();
ChatListener historyListeners = new ChatListener() {
@Override
public void onGetAssistants(ChatResponse<List<AssistantVo>> response) {
System.out.println("onGetAssistants: " + response);
Assert.assertTrue(true);
}
};
chat.addListener(historyListeners);
getAssistants();
}
Aggregations