Struct RecommendationService (0.5.0)

實作 Discovery Engine API 的用戶端。

範例

# tokio_test::block_on(async {
# use google_cloud_discoveryengine_v1::client::RecommendationService;
let client = RecommendationService::builder().build().await?;
// use `client` to make requests to the Discovery Engine API.
# gax::client_builder::Result::<()>::Ok(()) });

服務說明

提供建議的服務。

設定

如要設定 RecommendationService,請在 [builder()][RecommendationService::builder] 傳回的類型中使用 with_* 方法。預設設定應適用於大多數應用程式。常見的設定變更包括

  • with_endpoint():根據預設,這個用戶端會使用全域預設端點 (https://discoveryengine.googleapis.com)。如果應用程式使用區域端點,或在受限網路中執行 (例如設定為覆寫這個預設值的網路),
  • with_credentials():根據預設,這個用戶端會使用應用程式預設憑證。使用自訂驗證的應用程式可能需要覆寫這項預設設定。

集區和複製

RecommendationService 會在內部保留連線集區,建議您建立一個並重複使用。您不需要將 RecommendationService 包裝在 Rc 或 Arc 中即可重複使用,因為它內部已使用 Arc。

實作

建構工具

 fn builder() -> super::builder::recommendation_service::ClientBuilder

傳回 [RecommendationService] 的建構工具。

# tokio_test::block_on(async {
# use google_cloud_discoveryengine_v1::client::RecommendationService;
let client = RecommendationService::builder().build().await?;
# gax::client_builder::Result::<()>::Ok(()) });

from_stub

 fn from_stub<T>(stub: T) -> Self
where
    T: super::stub::RecommendationService + 'static,

使用提供的虛設常式建立新的用戶端。

呼叫這個函式最常見的情況,是在測試中模擬用戶端的行為。

recommend

 fn recommend(self: &Self) -> super::builder::recommendation_service::Recommend

提出建議,這項操作需要情境式使用者事件。

list_operations

 fn list_operations(self: &Self) -> super::builder::recommendation_service::ListOperations

在這項服務中提供作業服務功能。

get_operation

 fn get_operation(self: &Self) -> super::builder::recommendation_service::GetOperation

在這項服務中提供作業服務功能。

cancel_operation

 fn cancel_operation(self: &Self) -> super::builder::recommendation_service::CancelOperation

在這項服務中提供作業服務功能。