ferrisgram 0.2.1

An elegent rust client for the Telegram Bot API.
Documentation
// WARNING: THIS CODE IS AUTOGENERATED.
// DO NOT EDIT!!!

#![allow(clippy::too_many_arguments)]
use serde::Serialize;

use crate::error::Result;
use crate::types::BusinessConnection;
use crate::Bot;

impl Bot {
    /// Use this method to get information about the connection of the bot with a business account. Returns a BusinessConnection object on success.
    /// <https://core.telegram.org/bots/api#getbusinessconnection>
    pub fn get_business_connection(
        &self,
        business_connection_id: String,
    ) -> GetBusinessConnectionBuilder {
        GetBusinessConnectionBuilder::new(self, business_connection_id)
    }
}

#[derive(Serialize)]
pub struct GetBusinessConnectionBuilder<'a> {
    #[serde(skip)]
    bot: &'a Bot,
    /// Unique identifier of the business connection
    pub business_connection_id: String,
}

impl<'a> GetBusinessConnectionBuilder<'a> {
    pub fn new(bot: &'a Bot, business_connection_id: String) -> Self {
        Self {
            bot,
            business_connection_id,
        }
    }

    pub fn business_connection_id(mut self, business_connection_id: String) -> Self {
        self.business_connection_id = business_connection_id;
        self
    }

    pub async fn send(self) -> Result<BusinessConnection> {
        let form = serde_json::to_value(&self)?;
        self.bot.get("getBusinessConnection", Some(&form)).await
    }
}