tmf_client/tmf/
tmf638.rs

1//! TMF638 Service Inventory Management API
2
3// use tmflib::tmf637::v4::product::Product;
4use 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
14// /// TMF645 Service Qualification API
15// #[derive(Clone,Default,Debug)]
16// pub struct TMF645 {
17//     host : Uri,
18// }
19
20// impl HasNew<TMF645> for TMF645 {
21//     fn new(host : Uri) -> TMF645 {
22//         TMF645 {
23//             host
24//         }
25//     }
26// }
27
28// impl TMF645 {
29//     /// Access the Check Service Qualification API
30//     pub fn check_qualifcation(&mut self) -> TMF645CheckServiceQualification {
31//         TMF645CheckServiceQualification::new(self.config)
32//     }
33// }
34
35/// TMF638 Service Inventory Management API
36pub struct TMF638ServiceInventoryManagement {
37    config: Config,
38}
39
40impl TMF638ServiceInventoryManagement {
41    /// Create a new instance of the Service Inventory Management module of TMF638 API
42    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/// TMF638 API
90/// This module provides access to the Service Inventory Management API of TMF638.
91#[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    /// Access the Product Inventory Management API
104    pub fn service(&mut self) -> TMF638ServiceInventoryManagement {
105        super::tmf638::TMF638ServiceInventoryManagement::new(self.config.clone())
106    }
107}