openlark_platform/app_engine/apaas/v1/workspace/
mod.rs1pub mod enum_mod;
6pub mod sql_commands;
7pub mod table;
8pub mod view;
9
10pub use enum_mod::enum_get;
11pub use enum_mod::list as enum_list;
12pub use sql_commands::SqlCommandsRequestBuilder;
13pub use table::list as table_list;
14pub use table::table_get;
15pub use view::views_get;
16
17use crate::PlatformConfig;
18use std::sync::Arc;
19
20#[derive(Debug, Clone)]
22pub struct WorkspaceService {
23 config: Arc<PlatformConfig>,
24 workspace_id: String,
25}
26
27impl WorkspaceService {
28 pub fn new(config: Arc<PlatformConfig>, workspace_id: impl Into<String>) -> Self {
30 Self {
31 config,
32 workspace_id: workspace_id.into(),
33 }
34 }
35
36 pub fn table(&self, table_name: impl Into<String>) -> table::TableService {
38 table::TableService::new(
39 self.config.as_ref().clone(),
40 self.workspace_id.clone(),
41 table_name,
42 )
43 }
44
45 pub fn view(&self, view_name: impl Into<String>) -> view::ViewService {
47 view::ViewService::new(
48 self.config.as_ref().clone(),
49 self.workspace_id.clone(),
50 view_name,
51 )
52 }
53
54 pub fn enum_mod(&self) -> enum_mod::EnumModService {
56 enum_mod::EnumModService::new(self.config.as_ref().clone(), self.workspace_id.clone())
57 }
58
59 pub fn sql_commands(&self, sql: impl Into<String>) -> sql_commands::SqlCommandsRequestBuilder {
61 sql_commands::SqlCommandsRequestBuilder::new(
62 self.config.as_ref().clone(),
63 self.workspace_id.clone(),
64 sql,
65 )
66 }
67}