1use tmflib::tmf633::service_candidate::ServiceCandidate;
4use tmflib::tmf633::service_catalog::ServiceCatalog;
5use tmflib::tmf633::service_category::ServiceCategory;
6use tmflib::tmf633::service_specification::ServiceSpecification;
7
8use super::{create_tmf, delete_tmf, get_tmf, list_tmf, update_tmf};
9use crate::common::tmf_error::TMFError;
10#[cfg(not(feature = "blocking"))]
11use crate::AsyncOperations;
12#[cfg(feature = "blocking")]
13use crate::BlockingOperations;
14use crate::{Config, HasNew};
15
16pub struct TMF633Candidate {
18 config: Config,
19}
20
21pub struct TMF633Catalog {
23 config: Config,
24}
25
26pub struct TMF633Category {
28 config: Config,
29}
30
31pub struct TMF633Specification {
33 config: Config,
34}
35
36#[cfg(feature = "blocking")]
37impl BlockingOperations for TMF633Candidate {
38 type TMF = ServiceCandidate;
39
40 fn create(&self, item: Self::TMF) -> Result<Self::TMF, TMFError> {
41 create_tmf(&self.config, item)
42 }
43 fn delete(&self, id: impl Into<String>) -> Result<Self::TMF, TMFError> {
44 delete_tmf(&self.config, id.into())
45 }
46 fn get(&self, id: impl Into<String>) -> Result<Vec<Self::TMF>, TMFError> {
47 get_tmf(&self.config, id.into())
48 }
49 fn list(&self, filter: Option<crate::QueryOptions>) -> Result<Vec<Self::TMF>, TMFError> {
50 list_tmf(&self.config, filter)
51 }
52 fn update(&self, id: impl Into<String>, patch: Self::TMF) -> Result<Self::TMF, TMFError> {
53 update_tmf(&self.config, id, patch)
54 }
55}
56
57#[cfg(not(feature = "blocking"))]
58impl AsyncOperations for TMF633Candidate {
59 type TMF = ServiceCandidate;
60
61 async fn create(&self, item: Self::TMF) -> Result<Self::TMF, TMFError> {
62 create_tmf(&self.config, item).await
63 }
64 async fn delete(&self, id: impl Into<String>) -> Result<Self::TMF, TMFError> {
65 delete_tmf(&self.config, id.into()).await
66 }
67 async fn get(&self, id: impl Into<String>) -> Result<Vec<Self::TMF>, TMFError> {
68 get_tmf(&self.config, id.into()).await
69 }
70 async fn list(&self, filter: Option<crate::QueryOptions>) -> Result<Vec<Self::TMF>, TMFError> {
71 list_tmf(&self.config, filter).await
72 }
73 async fn update(&self, id: impl Into<String>, patch: Self::TMF) -> Result<Self::TMF, TMFError> {
74 update_tmf(&self.config, id, patch).await
75 }
76}
77
78#[cfg(feature = "blocking")]
79impl BlockingOperations for TMF633Catalog {
80 type TMF = ServiceCatalog;
81
82 fn create(&self, item: Self::TMF) -> Result<Self::TMF, TMFError> {
83 create_tmf(&self.config, item)
84 }
85 fn delete(&self, id: impl Into<String>) -> Result<Self::TMF, TMFError> {
86 delete_tmf(&self.config, id.into())
87 }
88 fn get(&self, id: impl Into<String>) -> Result<Vec<Self::TMF>, TMFError> {
89 get_tmf(&self.config, id.into())
90 }
91 fn list(&self, filter: Option<crate::QueryOptions>) -> Result<Vec<Self::TMF>, TMFError> {
92 list_tmf(&self.config, filter)
93 }
94 fn update(&self, id: impl Into<String>, patch: Self::TMF) -> Result<Self::TMF, TMFError> {
95 update_tmf(&self.config, id, patch)
96 }
97}
98
99#[cfg(not(feature = "blocking"))]
100impl AsyncOperations for TMF633Catalog {
101 type TMF = ServiceCatalog;
102
103 async fn create(&self, item: Self::TMF) -> Result<Self::TMF, TMFError> {
104 create_tmf(&self.config, item).await
105 }
106 async fn delete(&self, id: impl Into<String>) -> Result<Self::TMF, TMFError> {
107 delete_tmf(&self.config, id.into()).await
108 }
109 async fn get(&self, id: impl Into<String>) -> Result<Vec<Self::TMF>, TMFError> {
110 get_tmf(&self.config, id.into()).await
111 }
112 async fn list(&self, filter: Option<crate::QueryOptions>) -> Result<Vec<Self::TMF>, TMFError> {
113 list_tmf(&self.config, filter).await
114 }
115 async fn update(&self, id: impl Into<String>, patch: Self::TMF) -> Result<Self::TMF, TMFError> {
116 update_tmf(&self.config, id, patch).await
117 }
118}
119
120#[cfg(feature = "blocking")]
121impl BlockingOperations for TMF633Category {
122 type TMF = ServiceCategory;
123
124 fn create(&self, item: Self::TMF) -> Result<Self::TMF, TMFError> {
125 create_tmf(&self.config, item)
126 }
127 fn delete(&self, id: impl Into<String>) -> Result<Self::TMF, TMFError> {
128 delete_tmf(&self.config, id)
129 }
130 fn get(&self, id: impl Into<String>) -> Result<Vec<Self::TMF>, TMFError> {
131 get_tmf(&self.config, id.into())
132 }
133 fn list(&self, filter: Option<crate::QueryOptions>) -> Result<Vec<Self::TMF>, TMFError> {
134 list_tmf(&self.config, filter)
135 }
136 fn update(&self, id: impl Into<String>, patch: Self::TMF) -> Result<Self::TMF, TMFError> {
137 update_tmf(&self.config, id, patch)
138 }
139}
140
141#[cfg(not(feature = "blocking"))]
142impl AsyncOperations for TMF633Category {
143 type TMF = ServiceCategory;
144
145 async fn create(&self, item: Self::TMF) -> Result<Self::TMF, TMFError> {
146 create_tmf(&self.config, item).await
147 }
148 async fn delete(&self, id: impl Into<String>) -> Result<Self::TMF, TMFError> {
149 delete_tmf(&self.config, id).await
150 }
151 async fn get(&self, id: impl Into<String>) -> Result<Vec<Self::TMF>, TMFError> {
152 get_tmf(&self.config, id.into()).await
153 }
154 async fn list(&self, filter: Option<crate::QueryOptions>) -> Result<Vec<Self::TMF>, TMFError> {
155 list_tmf(&self.config, filter).await
156 }
157 async fn update(&self, id: impl Into<String>, patch: Self::TMF) -> Result<Self::TMF, TMFError> {
158 update_tmf(&self.config, id, patch).await
159 }
160}
161
162#[cfg(feature = "blocking")]
163impl BlockingOperations for TMF633Specification {
164 type TMF = ServiceSpecification;
165
166 fn create(&self, item: Self::TMF) -> Result<Self::TMF, TMFError> {
167 create_tmf(&self.config, item)
168 }
169 fn delete(&self, id: impl Into<String>) -> Result<Self::TMF, TMFError> {
170 delete_tmf(&self.config, id)
171 }
172 fn get(&self, id: impl Into<String>) -> Result<Vec<Self::TMF>, TMFError> {
173 get_tmf(&self.config, id.into())
174 }
175 fn list(&self, filter: Option<crate::QueryOptions>) -> Result<Vec<Self::TMF>, TMFError> {
176 list_tmf(&self.config, filter)
177 }
178 fn update(&self, id: impl Into<String>, patch: Self::TMF) -> Result<Self::TMF, TMFError> {
179 update_tmf(&self.config, id, patch)
180 }
181}
182
183#[cfg(not(feature = "blocking"))]
184impl AsyncOperations for TMF633Specification {
185 type TMF = ServiceSpecification;
186
187 async fn create(&self, item: Self::TMF) -> Result<Self::TMF, TMFError> {
188 create_tmf(&self.config, item).await
189 }
190 async fn delete(&self, id: impl Into<String>) -> Result<Self::TMF, TMFError> {
191 delete_tmf(&self.config, id).await
192 }
193 async fn get(&self, id: impl Into<String>) -> Result<Vec<Self::TMF>, TMFError> {
194 get_tmf(&self.config, id.into()).await
195 }
196 async fn list(&self, filter: Option<crate::QueryOptions>) -> Result<Vec<Self::TMF>, TMFError> {
197 list_tmf(&self.config, filter).await
198 }
199 async fn update(&self, id: impl Into<String>, patch: Self::TMF) -> Result<Self::TMF, TMFError> {
200 update_tmf(&self.config, id, patch).await
201 }
202}
203
204#[derive(Clone, Debug)]
206pub struct TMF633 {
207 config: Config,
208}
209
210impl HasNew<TMF633> for TMF633 {
211 fn new(config: Config) -> TMF633 {
212 TMF633 { config }
213 }
214}
215
216impl TMF633 {
217 pub fn candidate(&self) -> TMF633Candidate {
219 TMF633Candidate {
220 config: self.config.clone(),
221 }
222 }
223
224 pub fn catalog(&self) -> TMF633Catalog {
226 TMF633Catalog {
227 config: self.config.clone(),
228 }
229 }
230
231 pub fn category(&self) -> TMF633Category {
233 TMF633Category {
234 config: self.config.clone(),
235 }
236 }
237
238 pub fn specification(&self) -> TMF633Specification {
240 TMF633Specification {
241 config: self.config.clone(),
242 }
243 }
244}