Change options param type in method sendPoll to InputPollOption

This commit is contained in:
Andrey Brusnik 2024-08-19 16:26:11 +04:00
parent 477fd49faa
commit a833bd89ad
No known key found for this signature in database
GPG key ID: D33232F28CFF442C
6 changed files with 13 additions and 13 deletions

View file

@ -1752,8 +1752,8 @@ Schema(
),
Param(
name: "options",
ty: ArrayOf(String),
descr: Doc(md: "A JSON-serialized list of answer options, 2-10 strings 1-100 characters each"),
ty: ArrayOf(RawTy("InputPollOption")),
descr: Doc(md: "A JSON-serialized list of 2-10 answer options"),
),
Param(
name: "is_anonymous",

View file

@ -473,7 +473,7 @@ trait ErasableRequester<'a> {
&self,
chat_id: Recipient,
question: String,
options: Vec<String>,
options: Vec<InputPollOption>,
) -> ErasedRequest<'a, SendPoll, Self::Err>;
fn send_dice(&self, chat_id: Recipient) -> ErasedRequest<'a, SendDice, Self::Err>;
@ -1234,7 +1234,7 @@ where
&self,
chat_id: Recipient,
question: String,
options: Vec<String>,
options: Vec<InputPollOption>,
) -> ErasedRequest<'a, SendPoll, Self::Err> {
Requester::send_poll(self, chat_id, question, options).erase()
}

View file

@ -6,8 +6,8 @@ use crate::{
requests::{JsonRequest, MultipartRequest},
types::{
BotCommand, BusinessConnectionId, ChatId, ChatPermissions, InlineQueryResult, InputFile,
InputMedia, InputSticker, LabeledPrice, MessageId, Recipient, Rgb, StickerFormat, ThreadId,
UserId,
InputMedia, InputPollOption, InputSticker, LabeledPrice, MessageId, Recipient, Rgb,
StickerFormat, ThreadId, UserId,
},
Bot,
};
@ -283,7 +283,7 @@ impl Requester for Bot {
where
C: Into<Recipient>,
Q: Into<String>,
O: IntoIterator<Item = String>,
O: IntoIterator<Item = InputPollOption>,
{
Self::SendPoll::new(self.clone(), payloads::SendPoll::new(chat_id, question, options))
}

View file

@ -646,7 +646,7 @@ macro_rules! requester_forward {
fn send_poll<C, Q, O>(&self, chat_id: C, question: Q, options: O) -> Self::SendPoll where C: Into<Recipient>,
Q: Into<String>,
O: IntoIterator<Item = String> {
O: IntoIterator<Item = InputPollOption> {
let this = self;
$body!(send_poll this (chat_id: C, question: Q, options: O))
}

View file

@ -4,8 +4,8 @@ use chrono::{DateTime, Utc};
use serde::Serialize;
use crate::types::{
BusinessConnectionId, Message, MessageEntity, ParseMode, PollType, Recipient, ReplyMarkup,
ReplyParameters, ThreadId,
BusinessConnectionId, InputPollOption, Message, MessageEntity, ParseMode, PollType, Recipient,
ReplyMarkup, ReplyParameters, ThreadId,
};
impl_payload! {
@ -19,8 +19,8 @@ impl_payload! {
pub chat_id: Recipient [into],
/// Poll question, 1-300 characters
pub question: String [into],
/// A JSON-serialized list of answer options, 2-10 strings 1-100 characters each
pub options: Vec<String> [collect],
/// A JSON-serialized list of 2-10 answer options
pub options: Vec<InputPollOption> [collect],
}
optional {
/// Unique identifier of the business connection on behalf of which the message will be sent

View file

@ -397,7 +397,7 @@ pub trait Requester {
where
C: Into<Recipient>,
Q: Into<String>,
O: IntoIterator<Item = String>;
O: IntoIterator<Item = InputPollOption>;
type SendDice: Request<Payload = SendDice, Err = Self::Err>;