use crate::client::BotClient;
use crate::error::Result;
use serde::Serialize;
use std::future::{Future, IntoFuture};
use std::pin::Pin;
#[derive(Serialize)]
struct SetPassportDataErrorsParams {
user_id: i64,
errors: Vec<serde_json::Value>,
}
pub struct SetPassportDataErrors {
client: BotClient,
params: SetPassportDataErrorsParams,
}
impl SetPassportDataErrors {
pub(crate) fn new(client: BotClient, user_id: i64, errors: Vec<serde_json::Value>) -> Self {
Self {
client,
params: SetPassportDataErrorsParams { user_id, errors },
}
}
}
impl IntoFuture for SetPassportDataErrors {
type Output = Result<bool>;
type IntoFuture = Pin<Box<dyn Future<Output = Self::Output> + Send>>;
fn into_future(self) -> Self::IntoFuture {
Box::pin(async move {
self.client
.post_json("setPassportDataErrors", &self.params)
.await
})
}
}