tmf_client/tmf/
tmf674.rs

1//! TMF674 Module
2
3use tmflib::tmf674::geographic_site_v4::GeographicSite;
4
5use super::{create_tmf, delete_tmf, get_tmf, list_tmf, update_tmf};
6use crate::common::tmf_error::TMFError;
7#[cfg(not(feature = "blocking"))]
8use crate::AsyncOperations;
9#[cfg(feature = "blocking")]
10use crate::BlockingOperations;
11use crate::{Config, HasNew};
12
13/// TMF674 GeographicSite API Object
14pub struct TMF674GeographicSite {
15    config: Config,
16}
17
18#[cfg(feature = "blocking")]
19impl BlockingOperations for TMF674GeographicSite {
20    type TMF = GeographicSite;
21
22    fn create(&self, item: Self::TMF) -> Result<Self::TMF, TMFError> {
23        create_tmf(&self.config, item)
24    }
25    fn delete(&self, id: impl Into<String>) -> Result<Self::TMF, TMFError> {
26        delete_tmf(&self.config, id)
27    }
28    fn get(&self, id: impl Into<String>) -> Result<Vec<Self::TMF>, TMFError> {
29        get_tmf(&self.config, id.into())
30    }
31    fn list(&self, filter: Option<crate::QueryOptions>) -> Result<Vec<Self::TMF>, TMFError> {
32        list_tmf(&self.config, filter)
33    }
34    fn update(&self, id: impl Into<String>, patch: Self::TMF) -> Result<Self::TMF, TMFError> {
35        update_tmf(&self.config, id, patch)
36    }
37}
38
39#[cfg(not(feature = "blocking"))]
40impl AsyncOperations for TMF674GeographicSite {
41    type TMF = GeographicSite;
42
43    async fn create(&self, item: Self::TMF) -> Result<Self::TMF, TMFError> {
44        create_tmf(&self.config, item).await
45    }
46    async fn delete(&self, id: impl Into<String>) -> Result<Self::TMF, TMFError> {
47        delete_tmf(&self.config, id).await
48    }
49    async fn get(&self, id: impl Into<String>) -> Result<Vec<Self::TMF>, TMFError> {
50        get_tmf(&self.config, id.into()).await
51    }
52    async fn list(&self, filter: Option<crate::QueryOptions>) -> Result<Vec<Self::TMF>, TMFError> {
53        list_tmf(&self.config, filter).await
54    }
55    async fn update(&self, id: impl Into<String>, patch: Self::TMF) -> Result<Self::TMF, TMFError> {
56        update_tmf(&self.config, id, patch).await
57    }
58}
59
60/// Product Catalogue API
61#[derive(Clone, Default, Debug)]
62pub struct TMF674 {
63    config: Config,
64}
65
66impl HasNew<TMF674> for TMF674 {
67    fn new(config: Config) -> TMF674 {
68        TMF674 { config }
69    }
70}
71
72impl TMF674 {
73    /// Provide a GeographicSite API object
74    pub fn site(&self) -> TMF674GeographicSite {
75        TMF674GeographicSite {
76            config: self.config.clone(),
77        }
78    }
79}