1use tmflib::tmf648::quote::Quote;
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
13pub struct TMF648Quote {
15 config: Config,
16}
17
18#[cfg(feature = "blocking")]
19impl BlockingOperations for TMF648Quote {
20 type TMF = Quote;
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.into())
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.into(), patch)
36 }
37}
38
39#[cfg(not(feature = "blocking"))]
40impl AsyncOperations for TMF648Quote {
41 type TMF = Quote;
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.into()).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.into(), patch).await
57 }
58}
59
60#[derive(Clone, Default, Debug)]
62pub struct TMF648 {
63 config: Config,
64}
65
66impl HasNew<TMF648> for TMF648 {
67 fn new(config: Config) -> TMF648 {
68 TMF648 { config }
69 }
70}
71
72impl TMF648 {
73 pub fn quote(&self) -> TMF648Quote {
75 TMF648Quote {
76 config: self.config.clone(),
77 }
78 }
79}