open_lark/service/cloud_docs/wiki/v2/space_node/
mod.rs1use crate::core::{config::Config, req_option::RequestOption, SDKResult};
2
3pub use copy::{copy_space_node, CopiedNode, CopySpaceNodeRequest, CopySpaceNodeResponse};
4pub use create::{create_space_node, CreateSpaceNodeRequest, CreateSpaceNodeResponse, CreatedNode};
5pub use get::{get_space_node, GetSpaceNodeRequest, GetSpaceNodeResponse, SpaceNode};
6pub use list::{list_space_node, ListSpaceNodeRequest, ListSpaceNodeResponse, NodeItem};
7pub use r#move::{move_space_node, MoveSpaceNodeRequest, MoveSpaceNodeResponse, MovedNode};
8pub use update_title::{
9 update_space_node_title, UpdateSpaceNodeTitleRequest, UpdateSpaceNodeTitleResponse, UpdatedNode,
10};
11
12mod copy;
13mod create;
14mod get;
15mod list;
16mod r#move;
17mod update_title;
18
19pub struct SpaceNodeService {
21 config: Config,
22}
23
24impl SpaceNodeService {
25 pub fn new(config: Config) -> Self {
26 Self { config }
27 }
28
29 pub async fn create(
31 &self,
32 request: CreateSpaceNodeRequest,
33 option: Option<RequestOption>,
34 ) -> SDKResult<CreateSpaceNodeResponse> {
35 let result = create_space_node(request, &self.config, option).await?;
36 result.data.ok_or_else(|| {
37 crate::core::error::LarkAPIError::IllegalParamError(
38 "Response data is missing".to_string(),
39 )
40 })
41 }
42
43 pub async fn get(
45 &self,
46 request: GetSpaceNodeRequest,
47 option: Option<RequestOption>,
48 ) -> SDKResult<GetSpaceNodeResponse> {
49 let result = get_space_node(request, &self.config, option).await?;
50 result.data.ok_or_else(|| {
51 crate::core::error::LarkAPIError::IllegalParamError(
52 "Response data is missing".to_string(),
53 )
54 })
55 }
56
57 pub async fn list(
59 &self,
60 request: ListSpaceNodeRequest,
61 option: Option<RequestOption>,
62 ) -> SDKResult<ListSpaceNodeResponse> {
63 let result = list_space_node(request, &self.config, option).await?;
64 result.data.ok_or_else(|| {
65 crate::core::error::LarkAPIError::IllegalParamError(
66 "Response data is missing".to_string(),
67 )
68 })
69 }
70
71 pub async fn r#move(
73 &self,
74 request: MoveSpaceNodeRequest,
75 option: Option<RequestOption>,
76 ) -> SDKResult<MoveSpaceNodeResponse> {
77 let result = move_space_node(request, &self.config, option).await?;
78 result.data.ok_or_else(|| {
79 crate::core::error::LarkAPIError::IllegalParamError(
80 "Response data is missing".to_string(),
81 )
82 })
83 }
84
85 pub async fn update_title(
87 &self,
88 request: UpdateSpaceNodeTitleRequest,
89 option: Option<RequestOption>,
90 ) -> SDKResult<UpdateSpaceNodeTitleResponse> {
91 let result = update_space_node_title(request, &self.config, option).await?;
92 result.data.ok_or_else(|| {
93 crate::core::error::LarkAPIError::IllegalParamError(
94 "Response data is missing".to_string(),
95 )
96 })
97 }
98
99 pub async fn copy(
101 &self,
102 request: CopySpaceNodeRequest,
103 option: Option<RequestOption>,
104 ) -> SDKResult<CopySpaceNodeResponse> {
105 let result = copy_space_node(request, &self.config, option).await?;
106 result.data.ok_or_else(|| {
107 crate::core::error::LarkAPIError::IllegalParamError(
108 "Response data is missing".to_string(),
109 )
110 })
111 }
112}