1use tmflib::tmf638::service::Service;
5
6use super::{create_tmf, delete_tmf, get_tmf, list_tmf, update_tmf};
7use crate::common::tmf_error::TMFError;
8#[cfg(not(feature = "blocking"))]
9use crate::AsyncOperations;
10#[cfg(feature = "blocking")]
11use crate::BlockingOperations;
12use crate::{Config, HasNew};
13
14pub struct TMF638ServiceInventoryManagement {
37 config: Config,
38}
39
40impl TMF638ServiceInventoryManagement {
41 pub fn new(config: Config) -> TMF638ServiceInventoryManagement {
43 TMF638ServiceInventoryManagement { config }
44 }
45}
46
47#[cfg(feature = "blocking")]
48impl BlockingOperations for TMF638ServiceInventoryManagement {
49 type TMF = Service;
50
51 fn create(&self, item: Self::TMF) -> Result<Self::TMF, TMFError> {
52 create_tmf(&self.config, item)
53 }
54 fn delete(&self, id: impl Into<String>) -> Result<Self::TMF, TMFError> {
55 delete_tmf(&self.config, id.into())
56 }
57 fn get(&self, id: impl Into<String>) -> Result<Vec<Self::TMF>, TMFError> {
58 get_tmf(&self.config, id.into())
59 }
60 fn list(&self, filter: Option<crate::QueryOptions>) -> Result<Vec<Self::TMF>, TMFError> {
61 list_tmf(&self.config, filter)
62 }
63 fn update(&self, id: impl Into<String>, patch: Self::TMF) -> Result<Self::TMF, TMFError> {
64 update_tmf(&self.config, id.into(), patch)
65 }
66}
67
68#[cfg(not(feature = "blocking"))]
69impl AsyncOperations for TMF638ServiceInventoryManagement {
70 type TMF = Service;
71
72 async fn create(&self, item: Self::TMF) -> Result<Self::TMF, TMFError> {
73 create_tmf(&self.config, item).await
74 }
75 async fn delete(&self, id: impl Into<String>) -> Result<Self::TMF, TMFError> {
76 delete_tmf(&self.config, id.into()).await
77 }
78 async fn get(&self, id: impl Into<String>) -> Result<Vec<Self::TMF>, TMFError> {
79 get_tmf(&self.config, id.into()).await
80 }
81 async fn list(&self, filter: Option<crate::QueryOptions>) -> Result<Vec<Self::TMF>, TMFError> {
82 list_tmf(&self.config, filter).await
83 }
84 async fn update(&self, id: impl Into<String>, patch: Self::TMF) -> Result<Self::TMF, TMFError> {
85 update_tmf(&self.config, id.into(), patch).await
86 }
87}
88
89#[derive(Clone, Default, Debug)]
92pub struct TMF638 {
93 config: Config,
94}
95
96impl HasNew<TMF638> for TMF638 {
97 fn new(config: Config) -> TMF638 {
98 TMF638 { config }
99 }
100}
101
102impl TMF638 {
103 pub fn service(&mut self) -> TMF638ServiceInventoryManagement {
105 super::tmf638::TMF638ServiceInventoryManagement::new(self.config.clone())
106 }
107}