module_attach_line/apis/
line_module_attach_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 LineModuleAttachApiClient<C: Connect>
26    where C: Clone + std::marker::Send + Sync + 'static {
27    configuration: Arc<configuration::Configuration<C>>,
28}
29
30impl<C: Connect> LineModuleAttachApiClient<C>
31    where C: Clone + std::marker::Send + Sync {
32    pub fn new(configuration: Arc<configuration::Configuration<C>>) -> LineModuleAttachApiClient<C> {
33        LineModuleAttachApiClient {
34            configuration,
35        }
36    }
37}
38
39pub trait LineModuleAttachApi: Send + Sync {
40    fn attach_module(&self, grant_type: &str, code: &str, redirect_uri: &str, code_verifier: Option<&str>, client_id: Option<&str>, client_secret: Option<&str>, region: Option<&str>, basic_search_id: Option<&str>, scope: Option<&str>, brand_type: Option<&str>) -> Pin<Box<dyn Future<Output = Result<models::AttachModuleResponse, Error>> + Send>>;
41}
42
43impl<C: Connect>LineModuleAttachApi for LineModuleAttachApiClient<C>
44    where C: Clone + std::marker::Send + Sync {
45    #[allow(unused_mut)]
46    fn attach_module(&self, grant_type: &str, code: &str, redirect_uri: &str, code_verifier: Option<&str>, client_id: Option<&str>, client_secret: Option<&str>, region: Option<&str>, basic_search_id: Option<&str>, scope: Option<&str>, brand_type: Option<&str>) -> Pin<Box<dyn Future<Output = Result<models::AttachModuleResponse, Error>> + Send>> {
47        let mut req = __internal_request::Request::new(hyper::Method::POST, "/module/auth/v1/token".to_string())
48            .with_auth(__internal_request::Auth::Basic)
49        ;
50        req = req.with_form_param("grant_type".to_string(), grant_type.to_string());
51        req = req.with_form_param("code".to_string(), code.to_string());
52        req = req.with_form_param("redirect_uri".to_string(), redirect_uri.to_string());
53        if let Some(param_value) = code_verifier {
54            req = req.with_form_param("code_verifier".to_string(), param_value.to_string());
55        }
56        if let Some(param_value) = client_id {
57            req = req.with_form_param("client_id".to_string(), param_value.to_string());
58        }
59        if let Some(param_value) = client_secret {
60            req = req.with_form_param("client_secret".to_string(), param_value.to_string());
61        }
62        if let Some(param_value) = region {
63            req = req.with_form_param("region".to_string(), param_value.to_string());
64        }
65        if let Some(param_value) = basic_search_id {
66            req = req.with_form_param("basic_search_id".to_string(), param_value.to_string());
67        }
68        if let Some(param_value) = scope {
69            req = req.with_form_param("scope".to_string(), param_value.to_string());
70        }
71        if let Some(param_value) = brand_type {
72            req = req.with_form_param("brand_type".to_string(), param_value.to_string());
73        }
74
75        req.execute(self.configuration.borrow())
76    }
77
78}