RestConnectorClient 類別

實作

public class RestConnectorClient
extends ServiceClient
implements ConnectorClient

Bot 連接器 REST API 可讓您的 Bot 將訊息傳送和接收至 [Bot Framework 開發人員入口網站] 中設定的通道(https://dev.botframework.com)。 連接器服務會透過 HTTPS 使用業界標準的 REST 和 JSON。 此 REST API 的用戶端連結庫可供使用。 如需清單,請參閱下方。 許多 Bot 會同時使用 Bot 連接器 REST API 和相關聯的 [Bot 狀態 REST API](/en-us/restapi/state)。 Bot 狀態 REST API 可讓 Bot 儲存和擷取與使用者和交談相關聯的狀態。 Bot 連接器和 Bot 狀態 REST API 的驗證都是使用 JWT 持有人令牌完成的,並詳述於 [連接器驗證](/en-us/restapi/authentication) 檔中。

建構函式摘要

建構函式 Description
RestConnectorClient(RestClient restClient)

初始化 ConnectorClient 用戶端的實例。

RestConnectorClient(ServiceClientCredentials credentials)

初始化 ConnectorClient 用戶端的實例。

RestConnectorClient(String baseUrl, ServiceClientCredentials credentials)

初始化 ConnectorClient 用戶端的實例。

方法摘要

修飾詞與類型 方法與描述
java.lang.String baseUrl()

傳回此連接器用戶端的基底 URL。

void close()

自動可處置關閉。

ServiceClientCredentials credentials()

傳回使用中的認證。

java.lang.String getAcceptLanguage()

取得回應的慣用語言。

Attachments getAttachments()

取得 Attachments 物件,以存取其作業。

Conversations getConversations()

取得 Conversations 物件,以存取其作業。

static Builder getDefaultRestClientBuilder(String baseUrl, ServiceClientCredentials credentials)

這是 Azure 用戶端用來建立 RestClient 的複本。

boolean getGenerateClientRequestId()

當設定為 true 時,會產生唯一的 x-ms-client-request-id 值,並包含在每個要求中。

int getLongRunningOperationRetryTimeout()

取得長時間執行作業的重試逾時,以秒為單位。

RestClient getRestClient()

取得 REST 用戶端。

RetryStrategy getRestRetryStrategy()

取得 Rest 重試策略。

java.lang.String getUserAgent()

取得用戶端 User-Agent 標頭。

protected void initialize()

初始化建構后的物件。

void setAcceptLanguage(String withAcceptLanguage)

設定回應的慣用語言。

void setGenerateClientRequestId(boolean requestId)

當設定為 true 時,會產生唯一的 x-ms-client-request-id 值,並包含在每個要求中。

void setLongRunningOperationRetryTimeout(int timeout)

設定長時間執行作業的重試逾時,以秒為單位。

void setRestRetryStrategy(RetryStrategy strategy)

設定 Rest 重試策略。

java.lang.String userAgent()

這是覆寫 AzureService用戶端版本。

方法繼承來源 ServiceClient

方法繼承來源 java.lang.Object

java.lang.Object.clone java.lang.Object.equals java.lang.Object.finalize java.lang.Object.getClass java.lang.Object.hashCode java.lang.Object.notify java.lang.Object.notifyAll java.lang.Object.toString java.lang.Object.wait java.lang.Object.wait java.lang.Object.wait

建構函式詳細資料

RestConnectorClient

public RestConnectorClient(RestClient restClient)

初始化 ConnectorClient 用戶端的實例。

參數:

restClient - 要連線到 Azure 的 REST 用戶端。

RestConnectorClient

public RestConnectorClient(ServiceClientCredentials credentials)

初始化 ConnectorClient 用戶端的實例。

參數:

credentials - Azure 的管理認證

RestConnectorClient

public RestConnectorClient(String baseUrl, ServiceClientCredentials credentials)

初始化 ConnectorClient 用戶端的實例。

參數:

baseUrl - 主機的基底 URL
credentials - Azure 的管理認證

方法詳細資料

baseUrl

public String baseUrl()

傳回此 ConnectorClient 的基底 URL。

傳回:

基底 URL。

close

public void close()

AutoDisposable 關閉。

credentials

public ServiceClientCredentials credentials()

傳回使用中的認證。

傳回:

使用中的 ServiceClientCredentials。

getAcceptLanguage

public String getAcceptLanguage()

取得回應的慣用語言。

傳回:

acceptLanguage 值。

getAttachments

public Attachments getAttachments()

取得 Attachments 物件,以存取其作業。

傳回:

Attachments 物件。

getConversations

public Conversations getConversations()

取得 Conversations 物件,以存取其作業。

傳回:

Conversations 物件。

getDefaultRestClientBuilder

public static RestClient.Builder getDefaultRestClientBuilder(String baseUrl, ServiceClientCredentials credentials)

這是 Azure 用戶端用來建立 RestClient 的複本。 這會傳回 RestClient.Builder,讓應用程式可以建立自定義 RestClient,並在建構期間提供給 ConnectorClient。 其中一個使用案例是提供 Proxy 給 RestClient。 雖然建議透過 Java 系統屬性設定 Proxy 資訊。

參數:

baseUrl - 服務端點
credentials - 驗證認證。

傳回:

RestClient.Builder。

getGenerateClientRequestId

public boolean getGenerateClientRequestId()

當設定為 true 時,會產生唯一的 x-ms-client-request-id 值,並包含在每個要求中。

傳回:

generateClientRequestId 值。

getLongRunningOperationRetryTimeout

public int getLongRunningOperationRetryTimeout()

取得長時間執行作業的重試逾時,以秒為單位。 預設值為 30。

傳回:

逾時值。

getRestClient

public RestClient getRestClient()

取得 REST 用戶端。

傳回:

RestClient 物件。

getRestRetryStrategy

public RetryStrategy getRestRetryStrategy()

取得 Rest 重試策略。

傳回:

正在使用 RetryStrategy

getUserAgent

public String getUserAgent()

取得用戶端 User-Agent 標頭。

傳回:

使用者代理程式字串。

initialize

protected void initialize()

初始化建構后的物件。

setAcceptLanguage

public void setAcceptLanguage(String withAcceptLanguage)

設定回應的慣用語言。

參數:

withAcceptLanguage - acceptLanguage 值。

setGenerateClientRequestId

public void setGenerateClientRequestId(boolean requestId)

當設定為 true 時,會產生唯一的 x-ms-client-request-id 值,並包含在每個要求中。

參數:

requestId - generateClientRequestId 值。

setLongRunningOperationRetryTimeout

public void setLongRunningOperationRetryTimeout(int timeout)

設定長時間執行作業的重試逾時,以秒為單位。 預設值為 30。

參數:

timeout - longRunningOperationRetryTimeout 值。

setRestRetryStrategy

public void setRestRetryStrategy(RetryStrategy strategy)

設定 Rest 重試策略。

參數:

strategy - 要使用的 RetryStrategy

userAgent

public String userAgent()

這是覆寫 AzureServiceClient 版本。

覆寫:

RestConnectorClient.userAgent()

傳回:

使用者代理程式。 與 getUserAgent() 相同

適用於