1use super::types::*;
2use crate::client::{AuthType, Client};
3use crate::error::ApiResult;
4
5pub trait ChatApi {
6 fn bot_join_chat(
11 &self,
12 request: BotJoinChatRequest,
13 auth: AuthType,
14 ) -> impl std::future::Future<Output = ApiResult<BotJoinChatResponse>> + Send;
15}
16
17impl ChatApi for Client {
18 async fn bot_join_chat(
19 &self,
20 request: BotJoinChatRequest,
21 auth: AuthType,
22 ) -> ApiResult<BotJoinChatResponse> {
23 let url = format!(
24 "{}/work_item/{}/bot_join_chat",
25 request.project_key, request.work_item_id
26 );
27
28 let body = serde_json::json!({
29 "app_ids": request.app_ids,
30 "work_item_type_key": request.work_item_type_key,
31 });
32
33 Ok(self.post(&url, &body, auth).await?)
34 }
35}