insight_line/apis/
insight_api.rs

1/*
2 * LINE Messaging API(Insight)
3 *
4 * This document describes LINE Messaging API(Insight).
5 *
6 * The version of the OpenAPI document: 0.0.1
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11use std::sync::Arc;
12use std::borrow::Borrow;
13use std::pin::Pin;
14#[allow(unused_imports)]
15use std::option::Option;
16
17use hyper;
18use hyper_util::client::legacy::connect::Connect;
19use futures::Future;
20
21use crate::models;
22use super::{Error, configuration};
23use super::request as __internal_request;
24
25pub struct InsightApiClient<C: Connect>
26    where C: Clone + std::marker::Send + Sync + 'static {
27    configuration: Arc<configuration::Configuration<C>>,
28}
29
30impl<C: Connect> InsightApiClient<C>
31    where C: Clone + std::marker::Send + Sync {
32    pub fn new(configuration: Arc<configuration::Configuration<C>>) -> InsightApiClient<C> {
33        InsightApiClient {
34            configuration,
35        }
36    }
37}
38
39pub trait InsightApi: Send + Sync {
40    fn get_friends_demographics(&self, ) -> Pin<Box<dyn Future<Output = Result<models::GetFriendsDemographicsResponse, Error>> + Send>>;
41    fn get_message_event(&self, request_id: &str) -> Pin<Box<dyn Future<Output = Result<models::GetMessageEventResponse, Error>> + Send>>;
42    fn get_number_of_followers(&self, date: Option<&str>) -> Pin<Box<dyn Future<Output = Result<models::GetNumberOfFollowersResponse, Error>> + Send>>;
43    fn get_number_of_message_deliveries(&self, date: &str) -> Pin<Box<dyn Future<Output = Result<models::GetNumberOfMessageDeliveriesResponse, Error>> + Send>>;
44    fn get_statistics_per_unit(&self, custom_aggregation_unit: &str, from: &str, to: &str) -> Pin<Box<dyn Future<Output = Result<models::GetStatisticsPerUnitResponse, Error>> + Send>>;
45}
46
47impl<C: Connect>InsightApi for InsightApiClient<C>
48    where C: Clone + std::marker::Send + Sync {
49    #[allow(unused_mut)]
50    fn get_friends_demographics(&self, ) -> Pin<Box<dyn Future<Output = Result<models::GetFriendsDemographicsResponse, Error>> + Send>> {
51        let mut req = __internal_request::Request::new(hyper::Method::GET, "/v2/bot/insight/demographic".to_string())
52        ;
53
54        req.execute(self.configuration.borrow())
55    }
56
57    #[allow(unused_mut)]
58    fn get_message_event(&self, request_id: &str) -> Pin<Box<dyn Future<Output = Result<models::GetMessageEventResponse, Error>> + Send>> {
59        let mut req = __internal_request::Request::new(hyper::Method::GET, "/v2/bot/insight/message/event".to_string())
60        ;
61        req = req.with_query_param("requestId".to_string(), request_id.to_string());
62
63        req.execute(self.configuration.borrow())
64    }
65
66    #[allow(unused_mut)]
67    fn get_number_of_followers(&self, date: Option<&str>) -> Pin<Box<dyn Future<Output = Result<models::GetNumberOfFollowersResponse, Error>> + Send>> {
68        let mut req = __internal_request::Request::new(hyper::Method::GET, "/v2/bot/insight/followers".to_string())
69        ;
70        if let Some(ref s) = date {
71            let query_value = s.to_string();
72            req = req.with_query_param("date".to_string(), query_value);
73        }
74
75        req.execute(self.configuration.borrow())
76    }
77
78    #[allow(unused_mut)]
79    fn get_number_of_message_deliveries(&self, date: &str) -> Pin<Box<dyn Future<Output = Result<models::GetNumberOfMessageDeliveriesResponse, Error>> + Send>> {
80        let mut req = __internal_request::Request::new(hyper::Method::GET, "/v2/bot/insight/message/delivery".to_string())
81        ;
82        req = req.with_query_param("date".to_string(), date.to_string());
83
84        req.execute(self.configuration.borrow())
85    }
86
87    #[allow(unused_mut)]
88    fn get_statistics_per_unit(&self, custom_aggregation_unit: &str, from: &str, to: &str) -> Pin<Box<dyn Future<Output = Result<models::GetStatisticsPerUnitResponse, Error>> + Send>> {
89        let mut req = __internal_request::Request::new(hyper::Method::GET, "/v2/bot/insight/message/event/aggregation".to_string())
90        ;
91        req = req.with_query_param("customAggregationUnit".to_string(), custom_aggregation_unit.to_string());
92        req = req.with_query_param("from".to_string(), from.to_string());
93        req = req.with_query_param("to".to_string(), to.to_string());
94
95        req.execute(self.configuration.borrow())
96    }
97
98}