FastComments.com

FastComments Rust SDK


這是 FastComments 的官方 Rust SDK。

FastComments API 的官方 Rust SDK

儲存庫

在 GitHub 上檢視


安裝 Internal Link

cargo add fastcomments-sdk

此 SDK 需要使用 Rust 2021 版或更新版本。

函式庫內容 Internal Link

FastComments Rust SDK 由多個模組組成:

  • 客戶端模組 - FastComments REST API 的 API 客戶端

    • 完整的所有 API 模型類型定義
    • 三個 API 客戶端,涵蓋所有 FastComments 方法:
      • default_api (DefaultApi) - 透過 API 金鑰驗證的伺服器端使用方法
      • public_api (PublicApi) - 公開的、無需 API 金鑰的方法,可安全在瀏覽器和行動應用中呼叫
      • moderation_api (ModerationApi) - 廣泛的即時且快速的審核 API 組合。每個 Moderation 方法接受 sso 參數,且可透過 SSO 或 FastComments.com 會話 Cookie 進行驗證。
    • 完整的 async/await 支援,使用 tokio
    • 請參閱 client/README.md 以取得詳細的 API 文件說明
  • SSO 模組 - 伺服器端單一登入(Single Sign-On)工具

    • 安全的令牌產生,用於使用者驗證
    • 支援簡易與安全兩種 SSO 模式
    • 基於 HMAC‑SHA256 的令牌簽署
  • 核心類型 - 共享的類型定義與工具函式

    • 評論模型與中繼資料結構
    • 使用者與租戶設定
    • 常用操作的輔助函式

快速開始 Internal Link

使用公開 API

use fastcomments_sdk::client::apis::configuration::Configuration;
use fastcomments_sdk::client::apis::public_api;

#[tokio::main]
async fn main() {
    // 建立 API 設定
    let config = Configuration::new();

    // 擷取頁面的留言
    let result = public_api::get_comments_public(
        &config,
        public_api::GetCommentsPublicParams {
            tenant_id: "your-tenant-id".to_string(),
            urlid: Some("page-url-id".to_string()),
            url: None,
            count_only: None,
            skip: None,
            limit: None,
            sort_dir: None,
            page: None,
            sso_hash: None,
            simple_sso_hash: None,
            has_no_comment: None,
            has_comment: None,
            comment_id_filter: None,
            child_ids: None,
            start_date_time: None,
            starts_with: None,
        },
    )
    .await;

    match result {
        Ok(response) => {
            println!("Found {} comments", response.comments.len());
            for comment in response.comments {
                println!("Comment: {:?}", comment);
            }
        }
        Err(e) => eprintln!("Error fetching comments: {:?}", e),
    }
}

使用已驗證的 API

use fastcomments_sdk::client::apis::configuration::{ApiKey, Configuration};
use fastcomments_sdk::client::apis::default_api;

#[tokio::main]
async fn main() {
    // 使用 API 金鑰建立設定
    let mut config = Configuration::new();
    config.api_key = Some(ApiKey {
        prefix: None,
        key: "your-api-key".to_string(),
    });

    // 使用已驗證 API 擷取留言
    let result = default_api::get_comments(
        &config,
        default_api::GetCommentsParams {
            tenant_id: "your-tenant-id".to_string(),
            skip: None,
            limit: None,
            sort_dir: None,
            urlid: Some("page-url-id".to_string()),
            url: None,
            is_spam: None,
            user_id: None,
            all_comments: None,
            for_moderation: None,
            parent_id: None,
            is_flagged: None,
            is_flagged_tag: None,
            is_by_verified: None,
            is_pinned: None,
            asc: None,
            include_imported: None,
            origin: None,
            tags: None,
        },
    )
    .await;

    match result {
        Ok(response) => {
            println!("Total comments: {}", response.count);
            for comment in response.comments {
                println!("Comment ID: {}, Text: {}", comment.id, comment.comment);
            }
        }
        Err(e) => eprintln!("Error: {:?}", e),
    }
}

使用審核 API

審核方法支援管理員儀表板。它們使用與已驗證 API 相同的 API-key Configuration,且每個方法都接受可選的 sso 令牌,使呼叫可以代表已通過 SSO 驗證的管理員進行。

use fastcomments_sdk::client::apis::configuration::{ApiKey, Configuration};
use fastcomments_sdk::client::apis::moderation_api;

#[tokio::main]
async fn main() {
    // 使用 API 金鑰建立設定
    let mut config = Configuration::new();
    config.api_key = Some(ApiKey {
        prefix: None,
        key: "your-api-key".to_string(),
    });

    // 計算在審核佇列中等待的留言
    let result = moderation_api::get_count(
        &config,
        moderation_api::GetCountParams {
            text_search: None,
            by_ip_from_comment: None,
            filter: None,
            search_filters: None,
            demo: None,
            sso: None, // 傳入 SSO 令牌以作為 SSO 驗證的管理者代理呼叫
        },
    )
    .await;

    match result {
        Ok(response) => println!("Comments to moderate: {}", response.count),
        Err(e) => eprintln!("Error: {:?}", e),
    }
}

使用 SSO 進行驗證

use fastcomments_sdk::sso::{
    fastcomments_sso::FastCommentsSSO,
    secure_sso_user_data::SecureSSOUserData,
};

fn main() {
    let api_key = "your-api-key".to_string();

    // 建立安全的 SSO 使用者資料(僅限於伺服器端!)
    let user_data = SecureSSOUserData::new(
        "user-123".to_string(),           // 使用者 ID
        "user@example.com".to_string(),   // 電子郵件
        "John Doe".to_string(),            // 使用者名稱
        "https://example.com/avatar.jpg".to_string(), // 大頭貼 URL
    );

    // 產生 SSO 令牌
    let sso = FastCommentsSSO::new_secure(api_key, &user_data).unwrap();
    let token = sso.create_token().unwrap();

    println!("SSO Token: {}", token);
    // 將此令牌傳給前端以進行驗證
}

常見問題 Internal Link

401 Unauthorized Errors

如果在使用需要認證的 API 時收到 401 錯誤:

  1. 檢查您的 API 金鑰:確保您正在使用來自 FastComments 儀表板的正確 API 金鑰
  2. 驗證租戶 ID:確保租戶 ID 與您的帳戶相符
  3. API 金鑰格式:API 金鑰應該在 Configuration 中傳遞:
let mut config = Configuration::new();
config.api_key = Some(ApiKey {
    prefix: None,
    key: "YOUR_API_KEY".to_string(),
});

SSO Token Issues

如果 SSO 令牌無法運作:

  1. 於生產環境使用安全模式:在生產環境中始終使用 FastCommentsSSO::new_secure() 並搭配您的 API 金鑰
  2. 僅限伺服端:在您的伺服器上產生 SSO 令牌,切勿將 API 金鑰洩露給客戶端
  3. 檢查使用者資料:確保所有必要欄位(id, email, username)都已提供

Async Runtime Errors

SDK 使用 tokio 執行非同步操作。請確保:

  1. Add tokio to your dependencies:
[dependencies]
tokio = { version = "1", features = ["full"] }
  1. Use the tokio runtime:
#[tokio::main]
async fn main() {
    // Your async code here
}

注意事項 Internal Link

廣播 ID

你會看到在某些 API 呼叫中應該傳遞 broadcastId。當你接收到事件時,會回傳這個 ID,因此如果你打算在用戶端以樂觀方式套用變更,就知道要忽略該事件 (你大概會想這麼做,因為這能提供最佳體驗)。請在此傳入一個 UUID。該 ID 應足夠唯一,以免在同一瀏覽器會話中出現兩次。

聚合 Internal Link

Aggregates documents by grouping them (if groupBy is provided) and applying multiple operations. Different operations (e.g. sum, countDistinct, avg, etc.) are supported.

參數

名稱型別必要說明
tenant_idStringYes
aggregation_requestmodels::AggregationRequestYes
parent_tenant_idStringNo
include_statsboolNo

回應

Returns: AggregateResponse

範例

彙總 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let config = configuration::Configuration::default();
4 let aggregation_request = models::AggregationRequest::default();
5 let params = AggregateParams {
6 tenant_id: "acme-corp-tenant".to_string(),
7 aggregation_request,
8 parent_tenant_id: Some("global-tenant".to_string()),
9 include_stats: Some(true),
10 };
11 let _response = aggregate(&config, params).await?;
12 Ok(())
13}
14

取得 API 評論 Internal Link

參數

名稱類型必填說明
tenant_idString
pagef64
countf64
text_searchString
by_ip_from_commentString
filtersString
search_filtersString
sortsString
demobool
ssoString

回應

回傳:ModerationApiGetCommentsResponse

範例

get_api_comments 範例
Copy Copy
1
2async fn run() -> Result<(), Error> {
3 let params = GetApiCommentsParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 page: Some(1.0),
6 count: Some(20.0),
7 text_search: Some("rust".to_string()),
8 by_ip_from_comment: None,
9 filters: Some("status:approved".to_string()),
10 search_filters: Some("author:john".to_string()),
11 sorts: Some("date:desc".to_string()),
12 demo: Some(false),
13 sso: None,
14 };
15 let _response = get_api_comments(&configuration, params).await?;
16 Ok(())
17}
18

取得 API 匯出狀態 Internal Link

參數

名稱類型必填描述
tenant_idStringYes
batch_job_idStringNo
ssoStringNo

回應

返回:ModerationExportStatusResponse

範例

get_api_export_status 範例
Copy Copy
1
2async fn run() -> Result<(), Error> {
3 let params = GetApiExportStatusParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 batch_job_id: Some("batch-2023-09-01".to_string()),
6 sso: Some("sso-token-xyz".to_string()),
7 };
8 let _status = get_api_export_status(&configuration, params).await?;
9 Ok(())
10}
11

取得 API ID Internal Link


參數

NameTypeRequiredDescription
tenant_idString
text_searchString
by_ip_from_commentString
filtersString
search_filtersString
after_idString
demobool
ssoString

回應

Returns: ModerationApiGetCommentIdsResponse

範例

get_api_ids 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = GetApiIdsParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 text_search: Some("breaking news".to_string()),
6 by_ip_from_comment: None,
7 filters: Some("status:approved".to_string()),
8 search_filters: None,
9 after_id: None,
10 demo: Some(false),
11 sso: Some("sso-token".to_string()),
12 };
13 let _response = get_api_ids(&config, params).await?;
14 Ok(())
15}
16

建立 API 匯出 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
text_searchStringNo
by_ip_from_commentStringNo
filtersStringNo
search_filtersStringNo
sortsStringNo
ssoStringNo

回應

返回: ModerationExportResponse

範例

post_api_export 範例
Copy Copy
1
2async fn export_moderation() -> Result<(), Error> {
3 let params = PostApiExportParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 text_search: Some("news/article".to_string()),
6 by_ip_from_comment: Some("203.0.113.42".to_string()),
7 filters: Some("status:pending".to_string()),
8 search_filters: Some("created_at>2023-01-01".to_string()),
9 sorts: Some("created_at_desc".to_string()),
10 sso: None,
11 };
12 let _response = post_api_export(&configuration, params).await?;
13 Ok(())
14}
15

取得稽核日誌 Internal Link

參數

名稱類型必填說明
tenant_idString
limitf64
skipf64
ordermodels::SortDir
afterf64
beforef64

回應

返回:GetAuditLogsResponse

範例

get_audit_logs 範例
Copy Copy
1
2async fn fetch_audit_logs(config: &configuration::Configuration) -> Result<(), Error> {
3 let params = GetAuditLogsParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 limit: Some(100.0),
6 skip: Some(0.0),
7 order: Some(models::SortDir::Desc),
8 after: Some(1622505600.0),
9 before: None,
10 };
11 let _response: GetAuditLogsResponse = get_audit_logs(config, params).await?;
12 Ok(())
13}
14

從公開評論封鎖 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
comment_idStringYes
public_block_from_comment_paramsmodels::PublicBlockFromCommentParamsYes
ssoStringNo

回應

返回:BlockSuccess

範例

block_from_comment_public 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = BlockFromCommentPublicParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 comment_id: "cmt-98765".to_string(),
6 public_block_from_comment_params: models::PublicBlockFromCommentParams::default(),
7 sso: Some("sso-token-xyz".to_string()),
8 };
9 let _result: BlockSuccess = block_from_comment_public(&configuration, params).await?;
10 Ok(())
11}
12

取消封鎖公開評論 Internal Link

參數

名稱類型必要描述
tenant_idStringYes
comment_idStringYes
public_block_from_comment_paramsmodels::PublicBlockFromCommentParamsYes
ssoStringNo

回應

回傳: UnblockSuccess

範例

un_block_comment_public 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = UnBlockCommentPublicParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 comment_id: "comment-12345".to_string(),
6 public_block_from_comment_params: models::PublicBlockFromCommentParams::default(),
7 sso: Some("user-sso-token".to_string()),
8 };
9 let _result: UnblockSuccess = un_block_comment_public(configuration, params).await?;
10 Ok(())
11}
12

檢查已封鎖的評論 Internal Link

參數

名稱類型必填描述
tenant_idString
comment_idsString
ssoString

回應

返回:CheckBlockedCommentsResponse

範例

checked_comments_for_blocked 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = CheckedCommentsForBlockedParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 comment_ids: "cmt-001,cmt-002".to_string(),
6 sso: Some("user@example.com".to_string()),
7 };
8 let _response: CheckBlockedCommentsResponse = checked_comments_for_blocked(&config, params).await?;
9 Ok(())
10}
11

封鎖評論中的使用者 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
idStringYes
block_from_comment_paramsmodels::BlockFromCommentParamsYes
user_idStringNo
anon_user_idStringNo

回應

回傳:BlockSuccess

範例

block_user_from_comment 範例
Copy Copy
1
2async fn example(configuration: &configuration::Configuration) -> Result<(), Error> {
3 let params = BlockUserFromCommentParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 id: "comment-9876".to_string(),
6 block_from_comment_params: models::BlockFromCommentParams {
7 reason: "spam".to_string(),
8 },
9 user_id: Some("user-42".to_string()),
10 anon_user_id: None,
11 };
12 let _result: BlockSuccess = block_user_from_comment(configuration, params).await?;
13 Ok(())
14}
15

建立公開評論 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
url_idStringYes
broadcast_idStringYes
comment_datamodels::CommentDataYes
session_idStringNo
ssoStringNo

回應

回傳:SaveCommentsResponseWithPresence

範例

create_comment_public 範例
Copy Copy
1
2let params = CreateCommentPublicParams {
3 tenant_id: "acme-corp-tenant".to_string(),
4 url_id: "news/article-123".to_string(),
5 broadcast_id: "broadcast-2023-09-01".to_string(),
6 comment_data: models::CommentData {
7 text: "Great read!".to_string(),
8 },
9 session_id: Some("session-abc123".to_string()),
10 sso: Some("sso-token-xyz".to_string()),
11};
12let response = create_comment_public(&configuration, params).await?;
13

刪除評論 Internal Link

參數

名稱類型必填描述
tenant_idStringYes
idStringYes
context_user_idStringNo
is_liveboolNo

回應

返回:DeleteCommentResult

範例

delete_comment 範例
Copy Copy
1
2async fn main() -> Result<(), Error> {
3 let params = DeleteCommentParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 id: "comment-12345".to_string(),
6 context_user_id: Some("user-6789".to_string()),
7 is_live: Some(true),
8 };
9 let _result = delete_comment(&configuration, params).await?;
10 Ok(())
11}
12

刪除公開評論 Internal Link

參數

名稱類型必要描述
tenant_idStringYes
comment_idStringYes
broadcast_idStringYes
edit_keyStringNo
ssoStringNo

回應

回傳: PublicApiDeleteCommentResponse

範例

delete_comment_public 範例
Copy Copy
1
2async fn run_delete() -> Result<(), Error> {
3 let params = DeleteCommentPublicParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 comment_id: "cmt-12345".to_string(),
6 broadcast_id: "news/article-6789".to_string(),
7 edit_key: Some("edit-abc123".to_string()),
8 sso: Some("sso-token-xyz".to_string()),
9 };
10 let response = delete_comment_public(&configuration, params).await?;
11 let _deleted: PublicApiDeleteCommentResponse = response;
12 Ok(())
13}
14

刪除評論投票 Internal Link

參數

名稱型別必填描述
tenant_idString
comment_idString
vote_idString
url_idString
broadcast_idString
edit_keyString
ssoString

回應

返回: VoteDeleteResponse

範例

delete_comment_vote 範例
Copy Copy
1
2#[tokio::main]
3async fn main() -> Result<(), Error> {
4 let params = DeleteCommentVoteParams {
5 tenant_id: "acme-corp-tenant".to_string(),
6 comment_id: "comment-12345".to_string(),
7 vote_id: "vote-67890".to_string(),
8 url_id: "news/article".to_string(),
9 broadcast_id: "broadcast-abc".to_string(),
10 edit_key: Some("edit-key-xyz".to_string()),
11 sso: Some("sso-token-123".to_string()),
12 };
13 let _response: VoteDeleteResponse = delete_comment_vote(&configuration, params).await?;
14 Ok(())
15}
16

標記評論 Internal Link

參數

NameTypeRequiredDescription
tenant_idString
idString
user_idString
anon_user_idString

回應

返回:FlagCommentResponse

範例

flag_comment 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = FlagCommentParams {
4 tenant_id: "acme-corp".to_string(),
5 id: "comment-9876".to_string(),
6 user_id: Some("user-42".to_string()),
7 anon_user_id: None,
8 };
9 let _response = flag_comment(&configuration, params).await?;
10 Ok(())
11}
12

取得評論 Internal Link

參數

名稱類型必填描述
tenant_idString
idString

回應

返回:ApiGetCommentResponse

範例

get_comment 範例
Copy Copy
1
2async fn fetch_comment() -> Result<(), Error> {
3 let params = GetCommentParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 id: "comment-12345".to_string(),
6 include_deleted: Some(false),
7 };
8
9 let _response: ApiGetCommentResponse = get_comment(&configuration, params).await?;
10 Ok(())
11}
12

取得評論文字 Internal Link

參數

名稱類型必填說明
tenant_idString
comment_idString
edit_keyString
ssoString

回應

返回:PublicApiGetCommentTextResponse

範例

get_comment_text 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = GetCommentTextParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 comment_id: "comment-12345".to_string(),
6 edit_key: Some("edit-key-abc".to_string()),
7 sso: Some("sso-token-xyz".to_string()),
8 };
9 let _response = get_comment_text(&configuration, params).await?;
10 Ok(())
11}
12

取得評論投票者名稱 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
comment_idStringYes
diri32Yes
ssoStringNo

回應

回傳: GetCommentVoteUserNamesSuccessResponse

範例

get_comment_vote_user_names 範例
Copy Copy
1
2async fn demo(config: &configuration::Configuration) -> Result<(), Error> {
3 let params = GetCommentVoteUserNamesParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 comment_id: "news/article-123".to_string(),
6 dir: 1,
7 sso: Some("user-sso-id".to_string()),
8 };
9 let _response: GetCommentVoteUserNamesSuccessResponse =
10 get_comment_vote_user_names(config, params).await?;
11 Ok(())
12}
13

取得評論列表 Internal Link

參數

名稱類型必填描述
tenant_idStringYes
pagei32No
limiti32No
skipi32No
as_treeboolNo
skip_childreni32No
limit_childreni32No
max_tree_depthi32No
url_idStringNo
user_idStringNo
anon_user_idStringNo
context_user_idStringNo
hash_tagStringNo
parent_idStringNo
directionmodels::SortDirectionsNo
from_datei64No
to_datei64No

回應

返回: ApiGetCommentsResponse

範例

get_comments 範例
Copy Copy
1
2async fn fetch_comments() -> Result<(), Error> {
3 let params = GetCommentsParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 page: Some(1),
6 limit: Some(20),
7 skip: Some(0),
8 as_tree: Some(true),
9 skip_children: Some(5),
10 limit_children: Some(10),
11 max_tree_depth: Some(3),
12 url_id: Some("news/article".to_string()),
13 user_id: Some("user-123".to_string()),
14 anon_user_id: Some("anon-456".to_string()),
15 context_user_id: Some("ctx-789".to_string()),
16 hash_tag: Some("rust".to_string()),
17 parent_id: Some("parent-001".to_string()),
18 direction: Some(models::SortDirections::Desc),
19 from_date: Some(1_640_995_200),
20 to_date: Some(1_641_081_600),
21 };
22 let _response = get_comments(&config, params).await?;
23 Ok(())
24}
25

取得公開評論列表 Internal Link

請求 tenantId urlId

參數

名稱類型必須描述
tenant_idString
url_idString
pagei32
directionmodels::SortDirections
ssoString
skipi32
skip_childreni32
limiti32
limit_childreni32
count_childrenbool
fetch_page_for_comment_idString
include_configbool
count_allbool
includei10nbool
localeString
modulesString
is_crawlerbool
include_notification_countbool
as_treebool
max_tree_depthi32
use_full_translation_idsbool
parent_idString
search_textString
hash_tagsVec
user_idString
custom_config_strString
after_comment_idString
before_comment_idString

回應

返回: GetCommentsResponseWithPresencePublicComment

範例

get_comments_public 範例
Copy Copy
1
2async fn fetch_comments() -> Result<(), Error> {
3 let params = GetCommentsPublicParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 url_id: "news/article".to_string(),
6 page: Some(1),
7 direction: Some(models::SortDirections::Desc),
8 limit: Some(20),
9 includei10n: Some(true),
10 locale: Some("en-US".to_string()),
11 as_tree: Some(true),
12 max_tree_depth: Some(3),
13 hash_tags: Some(vec!["rust".to_string(), "programming".to_string()]),
14 ..Default::default()
15 };
16 let _response = get_comments_public(&configuration, params).await?;
17 Ok(())
18}
19

鎖定評論 Internal Link

參數

名稱類型必填描述
tenant_idStringYes
comment_idStringYes
broadcast_idStringYes
ssoStringNo

回應

返回: ApiEmptyResponse

範例

lock_comment 示例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = LockCommentParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 comment_id: "cmt-9876".to_string(),
6 broadcast_id: "news/article".to_string(),
7 sso: Some("user-sso-token".to_string()),
8 };
9 let _resp = lock_comment(&configuration, params).await?;
10 Ok(())
11}
12

置頂評論 Internal Link

參數

名稱類型必填說明
tenant_idString
comment_idString
broadcast_idString
ssoString

回應

返回: ChangeCommentPinStatusResponse

示例

pin_comment 示例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = PinCommentParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 comment_id: "comment-12345".to_string(),
6 broadcast_id: "news/article".to_string(),
7 sso: Some("sso-token-xyz".to_string()),
8 };
9 let _response = pin_comment(&configuration, params).await?;
10 Ok(())
11}
12

儲存評論 Internal Link

參數

名稱類型必填描述
tenant_idStringYes
create_comment_paramsmodels::CreateCommentParamsYes
is_liveboolNo
do_spam_checkboolNo
send_emailsboolNo
populate_notificationsboolNo

回應

回傳: ApiSaveCommentResponse

範例

save_comment 範例
Copy Copy
1
2async fn run() -> Result<(), Error> {
3 let params = SaveCommentParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 create_comment_params: models::CreateCommentParams {
6 body: "Great insights on the latest tech trends.".to_string(),
7 user_id: "user-789".to_string(),
8 ..Default::default()
9 },
10 is_live: Some(true),
11 do_spam_check: Some(true),
12 send_emails: Some(false),
13 populate_notifications: Some(true),
14 };
15 let _response = save_comment(&configuration, params).await?;
16 Ok(())
17}
18

批次儲存評論 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
create_comment_paramsVecmodels::CreateCommentParamsYes
is_liveboolNo
do_spam_checkboolNo
send_emailsboolNo
populate_notificationsboolNo

回應

返回:Vec<models::SaveCommentsBulkResponse>

範例

save_comments_bulk 範例
Copy Copy
1
2#[tokio::main]
3async fn main() -> Result<(), Box<dyn std::error::Error>> {
4 let params: SaveCommentsBulkParams = SaveCommentsBulkParams {
5 tenant_id: "acme-corp-tenant".to_string(),
6 create_comment_params: vec![
7 models::CreateCommentParams::default(),
8 models::CreateCommentParams::default(),
9 ],
10 is_live: Some(true),
11 do_spam_check: Some(false),
12 send_emails: Some(true),
13 populate_notifications: Some(false),
14 };
15 let _responses: Vec<models::SaveCommentsBulkResponse> = save_comments_bulk(&configuration, params).await?;
16 Ok(())
17}
18

設定評論文字 Internal Link


參數

名稱類型必填說明
tenant_idString
comment_idString
broadcast_idString
comment_text_update_requestmodels::CommentTextUpdateRequest
edit_keyString
ssoString

回應

返回:PublicApiSetCommentTextResponse

範例

set_comment_text 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let comment_text_update_request = models::CommentTextUpdateRequest {
4 text: "Edited comment text after moderation".to_string(),
5 ..Default::default()
6 };
7 let params = SetCommentTextParams {
8 tenant_id: "acme-corp-tenant".to_string(),
9 comment_id: "cmt-98765".to_string(),
10 broadcast_id: "news/article".to_string(),
11 comment_text_update_request,
12 edit_key: Some("edit-key-2024".to_string()),
13 sso: Some("sso-token-789".to_string()),
14 };
15 let _response = set_comment_text(&configuration, params).await?;
16 Ok(())
17}
18

取消封鎖評論中的使用者 Internal Link

參數

名稱類型必填描述
tenant_idString
idString
un_block_from_comment_paramsmodels::UnBlockFromCommentParams
user_idString
anon_user_idString

回應

返回:UnblockSuccess

示例

un_block_user_from_comment 範例
Copy Copy
1
2async fn example(config: &configuration::Configuration) -> Result<UnblockSuccess, Error> {
3 let params = UnBlockUserFromCommentParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 id: "comment-12345".to_string(),
6 un_block_from_comment_params: models::UnBlockFromCommentParams::default(),
7 user_id: Some("user-67890".to_string()),
8 anon_user_id: Some("anon-abcde".to_string()),
9 };
10 let result = un_block_user_from_comment(config, params).await?;
11 Ok(result)
12}
13

取消標記評論 Internal Link

參數

名稱類型必需說明
tenant_idStringYes
idStringYes
user_idStringNo
anon_user_idStringNo

回應

返回:FlagCommentResponse

範例

un_flag_comment 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = UnFlagCommentParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 id: "comment-12345".to_string(),
6 user_id: Some("user-67890".to_string()),
7 anon_user_id: None,
8 };
9 let _response = un_flag_comment(&configuration, params).await?;
10 Ok(())
11}
12

解除鎖定評論 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
comment_idStringYes
broadcast_idStringYes
ssoStringNo

回應

返回: ApiEmptyResponse

範例

un_lock_comment 範例
Copy Copy
1
2async fn run() -> Result<(), Error> {
3 let params = UnLockCommentParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 comment_id: "cmt-456".to_string(),
6 broadcast_id: "news/article-123".to_string(),
7 sso: Some("user-sso-token".to_string()),
8 };
9 let _response = un_lock_comment(&configuration, params).await?;
10 Ok(())
11}
12

取消置頂評論 Internal Link

參數

名稱類型必填說明
tenant_idString
comment_idString
broadcast_idString
ssoString

回應

回傳: ChangeCommentPinStatusResponse

範例

un_pin_comment 範例
Copy Copy
1
2async fn unpin_example(configuration: &configuration::Configuration) -> Result<(), Error> {
3 let params = UnPinCommentParams {
4 tenant_id: "acme-corp".to_string(),
5 comment_id: "comment-12345".to_string(),
6 broadcast_id: "news/article-6789".to_string(),
7 sso: Some("sso-token-xyz".to_string()),
8 };
9 let _response: ChangeCommentPinStatusResponse = un_pin_comment(configuration, params).await?;
10 Ok(())
11}
12

更新評論 Internal Link

參數

名稱類型必填描述
tenant_idStringYes
idStringYes
updatable_comment_paramsmodels::UpdatableCommentParamsYes
context_user_idStringNo
do_spam_checkboolNo
is_liveboolNo

回應

返回:ApiEmptyResponse

示例

update_comment 範例
Copy Copy
1
2async fn run_update() -> Result<(), Error> {
3 let updatable = models::UpdatableCommentParams {
4 content: "Edited comment about the latest news article".to_string(),
5 ..Default::default()
6 };
7 let params = UpdateCommentParams {
8 tenant_id: "acme-corp-tenant".to_string(),
9 id: "comment-789".to_string(),
10 updatable_comment_params: updatable,
11 context_user_id: Some("reader-42".to_string()),
12 do_spam_check: Some(true),
13 is_live: Some(true),
14 };
15 let _ = update_comment(&configuration, params).await?;
16 Ok(())
17}
18

對評論投票 Internal Link

參數

名稱類型必填說明
tenant_idString
comment_idString
url_idString
broadcast_idString
vote_body_paramsmodels::VoteBodyParams
session_idString
ssoString

回應

返回:VoteResponse

範例

vote_comment 範例
Copy Copy
1
2async fn run() -> Result<(), Error> {
3 let config = configuration::Configuration::default();
4
5 let vote_body = models::VoteBodyParams {
6 vote_type: "upvote".to_string(),
7 weight: 1,
8 };
9
10 let params = VoteCommentParams {
11 tenant_id: "acme-corp-tenant".to_string(),
12 comment_id: "comment-12345".to_string(),
13 url_id: "news/article".to_string(),
14 broadcast_id: "broadcast-67890".to_string(),
15 vote_body_params: vote_body,
16 session_id: Some("session-abcde".to_string()),
17 sso: None,
18 };
19
20 let _response = vote_comment(&config, params).await?;
21 Ok(())
22}
23

取得使用者的評論 Internal Link

參數

名稱類型必填說明
user_idStringNo
directionmodels::SortDirectionsNo
replies_to_user_idStringNo
pagef64No
includei10nboolNo
localeStringNo
is_crawlerboolNo

回應

返回:GetCommentsForUserResponse

範例

get_comments_for_user 範例
Copy Copy
1
2async fn fetch_user_comments() -> Result<(), Error> {
3 let params = GetCommentsForUserParams {
4 user_id: Some("user-42".to_string()),
5 direction: Some(models::SortDirections::Desc),
6 replies_to_user_id: Some("reply-to-42".to_string()),
7 page: Some(1.0),
8 includei10n: Some(true),
9 locale: Some("en-US".to_string()),
10 is_crawler: Some(false),
11 };
12 let _response = get_comments_for_user(&configuration, params).await?;
13 Ok(())
14}
15

新增網域設定 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
add_domain_config_paramsmodels::AddDomainConfigParamsYes

回應

返回: AddDomainConfigResponse

範例

add_domain_config 範例
Copy Copy
1
2let params = AddDomainConfigParams {
3 tenant_id: "acme-corp-tenant".to_string(),
4 add_domain_config_params: models::AddDomainConfigParams {
5 domain: "news.example.com".to_string(),
6 config_type: "article".to_string(),
7 is_active: true,
8 description: Some("News article domain".to_string()),
9 },
10};
11
12let response = add_domain_config(&configuration, params).await?;
13

刪除網域設定 Internal Link

參數

NameTypeRequiredDescription
tenant_idStringYes
domainStringYes

回應

Returns: DeleteDomainConfigResponse

範例

delete_domain_config 範例
Copy Copy
1
2async fn run_example(configuration: &configuration::Configuration) -> Result<(), Error> {
3 let params = DeleteDomainConfigParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 domain: "news/article".to_string(),
6 };
7 let _response: DeleteDomainConfigResponse = delete_domain_config(configuration, params).await?;
8 Ok(())
9}
10

取得網域設定 Internal Link

參數

名稱類型必填描述
tenant_idString
domainString

回應

返回: GetDomainConfigResponse

範例

get_domain_config 範例
Copy Copy
1
2#[tokio::main]
3async fn main() -> Result<(), Error> {
4 let params = GetDomainConfigParams {
5 tenant_id: "acme-corp-tenant".to_string(),
6 domain: "news/article".to_string(),
7 locale: Some("en-US".to_string()),
8 };
9 let _response = get_domain_config(&config, params).await?;
10 Ok(())
11}
12

取得所有網域設定 Internal Link

參數

名稱類型必填說明
tenant_idString

回應

返回: GetDomainConfigsResponse

範例

get_domain_configs 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = GetDomainConfigsParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 };
6 let _response = get_domain_configs(&configuration, params).await?;
7 Ok(())
8}
9

部分更新網域設定 Internal Link

參數

NameTypeRequiredDescription
tenant_idStringYes
domain_to_updateStringYes
patch_domain_config_paramsmodels::PatchDomainConfigParamsYes

回應

Returns: PatchDomainConfigResponse

範例

patch_domain_config 範例
Copy Copy
1
2async fn run_example() -> Result<(), Error> {
3 let config = configuration::Configuration::default();
4 let params = PatchDomainConfigParams {
5 tenant_id: "acme-corp-tenant".to_string(),
6 domain_to_update: "news/article".to_string(),
7 patch_domain_config_params: models::PatchDomainConfigParams {
8 enable_comments: Some(true),
9 theme: Some("dark".to_string()),
10 },
11 };
12 let _response = patch_domain_config(&config, params).await?;
13 Ok(())
14}
15

替換網域設定 Internal Link

參數

NameTypeRequiredDescription
tenant_idStringYes
domain_to_updateStringYes
update_domain_config_paramsmodels::UpdateDomainConfigParamsYes

回應

Returns: PutDomainConfigResponse

範例

put_domain_config 範例
Copy Copy
1
2async fn update_domain(configuration: &configuration::Configuration) -> Result<(), Error> {
3 let update_params = models::UpdateDomainConfigParams {
4 enable_comments: Some(true),
5 moderation_level: Some("strict".to_string()),
6 max_comment_length: Some(500),
7 ..Default::default()
8 };
9 let params = PutDomainConfigParams {
10 tenant_id: "acme-corp-tenant".to_string(),
11 domain_to_update: "news.example.com".to_string(),
12 update_domain_config_params: update_params,
13 };
14 let _resp: PutDomainConfigResponse = put_domain_config(configuration, params).await?;
15 Ok(())
16}
17

建立電子郵件範本 Internal Link

參數

名稱類型必填說明
tenant_idString
create_email_template_bodymodels::CreateEmailTemplateBody

回應

返回: CreateEmailTemplateResponse

範例

create_email_template 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = CreateEmailTemplateParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 create_email_template_body: models::CreateEmailTemplateBody {
6 name: "welcome".to_string(),
7 subject: "Welcome to Acme".to_string(),
8 html_content: "<h1>Welcome</h1>".to_string(),
9 plain_text_content: Some("Welcome to Acme".to_string()),
10 },
11 };
12 let _response = create_email_template(&configuration, params).await?;
13 Ok(())
14}
15

刪除電子郵件範本 Internal Link

參數

名稱類型必填說明
tenant_idString
idString

回應

返回: ApiEmptyResponse

範例

delete_email_template 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = DeleteEmailTemplateParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 id: "welcome-email".to_string(),
6 };
7 let _ = delete_email_template(&config, params).await?;
8 Ok(())
9}
10

刪除電子郵件範本渲染錯誤 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
idStringYes
error_idStringYes

回應

Returns: ApiEmptyResponse

範例

delete_email_template_render_error 範例
Copy Copy
1
2async fn example(config: &configuration::Configuration) -> Result<(), Error> {
3 let params = DeleteEmailTemplateRenderErrorParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 id: "welcome-email".to_string(),
6 error_id: "render-failure-123".to_string(),
7 };
8 let _ = delete_email_template_render_error(config, params).await?;
9 Ok(())
10}
11

取得電子郵件範本 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
idStringYes

回應

返回: GetEmailTemplateResponse

範例

get_email_template 範例
Copy Copy
1
2async fn fetch_template() -> Result<(), Error> {
3 let params: GetEmailTemplateParams = GetEmailTemplateParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 id: "welcome-email".to_string(),
6 };
7 let _response = get_email_template(&configuration, params).await?;
8 Ok(())
9}
10

取得電子郵件範本定義 Internal Link

參數

名稱類型必填描述
tenant_idString

回應

返回:GetEmailTemplateDefinitionsResponse

範例

get_email_template_definitions 範例
Copy Copy
1
2async fn run() -> Result<(), Error> {
3 let params = GetEmailTemplateDefinitionsParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 };
6 let _response = get_email_template_definitions(&configuration, params).await?;
7 Ok(())
8}
9

取得電子郵件範本渲染錯誤 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
idStringYes
skipf64No

回應

返回: GetEmailTemplateRenderErrorsResponse

範例

get_email_template_render_errors 範例
Copy Copy
1
2async fn fetch_template_errors(config: &configuration::Configuration) -> Result<(), Error> {
3 let params = GetEmailTemplateRenderErrorsParams {
4 tenant_id: "acme-corp".to_string(),
5 id: "newsletter-welcome".to_string(),
6 skip: Some(5.0),
7 };
8 let _response: GetEmailTemplateRenderErrorsResponse = get_email_template_render_errors(config, params).await?;
9 Ok(())
10}
11

取得電子郵件範本清單 Internal Link

參數

名稱類型必填說明
tenant_idString
skipf64

回應

返回:GetEmailTemplatesResponse

範例

get_email_templates 示例
Copy Copy
1
2async fn run() -> Result<(), Error> {
3 let params = GetEmailTemplatesParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 skip: Some(10.0),
6 };
7 let _response = get_email_templates(&configuration, params).await?;
8 Ok(())
9}
10

渲染電子郵件範本 Internal Link

參數

名稱類型必填說明
tenant_idString
render_email_template_bodymodels::RenderEmailTemplateBody
localeString

回應

返回: RenderEmailTemplateResponse

範例

render_email_template 範例
Copy Copy
1
2let mut vars = std::collections::HashMap::new();
3vars.insert("article_title".to_string(), "Breaking News".to_string());
4vars.insert("author".to_string(), "Jane Smith".to_string());
5
6let body = models::RenderEmailTemplateBody {
7 template_id: "newsletter".to_string(),
8 variables: vars,
9};
10
11let params = RenderEmailTemplateParams {
12 tenant_id: "acme-corp-tenant".to_string(),
13 render_email_template_body: body,
14 locale: Some("en-US".to_string()),
15};
16
17let response = render_email_template(&configuration, params).await?;
18

更新電子郵件範本 Internal Link

參數

名稱類型Required描述
tenant_idStringYes
idStringYes
update_email_template_bodymodels::UpdateEmailTemplateBodyYes

回應

返回:ApiEmptyResponse

範例

update_email_template 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = UpdateEmailTemplateParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 id: "welcome-email".to_string(),
6 update_email_template_body: models::UpdateEmailTemplateBody {
7 subject: Some("Welcome to Acme Corp".to_string()),
8 body_html: Some("<p>Hello, \{{user.name}}!</p>".to_string()),
9 body_text: None,
10 },
11 };
12 let _ = update_email_template(&config, params).await?;
13 Ok(())
14}
15

取得事件記錄 Internal Link

req tenantId urlId userIdWS

參數

名稱類型必填說明
tenant_idString
url_idString
user_id_wsString
start_timei64
end_timei64

回應

返回:GetEventLogResponse

範例

get_event_log 範例
Copy Copy
1
2async fn fetch_event_log(configuration: &configuration::Configuration) -> Result<(), Error> {
3 let params = GetEventLogParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 url_id: "news/article".to_string(),
6 user_id_ws: "user-12345".to_string(),
7 start_time: 1_640_995_200,
8 end_time: Some(1_640_995_300),
9 };
10 let _response: GetEventLogResponse = get_event_log(configuration, params).await?;
11 Ok(())
12}
13

取得全域事件記錄 Internal Link

req tenantId urlId userIdWS

參數

NameTypeRequiredDescription
tenant_idStringYes
url_idStringYes
user_id_wsStringYes
start_timei64Yes
end_timei64No

回應

Returns: GetEventLogResponse

範例

get_global_event_log 範例
Copy Copy
1
2async fn run(configuration: &configuration::Configuration) -> Result<(), Error> {
3 let params = GetGlobalEventLogParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 url_id: "news/article".to_string(),
6 user_id_ws: "user-12345".to_string(),
7 start_time: 1_680_000_000,
8 end_time: Some(1_680_864_000),
9 };
10 let _response = get_global_event_log(configuration, params).await?;
11 Ok(())
12}
13

建立動態貼文 Internal Link

參數

名稱類型必填描述
tenant_idString
create_feed_post_paramsmodels::CreateFeedPostParams
broadcast_idString
is_livebool
do_spam_checkbool
skip_dup_checkbool

回應

返回:CreateFeedPostsResponse

範例

create_feed_post 範例
Copy Copy
1
2async fn run_example(configuration: &configuration::Configuration) -> Result<(), Error> {
3 let params = CreateFeedPostParams {
4 tenant_id: "acme-corp-tenant".into(),
5 create_feed_post_params: models::CreateFeedPostParams {
6 text: "Launching new features".into(),
7 media: vec![],
8 },
9 broadcast_id: Some("broadcast-2023-09".into()),
10 is_live: Some(true),
11 do_spam_check: Some(true),
12 skip_dup_check: Some(false),
13 };
14 let _response = create_feed_post(configuration, params).await?;
15 Ok(())
16}
17

建立公開動態貼文 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
create_feed_post_paramsmodels::CreateFeedPostParamsYes
broadcast_idStringNo
ssoStringNo

回應

返回:CreateFeedPostResponse

範例

create_feed_post_public 範例
Copy Copy
1
2async fn run_example(configuration: &configuration::Configuration) -> Result<(), Error> {
3 let params = CreateFeedPostPublicParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 create_feed_post_params: models::CreateFeedPostParams {
6 title: "Breaking News".to_string(),
7 body: "Details about the news...".to_string(),
8 ..Default::default()
9 },
10 broadcast_id: Some("news/article".to_string()),
11 sso: Some("sso-token-abc".to_string()),
12 };
13 let _response = create_feed_post_public(configuration, params).await?;
14 Ok(())
15}
16

刪除公開動態貼文 Internal Link

參數

名稱類型必要說明
tenant_idString
post_idString
broadcast_idString
ssoString

回應

返回: DeleteFeedPostPublicResponse

範例

delete_feed_post_public 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = DeleteFeedPostPublicParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 post_id: "news/article-123".to_string(),
6 broadcast_id: Some("broadcast-456".to_string()),
7 sso: Some("sso-token-789".to_string()),
8 };
9 let _response: DeleteFeedPostPublicResponse = delete_feed_post_public(&configuration, params).await?;
10 Ok(())
11}
12

取得動態貼文 Internal Link

請求 tenantId afterId

參數

名稱類型必填說明
tenant_idString
after_idString
limiti32
tagsVec

回應

返回: GetFeedPostsResponse

範例

get_feed_posts 範例
Copy Copy
1
2async fn fetch_feed(config: &configuration::Configuration) -> Result<(), Error> {
3 let params = GetFeedPostsParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 after_id: Some("post-12345".to_string()),
6 limit: Some(20),
7 tags: Some(vec!["news".to_string(), "article".to_string()]),
8 };
9 let _response = get_feed_posts(config, params).await?;
10 Ok(())
11}
12

取得公開動態貼文 Internal Link

req tenantId afterId

參數

名稱類型必填說明
tenant_idStringYes
after_idStringNo
limiti32No
tagsVecNo
ssoStringNo
is_crawlerboolNo
include_user_infoboolNo

回應

Returns: PublicFeedPostsResponse

範例

get_feed_posts_public 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = GetFeedPostsPublicParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 after_id: Some("post123".to_string()),
6 limit: Some(20),
7 tags: Some(vec!["news".to_string(), "article".to_string()]),
8 sso: Some("sso-token-xyz".to_string()),
9 is_crawler: Some(false),
10 include_user_info: Some(true),
11 };
12 let _response = get_feed_posts_public(&configuration, params).await?;
13 Ok(())
14}
15

取得動態貼文統計 Internal Link

參數

名稱類型必填說明
tenant_idString
post_idsVec
ssoString

回應

返回: FeedPostsStatsResponse

範例

get_feed_posts_stats 範例
Copy Copy
1
2async fn fetch_feed_stats() -> Result<(), Error> {
3 let params = GetFeedPostsStatsParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 post_ids: vec![
6 "news/article/123".to_string(),
7 "blog/post/456".to_string(),
8 ],
9 sso: Some("sso-token-xyz".to_string()),
10 };
11 let _response = get_feed_posts_stats(&configuration, params).await?;
12 Ok(())
13}
14

取得公開使用者反應 Internal Link

參數

名稱類型必填描述
tenant_idString
post_idsVec
ssoString

回應

返回:UserReactsResponse

範例

get_user_reacts_public 範例
Copy Copy
1
2async fn fetch_user_reacts() -> Result<(), Error> {
3 let params = GetUserReactsPublicParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 post_ids: Some(vec![
6 "news/article-123".to_string(),
7 "blog/post-456".to_string(),
8 ]),
9 sso: Some("sso-token-xyz".to_string()),
10 };
11 let _response = get_user_reacts_public(&configuration, params).await?;
12 Ok(())
13}
14

對公開動態貼文反應 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
post_idStringYes
react_body_paramsmodels::ReactBodyParamsYes
is_undoboolNo
broadcast_idStringNo
ssoStringNo

回應

回傳: ReactFeedPostResponse

範例

react_feed_post_public 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let config = configuration::Configuration::default();
4 let react_body = models::ReactBodyParams {
5 reaction: "like".to_string(),
6 };
7 let params = ReactFeedPostPublicParams {
8 tenant_id: "acme-corp-tenant".to_string(),
9 post_id: "news/article/12345".to_string(),
10 react_body_params: react_body,
11 is_undo: Some(false),
12 broadcast_id: Some("broadcast-xyz".to_string()),
13 sso: Some("sso-token-abc".to_string()),
14 };
15 let _response: ReactFeedPostResponse = react_feed_post_public(&config, params).await?;
16 Ok(())
17}
18

更新動態貼文 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
idStringYes
feed_postmodels::FeedPostYes

回應

返回:ApiEmptyResponse

範例

update_feed_post 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let feed_post = models::FeedPost {
4 title: "Acme Corp Quarterly Update".to_string(),
5 content: Some("Q2 results exceeded expectations with a 15% revenue growth.".to_string()),
6 media: Some(vec![
7 models::FeedPostMediaItem {
8 asset: models::FeedPostMediaItemAsset {
9 url: "https://cdn.acme.com/media/q2-report.png".to_string(),
10 mime_type: Some("image/png".to_string()),
11 ..Default::default()
12 },
13 ..Default::default()
14 },
15 ]),
16 link: Some(models::FeedPostLink {
17 url: "https://www.acme.com/reports/q2".to_string(),
18 title: Some("Full Report".to_string()),
19 ..Default::default()
20 }),
21 ..Default::default()
22 };
23
24 let params = UpdateFeedPostParams {
25 tenant_id: "acme-corp-tenant".to_string(),
26 id: "news/q2-update".to_string(),
27 feed_post,
28 };
29
30 update_feed_post(&configuration, params).await?;
31 Ok(())
32}
33

更新公開動態貼文 Internal Link

參數

名稱類型必填描述
tenant_idStringYes
post_idStringYes
update_feed_post_paramsmodels::UpdateFeedPostParamsYes
broadcast_idStringNo
ssoStringNo

回應

返回: CreateFeedPostResponse

範例

update_feed_post_public 範例
Copy Copy
1
2let params = UpdateFeedPostPublicParams {
3 tenant_id: "acme-corp-tenant".into(),
4 post_id: "news/article-123".into(),
5 update_feed_post_params: models::UpdateFeedPostParams {
6 title: Some("Updated Headline".into()),
7 content: Some("Revised content of the article with latest information.".into()),
8 ..Default::default()
9 },
10 broadcast_id: Some("broadcast-001".into()),
11 sso: Some("sso-token-abc123".into()),
12};
13
14let response: CreateFeedPostResponse = update_feed_post_public(&configuration, params).await?;
15

公開標記評論 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
comment_idStringYes
is_flaggedboolYes
ssoStringNo

回應

返回:ApiEmptyResponse

範例

flag_comment_public 範例
Copy Copy
1
2async fn run(configuration: &configuration::Configuration) -> Result<(), Error> {
3 let params = FlagCommentPublicParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 comment_id: "comment-12345".to_string(),
6 is_flagged: true,
7 sso: Some("user-sso-token".to_string()),
8 };
9 flag_comment_public(configuration, params).await?;
10 Ok(())
11}
12

取得大型 GIF Internal Link

參數

名稱型別必填說明
tenant_idStringYes
large_internal_url_sanitizedStringYes

回應

返回:GifGetLargeResponse

範例

get_gif_large 範例
Copy Copy
1
2let params: GetGifLargeParams = GetGifLargeParams {
3 tenant_id: "acme-corp-tenant".into(),
4 large_internal_url_sanitized: "news/article/gif123".into(),
5};
6
7let response: GifGetLargeResponse = get_gif_large(&configuration, params).await?;
8

搜尋 GIF Internal Link

參數

名稱類型必填描述
tenant_idString
searchString
localeString
ratingString
pagef64

回應

返回:GetGifsSearchResponse

範例

get_gifs_search 範例
Copy Copy
1
2async fn fetch_gifs(config: &configuration::Configuration) -> Result<(), Error> {
3 let params = GetGifsSearchParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 search: "funny cats".to_string(),
6 locale: Some("en-US".to_string()),
7 rating: Some("pg".to_string()),
8 page: Some(1.0),
9 };
10 let _response = get_gifs_search(config, params).await?;
11 Ok(())
12}
13

參數

名稱類型必填說明
tenant_idString
localeString
ratingString
pagef64

回應

返回:GetGifsTrendingResponse

範例

get_gifs_trending 範例
Copy Copy
1
2async fn fetch_trending_gifs(configuration: &configuration::Configuration) -> Result<(), Error> {
3 let params = GetGifsTrendingParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 locale: Some("en-US".to_string()),
6 rating: Some("pg".to_string()),
7 page: Some(1.0),
8 };
9 let _response = get_gifs_trending(configuration, params).await?;
10 Ok(())
11}
12

新增主題標籤 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
create_hash_tag_bodymodels::CreateHashTagBodyNo

回應

回傳: CreateHashTagResponse

範例

add_hash_tag 範例
Copy Copy
1
2async fn example(cfg: &configuration::Configuration) -> Result<(), Error> {
3 let params = AddHashTagParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 create_hash_tag_body: Some(models::CreateHashTagBody {
6 tag: "news/article".to_string(),
7 }),
8 };
9 let _response: CreateHashTagResponse = add_hash_tag(cfg, params).await?;
10 Ok(())
11}
12

批次新增主題標籤 Internal Link

參數

名稱類型必填描述
tenant_idStringYes
bulk_create_hash_tags_bodymodels::BulkCreateHashTagsBodyNo

回應

Returns: BulkCreateHashTagsResponse

範例

add_hash_tags_bulk 範例
Copy Copy
1
2async fn run() -> Result<(), Error> {
3 let params = AddHashTagsBulkParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 bulk_create_hash_tags_body: Some(models::BulkCreateHashTagsBody {
6 tags: vec![
7 models::BulkCreateHashTagsBodyTagsInner {
8 tag: "news/article".to_string(),
9 },
10 ],
11 }),
12 };
13 let _response: BulkCreateHashTagsResponse = add_hash_tags_bulk(&configuration, params).await?;
14 Ok(())
15}
16

刪除主題標籤 Internal Link

參數

NameTypeRequiredDescription
tenant_idStringYes
tagStringYes
delete_hash_tag_request_bodymodels::DeleteHashTagRequestBodyNo

回應

Returns: ApiEmptyResponse

範例

delete_hash_tag 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = DeleteHashTagParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 tag: "news/article".to_string(),
6 delete_hash_tag_request_body: Some(models::DeleteHashTagRequestBody {}),
7 };
8 delete_hash_tag(&configuration, params).await?;
9 Ok(())
10}
11

取得主題標籤 Internal Link

參數

名稱類型必填說明
tenant_idString
pagef64

回應

返回: GetHashTagsResponse

範例

get_hash_tags 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = GetHashTagsParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 page: Some(1.0),
6 };
7 let _response = get_hash_tags(&config, params).await?;
8 Ok(())
9}
10

部分更新主題標籤 Internal Link

參數

名稱類型必填說明
tenant_idString
tagString
update_hash_tag_bodymodels::UpdateHashTagBody

回應

返回:UpdateHashTagResponse

範例

patch_hash_tag 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = PatchHashTagParams {
4 tenant_id: "acme-corp-tenant".into(),
5 tag: "news/article".into(),
6 update_hash_tag_body: Some(models::UpdateHashTagBody::default()),
7 };
8 let _response = patch_hash_tag(&configuration, params).await?;
9 Ok(())
10}
11

刪除審核投票 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
comment_idStringYes
vote_idStringYes
broadcast_idStringNo
ssoStringNo

回應

返回:VoteDeleteResponse

範例

delete_moderation_vote 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = DeleteModerationVoteParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 comment_id: "news/article-42".to_string(),
6 vote_id: "vote-12345".to_string(),
7 broadcast_id: Some("broadcast-987".to_string()),
8 sso: None,
9 };
10 let _response: VoteDeleteResponse = delete_moderation_vote(&configuration, params).await?;
11 Ok(())
12}
13

取得因評論被封鎖的使用者 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
comment_idStringYes
ssoStringNo

回應

返回:GetBannedUsersFromCommentResponse

範例

get_ban_users_from_comment 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = GetBanUsersFromCommentParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 comment_id: "news/article/12345".to_string(),
6 sso: Some("sso-unique-id".to_string()),
7 };
8 let _response = get_ban_users_from_comment(&configuration, params).await?;
9 Ok(())
10}
11

取得評論封鎖狀態 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
comment_idStringYes
ssoStringNo

回應

Returns: GetCommentBanStatusResponse

範例

get_comment_ban_status 範例
Copy Copy
1
2async fn example(config: &configuration::Configuration) -> Result<(), Error> {
3 let params = GetCommentBanStatusParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 comment_id: "comment-12345".to_string(),
6 sso: Some("user@example.com".to_string()),
7 };
8 let _response: GetCommentBanStatusResponse = get_comment_ban_status(config, params).await?;
9 Ok(())
10}
11

取得評論回覆 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
comment_idStringYes
ssoStringNo

回應

返回: ModerationApiChildCommentsResponse

範例

get_comment_children 範例
Copy Copy
1
2async fn fetch_children(config: &configuration::Configuration) -> Result<(), Error> {
3 let params = GetCommentChildrenParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 comment_id: "news/article/comment-9876".to_string(),
6 sso: Some("user-42".to_string()),
7 };
8 let _response: ModerationApiChildCommentsResponse = get_comment_children(config, params).await?;
9 Ok(())
10}
11

取得計數 Internal Link

參數

NameTypeRequiredDescription
tenant_idStringYes
text_searchStringNo
by_ip_from_commentStringNo
filterStringNo
search_filtersStringNo
demoboolNo
ssoStringNo

回應

返回:ModerationApiCountCommentsResponse

範例

get_count 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = GetCountParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 text_search: Some("breaking news".to_string()),
6 by_ip_from_comment: Some("192.168.1.1".to_string()),
7 filter: Some("status:approved".to_string()),
8 search_filters: Some("author:john".to_string()),
9 demo: Some(false),
10 sso: Some("sso-token-123".to_string()),
11 };
12 let _response = get_count(&configuration, params).await?;
13 Ok(())
14}
15

取得多項計數 Internal Link

參數

NameTypeRequiredDescription
tenant_idStringYes
ssoStringNo

回傳

Returns: GetBannedUsersCountResponse

範例

get_counts 範例
Copy Copy
1
2async fn run() -> Result<(), Error> {
3 let params = GetCountsParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 sso: Some("news/article".to_string()),
6 };
7 let _response = get_counts(&configuration, params).await?;
8 Ok(())
9}
10

取得日誌 Internal Link

參數

名稱類型必填說明
tenant_idString
comment_idString
ssoString

回應

返回:ModerationApiGetLogsResponse

範例

get_logs 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = GetLogsParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 comment_id: "news/article-12345".to_string(),
6 sso: Some("user@example.com".to_string()),
7 };
8 let response = get_logs(&configuration, params).await?;
9 let _ = response;
10 Ok(())
11}
12

取得手動徽章 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
ssoStringNo

回應

返回:GetTenantManualBadgesResponse

範例

get_manual_badges 範例
Copy Copy
1
2async fn fetch_badges(configuration: &configuration::Configuration) -> Result<(), Error> {
3 let params = GetManualBadgesParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 sso: Some("news/article".to_string()),
6 };
7 let _response = get_manual_badges(configuration, params).await?;
8 Ok(())
9}
10

取得使用者的手動徽章 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
badges_user_idStringNo
comment_idStringNo
ssoStringNo

回應

返回: GetUserManualBadgesResponse

範例

get_manual_badges_for_user 範例
Copy Copy
1
2async fn fetch_badges(config: &configuration::Configuration) -> Result<(), Error> {
3 let params = GetManualBadgesForUserParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 badges_user_id: Some("user-42".to_string()),
6 comment_id: Some("comment-987".to_string()),
7 sso: Some("sso-abc123".to_string()),
8 };
9 let _response: GetUserManualBadgesResponse = get_manual_badges_for_user(config, params).await?;
10 Ok(())
11}
12

取得審核評論 Internal Link

參數

名稱類型必填說明
tenant_idString
comment_idString
include_emailbool
include_ipbool
ssoString

回應

返回:ModerationApiCommentResponse

範例

get_moderation_comment 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = GetModerationCommentParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 comment_id: "news/article-6789".to_string(),
6 include_email: Some(true),
7 include_ip: Some(true),
8 sso: Some("sso-user-42".to_string()),
9 };
10 let _response = get_moderation_comment(&configuration, params).await?;
11 Ok(())
12}
13

取得審核評論文字 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
comment_idStringYes
ssoStringNo

回應

返回:GetCommentTextResponse

範例

取得審核評論文字 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = GetModerationCommentTextParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 comment_id: "comment-12345".to_string(),
6 sso: Some("user-sso-token".to_string()),
7 };
8 let _response: GetCommentTextResponse =
9 get_moderation_comment_text(&configuration, params).await?;
10 Ok(())
11}
12

取得預封鎖摘要 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
comment_idStringYes
include_by_user_id_and_emailboolNo
include_by_ipboolNo
include_by_email_domainboolNo
ssoStringNo

回應

返回:PreBanSummary

範例

get_pre_ban_summary 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = GetPreBanSummaryParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 comment_id: "comment-12345".to_string(),
6 include_by_user_id_and_email: Some(true),
7 include_by_ip: Some(false),
8 include_by_email_domain: Some(true),
9 sso: Some("sso-token-abc".to_string()),
10 };
11 let _summary = get_pre_ban_summary(&configuration, params).await?;
12 Ok(())
13}
14

取得搜尋評論摘要 Internal Link

參數

名稱類型必需說明
tenant_idStringYes
valueStringNo
filtersStringNo
search_filtersStringNo
ssoStringNo

回應

Returns: ModerationCommentSearchResponse

範例

get_search_comments_summary 範例
Copy Copy
1
2async fn run_example(configuration: &configuration::Configuration) -> Result<(), Error> {
3 let params = GetSearchCommentsSummaryParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 value: Some("news/article".to_string()),
6 filters: Some("status:approved".to_string()),
7 search_filters: Some("author:john".to_string()),
8 sso: Some("sso-token-123".to_string()),
9 };
10 let _response = get_search_comments_summary(configuration, params).await?;
11 Ok(())
12}
13

取得搜尋頁面 Internal Link


參數

名稱類型必填說明
tenant_idString
valueString
ssoString

回應

返回:ModerationPageSearchResponse

範例

get_search_pages 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = GetSearchPagesParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 value: Some("news/article".to_string()),
6 sso: Some("sso-token-123".to_string()),
7 };
8 let response: ModerationPageSearchResponse = get_search_pages(&configuration, params).await?;
9 Ok(())
10}
11

取得搜尋網站 Internal Link

參數

名稱類型必填說明
tenant_idString
valueString
ssoString

回應

返回:ModerationSiteSearchResponse

範例

get_search_sites 示例
Copy Copy
1
2async fn run() -> Result<(), Error> {
3 let params = GetSearchSitesParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 value: Some("news/article".to_string()),
6 sso: Some("sso-token-abc".to_string()),
7 };
8 let _response = get_search_sites(&config, params).await?;
9 Ok(())
10}
11

取得搜尋建議 Internal Link

參數

名稱類型必要說明
tenant_idString
text_searchString
ssoString

回應

返回: ModerationSuggestResponse

範例

get_search_suggest 範例
Copy Copy
1
2async fn run_example(configuration: &configuration::Configuration) -> Result<(), Error> {
3 let params = GetSearchSuggestParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 text_search: Some("news/article".to_string()),
6 sso: Some("sso-token-123".to_string()),
7 };
8 let _response: ModerationSuggestResponse = get_search_suggest(configuration, params).await?;
9 Ok(())
10}
11

取得搜尋使用者 Internal Link

參數

名稱類型必填說明
tenant_idString
valueString
ssoString

回應

返回: ModerationUserSearchResponse

範例

get_search_users 範例
Copy Copy
1
2async fn run_example(configuration: &configuration::Configuration) -> Result<(), Error> {
3 let params = GetSearchUsersParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 value: Some("john.doe".to_string()),
6 sso: Some("sso-provider".to_string()),
7 };
8 let _response: ModerationUserSearchResponse = get_search_users(configuration, params).await?;
9 Ok(())
10}
11

取得信任因子 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
user_idStringNo
ssoStringNo

回應

Returns: GetUserTrustFactorResponse

範例

取得 trust_factor 範例
Copy Copy
1
2async fn run() -> Result<(), Error> {
3 let params = GetTrustFactorParams {
4 tenant_id: "acme-corp-tenant".into(),
5 user_id: Some("user-12345".into()),
6 sso: Some("sso-provider".into()),
7 };
8 let _response = get_trust_factor(&configuration, params).await?;
9 Ok(())
10}
11

取得使用者封鎖偏好 Internal Link

參數

名稱類型必填說明
tenant_idString
ssoString

回應

返回:ApiModerateGetUserBanPreferencesResponse

範例

get_user_ban_preference 範例
Copy Copy
1
2async fn example(configuration: &configuration::Configuration) -> Result<(), Error> {
3 let params = GetUserBanPreferenceParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 sso: Some("user123".to_string()),
6 };
7 let _response = get_user_ban_preference(configuration, params).await?;
8 Ok(())
9}
10

取得使用者內部檔案 Internal Link

參數

名稱類型必填描述
tenant_idString
comment_idString
ssoString

回應

返回:GetUserInternalProfileResponse

範例

get_user_internal_profile 範例
Copy Copy
1
2async fn fetch_profile() -> Result<(), Error> {
3 let params = GetUserInternalProfileParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 comment_id: Some("news/article".to_string()),
6 sso: Some("sso-user-xyz".to_string()),
7 };
8 let _response = get_user_internal_profile(&configuration, params).await?;
9 Ok(())
10}
11

調整評論投票 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
comment_idStringYes
adjust_comment_votes_paramsmodels::AdjustCommentVotesParamsYes
broadcast_idStringNo
ssoStringNo

回應

返回: AdjustVotesResponse

範例

post_adjust_comment_votes 範例
Copy Copy
1
2async fn adjust_votes_example(configuration: &configuration::Configuration) -> Result<(), Error> {
3 let params = PostAdjustCommentVotesParams {
4 tenant_id: "acme-corp".to_string(),
5 comment_id: "comment-9876".to_string(),
6 adjust_comment_votes_params: models::AdjustCommentVotesParams::default(),
7 broadcast_id: Some("broadcast-2023-11".to_string()),
8 sso: Some("sso-xyz".to_string()),
9 };
10 let _response = post_adjust_comment_votes(configuration, params).await?;
11 Ok(())
12}
13

封鎖使用者(評論) Internal Link

參數

名稱類型必填描述
tenant_idStringYes
comment_idStringYes
ban_emailboolNo
ban_email_domainboolNo
ban_ipboolNo
delete_all_users_commentsboolNo
banned_untilStringNo
is_shadow_banboolNo
update_idStringNo
ban_reasonStringNo
ssoStringNo

回應

返回:BanUserFromCommentResult

範例

post_ban_user_from_comment 範例
Copy Copy
1
2async fn example(configuration: &configuration::Configuration) -> Result<(), Error> {
3 let params = PostBanUserFromCommentParams {
4 tenant_id: "acme-corp".to_string(),
5 comment_id: "cmt-12345".to_string(),
6 ban_email: Some(true),
7 ban_email_domain: Some(false),
8 ban_ip: Some(true),
9 delete_all_users_comments: Some(false),
10 banned_until: Some("2024-12-31T23:59:59Z".to_string()),
11 is_shadow_ban: Some(false),
12 update_id: Some("upd-987".to_string()),
13 ban_reason: Some("spam".to_string()),
14 sso: Some("sso-provider".to_string()),
15 };
16 let _result: BanUserFromCommentResult = post_ban_user_from_comment(configuration, params).await?;
17 Ok(())
18}
19

取消封鎖使用者 Internal Link

參數

名稱類型必填說明
tenant_idString
ban_user_undo_paramsmodels::BanUserUndoParams
ssoString

回應

返回:ApiEmptyResponse

範例

post_ban_user_undo 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = PostBanUserUndoParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 ban_user_undo_params: models::BanUserUndoParams {
6 user_id: "user-42".to_string(),
7 note: Some("ban appeal accepted".to_string()),
8 },
9 sso: Some("sso-token-abc".to_string()),
10 };
11 let _ = post_ban_user_undo(&configuration, params).await?;
12 Ok(())
13}
14

批次預封鎖摘要 Internal Link

參數

名稱型別必填說明
tenant_idString
bulk_pre_ban_paramsmodels::BulkPreBanParams
include_by_user_id_and_emailbool
include_by_ipbool
include_by_email_domainbool
ssoString

回應

返回:BulkPreBanSummary

範例

post_bulk_pre_ban_summary 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let bulk_params = models::BulkPreBanParams::default();
4 let params = PostBulkPreBanSummaryParams {
5 tenant_id: "acme-corp-tenant".to_string(),
6 bulk_pre_ban_params: bulk_params,
7 include_by_user_id_and_email: Some(true),
8 include_by_ip: Some(false),
9 include_by_email_domain: Some(true),
10 sso: Some("sso-token-xyz".to_string()),
11 };
12 let _summary = post_bulk_pre_ban_summary(&configuration, params).await?;
13 Ok(())
14}
15

以 ID 批次取得評論 Internal Link

參數

名稱類型必填描述
tenant_idString
comments_by_ids_paramsmodels::CommentsByIdsParams
ssoString

回應

返回: ModerationApiChildCommentsResponse

範例

post_comments_by_ids 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = PostCommentsByIdsParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 comments_by_ids_params: models::CommentsByIdsParams {
6 comment_ids: vec!["cmt123".to_string(), "cmt456".to_string()],
7 },
8 sso: Some("user-sso-token".to_string()),
9 };
10 let _response = post_comments_by_ids(&configuration, params).await?;
11 Ok(())
12}
13

送出標記評論 Internal Link

參數

名稱型別必填說明
tenant_idString
comment_idString
broadcast_idString
ssoString

回應

返回:ApiEmptyResponse

範例

post_flag_comment 範例
Copy Copy
1
2async fn flag_comment_example() -> Result<(), Error> {
3 let params = PostFlagCommentParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 comment_id: "comment-9f8e7d".to_string(),
6 broadcast_id: Some("broadcast-2024-01".to_string()),
7 sso: Some("sso-uid-12345".to_string()),
8 };
9 post_flag_comment(&config, params).await?;
10 Ok(())
11}
12

送出移除評論 Internal Link


參數

名稱類型必填描述
tenant_idStringYes
comment_idStringYes
broadcast_idStringNo
ssoStringNo

回應

返回: PostRemoveCommentApiResponse

範例

post_remove_comment 範例
Copy Copy
1
2async fn remove_comment_example(config: &configuration::Configuration) -> Result<(), Error> {
3 let params = PostRemoveCommentParams {
4 tenant_id: "acme-corp".into(),
5 comment_id: "news/article/42".into(),
6 broadcast_id: Some("live-event-99".into()),
7 sso: Some("sso-user-abc".into()),
8 };
9 let _response = post_remove_comment(config, params).await?;
10 Ok(())
11}
12

還原已刪除的評論 Internal Link


參數

名稱類型必填說明
tenant_idString
comment_idString
broadcast_idString
ssoString

回應

返回: ApiEmptyResponse

範例

post_restore_deleted_comment 範例
Copy Copy
1
2async fn restore_comment() -> Result<(), Error> {
3 let config: &configuration::Configuration = get_configuration();
4 let params = PostRestoreDeletedCommentParams {
5 tenant_id: "acme-corp-tenant".to_string(),
6 comment_id: "comment-12345".to_string(),
7 broadcast_id: Some("broadcast-987".to_string()),
8 sso: Some("user@example.com".to_string()),
9 };
10 let _response = post_restore_deleted_comment(config, params).await?;
11 Ok(())
12}
13

設定評論核准狀態 Internal Link

參數

NameTypeRequiredDescription
tenant_idString
comment_idString
approvedbool
broadcast_idString
ssoString

回應

返回:SetCommentApprovedResponse

範例

post_set_comment_approval_status 範例
Copy Copy
1
2async fn approve_comment(configuration: &configuration::Configuration) -> Result<(), Error> {
3 let params = PostSetCommentApprovalStatusParams {
4 tenant_id: "acme-corp".to_string(),
5 comment_id: "cmt-9876".to_string(),
6 approved: Some(true),
7 broadcast_id: Some("broadcast-2023".to_string()),
8 sso: None,
9 };
10 let _response = post_set_comment_approval_status(configuration, params).await?;
11 Ok(())
12}
13

設定評論審查狀態 Internal Link

Parameters

名稱類型必填說明
tenant_idString
comment_idString
reviewedbool
broadcast_idString
ssoString

Response

Returns: ApiEmptyResponse

Example

post_set_comment_review_status 範例
Copy Copy
1
2async fn update_review_status(configuration: &configuration::Configuration) -> Result<(), Error> {
3 let params = PostSetCommentReviewStatusParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 comment_id: "comment-98765".to_string(),
6 reviewed: Some(true),
7 broadcast_id: Some("broadcast-2023-summer".to_string()),
8 sso: Some("sso-user-42".to_string()),
9 };
10 post_set_comment_review_status(configuration, params).await?;
11 Ok(())
12}
13

設定評論垃圾狀態 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
comment_idStringYes
spamboolNo
perm_not_spamboolNo
broadcast_idStringNo
ssoStringNo

回應

Returns: ApiEmptyResponse

範例

post_set_comment_spam_status 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = PostSetCommentSpamStatusParams {
4 tenant_id: "acme-corp-tenant".into(),
5 comment_id: "comment-12345".into(),
6 spam: Some(true),
7 perm_not_spam: Some(false),
8 broadcast_id: Some("broadcast-678".into()),
9 sso: Some("user@example.com".into()),
10 };
11 post_set_comment_spam_status(&configuration, params).await?;
12 Ok(())
13}
14

設定評論文字 Internal Link

參數

NameTypeRequiredDescription
tenant_idStringYes
comment_idStringYes
set_comment_text_paramsmodels::SetCommentTextParamsYes
broadcast_idStringNo
ssoStringNo

回應

Returns: SetCommentTextResponse

範例

post_set_comment_text 範例
Copy Copy
1
2async fn update_comment(config: &configuration::Configuration) -> Result<(), Error> {
3 let params = PostSetCommentTextParams {
4 tenant_id: "acme-corp".to_string(),
5 comment_id: "comment-9876".to_string(),
6 set_comment_text_params: models::SetCommentTextParams {
7 text: "Revised comment content".to_string(),
8 },
9 broadcast_id: Some("broadcast-2023".to_string()),
10 sso: Some("sso-token-abc".to_string()),
11 };
12 let _response = post_set_comment_text(config, params).await?;
13 Ok(())
14}
15

送出取消標記評論 Internal Link

參數

名稱類型必填描述
tenant_idString
comment_idString
broadcast_idString
ssoString

回應

返回: ApiEmptyResponse

範例

post_un_flag_comment 範例
Copy Copy
1
2async fn unflag_example(configuration: &configuration::Configuration) -> Result<(), Error> {
3 let params = PostUnFlagCommentParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 comment_id: "comment-12345".to_string(),
6 broadcast_id: Some("broadcast-987".to_string()),
7 sso: Some("user@example.com".to_string()),
8 };
9 let _ = post_un_flag_comment(configuration, params).await?;
10 Ok(())
11}
12

送出投票 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
comment_idStringYes
directionStringNo
broadcast_idStringNo
ssoStringNo

回應

回傳: VoteResponse

範例

post_vote 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let cfg = configuration::Configuration::default();
4 let params = PostVoteParams {
5 tenant_id: "acme-corp-tenant".to_string(),
6 comment_id: "news/article-12345".to_string(),
7 direction: Some("up".to_string()),
8 broadcast_id: Some("broadcast-987".to_string()),
9 sso: None,
10 };
11 let _response = post_vote(&cfg, params).await?;
12 Ok(())
13}
14

頒發徽章 Internal Link

參數

名稱類型必填描述
tenant_idStringYes
badge_idStringYes
user_idStringNo
comment_idStringNo
broadcast_idStringNo
ssoStringNo

回應

返回: AwardUserBadgeResponse

範例

put_award_badge 範例
Copy Copy
1
2async fn example(configuration: &configuration::Configuration) -> Result<(), Error> {
3 let params = PutAwardBadgeParams {
4 tenant_id: "acme-corp".to_string(),
5 badge_id: "top-contributor".to_string(),
6 user_id: Some("user-42".to_string()),
7 comment_id: Some("comment-99".to_string()),
8 broadcast_id: None,
9 sso: Some("sso-abc123".to_string()),
10 };
11 let _response = put_award_badge(configuration, params).await?;
12 Ok(())
13}
14

關閉討論串 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
url_idStringYes
ssoStringNo

回應

返回:ApiEmptyResponse

範例

put_close_thread 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let config = configuration::Configuration::default();
4 let params = PutCloseThreadParams {
5 tenant_id: "acme-corp-tenant".to_string(),
6 url_id: "news/article-123".to_string(),
7 sso: Some("sso-token-abc".to_string()),
8 };
9 put_close_thread(&config, params).await?;
10 Ok(())
11}
12

移除徽章 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
badge_idStringYes
user_idStringNo
comment_idStringNo
broadcast_idStringNo
ssoStringNo

回應

返回:RemoveUserBadgeResponse

範例

put_remove_badge 範例
Copy Copy
1
2async fn remove_badge_example(configuration: &configuration::Configuration) -> Result<(), Error> {
3 let params = PutRemoveBadgeParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 badge_id: "news-contributor".to_string(),
6 user_id: Some("user-42".to_string()),
7 comment_id: Some("comment-12345".to_string()),
8 broadcast_id: None,
9 sso: Some("sso-key-xyz".to_string()),
10 };
11 let _response: RemoveUserBadgeResponse = put_remove_badge(configuration, params).await?;
12 Ok(())
13}
14

重新開啟討論串 Internal Link

參數

名稱類型必填描述
tenant_idStringYes
url_idStringYes
ssoStringNo

回應

返回:ApiEmptyResponse

範例

put_reopen_thread 範例
Copy Copy
1
2async fn reopen_thread_example(configuration: &configuration::Configuration) -> Result<(), Error> {
3 let params = PutReopenThreadParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 url_id: "news/article-123".to_string(),
6 sso: Some("user-42".to_string()),
7 };
8 let _response: ApiEmptyResponse = put_reopen_thread(configuration, params).await?;
9 Ok(())
10}
11

設定信任因子 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
user_idStringNo
trust_factorStringNo
ssoStringNo

回應

返回: SetUserTrustFactorResponse

範例

set_trust_factor 範例
Copy Copy
1
2async fn update_trust() -> Result<(), Error> {
3 let params = SetTrustFactorParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 user_id: Some("user-123".to_string()),
6 trust_factor: Some("high".to_string()),
7 sso: Some("sso-token-xyz".to_string()),
8 };
9 let _response = set_trust_factor(&configuration, params).await?;
10 Ok(())
11}
12

建立管理員 Internal Link

參數

名稱類型必填描述
tenant_idStringYes
create_moderator_bodymodels::CreateModeratorBodyYes

回應

返回: CreateModeratorResponse

範例

create_moderator 範例
Copy Copy
1
2async fn example(configuration: &configuration::Configuration) -> Result<(), Error> {
3 let params = CreateModeratorParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 create_moderator_body: models::CreateModeratorBody {
6 email: "mod@example.com".to_string(),
7 username: Some("mod_user".to_string()),
8 permissions: vec!["delete".to_string(), "edit".to_string()],
9 ..Default::default()
10 },
11 };
12 let _response = create_moderator(configuration, params).await?;
13 Ok(())
14}
15

刪除管理員 Internal Link

參數

名稱類型必填說明
tenant_idString
idString
send_emailString

回應

返回: ApiEmptyResponse

範例

delete_moderator 範例
Copy Copy
1
2async fn run() -> Result<(), Error> {
3 let params = DeleteModeratorParams {
4 tenant_id: "acme-corp".to_string(),
5 id: "moderator-123".to_string(),
6 send_email: Some("admin@acme.com".to_string()),
7 };
8 let _ = delete_moderator(&configuration, params).await?;
9 Ok(())
10}
11

取得管理員 Internal Link

參數

名稱類型必填說明
tenant_idString
idString

回應

返回:GetModeratorResponse

範例

get_moderator 範例
Copy Copy
1
2async fn run() -> Result<(), Error> {
3 let params = GetModeratorParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 id: "moderator-123".to_string(),
6 };
7 let _response: GetModeratorResponse = get_moderator(configuration, params).await?;
8 Ok(())
9}
10

取得管理員清單 Internal Link

參數

名稱類型必填說明
tenant_idString
skipf64

回應

Returns: GetModeratorsResponse

範例

get_moderators 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = GetModeratorsParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 skip: Some(20.0),
6 };
7 let _response = get_moderators(&configuration, params).await?;
8 Ok(())
9}
10

發送邀請 Internal Link

參數

名稱類型必填描述
tenant_idStringYes
idStringYes
from_nameStringYes

回應

返回: ApiEmptyResponse

範例

send_invite 範例
Copy Copy
1
2async fn run_example(configuration: &configuration::Configuration) -> Result<(), Error> {
3 let params = SendInviteParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 id: "news/article".to_string(),
6 from_name: "John Doe".to_string(),
7 message: Some("Welcome to the platform".to_string()),
8 ..Default::default()
9 };
10 let _ = send_invite(configuration, params).await?;
11 Ok(())
12}
13

更新管理員 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
idStringYes
update_moderator_bodymodels::UpdateModeratorBodyYes

回應

返回: ApiEmptyResponse

範例

update_moderator 範例
Copy Copy
1
2async fn run() -> Result<(), Error> {
3 let params = UpdateModeratorParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 id: "moderator-42".to_string(),
6 update_moderator_body: models::UpdateModeratorBody {
7 name: Some("Alice Smith".to_string()),
8 email: Some("alice.smith@example.com".to_string()),
9 is_active: Some(true),
10 },
11 };
12 update_moderator(&configuration, params).await?;
13 Ok(())
14}
15

刪除通知計數 Internal Link

參數

名稱類型必填說明
tenant_idString
idString

回應

返回: ApiEmptyResponse

範例

delete_notification_count 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = DeleteNotificationCountParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 id: "news/article-123".to_string(),
6 };
7 let _response: ApiEmptyResponse = delete_notification_count(&configuration, params).await?;
8 Ok(())
9}
10

取得快取的通知數量 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
idStringYes

回應

回傳: GetCachedNotificationCountResponse

範例

取得快取通知計數範例
Copy Copy
1
2async fn fetch_notification_count() -> Result<(), Error> {
3 let params = GetCachedNotificationCountParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 id: "news/article".to_string(),
6 };
7 let response = get_cached_notification_count(&configuration, params).await?;
8 let _ = response.user_notification_count;
9 Ok(())
10}
11

取得通知數量 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
user_idStringNo
url_idStringNo
from_comment_idStringNo
viewedboolNo

回應

返回:GetNotificationCountResponse

範例

get_notification_count 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = GetNotificationCountParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 user_id: Some("john.doe".to_string()),
6 url_id: Some("blog/post-123".to_string()),
7 from_comment_id: Some("comment789".to_string()),
8 viewed: Some(true),
9 };
10 let _response = get_notification_count(&configuration, params).await?;
11 Ok(())
12}
13

取得通知 Internal Link

參數

名稱類型必需描述
tenant_idStringYes
user_idStringNo
url_idStringNo
from_comment_idStringNo
viewedboolNo
skipf64No

回應

返回:GetNotificationsResponse

範例

get_notifications 範例
Copy Copy
1
2async fn fetch_notifications(configuration: &configuration::Configuration) -> Result<(), Error> {
3 let params = GetNotificationsParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 user_id: Some("user-123".to_string()),
6 url_id: Some("news/article".to_string()),
7 from_comment_id: Some("cmt-456".to_string()),
8 viewed: Some(true),
9 skip: Some(0.0),
10 };
11 let _response = get_notifications(configuration, params).await?;
12 Ok(())
13}
14

更新通知 Internal Link

參數

名稱類型必填說明
tenant_idString
idString
update_notification_bodymodels::UpdateNotificationBody
user_idString

回應

回傳:ApiEmptyResponse

範例

update_notification 範例
Copy Copy
1
2#[tokio::main]
3async fn main() -> Result<(), Error> {
4 let params = UpdateNotificationParams {
5 tenant_id: "acme-corp".to_string(),
6 id: "news/article".to_string(),
7 update_notification_body: models::UpdateNotificationBody {
8 title: "New article published".to_string(),
9 content: "Read the latest updates in our blog.".to_string(),
10 },
11 user_id: Some("user-123".to_string()),
12 };
13 update_notification(&configuration, params).await?;
14 Ok(())
15}
16

建立 v1 頁面反應 Internal Link

參數

NameTypeRequiredDescription
tenant_idStringYes
url_idStringYes
titleStringNo

回應

返回: CreateV1PageReact

範例

create_v1_page_react 示例
Copy Copy
1
2async fn run() -> Result<(), Error> {
3 let params: CreateV1PageReactParams = CreateV1PageReactParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 url_id: "news/article".to_string(),
6 title: Some("Rust Community Update".to_string()),
7 };
8 let _response = create_v1_page_react(&config, params).await?;
9 Ok(())
10}
11

建立 v2 頁面反應 Internal Link

參數

名稱類型必要描述
tenant_idStringYes
url_idStringYes
idStringYes
titleStringNo

回應

Returns: CreateV1PageReact

範例

create_v2_page_react 範例
Copy Copy
1
2async fn run() -> Result<(), Error> {
3 let params = CreateV2PageReactParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 url_id: "news/article".to_string(),
6 id: "comment-123".to_string(),
7 title: Some("Breaking News".to_string()),
8 };
9 let _react = create_v2_page_react(&configuration, params).await?;
10 Ok(())
11}
12

刪除 v1 頁面反應 Internal Link

參數

名稱類型必填描述
tenant_idStringYes
url_idStringYes

回傳

返回: CreateV1PageReact

範例

delete_v1_page_react 範例
Copy Copy
1
2async fn run_example(cfg: &configuration::Configuration) -> Result<(), Error> {
3 let tenant_id: String = Some("acme-corp-tenant".to_string()).unwrap();
4 let url_id: String = "news/article".to_string();
5 let params: DeleteV1PageReactParams = DeleteV1PageReactParams {
6 tenant_id,
7 url_id,
8 ..Default::default()
9 };
10 let _result = delete_v1_page_react(cfg, params).await?;
11 Ok(())
12}
13

刪除 v2 頁面反應 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
url_idStringYes
idStringYes

回應

返回: CreateV1PageReact

範例

delete_v2_page_react 範例
Copy Copy
1
2async fn run() -> Result<(), Error> {
3 let params = DeleteV2PageReactParams {
4 tenant_id: "acme-corp-tenant".into(),
5 url_id: "news/article".into(),
6 id: "react-987".into(),
7 };
8 let _response: CreateV1PageReact = delete_v2_page_react(&config, params).await?;
9 Ok(())
10}
11

取得 v1 頁面按讚 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
url_idStringYes

回應

返回: GetV1PageLikes

範例

get_v1_page_likes 範例
Copy Copy
1
2async fn example(configuration: &configuration::Configuration) -> Result<(), Error> {
3 let params = GetV1PageLikesParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 url_id: "news/article".to_string(),
6 };
7 let _likes = get_v1_page_likes(configuration, params).await?;
8 Ok(())
9}
10

取得 v2 頁面反應使用者 Internal Link


參數

名稱類型必填說明
tenant_idStringYes
url_idStringYes
idStringYes

回應

返回: GetV2PageReactUsersResponse

範例

get_v2_page_react_users 範例
Copy Copy
1
2async fn example(configuration: &configuration::Configuration) -> Result<(), Error> {
3 let params = GetV2PageReactUsersParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 url_id: "news/article".to_string(),
6 id: "react567".to_string(),
7 page: Some(1),
8 per_page: Some(50),
9 ..Default::default()
10 };
11 let _response = get_v2_page_react_users(configuration, params).await?;
12 Ok(())
13}
14

取得 v2 頁面反應 Internal Link

參數

名稱類型必要描述
tenant_idStringYes
url_idStringYes

回應

返回: GetV2PageReacts

範例

get_v2_page_reacts 範例
Copy Copy
1
2async fn run() -> Result<(), Error> {
3 let params = GetV2PageReactsParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 url_id: "news/article".to_string(),
6 page: Some(1),
7 page_size: Some(50),
8 };
9 let _reacts = get_v2_page_reacts(&configuration, params).await?;
10 Ok(())
11}
12

新增頁面 Internal Link

參數

名稱類型必要說明
tenant_idString
create_api_page_datamodels::CreateApiPageData

回應

返回: AddPageApiResponse

範例

add_page 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = AddPageParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 create_api_page_data: models::CreateApiPageData {
6 title: Some("Breaking News".to_string()),
7 url: Some("/news/article".to_string()),
8 ..Default::default()
9 },
10 };
11 let _response = add_page(&configuration, params).await?;
12 Ok(())
13}
14

刪除頁面 Internal Link


參數

名稱類型必填說明
tenant_idString
idString

回應

返回: DeletePageApiResponse

範例

delete_page 範例
Copy Copy
1
2async fn example(configuration: &configuration::Configuration) -> Result<(), Error> {
3 let params = DeletePageParams {
4 tenant_id: "acme-corp-tenant".into(),
5 id: "news/article".into(),
6 };
7 let _resp = delete_page(configuration, params).await?;
8 Ok(())
9}
10

取得離線使用者 Internal Link

Past commenters on the page who are NOT currently online. Sorted by displayName.
頁面上過去的評論者(目前未在線),依 displayName 排序。

Use this after exhausting /users/online to render a "Members" section.
在耗盡 /users/online 後,用於呈現「Members」區段。

Cursor pagination on commenterName: server walks the partial {tenantId, urlId, commenterName} index from afterName forward via $gt, no $skip cost.
在 commenterName 上的游標分頁:伺服器從 afterName 之後的 {tenantId, urlId, commenterName} 索引走訪,使用 $gt,無 $skip 成本。

Parameters

名稱類型必填描述
tenant_idString
url_idString
after_nameString
after_user_idString

Response

返回:PageUsersOfflineResponse

Example

get_offline_users 範例
Copy Copy
1
2async fn fetch_offline(config: &configuration::Configuration) -> Result<(), Error> {
3 let params = GetOfflineUsersParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 url_id: "news/article".to_string(),
6 after_name: Some("alice".to_string()),
7 after_user_id: Some("user-42".to_string()),
8 };
9 let _response = get_offline_users(config, params).await?;
10 Ok(())
11}
12

取得在線使用者 Internal Link

目前線上觀看頁面的使用者:指目前透過 websocket 連線訂閱該頁面的使用者。
回傳 anonCount + totalCount(房間內的所有訂閱者數量,包含我們未列舉的匿名觀看者)。

Parameters

NameTypeRequiredDescription
tenant_idStringYes
url_idStringYes
after_nameStringNo
after_user_idStringNo

Response

回傳:PageUsersOnlineResponse

Example

get_online_users 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = GetOnlineUsersParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 url_id: "news/article".to_string(),
6 after_name: Some("john_doe".to_string()),
7 after_user_id: Some("user-123".to_string()),
8 };
9 let _response: PageUsersOnlineResponse = get_online_users(&config, params).await?;
10 Ok(())
11}
12

以 URL ID 取得頁面 Internal Link

參數

NameTypeRequiredDescription
tenant_idString
url_idString

回應

Returns: GetPageByUrlidApiResponse

範例

get_page_by_urlid 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = GetPageByUrlidParams {
4 tenant_id: "acme-corp-tenant".into(),
5 url_id: "news/article".into(),
6 };
7 let _response = get_page_by_urlid(&config, params).await?;
8 Ok(())
9}
10

取得頁面 Internal Link

參數

名稱類型必要說明
tenant_idStringYes

回應

返回: GetPagesApiResponse

範例

get_pages 範例
Copy Copy
1
2async fn fetch_pages(configuration: &configuration::Configuration) -> Result<(), Error> {
3 let params = GetPagesParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 };
6 let _response: GetPagesApiResponse = get_pages(configuration, params).await?;
7 Ok(())
8}
9

取得公開頁面 Internal Link

List pages for a tenant. Used by the FChat desktop client to populate its room list.
Requires enableFChat to be true on the resolved custom config for each page.
Pages that require SSO are filtered against the requesting user's group access.

Parameters

NameTypeRequiredDescription
tenant_idStringYes
cursorStringNo
limiti32No
qStringNo
sort_bymodels::PagesSortByNo
has_commentsboolNo

Response

返回:GetPublicPagesResponse

範例

get_pages_public 範例
Copy Copy
1
2async fn example(configuration: &configuration::Configuration) -> Result<(), Error> {
3 let params = GetPagesPublicParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 cursor: Some("page_20".to_string()),
6 limit: Some(50),
7 q: Some("news/article".to_string()),
8 sort_by: Some(models::PagesSortBy::CreatedDesc),
9 has_comments: Some(true),
10 };
11 let _response = get_pages_public(configuration, params).await?;
12 Ok(())
13}
14

取得使用者資訊 Internal Link

批次取得租戶的使用者資訊。給定 userIds,返回來自 User / SSOUser 的顯示資訊。
此功能由評論小工具使用,以在使用者透過 presence 事件剛出現時豐富其資訊。
沒有頁面上下文:隱私會統一強制執行(私人檔案會被遮蔽)。

Parameters

名稱類型必要說明
tenant_idString
idsString

Response

返回:PageUsersInfoResponse

Example

取得使用者資訊 範例
Copy Copy
1
2let params = GetUsersInfoParams {
3 tenant_id: "acme-corp-tenant".to_string(),
4 ids: "user-1,user-2".to_string(),
5};
6let page: PageUsersInfoResponse = get_users_info(&configuration, params).await?;
7

部分更新頁面 Internal Link

參數

名稱類型必填說明
tenant_idString
idString
update_api_page_datamodels::UpdateApiPageData

回應

返回:PatchPageApiResponse

範例

patch_page 範例
Copy Copy
1
2async fn run_patch_page() -> Result<(), Error> {
3 let update = models::UpdateApiPageData {
4 title: Some("Breaking News".into()),
5 content: Some("Updated article content".into()),
6 ..Default::default()
7 };
8 let params = PatchPageParams {
9 tenant_id: "acme-corp-tenant".into(),
10 id: "news/article".into(),
11 update_api_page_data: update,
12 };
13 let _resp: PatchPageApiResponse = patch_page(&configuration, params).await?;
14 Ok(())
15}
16

刪除待處理的 Webhook 事件 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
idStringYes

回應

回傳: ApiEmptyResponse

範例

delete_pending_webhook_event 範例
Copy Copy
1
2async fn example(configuration: &configuration::Configuration) -> Result<(), Error> {
3 let params = DeletePendingWebhookEventParams {
4 tenant_id: "acme-corp-tenant".into(),
5 id: "event-12345".into(),
6 };
7 delete_pending_webhook_event(configuration, params).await?;
8 Ok(())
9}
10

取得待處理 Webhook 事件數量 Internal Link

參數

名稱類型必填描述
tenant_idStringYes
comment_idStringNo
external_idStringNo
event_typeStringNo
domainStringNo
attempt_count_gtf64No

回應

回傳: GetPendingWebhookEventCountResponse

範例

get_pending_webhook_event_count 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = GetPendingWebhookEventCountParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 comment_id: Some("comment-12345".to_string()),
6 external_id: Some("ext-98765".to_string()),
7 event_type: Some("comment_created".to_string()),
8 domain: Some("news.example.com".to_string()),
9 attempt_count_gt: Some(2.0),
10 };
11 let _response = get_pending_webhook_event_count(&configuration, params).await?;
12 Ok(())
13}
14

取得待處理的 Webhook 事件 Internal Link

參數

名稱類型必要說明
tenant_idStringYes
comment_idStringNo
external_idStringNo
event_typeStringNo
domainStringNo
attempt_count_gtf64No
skipf64No

回應

回傳:GetPendingWebhookEventsResponse

範例

get_pending_webhook_events 範例
Copy Copy
1
2async fn demo() -> Result<(), Error> {
3 let params = GetPendingWebhookEventsParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 comment_id: Some("comment-123".to_string()),
6 external_id: Some("external-789".to_string()),
7 event_type: Some("comment_created".to_string()),
8 domain: Some("news.example.com".to_string()),
9 attempt_count_gt: Some(1.0),
10 skip: Some(0.0),
11 };
12 let _response = get_pending_webhook_events(&config, params).await?;
13 Ok(())
14}
15

建立問題設定 Internal Link

參數

名稱類型必填說明
tenant_idString
create_question_config_bodymodels::CreateQuestionConfigBody

回應

返回:CreateQuestionConfigResponse

範例

create_question_config 範例
Copy Copy
1
2let params = CreateQuestionConfigParams {
3 tenant_id: "acme-corp-tenant".to_string(),
4 create_question_config_body: models::CreateQuestionConfigBody {
5 description: Some("Survey for news article feedback".to_string()),
6 custom_options: Some(vec![
7 QuestionConfigCustomOptionsInner {
8 option_key: "allow_multiple".to_string(),
9 option_value: "true".to_string(),
10 },
11 ]),
12 ..Default::default()
13 },
14};
15
16let response = create_question_config(&configuration, params).await?;
17

刪除問題設定 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
idStringYes

回應

回傳: ApiEmptyResponse

範例

delete_question_config 範例
Copy Copy
1
2async fn run() -> Result<(), Error> {
3 let params: DeleteQuestionConfigParams = DeleteQuestionConfigParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 id: "question-456".to_string(),
6 };
7 delete_question_config(&configuration, params).await?;
8 Ok(())
9}
10

取得問題設定 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
idStringYes

回應

返回: GetQuestionConfigResponse

範例

get_question_config 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = GetQuestionConfigParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 id: "news/article".to_string(),
6 };
7 let _response = get_question_config(&configuration, params).await?;
8 Ok(())
9}
10

取得問題設定清單 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
skipf64No

回應

返回: GetQuestionConfigsResponse

範例

get_question_configs 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = GetQuestionConfigsParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 skip: Some(10.0),
6 };
7 let _response: GetQuestionConfigsResponse = get_question_configs(&configuration, params).await?;
8 Ok(())
9}
10

更新問題設定 Internal Link

參數

名稱類型必填說明
tenant_idString
idString
update_question_config_bodymodels::UpdateQuestionConfigBody

回應

返回:ApiEmptyResponse

範例

update_question_config 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = UpdateQuestionConfigParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 id: "news/article".to_string(),
6 update_question_config_body: UpdateQuestionConfigBody {
7 title: "Breaking News".to_string(),
8 is_active: true,
9 custom_options: vec![
10 QuestionConfigCustomOptionsInner {
11 key: "priority".to_string(),
12 value: "high".to_string(),
13 },
14 ],
15 description: Some("Config for breaking news article".to_string()),
16 },
17 };
18 update_question_config(&configuration, params).await?;
19 Ok(())
20}
21

建立問題結果 Internal Link


參數

名稱類型必填描述
tenant_idStringYes
create_question_result_bodymodels::CreateQuestionResultBodyYes

回應

返回:CreateQuestionResultResponse

範例

create_question_result 範例
Copy Copy
1
2let mut metadata = std::collections::HashMap::new();
3metadata.insert("source".to_string(), "web".to_string());
4
5let body = models::CreateQuestionResultBody {
6 question_id: "q-987".to_string(),
7 user_id: "user-42".to_string(),
8 answer: "Positive".to_string(),
9 metadata: Some(metadata),
10};
11
12let params = CreateQuestionResultParams {
13 tenant_id: "acme-corp-tenant".to_string(),
14 create_question_result_body: body,
15};
16
17let response = create_question_result(&configuration, params).await?;
18

刪除問題結果 Internal Link

參數

名稱類型必填說明
tenant_idString
idString

回應

返回: ApiEmptyResponse

範例

delete_question_result 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = DeleteQuestionResultParams {
4 tenant_id: "acme-corp".to_string(),
5 id: "question-9876".to_string(),
6 };
7 delete_question_result(&configuration, params).await?;
8 Ok(())
9}
10

取得問題結果 Internal Link

參數

名稱類型必填描述
tenant_idStringYes
idStringYes

回應

返回: GetQuestionResultResponse

範例

get_question_result 範例
Copy Copy
1
2async fn fetch_question_result(config: &configuration::Configuration) -> Result<(), Error> {
3 let params = GetQuestionResultParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 id: "question-12345".to_string(),
6 locale: Some("en-US".to_string()),
7 };
8 let _response: GetQuestionResultResponse = get_question_result(config, params).await?;
9 Ok(())
10}
11

取得問題結果清單 Internal Link

參數

名稱類型必填說明
tenant_idString
url_idString
user_idString
start_dateString
question_idString
question_idsString
skipf64

回應

Returns: GetQuestionResultsResponse

範例

get_question_results 範例
Copy Copy
1
2async fn example(configuration: &configuration::Configuration) -> Result<(), Error> {
3 let params = GetQuestionResultsParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 url_id: Some("news/article".to_string()),
6 user_id: Some("user-12345".to_string()),
7 start_date: Some("2023-01-01".to_string()),
8 question_id: Some("q-987".to_string()),
9 question_ids: Some("q-1,q-2,q-3".to_string()),
10 skip: Some(10.0),
11 };
12 let _response = get_question_results(configuration, params).await?;
13 Ok(())
14}
15

更新問題結果 Internal Link

參數

名稱類型必填說明
tenant_idString
idString
update_question_result_bodymodels::UpdateQuestionResultBody

回應

返回: ApiEmptyResponse

範例

update_question_result 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = UpdateQuestionResultParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 id: "question-9876".to_string(),
6 update_question_result_body: models::UpdateQuestionResultBody {
7 status: Some("approved".to_string()),
8 score: Some(95),
9 ..Default::default()
10 },
11 };
12 let _ = update_question_result(&configuration, params).await?;
13 Ok(())
14}
15

彙總問題結果 Internal Link

參數

名稱類型必填描述
tenant_idString
question_idString
question_idsVec
url_idString
time_bucketmodels::AggregateTimeBucket
start_datechrono::DateTimechrono::FixedOffset
force_recalculatebool

回應

返回: AggregateQuestionResultsResponse

範例

aggregate_question_results 範例
Copy Copy
1
2let params = AggregateQuestionResultsParams {
3 tenant_id: "acme-corp-tenant".to_string(),
4 question_id: Some("question-123".to_string()),
5 question_ids: Some(vec!["question-123".to_string(), "question-456".to_string()]),
6 url_id: Some("news/article".to_string()),
7 time_bucket: Some(models::AggregateTimeBucket::Day),
8 start_date: Some(chrono::DateTime::parse_from_rfc3339("2023-01-01T00:00:00+00:00").unwrap()),
9 force_recalculate: Some(true),
10};
11
12let response = aggregate_question_results(&configuration, params).await?;
13

批次彙總問題結果 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
bulk_aggregate_question_results_requestmodels::BulkAggregateQuestionResultsRequestYes
force_recalculateboolNo

回應

回傳: BulkAggregateQuestionResultsResponse

範例

bulk_aggregate_question_results 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let request = models::BulkAggregateQuestionResultsRequest {
4 question_ids: vec!["q123".into(), "q456".into()],
5 time_bucket: "daily".into(),
6 };
7 let params = BulkAggregateQuestionResultsParams {
8 tenant_id: "acme-corp-tenant".into(),
9 bulk_aggregate_question_results_request: request,
10 force_recalculate: Some(true),
11 };
12 let _response = bulk_aggregate_question_results(&configuration, params).await?;
13 Ok(())
14}
15

將評論與問題結果結合 Internal Link

參數

名稱類型必填描述
tenant_idString
question_idString
question_idsVec
url_idString
start_datechrono::DateTimechrono::FixedOffset
force_recalculatebool
min_valuef64
max_valuef64
limitf64

回應

返回:CombineQuestionResultsWithCommentsResponse

範例

combine_comments_with_question_results 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let config = configuration::Configuration::default();
4 let params = CombineCommentsWithQuestionResultsParams {
5 tenant_id: "acme-corp-tenant".to_string(),
6 question_id: Some("q123".to_string()),
7 question_ids: Some(vec!["q123".to_string(), "q124".to_string()]),
8 url_id: Some("news/article".to_string()),
9 start_date: Some(chrono::DateTime::parse_from_rfc3339("2023-01-01T00:00:00+00:00").unwrap()),
10 force_recalculate: Some(true),
11 min_value: Some(0.0),
12 max_value: Some(100.0),
13 limit: Some(50.0),
14 };
15 let _response = combine_comments_with_question_results(&config, params).await?;
16 Ok(())
17}
18

新增 SSO 使用者 Internal Link

參數

名稱類型必填說明
tenant_idString
create_apisso_user_datamodels::CreateApissoUserData

回應

返回:AddSsoUserApiResponse

示例

add_sso_user 示例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let user_data = models::CreateApissoUserData {
4 username: "jdoe".to_string(),
5 email: "jdoe@acme.com".to_string(),
6 display_name: Some("John Doe".to_string()),
7 is_active: Some(true),
8 };
9 let params = AddSsoUserParams {
10 tenant_id: "acme-corp".to_string(),
11 create_apisso_user_data: user_data,
12 };
13 let _response = add_sso_user(&configuration, params).await?;
14 Ok(())
15}
16

刪除 SSO 使用者 Internal Link


參數

NameTypeRequiredDescription
tenant_idStringYes
idStringYes
delete_commentsboolNo
comment_delete_modeStringNo

回應

返回:DeleteSsoUserApiResponse

範例

delete_sso_user 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = DeleteSsoUserParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 id: "user-42".to_string(),
6 delete_comments: Some(true),
7 comment_delete_mode: Some("soft".to_string()),
8 };
9 let _response: DeleteSsoUserApiResponse = delete_sso_user(&config, params).await?;
10 Ok(())
11}
12

以電子郵件取得 SSO 使用者 Internal Link

參數

名稱類型必要描述
tenant_idStringYes
emailStringYes

回應

返回: GetSsoUserByEmailApiResponse

範例

get_sso_user_by_email 範例
Copy Copy
1
2async fn run_example(configuration: &configuration::Configuration) -> Result<(), Error> {
3 let tenant_id = Some("acme-corp".to_string());
4 let email = Some("john.doe@example.com".to_string());
5 let params = GetSsoUserByEmailParams {
6 tenant_id: tenant_id.unwrap(),
7 email: email.unwrap(),
8 };
9 let _response = get_sso_user_by_email(configuration, params).await?;
10 Ok(())
11}
12

以 ID 取得 SSO 使用者 Internal Link


參數

名稱類型必填說明
tenant_idString
idString

回應

返回:GetSsoUserByIdApiResponse

範例

get_sso_user_by_id 範例
Copy Copy
1
2async fn example(configuration: &configuration::Configuration) -> Result<(), Error> {
3 let params = GetSsoUserByIdParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 id: "user-9876".to_string(),
6 };
7 let _response: GetSsoUserByIdApiResponse = get_sso_user_by_id(configuration, params).await?;
8 Ok(())
9}
10

取得 SSO 使用者清單 Internal Link

參數

名稱類型必填描述
tenant_idStringYes
skipi32No

回應

回傳: GetSsoUsersResponse

範例

get_sso_users 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = GetSsoUsersParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 skip: Some(10),
6 };
7 let _response = get_sso_users(&configuration, params).await?;
8 Ok(())
9}
10

部分更新 SSO 使用者 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
idStringYes
update_apisso_user_datamodels::UpdateApissoUserDataYes
update_commentsboolNo

回應

返回:PatchSsoUserApiResponse

範例

patch_sso_user 範例
Copy Copy
1
2async fn run() -> Result<(), Error> {
3 let config = configuration::Configuration::default();
4 let update_data = models::UpdateApissoUserData {
5 email: Some("john.doe@example.com".to_string()),
6 name: Some("John Doe".to_string()),
7 };
8 let params = PatchSsoUserParams {
9 tenant_id: "acme-corp-tenant".to_string(),
10 id: "user-12345".to_string(),
11 update_apisso_user_data: update_data,
12 update_comments: Some(true),
13 };
14 let _response: PatchSsoUserApiResponse = patch_sso_user(&config, params).await?;
15 Ok(())
16}
17

替換 SSO 使用者 Internal Link

參數

名稱類型必填描述
tenant_idString
idString
update_apisso_user_datamodels::UpdateApissoUserData
update_commentsbool

回應

返回: PutSsoUserApiResponse

範例

put_sso_user 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let update_data = UpdateApissoUserData {
4 email: "jane.doe@example.com".to_string(),
5 display_name: "Jane Doe".to_string(),
6 };
7 let params = PutSsoUserParams {
8 tenant_id: "acme-corp-tenant".to_string(),
9 id: "user-12345".to_string(),
10 update_apisso_user_data: update_data,
11 update_comments: Some(true),
12 };
13 let _response = put_sso_user(&configuration, params).await?;
14 Ok(())
15}
16

建立訂閱 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
create_api_user_subscription_datamodels::CreateApiUserSubscriptionDataYes

回應

返回:CreateSubscriptionApiResponse

範例

create_subscription 範例
Copy Copy
1
2async fn run(configuration: &configuration::Configuration) -> Result<(), Error> {
3 let subscription_data = models::CreateApiUserSubscriptionData {
4 plan_id: "pro-plan".to_string(),
5 trial_period_days: Some(14),
6 start_date: Some("2024-01-01".to_string()),
7 ..Default::default()
8 };
9 let params = CreateSubscriptionParams {
10 tenant_id: "acme-corp-tenant".to_string(),
11 create_api_user_subscription_data: subscription_data,
12 };
13 let _response: CreateSubscriptionApiResponse = create_subscription(configuration, params).await?;
14 Ok(())
15}
16

刪除訂閱 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
idStringYes
user_idStringNo

回應

回傳: DeleteSubscriptionApiResponse

範例

delete_subscription 範例
Copy Copy
1
2async fn run() -> Result<(), Error> {
3 let params = DeleteSubscriptionParams {
4 tenant_id: "acme-corp".to_string(),
5 id: "sub-2024-09".to_string(),
6 user_id: Some("user-42".to_string()),
7 };
8 let _response = delete_subscription(&config, params).await?;
9 Ok(())
10}
11

取得訂閱 Internal Link

參數

名稱類型必填說明
tenant_idString
user_idString

回應

返回:GetSubscriptionsApiResponse

範例

get_subscriptions 範例
Copy Copy
1
2async fn fetch_subscriptions(config: &configuration::Configuration) -> Result<(), Error> {
3 let params = GetSubscriptionsParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 user_id: Some("user-12345".to_string()),
6 };
7 let _response: GetSubscriptionsApiResponse = get_subscriptions(config, params).await?;
8 Ok(())
9}
10

更新訂閱 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
idStringYes
update_api_user_subscription_datamodels::UpdateApiUserSubscriptionDataYes
user_idStringNo

回應

返回: UpdateSubscriptionApiResponse

範例

update_subscription 範例
Copy Copy
1
2async fn example(config: &configuration::Configuration) -> Result<(), Error> {
3 let params = UpdateSubscriptionParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 id: "sub-12345".to_string(),
6 update_api_user_subscription_data: models::UpdateApiUserSubscriptionData {
7 plan_id: "premium".to_string(),
8 status: "active".to_string(),
9 },
10 user_id: Some("user-987".to_string()),
11 };
12 let _resp = update_subscription(config, params).await?;
13 Ok(())
14}
15

取得租戶每日使用量 Internal Link

參數

名稱類型必填說明
tenant_idString
year_numberf64
month_numberf64
day_numberf64
skipf64

回應

回傳:GetTenantDailyUsagesResponse

範例

get_tenant_daily_usages 範例
Copy Copy
1
2async fn fetch_daily_usage(configuration: &configuration::Configuration) -> Result<(), Error> {
3 let params = GetTenantDailyUsagesParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 year_number: Some(2023.0),
6 month_number: Some(7.0),
7 day_number: Some(15.0),
8 skip: Some(0.0),
9 };
10 let _response: GetTenantDailyUsagesResponse = get_tenant_daily_usages(configuration, params).await?;
11 Ok(())
12}
13

建立租戶套件 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
create_tenant_package_bodymodels::CreateTenantPackageBodyYes

回應

返回:CreateTenantPackageResponse

範例

create_tenant_package 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = CreateTenantPackageParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 create_tenant_package_body: models::CreateTenantPackageBody {
6 package_name: "Standard".to_string(),
7 package_type: "news/article".to_string(),
8 description: Some("Package for news articles".to_string()),
9 ..Default::default()
10 },
11 };
12 let _response = create_tenant_package(&configuration, params).await?;
13 Ok(())
14}
15

刪除租戶套件 Internal Link


參數

名稱類型必填描述
tenant_idStringYes
idStringYes

回應

返回: ApiEmptyResponse

範例

delete_tenant_package 範例
Copy Copy
1
2async fn run() -> Result<(), Error> {
3 let params = DeleteTenantPackageParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 id: "premium-plan".to_string(),
6 force: Some(true),
7 };
8 delete_tenant_package(&configuration, params).await?;
9 Ok(())
10}
11

取得租戶套件 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
idStringYes

回應

返回:GetTenantPackageResponse

範例

get_tenant_package 範例
Copy Copy
1
2async fn example(configuration: &configuration::Configuration) -> Result<(), Error> {
3 let params = GetTenantPackageParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 id: "news/article".to_string(),
6 };
7 let _response: GetTenantPackageResponse = get_tenant_package(configuration, params).await?;
8 Ok(())
9}
10

取得租戶套件清單 Internal Link

參數

名稱類型必填說明
tenant_idString
skipf64

回應

返回: GetTenantPackagesResponse

範例

取得租戶套件 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = GetTenantPackagesParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 skip: Some(5.0),
6 };
7 let _resp = get_tenant_packages(&config, params).await?;
8 Ok(())
9}
10

替換租戶套件 Internal Link

參數

名稱類型必填說明
tenant_idString
idString
replace_tenant_package_bodymodels::ReplaceTenantPackageBody

回應

返回: ApiEmptyResponse

範例

replace_tenant_package 示例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = ReplaceTenantPackageParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 id: "news/article".to_string(),
6 replace_tenant_package_body: models::ReplaceTenantPackageBody {
7 package_id: "premium-plan".to_string(),
8 enabled: true,
9 description: Some("Premium package for high traffic".to_string()),
10 },
11 };
12 replace_tenant_package(&configuration, params).await?;
13 Ok(())
14}
15

更新租戶套件 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
idStringYes
update_tenant_package_bodymodels::UpdateTenantPackageBodyYes

回應

返回:ApiEmptyResponse

範例

update_tenant_package 範例
Copy Copy
1
2async fn run_update(configuration: &configuration::Configuration) -> Result<(), Error> {
3 let body = models::UpdateTenantPackageBody {
4 plan: Some("enterprise".to_string()),
5 renewal_date: Some("2024-12-31".to_string()),
6 ..Default::default()
7 };
8 let params = UpdateTenantPackageParams {
9 tenant_id: "acme-corp-tenant".to_string(),
10 id: "pkg-2024".to_string(),
11 update_tenant_package_body: body,
12 };
13 let _: ApiEmptyResponse = update_tenant_package(configuration, params).await?;
14 Ok(())
15}
16

建立租戶使用者 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
create_tenant_user_bodymodels::CreateTenantUserBodyYes

回應

返回: CreateTenantUserResponse

範例

create_tenant_user 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = CreateTenantUserParams {
4 tenant_id: "acme-corp".to_string(),
5 create_tenant_user_body: models::CreateTenantUserBody {
6 email: "john.doe@example.com".to_string(),
7 role: "admin".to_string(),
8 first_name: Some("John".to_string()),
9 last_name: Some("Doe".to_string()),
10 digest_email_frequency: Some(DigestEmailFrequency::Daily),
11 imported_agent_approval_notification_frequency: Some(ImportedAgentApprovalNotificationFrequency::Weekly),
12 ..Default::default()
13 },
14 };
15 let _response: CreateTenantUserResponse = create_tenant_user(&configuration, params).await?;
16 Ok(())
17}
18

刪除租戶使用者 Internal Link

參數

名稱類型必填描述
tenant_idStringYes
idStringYes
delete_commentsStringNo
comment_delete_modeStringNo

回應

回傳:ApiEmptyResponse

範例

delete_tenant_user 範例
Copy Copy
1
2async fn run() -> Result<(), Error> {
3 let params = DeleteTenantUserParams {
4 tenant_id: "acme-corp".into(),
5 id: "user-123".into(),
6 delete_comments: Some("true".into()),
7 comment_delete_mode: Some("hard".into()),
8 };
9 delete_tenant_user(&config, params).await?;
10 Ok(())
11}
12

取得租戶使用者 Internal Link

參數

NameTypeRequiredDescription
tenant_idStringYes
idStringYes

回應

Returns: GetTenantUserResponse

範例

get_tenant_user 範例
Copy Copy
1
2async fn run() -> Result<(), Error> {
3 let config = configuration::Configuration::default();
4 let params = GetTenantUserParams {
5 tenant_id: "acme-corp-tenant".into(),
6 id: "user-42".into(),
7 };
8 let _response = get_tenant_user(&config, params).await?;
9 Ok(())
10}
11

取得租戶使用者清單 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
skipf64No

回應

回傳:GetTenantUsersResponse

範例

get_tenant_users 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = GetTenantUsersParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 skip: Some(10.0),
6 };
7 let _response = get_tenant_users(&configuration, params).await?;
8 Ok(())
9}
10

替換租戶使用者 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
idStringYes
replace_tenant_user_bodymodels::ReplaceTenantUserBodyYes
update_commentsStringNo

回應

返回: ApiEmptyResponse

範例

replace_tenant_user 示例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = ReplaceTenantUserParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 id: "user-12345".to_string(),
6 replace_tenant_user_body: ReplaceTenantUserBody::default(),
7 update_comments: Some("Update user role".to_string()),
8 };
9 replace_tenant_user(&configuration, params).await?;
10 Ok(())
11}
12

參數

NameTypeRequiredDescription
tenant_idStringYes
idStringYes
redirect_urlStringNo

回應

返回: ApiEmptyResponse

範例

send_login_link 範例
Copy Copy
1
2async fn run_example(config: &configuration::Configuration) -> Result<(), Error> {
3 let params = SendLoginLinkParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 id: "news/article".to_string(),
6 redirect_url: Some("https://acme.com/after-login".to_string()),
7 };
8 send_login_link(config, params).await?;
9 Ok(())
10}
11

更新租戶使用者 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
idStringYes
update_tenant_user_bodymodels::UpdateTenantUserBodyYes
update_commentsStringNo

回應

返回:ApiEmptyResponse

範例

update_tenant_user 範例
Copy Copy
1
2async fn run_example(configuration: &configuration::Configuration) -> Result<(), Error> {
3 let params = UpdateTenantUserParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 id: "user-9876".to_string(),
6 update_tenant_user_body: models::UpdateTenantUserBody {
7 email: "jane.doe@example.com".to_string(),
8 role: "editor".to_string(),
9 },
10 update_comments: Some("Promoted to editor".to_string()),
11 };
12 let _ = update_tenant_user(configuration, params).await?;
13 Ok(())
14}
15

建立租戶 Internal Link

參數

名稱類型必填說明
tenant_idString
create_tenant_bodymodels::CreateTenantBody

回應

返回:CreateTenantResponse

範例

create_tenant 範例
Copy Copy
1
2async fn example(configuration: &configuration::Configuration) -> Result<(), Error> {
3 let create_body = models::CreateTenantBody {
4 name: "Acme Corp".into(),
5 domain: ApiDomainConfiguration {
6 domain_name: "acme.example.com".into(),
7 ..Default::default()
8 },
9 imported_site_type: Some(ImportedSiteType::NewsArticle),
10 billing_info: Some(BillingInfo {
11 plan: "enterprise".into(),
12 ..Default::default()
13 }),
14 ..Default::default()
15 };
16 let params = CreateTenantParams {
17 tenant_id: "acme-corp-tenant".to_string(),
18 create_tenant_body: create_body,
19 };
20 let _response: CreateTenantResponse = create_tenant(configuration, params).await?;
21 Ok(())
22}
23

刪除租戶 Internal Link


參數

名稱類型必填說明
tenant_idString
idString
sureString

回應

返回: ApiEmptyResponse

範例

delete_tenant 範例
Copy Copy
1
2async fn delete_example(config: &configuration::Configuration) -> Result<(), Error> {
3 let params = DeleteTenantParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 id: "news/article".to_string(),
6 sure: Some("true".to_string()),
7 };
8 delete_tenant(config, params).await?;
9 Ok(())
10}
11

取得租戶 Internal Link

參數

名稱類型必要說明
tenant_idString
idString

回應

返回:GetTenantResponse

範例

get_tenant 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = GetTenantParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 id: "news/article".to_string(),
6 include_billing: Some(true),
7 };
8 let _response: GetTenantResponse = get_tenant(&configuration, params).await?;
9 Ok(())
10}
11

取得租戶清單 Internal Link

參數

名稱類型必填描述
tenant_idString
metaString
skipf64

回應

返回:GetTenantsResponse

範例

get_tenants 範例
Copy Copy
1
2async fn example(config: &configuration::Configuration) -> Result<(), Error> {
3 let params = GetTenantsParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 meta: Some("news/article".to_string()),
6 skip: Some(10.0),
7 };
8 let _response = get_tenants(config, params).await?;
9 Ok(())
10}
11

更新租戶 Internal Link

參數

名稱類型必要說明
tenant_idStringYes
idStringYes
update_tenant_bodymodels::UpdateTenantBodyYes

回應

Returns: ApiEmptyResponse

範例

update_tenant 範例
Copy Copy
1
2async fn run() -> Result<(), Error> {
3 let params = UpdateTenantParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 id: "tenant-001".to_string(),
6 update_tenant_body: UpdateTenantBody {
7 description: Some("Primary tenant for Acme Corp".to_string()),
8 ..Default::default()
9 },
10 };
11 let _ = update_tenant(&configuration, params).await?;
12 Ok(())
13}
14

變更工單狀態 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
user_idStringYes
idStringYes
change_ticket_state_bodymodels::ChangeTicketStateBodyYes

回應

返回:ChangeTicketStateResponse

範例

change_ticket_state 範例
Copy Copy
1
2async fn example(config: &configuration::Configuration) -> Result<(), Error> {
3 let body = models::ChangeTicketStateBody {
4 state: Some("closed".to_string()),
5 comment: Some("Issue resolved".to_string()),
6 };
7 let params = ChangeTicketStateParams {
8 tenant_id: "acme-corp-tenant".to_string(),
9 user_id: "user-1234".to_string(),
10 id: "ticket-5678".to_string(),
11 change_ticket_state_body: body,
12 };
13 let _response: ChangeTicketStateResponse = change_ticket_state(config, params).await?;
14 Ok(())
15}
16

建立工單 Internal Link

參數

名稱類型必填說明
tenant_idString
user_idString
create_ticket_bodymodels::CreateTicketBody

回應

返回:CreateTicketResponse

範例

create_ticket 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let body = models::CreateTicketBody {
4 title: "Login Issue".to_string(),
5 description: "User cannot log in after password reset".to_string(),
6 priority: Some("high".to_string()),
7 };
8 let params = CreateTicketParams {
9 tenant_id: "acme-corp-tenant".to_string(),
10 user_id: "user-12345".to_string(),
11 create_ticket_body: body,
12 };
13 let _response: CreateTicketResponse = create_ticket(&configuration, params).await?;
14 Ok(())
15}
16

取得工單 Internal Link

參數

NameTypeRequiredDescription
tenant_idStringYes
idStringYes
user_idStringNo

回應

Returns: GetTicketResponse

範例

get_ticket 範例
Copy Copy
1
2async fn run() -> Result<(), Error> {
3 let params = GetTicketParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 id: "ticket-456".to_string(),
6 user_id: Some("user-123".to_string()),
7 };
8 let _response: GetTicketResponse = get_ticket(&configuration, params).await?;
9 Ok(())
10}
11

取得工單清單 Internal Link

參數

名稱類型必填描述
tenant_idString
user_idString
statef64
skipf64
limitf64

回應

返回: GetTicketsResponse

範例

get_tickets 範例
Copy Copy
1
2async fn fetch_tickets(configuration: &configuration::Configuration) -> Result<(), Error> {
3 let params = GetTicketsParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 user_id: Some("user-12345".to_string()),
6 state: Some(1.0),
7 skip: Some(0.0),
8 limit: Some(20.0),
9 };
10 let _response: GetTicketsResponse = get_tickets(configuration, params).await?;
11 Ok(())
12}
13

取得翻譯 Internal Link

參數

NameTypeRequiredDescription
namespaceString
componentString
localeString
use_full_translation_idsbool

回應

返回: GetTranslationsResponse

範例

get_translations 範例
Copy Copy
1
2async fn fetch_translations() -> Result<(), Error> {
3 let params = GetTranslationsParams {
4 namespace: "acme-corp-tenant".to_string(),
5 component: "news/article".to_string(),
6 locale: Some("en-US".to_string()),
7 use_full_translation_ids: Some(true),
8 };
9 let _response: GetTranslationsResponse = get_translations(&configuration, params).await?;
10 Ok(())
11}
12

上傳圖片 Internal Link

上傳並重新調整圖像大小

參數

名稱類型必填說明
tenant_idStringYes
filestd::path::PathBufYes
size_presetmodels::SizePresetNo
url_idStringNo

回應

返回: UploadImageResponse

範例

upload_image 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = UploadImageParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 file: std::path::PathBuf::from("/tmp/photo.jpg"),
6 size_preset: Some(models::SizePreset::Medium),
7 url_id: Some("news/article".to_string()),
8 };
9 let _response = upload_image(&configuration, params).await?;
10 Ok(())
11}
12

以 ID 取得使用者徽章進度 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
idStringYes

回應

回傳: ApiGetUserBadgeProgressResponse

範例

get_user_badge_progress_by_id 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = GetUserBadgeProgressByIdParams {
4 tenant_id: "acme-corp".to_string(),
5 id: "user-12345".to_string(),
6 };
7 let _response = get_user_badge_progress_by_id(&configuration, params).await?;
8 Ok(())
9}
10

以使用者 ID 取得使用者徽章進度 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
user_idStringYes

回應

返回: ApiGetUserBadgeProgressResponse

範例

get_user_badge_progress_by_user_id 示例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let config = configuration::Configuration::default();
4 let params = GetUserBadgeProgressByUserIdParams {
5 tenant_id: "acme-corp-tenant".to_string(),
6 user_id: "user-9876".to_string(),
7 };
8 let _response = get_user_badge_progress_by_user_id(&config, params).await?;
9 Ok(())
10}
11

取得使用者徽章進度清單 Internal Link

參數

NameTypeRequiredDescription
tenant_idStringYes
user_idStringNo
limitf64No
skipf64No

回應

返回:ApiGetUserBadgeProgressListResponse

範例

get_user_badge_progress_list 範例
Copy Copy
1
2async fn fetch_badge_progress(conf: &configuration::Configuration) -> Result<(), Error> {
3 let params = GetUserBadgeProgressListParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 user_id: Some("user-98765".to_string()),
6 limit: Some(20.0),
7 skip: Some(5.0),
8 };
9 let _resp = get_user_badge_progress_list(conf, params).await?;
10 Ok(())
11}
12

建立使用者徽章 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
create_user_badge_paramsmodels::CreateUserBadgeParamsYes

回應

返回: ApiCreateUserBadgeResponse

範例

create_user_badge 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = CreateUserBadgeParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 create_user_badge_params: models::CreateUserBadgeParams {
6 badge_type: "premium".to_string(),
7 user_id: "user-123".to_string(),
8 description: Some("Top contributor".to_string()),
9 expires_at: None,
10 },
11 };
12 let _response = create_user_badge(&configuration, params).await?;
13 Ok(())
14}
15

刪除使用者徽章 Internal Link

參數

名稱類型必填描述
tenant_idStringYes
idStringYes

回應

返回:ApiEmptySuccessResponse

範例

delete_user_badge 範例
Copy Copy
1
2async fn remove_badge(config: &configuration::Configuration) -> Result<(), Error> {
3 let params: DeleteUserBadgeParams = DeleteUserBadgeParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 id: "badge-abcde".to_string(),
6 };
7 let _ = delete_user_badge(config, params).await?;
8 Ok(())
9}
10

取得使用者徽章 Internal Link

參數

名稱類型必填說明
tenant_idString
idString

回應

回傳:ApiGetUserBadgeResponse

範例

get_user_badge 範例
Copy Copy
1
2async fn fetch_badge() -> Result<(), Error> {
3 let params = GetUserBadgeParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 id: "badge-42".to_string(),
6 };
7 let _response: ApiGetUserBadgeResponse = get_user_badge(&configuration, params).await?;
8 Ok(())
9}
10

取得使用者徽章清單 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
user_idStringNo
badge_idStringNo
displayed_on_commentsboolNo
limitf64No
skipf64No

回應

返回: ApiGetUserBadgesResponse

範例

get_user_badges 範例
Copy Copy
1
2async fn fetch_badges(configuration: &configuration::Configuration) -> Result<(), Error> {
3 let params = GetUserBadgesParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 user_id: Some("user-12345".to_string()),
6 badge_id: Some("top-commenter".to_string()),
7 displayed_on_comments: Some(true),
8 limit: Some(50.0),
9 skip: Some(0.0),
10 };
11 let _response = get_user_badges(configuration, params).await?;
12 Ok(())
13}
14

更新使用者徽章 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
idStringYes
update_user_badge_paramsmodels::UpdateUserBadgeParamsYes

回應

返回:ApiEmptySuccessResponse

範例

update_user_badge 範例
Copy Copy
1
2async fn example(configuration: &configuration::Configuration) -> Result<(), Error> {
3 let params = UpdateUserBadgeParams {
4 tenant_id: "acme-corp".to_string(),
5 id: "user-42".to_string(),
6 update_user_badge_params: models::UpdateUserBadgeParams {
7 badge_name: "contributor".to_string(),
8 expires_at: Some("2025-12-31T23:59:59Z".to_string()),
9 },
10 };
11 let _resp = update_user_badge(configuration, params).await?;
12 Ok(())
13}
14

取得使用者通知數量 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
ssoStringNo

回應

返回:GetUserNotificationCountResponse

範例

get_user_notification_count 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = GetUserNotificationCountParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 sso: Some("user-sso-token".to_string()),
6 };
7 let response = get_user_notification_count(&config, params).await?;
8 println!("{:?}", response);
9 Ok(())
10}
11

取得使用者通知 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
url_idStringNo
page_sizei32No
after_idStringNo
include_contextboolNo
after_created_ati64No
unread_onlyboolNo
dm_onlyboolNo
no_dmboolNo
include_translationsboolNo
include_tenant_notificationsboolNo
ssoStringNo

回應

返回:GetMyNotificationsResponse

範例

get_user_notifications 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = GetUserNotificationsParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 url_id: Some("news/article".to_string()),
6 page_size: Some(20),
7 after_id: None,
8 include_context: Some(true),
9 after_created_at: None,
10 unread_only: Some(false),
11 dm_only: Some(false),
12 no_dm: Some(true),
13 include_translations: Some(false),
14 include_tenant_notifications: Some(true),
15 sso: None,
16 };
17 let _resp = get_user_notifications(&config, params).await?;
18 Ok(())
19}
20

重設使用者通知數量 Internal Link

參數

名稱類型必填描述
tenant_idString
ssoString

回應

返回: ResetUserNotificationsResponse

示例

reset_user_notification_count 示例
Copy Copy
1
2async fn run_example(config: &configuration::Configuration) -> Result<(), Error> {
3 let params = ResetUserNotificationCountParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 sso: Some("john.doe".to_string()),
6 };
7 let _response: ResetUserNotificationsResponse = reset_user_notification_count(config, params).await?;
8 Ok(())
9}
10

重設使用者通知 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
after_idStringNo
after_created_ati64No
unread_onlyboolNo
dm_onlyboolNo
no_dmboolNo
ssoStringNo

回應

返回:ResetUserNotificationsResponse

範例

reset_user_notifications 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = ResetUserNotificationsParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 after_id: Some("notif-12345".to_string()),
6 after_created_at: Some(1_640_995_200),
7 unread_only: Some(true),
8 dm_only: Some(false),
9 no_dm: Some(true),
10 sso: Some("sso-provider".to_string()),
11 };
12 let _response: ResetUserNotificationsResponse =
13 reset_user_notifications(&configuration, params).await?;
14 Ok(())
15}
16

更新使用者評論訂閱狀態 Internal Link


啟用或停用特定評論的通知。

參數

名稱類型必填說明
tenant_idString
notification_idString
opted_in_or_outString
comment_idString
ssoString

回應

返回:UpdateUserNotificationCommentSubscriptionStatusResponse

範例

update_user_notification_comment_subscription_status 範例
Copy Copy
1
2async fn run_example(configuration: &configuration::Configuration) -> Result<(), Error> {
3 let params = UpdateUserNotificationCommentSubscriptionStatusParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 notification_id: "comment-reply".to_string(),
6 opted_in_or_out: "opted_in".to_string(),
7 comment_id: "12345".to_string(),
8 sso: Some("user-sso-token".to_string()),
9 };
10 let _response = update_user_notification_comment_subscription_status(configuration, params).await?;
11 Ok(())
12}
13

更新使用者頁面訂閱狀態 Internal Link

Enable or disable notifications for a page. When users are subscribed to a page, notifications are created for new root comments, and also

Parameters

名稱型別必填描述
tenant_idString
url_idString
urlString
page_titleString
subscribed_or_unsubscribedString
ssoString

Response

返回: UpdateUserNotificationPageSubscriptionResponse

範例

update_user_notification_page_subscription_status 範例
Copy Copy
1
2async fn example() -> Result<UpdateUserNotificationPageSubscriptionStatusResponse, Error> {
3 let params = UpdateUserNotificationPageSubscriptionStatusParams {
4 tenant_id: "acme-corp-tenant".to_owned(),
5 url_id: "news-article-2024".to_owned(),
6 url: "https://news.example.com/articles/rust".to_owned(),
7 page_title: "Rust Dominates the Programming World".to_owned(),
8 subscribed_or_unsubscribed: "subscribed".to_owned(),
9 sso: Some("sso-token-abc".to_owned()),
10 };
11 update_user_notification_page_subscription_status(&configuration, params).await
12}
13

更新使用者通知狀態 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
notification_idStringYes
new_statusStringYes
ssoStringNo

回應

返回:UpdateUserNotificationStatusResponse

範例

update_user_notification_status 範例
Copy Copy
1
2async fn run_update() -> Result<(), Error> {
3 let params = UpdateUserNotificationStatusParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 notification_id: "news/article".to_string(),
6 new_status: "read".to_string(),
7 sso: Some("sso-token-123".to_string()),
8 };
9 let _response: UpdateUserNotificationStatusResponse =
10 update_user_notification_status(&configuration, params).await?;
11 Ok(())
12}
13

取得使用者在線狀態 Internal Link

參數

NameTypeRequiredDescription
tenant_idStringYes
url_id_wsStringYes
user_idsStringYes

回應

返回: GetUserPresenceStatusesResponse

範例

get_user_presence_statuses 範例
Copy Copy
1
2async fn run() -> Result<(), Error> {
3 let params = GetUserPresenceStatusesParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 url_id_ws: "news/article".to_string(),
6 user_ids: "user123,user456".to_string(),
7 };
8 let _response = get_user_presence_statuses(&configuration, params).await?;
9 Ok(())
10}
11

搜尋使用者 Internal Link

參數

名稱類型必填描述
tenant_idString
url_idString
username_starts_withString
mention_group_idsVec
ssoString
search_sectionString

回應

返回: SearchUsersResult

範例

search_users 範例
Copy Copy
1
2async fn run_search() -> Result<(), Error> {
3 let params = SearchUsersParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 url_id: "news/article".to_string(),
6 username_starts_with: Some("john".to_string()),
7 mention_group_ids: Some(vec!["group1".to_string(), "group2".to_string()]),
8 sso: Some("sso-provider".to_string()),
9 search_section: Some("comments".to_string()),
10 };
11 let _result: SearchUsersResult = search_users(&configuration, params).await?;
12 Ok(())
13}
14

取得使用者 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
idStringYes

回應

Returns: GetUserResponse

範例

get_user 範例
Copy Copy
1
2async fn example(configuration: &configuration::Configuration) -> Result<(), Error> {
3 let params = GetUserParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 id: "user-123".to_string(),
6 include_details: Some(true),
7 };
8 let _response = get_user(configuration, params).await?;
9 Ok(())
10}
11

建立投票 Internal Link


參數

名稱類型必填說明
tenant_idStringYes
comment_idStringYes
directionStringYes
user_idStringNo
anon_user_idStringNo

回應

返回:VoteResponse

範例

create_vote 範例
Copy Copy
1
2async fn submit_vote() -> Result<(), Error> {
3 let params = CreateVoteParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 comment_id: "news/article/12345".to_string(),
6 direction: "up".to_string(),
7 user_id: Some("user-42".to_string()),
8 anon_user_id: Some("anon-99".to_string()),
9 };
10 let _response = create_vote(&config, params).await?;
11 Ok(())
12}
13

刪除投票 Internal Link

參數

名稱類型必填說明
tenant_idString
idString
edit_keyString

回應

返回: VoteDeleteResponse

範例

delete_vote 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = DeleteVoteParams {
4 tenant_id: "acme-corp".to_string(),
5 id: "vote-12345".to_string(),
6 edit_key: Some("edit-key-abc".to_string()),
7 };
8 let _response: VoteDeleteResponse = delete_vote(&configuration, params).await?;
9 Ok(())
10}
11

取得投票 Internal Link

參數

名稱類型必填說明
tenant_idStringYes
url_idStringYes

回應

返回:GetVotesResponse

範例

get_votes 範例
Copy Copy
1
2async fn fetch_votes(configuration: &configuration::Configuration) -> Result<(), Error> {
3 let params = GetVotesParams {
4 tenant_id: "acme-corp-tenant".to_string(),
5 url_id: "news/article".to_string(),
6 limit: Some(100),
7 };
8 let _response: GetVotesResponse = get_votes(configuration, params).await?;
9 Ok(())
10}
11

取得使用者的投票 Internal Link

參數

名稱類型必填描述
tenant_idString
url_idString
user_idString
anon_user_idString

回應

返回: GetVotesForUserResponse

範例

get_votes_for_user 範例
Copy Copy
1
2async fn example() -> Result<(), Error> {
3 let params = GetVotesForUserParams {
4 tenant_id: "acme-corp".to_string(),
5 url_id: "news/2023/09/awesome-article".to_string(),
6 user_id: Some("user-12345".to_string()),
7 anon_user_id: None,
8 };
9 let _response = get_votes_for_user(&configuration, params).await?;
10 Ok(())
11}
12

需要幫助嗎?

如果您在使用 Rust SDK 時遇到任何問題或有任何疑問,請:

Contributing

歡迎貢獻!請造訪 GitHub 儲存庫 以取得貢獻指南。