Skip to content
This repository was archived by the owner on Dec 4, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,4 @@ dependency-reduced-pom.xml
*.factorypath
.vscode/settings.json
pom.xml.versionsBackup
libraries/swagger/generated
Binary file removed .vs/botbuilder-java/v15/.suo
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
import com.microsoft.bot.schema.models.ConversationParameters;
import com.microsoft.bot.schema.models.ConversationResourceResponse;
import com.microsoft.bot.schema.models.ConversationsResult;
import com.microsoft.bot.schema.models.PagedMembersResult;
import com.microsoft.bot.connector.models.ErrorResponseException;
import com.microsoft.bot.schema.models.ResourceResponse;
import com.microsoft.bot.schema.models.Transcript;
import com.microsoft.rest.ServiceCallback;
import com.microsoft.rest.ServiceFuture;
import com.microsoft.rest.ServiceResponse;
Expand Down Expand Up @@ -514,7 +516,7 @@ This is slightly different from SendToConversation().

/**
* GetConversationMembers.
* Enumerate the members of a converstion.
* Enumerate the members of a conversation.
This REST API takes a ConversationId and returns an array of ChannelAccount objects representing the members of the conversation.
*
* @param conversationId Conversation ID
Expand All @@ -525,7 +527,7 @@ This is slightly different from SendToConversation().

/**
* DeleteConversationMember.
* Deletes a member from a converstion.
* Deletes a member from a conversation.
This REST API takes a ConversationId and a memberId (of type string) and removes that member from the conversation. If that member was the last member
of the conversation, the conversation will also be deleted.
*
Expand All @@ -539,7 +541,7 @@ This REST API takes a ConversationId and a memberId (of type string) and removes

/**
* DeleteConversationMember.
* Deletes a member from a converstion.
* Deletes a member from a conversation.
This REST API takes a ConversationId and a memberId (of type string) and removes that member from the conversation. If that member was the last member
of the conversation, the conversation will also be deleted.
*
Expand All @@ -553,7 +555,7 @@ This REST API takes a ConversationId and a memberId (of type string) and removes

/**
* DeleteConversationMember.
* Deletes a member from a converstion.
* Deletes a member from a conversation.
This REST API takes a ConversationId and a memberId (of type string) and removes that member from the conversation. If that member was the last member
of the conversation, the conversation will also be deleted.
*
Expand All @@ -566,7 +568,7 @@ This REST API takes a ConversationId and a memberId (of type string) and removes

/**
* DeleteConversationMember.
* Deletes a member from a converstion.
* Deletes a member from a conversation.
This REST API takes a ConversationId and a memberId (of type string) and removes that member from the conversation. If that member was the last member
of the conversation, the conversation will also be deleted.
*
Expand Down Expand Up @@ -683,4 +685,163 @@ This REST API takes a ConversationId and a memberId (of type string) and removes
*/
Observable<ServiceResponse<ResourceResponse>> uploadAttachmentWithServiceResponseAsync(String conversationId, AttachmentData attachmentUpload);

}

/**
* This method allows you to upload the historic activities to the conversation.
*
* Sender must ensure that the historic activities have unique ids and appropriate timestamps.
* The ids are used by the client to deal with duplicate activities and the timestamps are used by
* the client to render the activities in the right order.
*
* @param conversationId Conversation ID
* @param history Historic activities
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws ErrorResponseException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the ResourceResponse object if successful.
*/
ResourceResponse sendConversationHistory(String conversationId, Transcript history);

/**
* This method allows you to upload the historic activities to the conversation.
*
* Sender must ensure that the historic activities have unique ids and appropriate timestamps.
* The ids are used by the client to deal with duplicate activities and the timestamps are used by
* the client to render the activities in the right order.
*
* @param conversationId Conversation ID
* @param history Historic activities
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws ErrorResponseException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the ResourceResponse object if successful.
*/
ServiceFuture<ResourceResponse> sendConversationHistoryAsync(String conversationId, Transcript history, final ServiceCallback<ResourceResponse> serviceCallback);

/**
* This method allows you to upload the historic activities to the conversation.
*
* Sender must ensure that the historic activities have unique ids and appropriate timestamps.
* The ids are used by the client to deal with duplicate activities and the timestamps are used by
* the client to render the activities in the right order.
*
* @param conversationId Conversation ID
* @param history Historic activities
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws ErrorResponseException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the ResourceResponse object if successful.
*/
Observable<ResourceResponse> sendConversationHistoryAsync(String conversationId, Transcript history);

/**
* This method allows you to upload the historic activities to the conversation.
*
* Sender must ensure that the historic activities have unique ids and appropriate timestamps.
* The ids are used by the client to deal with duplicate activities and the timestamps are used by
* the client to render the activities in the right order.
*
* @param conversationId Conversation ID
* @param history Historic activities
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws ErrorResponseException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the ResourceResponse object if successful.
*/
Observable<ServiceResponse<ResourceResponse>> sendConversationHistoryWithServiceResponseAsync(String conversationId, Transcript history);

/**
* Enumerate the members of a conversation one page at a time.
*
* This REST API takes a ConversationId. Optionally a pageSize and/or continuationToken can be provided.
* It returns a PagedMembersResult, which contains an array of ChannelAccounts representing the members
* of the conversation and a continuation token that can be used to get more values.
*
* One page of ChannelAccounts records are returned with each call. The number of records in a page may
* vary between channels and calls. The pageSize parameter can be used as a suggestion. If there are no
* additional results the response will not contain a continuation token. If there are no members in the
* conversation the Members will be empty or not present in the response.
*
* A response to a request that has a continuation token from a prior request may rarely return members
* from a previous request.
*
* @param conversationId Conversation ID
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws ErrorResponseException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the PagedMembersResult object if successful.
*/
PagedMembersResult getConversationPagedMembers(String conversationId);

/**
* Enumerate the members of a conversation one page at a time.
*
* This REST API takes a ConversationId. Optionally a pageSize and/or continuationToken can be provided.
* It returns a PagedMembersResult, which contains an array of ChannelAccounts representing the members
* of the conversation and a continuation token that can be used to get more values.
*
* One page of ChannelAccounts records are returned with each call. The number of records in a page may
* vary between channels and calls. The pageSize parameter can be used as a suggestion. If there are no
* additional results the response will not contain a continuation token. If there are no members in the
* conversation the Members will be empty or not present in the response.
*
* A response to a request that has a continuation token from a prior request may rarely return members
* from a previous request.
*
* @param conversationId Conversation ID
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws ErrorResponseException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the PagedMembersResult object if successful.
*/
ServiceFuture<PagedMembersResult> getConversationPagedMembersAsync(String conversationId, final ServiceCallback<PagedMembersResult> serviceCallback);

/**
* Enumerate the members of a conversation one page at a time.
*
* This REST API takes a ConversationId. Optionally a pageSize and/or continuationToken can be provided.
* It returns a PagedMembersResult, which contains an array of ChannelAccounts representing the members
* of the conversation and a continuation token that can be used to get more values.
*
* One page of ChannelAccounts records are returned with each call. The number of records in a page may
* vary between channels and calls. The pageSize parameter can be used as a suggestion. If there are no
* additional results the response will not contain a continuation token. If there are no members in the
* conversation the Members will be empty or not present in the response.
*
* A response to a request that has a continuation token from a prior request may rarely return members
* from a previous request.
*
* @param conversationId Conversation ID
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws ErrorResponseException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the PagedMembersResult object if successful.
*/
Observable<PagedMembersResult> getConversationPagedMembersAsync(String conversationId);

/**
* Enumerate the members of a conversation one page at a time.
*
* This REST API takes a ConversationId. Optionally a pageSize and/or continuationToken can be provided.
* It returns a PagedMembersResult, which contains an array of ChannelAccounts representing the members
* of the conversation and a continuation token that can be used to get more values.
*
* One page of ChannelAccounts records are returned with each call. The number of records in a page may
* vary between channels and calls. The pageSize parameter can be used as a suggestion. If there are no
* additional results the response will not contain a continuation token. If there are no members in the
* conversation the Members will be empty or not present in the response.
*
* A response to a request that has a continuation token from a prior request may rarely return members
* from a previous request.
*
* @param conversationId Conversation ID
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws ErrorResponseException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the observable to the ResourceResponse object
*/
Observable<ServiceResponse<PagedMembersResult>> getConversationPagedMembersWithServiceResponseAsync(String conversationId);

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,16 @@
package com.microsoft.bot.connector.implementation;

import com.microsoft.azure.AzureClient;
import com.microsoft.azure.AzureResponseBuilder;
import com.microsoft.azure.AzureServiceClient;
import com.microsoft.bot.connector.Attachments;
import com.microsoft.bot.connector.ConnectorClient;
import com.microsoft.rest.credentials.ServiceClientCredentials;
import com.microsoft.rest.RestClient;
import com.microsoft.rest.retry.RetryStrategy;
import com.microsoft.azure.serializer.AzureJacksonAdapter;
import okhttp3.OkHttpClient;
import retrofit2.Retrofit;

import java.io.IOException;
import java.io.InputStream;
Expand Down Expand Up @@ -212,4 +216,23 @@ protected void initialize() {
public String userAgent() {
return this.user_agent_string;
}

/**
* This is a copy of what the Azure Client does to create a RestClient. This returns
* a RestClient.Builder so that the app can create a custom RestClient, and supply
* it to ConnectorClient during construction.
*
* One use case of this is for supplying a Proxy to the RestClient.
*
* @param baseUrl
* @param credentials
* @return
*/
public static RestClient.Builder getDefaultRestClientBuilder(String baseUrl, ServiceClientCredentials credentials){
return new RestClient.Builder(new OkHttpClient.Builder(), new Retrofit.Builder())
.withBaseUrl(baseUrl)
.withCredentials(credentials)
.withSerializerAdapter(new AzureJacksonAdapter())
.withResponseBuilderFactory(new AzureResponseBuilder.Factory());
}
}
Loading