module-attach-line 0.0.2

This document describes LINE Messaging API.
Documentation
/*
 * LINE Messaging API
 *
 * This document describes LINE Messaging API.
 *
 * The version of the OpenAPI document: 0.0.1
 * 
 * Generated by: https://openapi-generator.tech
 */

use std::sync::Arc;
use std::borrow::Borrow;
use std::pin::Pin;
#[allow(unused_imports)]
use std::option::Option;

use hyper;
use hyper_util::client::legacy::connect::Connect;
use futures::Future;

use crate::models;
use super::{Error, configuration};
use super::request as __internal_request;

pub struct LineModuleAttachApiClient<C: Connect>
    where C: Clone + std::marker::Send + Sync + 'static {
    configuration: Arc<configuration::Configuration<C>>,
}

impl<C: Connect> LineModuleAttachApiClient<C>
    where C: Clone + std::marker::Send + Sync {
    pub fn new(configuration: Arc<configuration::Configuration<C>>) -> LineModuleAttachApiClient<C> {
        LineModuleAttachApiClient {
            configuration,
        }
    }
}

pub trait LineModuleAttachApi: Send + Sync {
    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>>;
}

impl<C: Connect>LineModuleAttachApi for LineModuleAttachApiClient<C>
    where C: Clone + std::marker::Send + Sync {
    #[allow(unused_mut)]
    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>> {
        let mut req = __internal_request::Request::new(hyper::Method::POST, "/module/auth/v1/token".to_string())
            .with_auth(__internal_request::Auth::Basic)
        ;
        req = req.with_form_param("grant_type".to_string(), grant_type.to_string());
        req = req.with_form_param("code".to_string(), code.to_string());
        req = req.with_form_param("redirect_uri".to_string(), redirect_uri.to_string());
        if let Some(param_value) = code_verifier {
            req = req.with_form_param("code_verifier".to_string(), param_value.to_string());
        }
        if let Some(param_value) = client_id {
            req = req.with_form_param("client_id".to_string(), param_value.to_string());
        }
        if let Some(param_value) = client_secret {
            req = req.with_form_param("client_secret".to_string(), param_value.to_string());
        }
        if let Some(param_value) = region {
            req = req.with_form_param("region".to_string(), param_value.to_string());
        }
        if let Some(param_value) = basic_search_id {
            req = req.with_form_param("basic_search_id".to_string(), param_value.to_string());
        }
        if let Some(param_value) = scope {
            req = req.with_form_param("scope".to_string(), param_value.to_string());
        }
        if let Some(param_value) = brand_type {
            req = req.with_form_param("brand_type".to_string(), param_value.to_string());
        }

        req.execute(self.configuration.borrow())
    }

}