openlark_platform/spark/v1/app/
patch.rs1use openlark_core::{
6 SDKResult, api::ApiRequest, config::Config, http::Transport, req_option::RequestOption,
7 validate_required,
8};
9use std::sync::Arc;
10
11#[derive(Debug, Clone)]
13pub struct PatchSparkAppRequest {
14 config: Arc<Config>,
15 app_id: String,
16}
17
18impl PatchSparkAppRequest {
19 pub fn new(config: Arc<Config>, app_id: impl Into<String>) -> Self {
21 Self {
22 config,
23 app_id: app_id.into(),
24 }
25 }
26
27 pub async fn execute(self, body: serde_json::Value) -> SDKResult<serde_json::Value> {
29 self.execute_with_options(body, RequestOption::default())
30 .await
31 }
32
33 pub async fn execute_with_options(
35 self,
36 body: serde_json::Value,
37 option: RequestOption,
38 ) -> SDKResult<serde_json::Value> {
39 validate_required!(self.app_id.trim(), "app_id 不能为空");
40 let path = format!("/open-apis/spark/v1/apps/{}", self.app_id);
41 let req = ApiRequest::<serde_json::Value>::patch(path).body(body);
42 Transport::request_typed(req, &self.config, Some(option), "更新妙搭应用信息").await
43 }
44}