Skip to main content

openlark_platform/spark/v1/app/
mod.rs

1/// create 模块。
2pub mod create;
3/// enum 模块。
4pub mod r#enum;
5/// get_app_visibility 模块。
6pub mod get_app_visibility;
7/// icon 模块。
8pub mod icon;
9/// list 模块。
10pub mod list;
11/// patch 模块。
12pub mod patch;
13/// sql_commands 模块。
14pub mod sql_commands;
15/// storage 模块。
16pub mod storage;
17/// table 模块。
18pub mod table;
19/// update_app_visibility 模块。
20pub mod update_app_visibility;
21/// upload_html_code_and_release 模块。
22pub mod upload_html_code_and_release;
23/// view 模块。
24pub mod view;
25
26use crate::PlatformConfig;
27use std::sync::Arc;
28
29pub use create::CreateSparkAppRequest;
30pub use get_app_visibility::GetSparkAppVisibilityRequest;
31pub use icon::UploadSparkAppIconRequest;
32pub use list::ListSparkAppsRequest;
33pub use patch::PatchSparkAppRequest;
34pub use update_app_visibility::UpdateSparkAppVisibilityRequest;
35pub use upload_html_code_and_release::UploadHtmlCodeAndReleaseRequest;
36
37/// 妙搭应用资源服务。
38#[derive(Debug, Clone)]
39pub struct SparkAppService {
40    config: Arc<PlatformConfig>,
41}
42
43impl SparkAppService {
44    /// 创建新的妙搭应用资源服务。
45    pub fn new(config: Arc<PlatformConfig>) -> Self {
46        Self { config }
47    }
48
49    /// 创建妙搭应用。
50    pub fn create(&self) -> CreateSparkAppRequest {
51        CreateSparkAppRequest::new(self.config.clone())
52    }
53
54    /// 批量获取妙搭应用。
55    pub fn list(&self) -> ListSparkAppsRequest {
56        ListSparkAppsRequest::new(self.config.clone())
57    }
58
59    /// 更新妙搭应用信息。
60    pub fn patch(&self, app_id: impl Into<String>) -> PatchSparkAppRequest {
61        PatchSparkAppRequest::new(self.config.clone(), app_id)
62    }
63
64    /// 上传妙搭应用图标。
65    pub fn icon(&self) -> UploadSparkAppIconRequest {
66        UploadSparkAppIconRequest::new(self.config.clone())
67    }
68
69    /// 获取妙搭应用可用范围。
70    pub fn get_app_visibility(&self, app_id: impl Into<String>) -> GetSparkAppVisibilityRequest {
71        GetSparkAppVisibilityRequest::new(self.config.clone(), app_id)
72    }
73
74    /// 更新妙搭应用可用范围。
75    pub fn update_app_visibility(
76        &self,
77        app_id: impl Into<String>,
78    ) -> UpdateSparkAppVisibilityRequest {
79        UpdateSparkAppVisibilityRequest::new(self.config.clone(), app_id)
80    }
81
82    /// 上传 HTML 代码并发布。
83    pub fn upload_html_code_and_release(
84        &self,
85        app_id: impl Into<String>,
86    ) -> UploadHtmlCodeAndReleaseRequest {
87        UploadHtmlCodeAndReleaseRequest::new(self.config.clone(), app_id)
88    }
89}