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( Param(
name: "options", name: "options",
ty: ArrayOf(String), ty: ArrayOf(RawTy("InputPollOption")),
descr: Doc(md: "A JSON-serialized list of answer options, 2-10 strings 1-100 characters each"), descr: Doc(md: "A JSON-serialized list of 2-10 answer options"),
), ),
Param( Param(
name: "is_anonymous", name: "is_anonymous",

View file

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

View file

@ -6,8 +6,8 @@ use crate::{
requests::{JsonRequest, MultipartRequest}, requests::{JsonRequest, MultipartRequest},
types::{ types::{
BotCommand, BusinessConnectionId, ChatId, ChatPermissions, InlineQueryResult, InputFile, BotCommand, BusinessConnectionId, ChatId, ChatPermissions, InlineQueryResult, InputFile,
InputMedia, InputSticker, LabeledPrice, MessageId, Recipient, Rgb, StickerFormat, ThreadId, InputMedia, InputPollOption, InputSticker, LabeledPrice, MessageId, Recipient, Rgb,
UserId, StickerFormat, ThreadId, UserId,
}, },
Bot, Bot,
}; };
@ -283,7 +283,7 @@ impl Requester for Bot {
where where
C: Into<Recipient>, C: Into<Recipient>,
Q: Into<String>, Q: Into<String>,
O: IntoIterator<Item = String>, O: IntoIterator<Item = InputPollOption>,
{ {
Self::SendPoll::new(self.clone(), payloads::SendPoll::new(chat_id, question, options)) 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>, fn send_poll<C, Q, O>(&self, chat_id: C, question: Q, options: O) -> Self::SendPoll where C: Into<Recipient>,
Q: Into<String>, Q: Into<String>,
O: IntoIterator<Item = String> { O: IntoIterator<Item = InputPollOption> {
let this = self; let this = self;
$body!(send_poll this (chat_id: C, question: Q, options: O)) $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 serde::Serialize;
use crate::types::{ use crate::types::{
BusinessConnectionId, Message, MessageEntity, ParseMode, PollType, Recipient, ReplyMarkup, BusinessConnectionId, InputPollOption, Message, MessageEntity, ParseMode, PollType, Recipient,
ReplyParameters, ThreadId, ReplyMarkup, ReplyParameters, ThreadId,
}; };
impl_payload! { impl_payload! {
@ -19,8 +19,8 @@ impl_payload! {
pub chat_id: Recipient [into], pub chat_id: Recipient [into],
/// Poll question, 1-300 characters /// Poll question, 1-300 characters
pub question: String [into], pub question: String [into],
/// A JSON-serialized list of answer options, 2-10 strings 1-100 characters each /// A JSON-serialized list of 2-10 answer options
pub options: Vec<String> [collect], pub options: Vec<InputPollOption> [collect],
} }
optional { optional {
/// Unique identifier of the business connection on behalf of which the message will be sent /// 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 where
C: Into<Recipient>, C: Into<Recipient>,
Q: Into<String>, Q: Into<String>,
O: IntoIterator<Item = String>; O: IntoIterator<Item = InputPollOption>;
type SendDice: Request<Payload = SendDice, Err = Self::Err>; type SendDice: Request<Payload = SendDice, Err = Self::Err>;