rustigram_api/methods/
passport.rs1use rustigram_types::passport::PassportElementError;
2
3use crate::client::BotClient;
4use crate::error::Result;
5use serde::Serialize;
6use std::future::{Future, IntoFuture};
7use std::pin::Pin;
8
9#[derive(Serialize)]
12struct SetPassportDataErrorsParams {
13 user_id: i64,
14 errors: Vec<PassportElementError>,
18}
19
20pub struct SetPassportDataErrors {
27 client: BotClient,
28 params: SetPassportDataErrorsParams,
29}
30
31impl SetPassportDataErrors {
32 pub(crate) fn new(client: BotClient, user_id: i64, errors: Vec<PassportElementError>) -> Self {
33 Self {
34 client,
35 params: SetPassportDataErrorsParams { user_id, errors },
36 }
37 }
38}
39
40impl IntoFuture for SetPassportDataErrors {
41 type Output = Result<bool>;
42 type IntoFuture = Pin<Box<dyn Future<Output = Self::Output> + Send>>;
43 fn into_future(self) -> Self::IntoFuture {
44 Box::pin(async move {
45 self.client
46 .post_json("setPassportDataErrors", &self.params)
47 .await
48 })
49 }
50}