use of com.azure.android.communication.chat.models.CreateChatThreadResult in project azure-sdk-for-android by Azure.
the class CreateChatThreadResultConverter method convert.
/**
* Maps from {@link com.azure.android.communication.chat.implementation.models.CreateChatThreadResult} to
* {@link CreateChatThreadResult}.
*/
public static CreateChatThreadResult convert(com.azure.android.communication.chat.implementation.models.CreateChatThreadResult obj, ClientLogger logger) {
if (obj == null) {
return null;
}
CreateChatThreadResult createChatThreadResult = new CreateChatThreadResult().setChatThreadProperties(ChatThreadPropertiesConverter.convert(obj.getChatThread(), logger));
if (obj.getInvalidParticipants() != null) {
List<ChatError> invalidParticipants = new ArrayList<>(obj.getInvalidParticipants().size());
for (CommunicationError invalidParticipant : obj.getInvalidParticipants()) {
invalidParticipants.add(ChatErrorConverter.convert(invalidParticipant));
}
createChatThreadResult.setInvalidParticipants(invalidParticipants);
}
return createChatThreadResult;
}
use of com.azure.android.communication.chat.models.CreateChatThreadResult in project azure-sdk-for-android by Azure.
the class ChatThreadAsyncClientTest method canGetExistingChatThread.
@ParameterizedTest
@MethodSource("com.azure.android.core.test.TestBase#getHttpClients")
public void canGetExistingChatThread(HttpClient httpClient) throws ExecutionException, InterruptedException {
setupTest(httpClient);
final CreateChatThreadOptions threadRequest = createThreadOptions(firstThreadParticipant.getId(), secondThreadParticipant.getId());
CompletableFuture<CreateChatThreadResult> completableFuture1 = this.client.createChatThread(threadRequest);
assertNotNull(completableFuture1);
CreateChatThreadResult result1 = completableFuture1.get();
assertNotNull(result1);
assertNotNull(result1.getChatThreadProperties());
assertNotNull(result1.getChatThreadProperties().getId());
String expectedThreadId = result1.getChatThreadProperties().getId();
CompletableFuture<ChatThreadProperties> completableFuture2 = this.client.getChatThreadClient(expectedThreadId).getProperties();
assertNotNull(completableFuture2);
ChatThreadProperties result2 = completableFuture2.get();
assertNotNull(result2);
assertNotNull(result2.getId());
assertEquals(expectedThreadId, result2.getId());
}
use of com.azure.android.communication.chat.models.CreateChatThreadResult in project azure-sdk-for-android by Azure.
the class ChatThreadAsyncClientTest method canGetExistingChatThreadWithResponse.
@ParameterizedTest
@MethodSource("com.azure.android.core.test.TestBase#getHttpClients")
public void canGetExistingChatThreadWithResponse(HttpClient httpClient) throws ExecutionException, InterruptedException {
setupTest(httpClient);
final CreateChatThreadOptions threadRequest = createThreadOptions(firstThreadParticipant.getId(), secondThreadParticipant.getId());
CompletableFuture<Response<CreateChatThreadResult>> completableFuture1 = this.client.createChatThreadWithResponse(threadRequest, null);
assertNotNull(completableFuture1);
Response<CreateChatThreadResult> response1 = completableFuture1.get();
assertNotNull(response1);
CreateChatThreadResult result1 = response1.getValue();
assertNotNull(result1);
assertNotNull(result1.getChatThreadProperties());
assertNotNull(result1.getChatThreadProperties().getId());
String expectedThreadId = result1.getChatThreadProperties().getId();
CompletableFuture<Response<ChatThreadProperties>> completableFuture2 = this.client.getChatThreadClient(expectedThreadId).getPropertiesWithResponse(null);
assertNotNull(completableFuture2);
Response<ChatThreadProperties> response2 = completableFuture2.get();
assertNotNull(response2);
ChatThreadProperties result2 = response2.getValue();
assertNotNull(result2);
assertNotNull(result2.getId());
assertEquals(expectedThreadId, result2.getId());
}
Aggregations