Skip to main content

openlark_platform/spark/v1/app/
create.rs

1//! 创建妙搭应用
2//!
3//! docPath:
4
5use openlark_core::{
6    SDKResult, api::ApiRequest, config::Config, http::Transport, req_option::RequestOption,
7};
8use std::sync::Arc;
9
10/// 创建妙搭应用请求。
11#[derive(Debug, Clone)]
12pub struct CreateSparkAppRequest {
13    config: Arc<Config>,
14}
15
16impl CreateSparkAppRequest {
17    /// 创建新的请求构建器。
18    pub fn new(config: Arc<Config>) -> Self {
19        Self { config }
20    }
21
22    /// 使用默认请求选项执行请求。
23    pub async fn execute(self, body: serde_json::Value) -> SDKResult<serde_json::Value> {
24        self.execute_with_options(body, RequestOption::default())
25            .await
26    }
27
28    /// 使用指定请求选项执行请求。
29    pub async fn execute_with_options(
30        self,
31        body: serde_json::Value,
32        option: RequestOption,
33    ) -> SDKResult<serde_json::Value> {
34        let req = ApiRequest::<serde_json::Value>::post("/open-apis/spark/v1/apps").body(body);
35        Transport::request_typed(req, &self.config, Some(option), "创建妙搭应用").await
36    }
37}