termii_rust/async_impl/rest/insights/
insights.rs

1use std::sync::Arc;
2
3use crate::{
4    async_impl::{
5        http::client,
6        rest::insights::{Balance, History, Search, Status},
7    },
8};
9
10#[derive(Debug)]
11#[allow(dead_code)]
12pub struct Insights<'a> {
13    api_key: &'a str,
14    client: Arc<client::HttpClient>,
15    pub balance: Balance<'a>,
16    pub history: History<'a>,
17    pub search: Search<'a>,
18    pub status: Status<'a>,
19}
20
21impl<'a> Insights<'a> {
22    pub fn new(api_key: &'a str, client: Arc<client::HttpClient>) -> Insights<'a> {
23        let balance = Balance::new(&api_key, Arc::clone(&client));
24        let history = History::new(&api_key, Arc::clone(&client));
25        let search = Search::new(&api_key, Arc::clone(&client));
26        let status = Status::new(&api_key, Arc::clone(&client));
27
28        Insights {
29            api_key,
30            client,
31            balance,
32            history,
33            search,
34            status,
35        }
36    }
37}