module_line/apis/
line_module_api.rs

1/*
2 * LINE Messaging API
3 *
4 * This document describes LINE Messaging API.
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 LineModuleApiClient<C: Connect>
26    where C: Clone + std::marker::Send + Sync + 'static {
27    configuration: Arc<configuration::Configuration<C>>,
28}
29
30impl<C: Connect> LineModuleApiClient<C>
31    where C: Clone + std::marker::Send + Sync {
32    pub fn new(configuration: Arc<configuration::Configuration<C>>) -> LineModuleApiClient<C> {
33        LineModuleApiClient {
34            configuration,
35        }
36    }
37}
38
39pub trait LineModuleApi: Send + Sync {
40    fn acquire_chat_control(&self, chat_id: &str, acquire_chat_control_request: Option<models::AcquireChatControlRequest>) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
41    fn detach_module(&self, detach_module_request: Option<models::DetachModuleRequest>) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
42    fn get_modules(&self, start: Option<&str>, limit: Option<i32>) -> Pin<Box<dyn Future<Output = Result<models::GetModulesResponse, Error>> + Send>>;
43    fn release_chat_control(&self, chat_id: &str) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
44}
45
46impl<C: Connect>LineModuleApi for LineModuleApiClient<C>
47    where C: Clone + std::marker::Send + Sync {
48    #[allow(unused_mut)]
49    fn acquire_chat_control(&self, chat_id: &str, acquire_chat_control_request: Option<models::AcquireChatControlRequest>) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
50        let mut req = __internal_request::Request::new(hyper::Method::POST, "/v2/bot/chat/{chatId}/control/acquire".to_string())
51        ;
52        req = req.with_path_param("chatId".to_string(), chat_id.to_string());
53        req = req.with_body_param(acquire_chat_control_request);
54        req = req.returns_nothing();
55
56        req.execute(self.configuration.borrow())
57    }
58
59    #[allow(unused_mut)]
60    fn detach_module(&self, detach_module_request: Option<models::DetachModuleRequest>) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
61        let mut req = __internal_request::Request::new(hyper::Method::POST, "/v2/bot/channel/detach".to_string())
62        ;
63        req = req.with_body_param(detach_module_request);
64        req = req.returns_nothing();
65
66        req.execute(self.configuration.borrow())
67    }
68
69    #[allow(unused_mut)]
70    fn get_modules(&self, start: Option<&str>, limit: Option<i32>) -> Pin<Box<dyn Future<Output = Result<models::GetModulesResponse, Error>> + Send>> {
71        let mut req = __internal_request::Request::new(hyper::Method::GET, "/v2/bot/list".to_string())
72        ;
73        if let Some(ref s) = start {
74            let query_value = s.to_string();
75            req = req.with_query_param("start".to_string(), query_value);
76        }
77        if let Some(ref s) = limit {
78            let query_value = s.to_string();
79            req = req.with_query_param("limit".to_string(), query_value);
80        }
81
82        req.execute(self.configuration.borrow())
83    }
84
85    #[allow(unused_mut)]
86    fn release_chat_control(&self, chat_id: &str) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
87        let mut req = __internal_request::Request::new(hyper::Method::POST, "/v2/bot/chat/{chatId}/control/release".to_string())
88        ;
89        req = req.with_path_param("chatId".to_string(), chat_id.to_string());
90        req = req.returns_nothing();
91
92        req.execute(self.configuration.borrow())
93    }
94
95}