openlark_platform/spark/v1/app/
create.rs1use openlark_core::{
6 SDKResult, api::ApiRequest, config::Config, http::Transport, req_option::RequestOption,
7};
8use std::sync::Arc;
9
10#[derive(Debug, Clone)]
12pub struct CreateSparkAppRequest {
13 config: Arc<Config>,
14}
15
16impl CreateSparkAppRequest {
17 pub fn new(config: Arc<Config>) -> Self {
19 Self { config }
20 }
21
22 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 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 let resp = Transport::request(req, &self.config, Some(option)).await?;
36 resp.data
37 .ok_or_else(|| openlark_core::error::validation_error("创建妙搭应用", "响应数据为空"))
38 }
39}