1use crate::types::*;
2use crate::helpers::*;
3
4impl From<ChatMemberOwner> for ChatMember {
5 fn from(o: ChatMemberOwner) -> Self {
6 Self::Owner(o)
7 }
8}
9
10impl From<ChatMemberAdministrator> for ChatMember {
11 fn from(o: ChatMemberAdministrator) -> Self {
12 Self::Administrator(o)
13 }
14}
15
16impl From<ChatMemberMember> for ChatMember {
17 fn from(o: ChatMemberMember) -> Self {
18 Self::Member(o)
19 }
20}
21
22impl From<ChatMemberRestricted> for ChatMember {
23 fn from(o: ChatMemberRestricted) -> Self {
24 Self::Restricted(o)
25 }
26}
27
28impl From<ChatMemberLeft> for ChatMember {
29 fn from(o: ChatMemberLeft) -> Self {
30 Self::Left(o)
31 }
32}
33
34impl From<ChatMemberBanned> for ChatMember {
35 fn from(o: ChatMemberBanned) -> Self {
36 Self::Banned(o)
37 }
38}
39
40impl From<BotCommandScopeDefault> for BotCommandScope {
41 fn from(o: BotCommandScopeDefault) -> Self {
42 Self::Default(o)
43 }
44}
45
46impl From<BotCommandScopeAllPrivateChats> for BotCommandScope {
47 fn from(o: BotCommandScopeAllPrivateChats) -> Self {
48 Self::AllPrivateChats(o)
49 }
50}
51
52impl From<BotCommandScopeAllGroupChats> for BotCommandScope {
53 fn from(o: BotCommandScopeAllGroupChats) -> Self {
54 Self::AllGroupChats(o)
55 }
56}
57
58impl From<BotCommandScopeAllChatAdministrators> for BotCommandScope {
59 fn from(o: BotCommandScopeAllChatAdministrators) -> Self {
60 Self::AllChatAdministrators(o)
61 }
62}
63
64impl From<BotCommandScopeChat> for BotCommandScope {
65 fn from(o: BotCommandScopeChat) -> Self {
66 Self::Chat(o)
67 }
68}
69
70impl From<BotCommandScopeChatAdministrators> for BotCommandScope {
71 fn from(o: BotCommandScopeChatAdministrators) -> Self {
72 Self::ChatAdministrators(o)
73 }
74}
75
76impl From<BotCommandScopeChatMember> for BotCommandScope {
77 fn from(o: BotCommandScopeChatMember) -> Self {
78 Self::ChatMember(o)
79 }
80}
81
82impl From<MenuButtonCommands> for MenuButton {
83 fn from(o: MenuButtonCommands) -> Self {
84 Self::Commands(o)
85 }
86}
87
88impl From<MenuButtonWebApp> for MenuButton {
89 fn from(o: MenuButtonWebApp) -> Self {
90 Self::WebApp(o)
91 }
92}
93
94impl From<MenuButtonDefault> for MenuButton {
95 fn from(o: MenuButtonDefault) -> Self {
96 Self::Default(o)
97 }
98}
99
100impl crate::TgObject for InputMedia {
101 fn add_file(&self, mut form: reqwest::multipart::Form) -> reqwest::multipart::Form {
102 match self {
103 Self::Animation(e) => e.add_file(form),
104 Self::Document(e) => e.add_file(form),
105 Self::Audio(e) => e.add_file(form),
106 Self::Video(e) => e.add_file(form),
107 _ => form,
108 }
109 }
110}
111
112impl From<InputMediaAnimation> for InputMedia {
113 fn from(o: InputMediaAnimation) -> Self {
114 Self::Animation(o)
115 }
116}
117
118impl From<InputMediaDocument> for InputMedia {
119 fn from(o: InputMediaDocument) -> Self {
120 Self::Document(o)
121 }
122}
123
124impl From<InputMediaAudio> for InputMedia {
125 fn from(o: InputMediaAudio) -> Self {
126 Self::Audio(o)
127 }
128}
129
130impl From<InputMediaPhoto> for InputMedia {
131 fn from(o: InputMediaPhoto) -> Self {
132 Self::Photo(o)
133 }
134}
135
136impl From<InputMediaVideo> for InputMedia {
137 fn from(o: InputMediaVideo) -> Self {
138 Self::Video(o)
139 }
140}
141
142impl From<InlineQueryResultCachedAudio> for InlineQueryResult {
143 fn from(o: InlineQueryResultCachedAudio) -> Self {
144 Self::CachedAudio(o)
145 }
146}
147
148impl From<InlineQueryResultCachedDocument> for InlineQueryResult {
149 fn from(o: InlineQueryResultCachedDocument) -> Self {
150 Self::CachedDocument(o)
151 }
152}
153
154impl From<InlineQueryResultCachedGif> for InlineQueryResult {
155 fn from(o: InlineQueryResultCachedGif) -> Self {
156 Self::CachedGif(o)
157 }
158}
159
160impl From<InlineQueryResultCachedMpeg4Gif> for InlineQueryResult {
161 fn from(o: InlineQueryResultCachedMpeg4Gif) -> Self {
162 Self::CachedMpeg4Gif(o)
163 }
164}
165
166impl From<InlineQueryResultCachedPhoto> for InlineQueryResult {
167 fn from(o: InlineQueryResultCachedPhoto) -> Self {
168 Self::CachedPhoto(o)
169 }
170}
171
172impl From<InlineQueryResultCachedSticker> for InlineQueryResult {
173 fn from(o: InlineQueryResultCachedSticker) -> Self {
174 Self::CachedSticker(o)
175 }
176}
177
178impl From<InlineQueryResultCachedVideo> for InlineQueryResult {
179 fn from(o: InlineQueryResultCachedVideo) -> Self {
180 Self::CachedVideo(o)
181 }
182}
183
184impl From<InlineQueryResultCachedVoice> for InlineQueryResult {
185 fn from(o: InlineQueryResultCachedVoice) -> Self {
186 Self::CachedVoice(o)
187 }
188}
189
190impl From<InlineQueryResultArticle> for InlineQueryResult {
191 fn from(o: InlineQueryResultArticle) -> Self {
192 Self::Article(o)
193 }
194}
195
196impl From<InlineQueryResultAudio> for InlineQueryResult {
197 fn from(o: InlineQueryResultAudio) -> Self {
198 Self::Audio(o)
199 }
200}
201
202impl From<InlineQueryResultContact> for InlineQueryResult {
203 fn from(o: InlineQueryResultContact) -> Self {
204 Self::Contact(o)
205 }
206}
207
208impl From<InlineQueryResultGame> for InlineQueryResult {
209 fn from(o: InlineQueryResultGame) -> Self {
210 Self::Game(o)
211 }
212}
213
214impl From<InlineQueryResultDocument> for InlineQueryResult {
215 fn from(o: InlineQueryResultDocument) -> Self {
216 Self::Document(o)
217 }
218}
219
220impl From<InlineQueryResultGif> for InlineQueryResult {
221 fn from(o: InlineQueryResultGif) -> Self {
222 Self::Gif(o)
223 }
224}
225
226impl From<InlineQueryResultLocation> for InlineQueryResult {
227 fn from(o: InlineQueryResultLocation) -> Self {
228 Self::Location(o)
229 }
230}
231
232impl From<InlineQueryResultMpeg4Gif> for InlineQueryResult {
233 fn from(o: InlineQueryResultMpeg4Gif) -> Self {
234 Self::Mpeg4Gif(o)
235 }
236}
237
238impl From<InlineQueryResultPhoto> for InlineQueryResult {
239 fn from(o: InlineQueryResultPhoto) -> Self {
240 Self::Photo(o)
241 }
242}
243
244impl From<InlineQueryResultVenue> for InlineQueryResult {
245 fn from(o: InlineQueryResultVenue) -> Self {
246 Self::Venue(o)
247 }
248}
249
250impl From<InlineQueryResultVideo> for InlineQueryResult {
251 fn from(o: InlineQueryResultVideo) -> Self {
252 Self::Video(o)
253 }
254}
255
256impl From<InlineQueryResultVoice> for InlineQueryResult {
257 fn from(o: InlineQueryResultVoice) -> Self {
258 Self::Voice(o)
259 }
260}
261
262impl From<InputTextMessageContent> for InputMessageContent {
263 fn from(o: InputTextMessageContent) -> Self {
264 Self::Text(o)
265 }
266}
267
268impl From<InputLocationMessageContent> for InputMessageContent {
269 fn from(o: InputLocationMessageContent) -> Self {
270 Self::Location(o)
271 }
272}
273
274impl From<InputVenueMessageContent> for InputMessageContent {
275 fn from(o: InputVenueMessageContent) -> Self {
276 Self::Venue(o)
277 }
278}
279
280impl From<InputContactMessageContent> for InputMessageContent {
281 fn from(o: InputContactMessageContent) -> Self {
282 Self::Contact(o)
283 }
284}
285
286impl From<InputInvoiceMessageContent> for InputMessageContent {
287 fn from(o: InputInvoiceMessageContent) -> Self {
288 Self::Invoice(o)
289 }
290}
291
292impl From<PassportElementErrorDataField> for PassportElementError {
293 fn from(o: PassportElementErrorDataField) -> Self {
294 Self::DataField(o)
295 }
296}
297
298impl From<PassportElementErrorFrontSide> for PassportElementError {
299 fn from(o: PassportElementErrorFrontSide) -> Self {
300 Self::FrontSide(o)
301 }
302}
303
304impl From<PassportElementErrorReverseSide> for PassportElementError {
305 fn from(o: PassportElementErrorReverseSide) -> Self {
306 Self::ReverseSide(o)
307 }
308}
309
310impl From<PassportElementErrorSelfie> for PassportElementError {
311 fn from(o: PassportElementErrorSelfie) -> Self {
312 Self::Selfie(o)
313 }
314}
315
316impl From<PassportElementErrorFile> for PassportElementError {
317 fn from(o: PassportElementErrorFile) -> Self {
318 Self::File(o)
319 }
320}
321
322impl From<PassportElementErrorFiles> for PassportElementError {
323 fn from(o: PassportElementErrorFiles) -> Self {
324 Self::Files(o)
325 }
326}
327
328impl From<PassportElementErrorTranslationFile> for PassportElementError {
329 fn from(o: PassportElementErrorTranslationFile) -> Self {
330 Self::TranslationFile(o)
331 }
332}
333
334impl From<PassportElementErrorTranslationFiles> for PassportElementError {
335 fn from(o: PassportElementErrorTranslationFiles) -> Self {
336 Self::TranslationFiles(o)
337 }
338}
339
340impl From<PassportElementErrorUnspecified> for PassportElementError {
341 fn from(o: PassportElementErrorUnspecified) -> Self {
342 Self::Unspecified(o)
343 }
344}
345
346impl From<InlineKeyboardMarkup> for ReplyMarkup {
347 fn from(o: InlineKeyboardMarkup) -> Self {
348 Self::InlineKeyboardMarkup(o)
349 }
350}
351
352impl From<ReplyKeyboardMarkup> for ReplyMarkup {
353 fn from(o: ReplyKeyboardMarkup) -> Self {
354 Self::Keyboard(o)
355 }
356}
357
358impl From<ReplyKeyboardRemove> for ReplyMarkup {
359 fn from(o: ReplyKeyboardRemove) -> Self {
360 Self::KeyboardRemove(o)
361 }
362}
363
364impl From<ForceReply> for ReplyMarkup {
365 fn from(o: ForceReply) -> Self {
366 Self::Force(o)
367 }
368}
369
370impl User {
371 pub fn new(id: i64, is_bot: bool, first_name: String, ) -> Self {
372 Self {
373 id,
374 is_bot,
375 first_name,
376 last_name: None,
377 username: None,
378 language_code: None,
379 is_premium: None,
380 added_to_attachment_menu: None,
381 can_join_groups: None,
382 can_read_all_group_messages: None,
383 supports_inline_queries: None,
384 }
385 }
386}
387
388impl User {
389 pub fn with_last_name(mut self, last_name: String) -> Self {
390 self.last_name = Some(last_name);
391 self
392 }
393
394 pub fn with_username(mut self, username: String) -> Self {
395 self.username = Some(username);
396 self
397 }
398
399 pub fn with_language_code(mut self, language_code: String) -> Self {
400 self.language_code = Some(language_code);
401 self
402 }
403
404 pub fn with_is_premium(mut self, is_premium: bool) -> Self {
405 self.is_premium = Some(is_premium);
406 self
407 }
408
409 pub fn with_added_to_attachment_menu(mut self, added_to_attachment_menu: bool) -> Self {
410 self.added_to_attachment_menu = Some(added_to_attachment_menu);
411 self
412 }
413
414 pub fn with_can_join_groups(mut self, can_join_groups: bool) -> Self {
415 self.can_join_groups = Some(can_join_groups);
416 self
417 }
418
419 pub fn with_can_read_all_group_messages(mut self, can_read_all_group_messages: bool) -> Self {
420 self.can_read_all_group_messages = Some(can_read_all_group_messages);
421 self
422 }
423
424 pub fn with_supports_inline_queries(mut self, supports_inline_queries: bool) -> Self {
425 self.supports_inline_queries = Some(supports_inline_queries);
426 self
427 }
428
429}
430
431impl MessageEntity {
432 pub fn new(type_: String, offset: i64, length: i64, ) -> Self {
433 Self {
434 type_,
435 offset,
436 length,
437 url: None,
438 user: None,
439 language: None,
440 custom_emoji_id: None,
441 }
442 }
443}
444
445impl MessageEntity {
446 pub fn with_url(mut self, url: String) -> Self {
447 self.url = Some(url);
448 self
449 }
450
451 pub fn with_user(mut self, user: User) -> Self {
452 self.user = Some(user);
453 self
454 }
455
456 pub fn with_language(mut self, language: String) -> Self {
457 self.language = Some(language);
458 self
459 }
460
461 pub fn with_custom_emoji_id(mut self, custom_emoji_id: String) -> Self {
462 self.custom_emoji_id = Some(custom_emoji_id);
463 self
464 }
465
466}
467
468impl WebAppInfo {
469 pub fn new(url: String, ) -> Self {
470 Self {
471 url,
472 }
473 }
474}
475
476impl ReplyKeyboardMarkup {
477 pub fn new(keyboard: Vec<Vec<KeyboardButton>>, ) -> Self {
478 Self {
479 keyboard,
480 is_persistent: None,
481 resize_keyboard: None,
482 one_time_keyboard: None,
483 input_field_placeholder: None,
484 selective: None,
485 }
486 }
487}
488
489impl ReplyKeyboardMarkup {
490 pub fn with_is_persistent(mut self, is_persistent: bool) -> Self {
491 self.is_persistent = Some(is_persistent);
492 self
493 }
494
495 pub fn with_resize_keyboard(mut self, resize_keyboard: bool) -> Self {
496 self.resize_keyboard = Some(resize_keyboard);
497 self
498 }
499
500 pub fn with_one_time_keyboard(mut self, one_time_keyboard: bool) -> Self {
501 self.one_time_keyboard = Some(one_time_keyboard);
502 self
503 }
504
505 pub fn with_input_field_placeholder(mut self, input_field_placeholder: String) -> Self {
506 self.input_field_placeholder = Some(input_field_placeholder);
507 self
508 }
509
510 pub fn with_selective(mut self, selective: bool) -> Self {
511 self.selective = Some(selective);
512 self
513 }
514
515}
516
517impl KeyboardButton {
518 pub fn new(text: String, ) -> Self {
519 Self {
520 text,
521 request_user: None,
522 request_chat: None,
523 request_contact: None,
524 request_location: None,
525 request_poll: None,
526 web_app: None,
527 }
528 }
529}
530
531impl KeyboardButton {
532 pub fn with_request_user(mut self, request_user: KeyboardButtonRequestUser) -> Self {
533 self.request_user = Some(request_user);
534 self
535 }
536
537 pub fn with_request_chat(mut self, request_chat: KeyboardButtonRequestChat) -> Self {
538 self.request_chat = Some(request_chat);
539 self
540 }
541
542 pub fn with_request_contact(mut self, request_contact: bool) -> Self {
543 self.request_contact = Some(request_contact);
544 self
545 }
546
547 pub fn with_request_location(mut self, request_location: bool) -> Self {
548 self.request_location = Some(request_location);
549 self
550 }
551
552 pub fn with_request_poll(mut self, request_poll: KeyboardButtonPollType) -> Self {
553 self.request_poll = Some(request_poll);
554 self
555 }
556
557 pub fn with_web_app(mut self, web_app: WebAppInfo) -> Self {
558 self.web_app = Some(web_app);
559 self
560 }
561
562}
563
564impl KeyboardButtonRequestUser {
565 pub fn new(request_id: i64, ) -> Self {
566 Self {
567 request_id,
568 user_is_bot: None,
569 user_is_premium: None,
570 }
571 }
572}
573
574impl KeyboardButtonRequestUser {
575 pub fn with_user_is_bot(mut self, user_is_bot: bool) -> Self {
576 self.user_is_bot = Some(user_is_bot);
577 self
578 }
579
580 pub fn with_user_is_premium(mut self, user_is_premium: bool) -> Self {
581 self.user_is_premium = Some(user_is_premium);
582 self
583 }
584
585}
586
587impl KeyboardButtonRequestChat {
588 pub fn new(request_id: i64, chat_is_channel: bool, ) -> Self {
589 Self {
590 request_id,
591 chat_is_channel,
592 chat_is_forum: None,
593 chat_has_username: None,
594 chat_is_created: None,
595 user_administrator_rights: None,
596 bot_administrator_rights: None,
597 bot_is_member: None,
598 }
599 }
600}
601
602impl KeyboardButtonRequestChat {
603 pub fn with_chat_is_forum(mut self, chat_is_forum: bool) -> Self {
604 self.chat_is_forum = Some(chat_is_forum);
605 self
606 }
607
608 pub fn with_chat_has_username(mut self, chat_has_username: bool) -> Self {
609 self.chat_has_username = Some(chat_has_username);
610 self
611 }
612
613 pub fn with_chat_is_created(mut self, chat_is_created: bool) -> Self {
614 self.chat_is_created = Some(chat_is_created);
615 self
616 }
617
618 pub fn with_user_administrator_rights(mut self, user_administrator_rights: ChatAdministratorRights) -> Self {
619 self.user_administrator_rights = Some(user_administrator_rights);
620 self
621 }
622
623 pub fn with_bot_administrator_rights(mut self, bot_administrator_rights: ChatAdministratorRights) -> Self {
624 self.bot_administrator_rights = Some(bot_administrator_rights);
625 self
626 }
627
628 pub fn with_bot_is_member(mut self, bot_is_member: bool) -> Self {
629 self.bot_is_member = Some(bot_is_member);
630 self
631 }
632
633}
634
635impl KeyboardButtonPollType {
636 pub fn with_type(mut self, type_: String) -> Self {
637 self.type_ = Some(type_);
638 self
639 }
640
641}
642
643impl ReplyKeyboardRemove {
644 pub fn new(remove_keyboard: bool, ) -> Self {
645 Self {
646 remove_keyboard,
647 selective: None,
648 }
649 }
650}
651
652impl ReplyKeyboardRemove {
653 pub fn with_selective(mut self, selective: bool) -> Self {
654 self.selective = Some(selective);
655 self
656 }
657
658}
659
660impl InlineKeyboardMarkup {
661 pub fn new(inline_keyboard: Vec<Vec<InlineKeyboardButton>>, ) -> Self {
662 Self {
663 inline_keyboard,
664 }
665 }
666}
667
668impl InlineKeyboardButton {
669 pub fn new(text: String, ) -> Self {
670 Self {
671 text,
672 url: None,
673 callback_data: None,
674 web_app: None,
675 login_url: None,
676 switch_inline_query: None,
677 switch_inline_query_current_chat: None,
678 callback_game: None,
679 pay: None,
680 }
681 }
682}
683
684impl InlineKeyboardButton {
685 pub fn with_url(mut self, url: String) -> Self {
686 self.url = Some(url);
687 self
688 }
689
690 pub fn with_callback_data(mut self, callback_data: String) -> Self {
691 self.callback_data = Some(callback_data);
692 self
693 }
694
695 pub fn with_web_app(mut self, web_app: WebAppInfo) -> Self {
696 self.web_app = Some(web_app);
697 self
698 }
699
700 pub fn with_login_url(mut self, login_url: LoginUrl) -> Self {
701 self.login_url = Some(login_url);
702 self
703 }
704
705 pub fn with_switch_inline_query(mut self, switch_inline_query: String) -> Self {
706 self.switch_inline_query = Some(switch_inline_query);
707 self
708 }
709
710 pub fn with_switch_inline_query_current_chat(mut self, switch_inline_query_current_chat: String) -> Self {
711 self.switch_inline_query_current_chat = Some(switch_inline_query_current_chat);
712 self
713 }
714
715 pub fn with_callback_game(mut self, callback_game: CallbackGame) -> Self {
716 self.callback_game = Some(callback_game);
717 self
718 }
719
720 pub fn with_pay(mut self, pay: bool) -> Self {
721 self.pay = Some(pay);
722 self
723 }
724
725}
726
727impl LoginUrl {
728 pub fn new(url: String, ) -> Self {
729 Self {
730 url,
731 forward_text: None,
732 bot_username: None,
733 request_write_access: None,
734 }
735 }
736}
737
738impl LoginUrl {
739 pub fn with_forward_text(mut self, forward_text: String) -> Self {
740 self.forward_text = Some(forward_text);
741 self
742 }
743
744 pub fn with_bot_username(mut self, bot_username: String) -> Self {
745 self.bot_username = Some(bot_username);
746 self
747 }
748
749 pub fn with_request_write_access(mut self, request_write_access: bool) -> Self {
750 self.request_write_access = Some(request_write_access);
751 self
752 }
753
754}
755
756impl ForceReply {
757 pub fn new(force_reply: bool, ) -> Self {
758 Self {
759 force_reply,
760 input_field_placeholder: None,
761 selective: None,
762 }
763 }
764}
765
766impl ForceReply {
767 pub fn with_input_field_placeholder(mut self, input_field_placeholder: String) -> Self {
768 self.input_field_placeholder = Some(input_field_placeholder);
769 self
770 }
771
772 pub fn with_selective(mut self, selective: bool) -> Self {
773 self.selective = Some(selective);
774 self
775 }
776
777}
778
779impl ChatAdministratorRights {
780 pub fn new(is_anonymous: bool, can_manage_chat: bool, can_delete_messages: bool, can_manage_video_chats: bool, can_restrict_members: bool, can_promote_members: bool, can_change_info: bool, can_invite_users: bool, ) -> Self {
781 Self {
782 is_anonymous,
783 can_manage_chat,
784 can_delete_messages,
785 can_manage_video_chats,
786 can_restrict_members,
787 can_promote_members,
788 can_change_info,
789 can_invite_users,
790 can_post_messages: None,
791 can_edit_messages: None,
792 can_pin_messages: None,
793 can_manage_topics: None,
794 }
795 }
796}
797
798impl ChatAdministratorRights {
799 pub fn with_can_post_messages(mut self, can_post_messages: bool) -> Self {
800 self.can_post_messages = Some(can_post_messages);
801 self
802 }
803
804 pub fn with_can_edit_messages(mut self, can_edit_messages: bool) -> Self {
805 self.can_edit_messages = Some(can_edit_messages);
806 self
807 }
808
809 pub fn with_can_pin_messages(mut self, can_pin_messages: bool) -> Self {
810 self.can_pin_messages = Some(can_pin_messages);
811 self
812 }
813
814 pub fn with_can_manage_topics(mut self, can_manage_topics: bool) -> Self {
815 self.can_manage_topics = Some(can_manage_topics);
816 self
817 }
818
819}
820
821impl ChatPermissions {
822 pub fn with_can_send_messages(mut self, can_send_messages: bool) -> Self {
823 self.can_send_messages = Some(can_send_messages);
824 self
825 }
826
827 pub fn with_can_send_audios(mut self, can_send_audios: bool) -> Self {
828 self.can_send_audios = Some(can_send_audios);
829 self
830 }
831
832 pub fn with_can_send_documents(mut self, can_send_documents: bool) -> Self {
833 self.can_send_documents = Some(can_send_documents);
834 self
835 }
836
837 pub fn with_can_send_photos(mut self, can_send_photos: bool) -> Self {
838 self.can_send_photos = Some(can_send_photos);
839 self
840 }
841
842 pub fn with_can_send_videos(mut self, can_send_videos: bool) -> Self {
843 self.can_send_videos = Some(can_send_videos);
844 self
845 }
846
847 pub fn with_can_send_video_notes(mut self, can_send_video_notes: bool) -> Self {
848 self.can_send_video_notes = Some(can_send_video_notes);
849 self
850 }
851
852 pub fn with_can_send_voice_notes(mut self, can_send_voice_notes: bool) -> Self {
853 self.can_send_voice_notes = Some(can_send_voice_notes);
854 self
855 }
856
857 pub fn with_can_send_polls(mut self, can_send_polls: bool) -> Self {
858 self.can_send_polls = Some(can_send_polls);
859 self
860 }
861
862 pub fn with_can_send_other_messages(mut self, can_send_other_messages: bool) -> Self {
863 self.can_send_other_messages = Some(can_send_other_messages);
864 self
865 }
866
867 pub fn with_can_add_web_page_previews(mut self, can_add_web_page_previews: bool) -> Self {
868 self.can_add_web_page_previews = Some(can_add_web_page_previews);
869 self
870 }
871
872 pub fn with_can_change_info(mut self, can_change_info: bool) -> Self {
873 self.can_change_info = Some(can_change_info);
874 self
875 }
876
877 pub fn with_can_invite_users(mut self, can_invite_users: bool) -> Self {
878 self.can_invite_users = Some(can_invite_users);
879 self
880 }
881
882 pub fn with_can_pin_messages(mut self, can_pin_messages: bool) -> Self {
883 self.can_pin_messages = Some(can_pin_messages);
884 self
885 }
886
887 pub fn with_can_manage_topics(mut self, can_manage_topics: bool) -> Self {
888 self.can_manage_topics = Some(can_manage_topics);
889 self
890 }
891
892}
893
894impl BotCommand {
895 pub fn new(command: String, description: String, ) -> Self {
896 Self {
897 command,
898 description,
899 }
900 }
901}
902
903impl BotCommandScopeDefault {
904 pub fn new() -> Self {
905 Self {
906 }
907 }
908}
909
910impl BotCommandScopeAllPrivateChats {
911 pub fn new() -> Self {
912 Self {
913 }
914 }
915}
916
917impl BotCommandScopeAllGroupChats {
918 pub fn new() -> Self {
919 Self {
920 }
921 }
922}
923
924impl BotCommandScopeAllChatAdministrators {
925 pub fn new() -> Self {
926 Self {
927 }
928 }
929}
930
931impl BotCommandScopeChat {
932 pub fn new(chat_id: ChatId, ) -> Self {
933 Self {
934 chat_id,
935 }
936 }
937}
938
939impl BotCommandScopeChatAdministrators {
940 pub fn new(chat_id: ChatId, ) -> Self {
941 Self {
942 chat_id,
943 }
944 }
945}
946
947impl BotCommandScopeChatMember {
948 pub fn new(chat_id: ChatId, user_id: i64, ) -> Self {
949 Self {
950 chat_id,
951 user_id,
952 }
953 }
954}
955
956impl MenuButtonCommands {
957 pub fn new() -> Self {
958 Self {
959 }
960 }
961}
962
963impl MenuButtonWebApp {
964 pub fn new(text: String, web_app: WebAppInfo, ) -> Self {
965 Self {
966 text,
967 web_app,
968 }
969 }
970}
971
972impl MenuButtonDefault {
973 pub fn new() -> Self {
974 Self {
975 }
976 }
977}
978
979impl InputMediaPhoto {
980 pub fn new(media: String, ) -> Self {
981 Self {
982 media,
983 caption: None,
984 parse_mode: None,
985 caption_entities: None,
986 has_spoiler: None,
987 }
988 }
989}
990
991impl InputMediaPhoto {
992 pub fn with_caption(mut self, caption: String) -> Self {
993 self.caption = Some(caption);
994 self
995 }
996
997 pub fn with_parse_mode(mut self, parse_mode: ParseMode) -> Self {
998 self.parse_mode = Some(parse_mode);
999 self
1000 }
1001
1002 pub fn with_caption_entities(mut self, caption_entities: Vec<MessageEntity>) -> Self {
1003 self.caption_entities = Some(caption_entities);
1004 self
1005 }
1006
1007 pub fn with_has_spoiler(mut self, has_spoiler: bool) -> Self {
1008 self.has_spoiler = Some(has_spoiler);
1009 self
1010 }
1011
1012}
1013
1014impl InputMediaVideo {
1015 pub fn new(media: String, ) -> Self {
1016 Self {
1017 media,
1018 thumb: None,
1019 caption: None,
1020 parse_mode: None,
1021 caption_entities: None,
1022 width: None,
1023 height: None,
1024 duration: None,
1025 supports_streaming: None,
1026 has_spoiler: None,
1027 }
1028 }
1029}
1030
1031impl InputMediaVideo {
1032 pub fn with_thumb(mut self, thumb: InputFile) -> Self {
1033 self.thumb = Some(thumb);
1034 self
1035 }
1036
1037 pub fn with_caption(mut self, caption: String) -> Self {
1038 self.caption = Some(caption);
1039 self
1040 }
1041
1042 pub fn with_parse_mode(mut self, parse_mode: ParseMode) -> Self {
1043 self.parse_mode = Some(parse_mode);
1044 self
1045 }
1046
1047 pub fn with_caption_entities(mut self, caption_entities: Vec<MessageEntity>) -> Self {
1048 self.caption_entities = Some(caption_entities);
1049 self
1050 }
1051
1052 pub fn with_width(mut self, width: i64) -> Self {
1053 self.width = Some(width);
1054 self
1055 }
1056
1057 pub fn with_height(mut self, height: i64) -> Self {
1058 self.height = Some(height);
1059 self
1060 }
1061
1062 pub fn with_duration(mut self, duration: i64) -> Self {
1063 self.duration = Some(duration);
1064 self
1065 }
1066
1067 pub fn with_supports_streaming(mut self, supports_streaming: bool) -> Self {
1068 self.supports_streaming = Some(supports_streaming);
1069 self
1070 }
1071
1072 pub fn with_has_spoiler(mut self, has_spoiler: bool) -> Self {
1073 self.has_spoiler = Some(has_spoiler);
1074 self
1075 }
1076
1077}
1078
1079impl crate::TgObject for InputMediaVideo {
1080 fn add_file(&self, mut form: reqwest::multipart::Form) -> reqwest::multipart::Form {
1081 form = self.thumb.add_file(form);
1082 form
1083 }
1084}
1085
1086impl InputMediaAnimation {
1087 pub fn new(media: String, ) -> Self {
1088 Self {
1089 media,
1090 thumb: None,
1091 caption: None,
1092 parse_mode: None,
1093 caption_entities: None,
1094 width: None,
1095 height: None,
1096 duration: None,
1097 has_spoiler: None,
1098 }
1099 }
1100}
1101
1102impl InputMediaAnimation {
1103 pub fn with_thumb(mut self, thumb: InputFile) -> Self {
1104 self.thumb = Some(thumb);
1105 self
1106 }
1107
1108 pub fn with_caption(mut self, caption: String) -> Self {
1109 self.caption = Some(caption);
1110 self
1111 }
1112
1113 pub fn with_parse_mode(mut self, parse_mode: ParseMode) -> Self {
1114 self.parse_mode = Some(parse_mode);
1115 self
1116 }
1117
1118 pub fn with_caption_entities(mut self, caption_entities: Vec<MessageEntity>) -> Self {
1119 self.caption_entities = Some(caption_entities);
1120 self
1121 }
1122
1123 pub fn with_width(mut self, width: i64) -> Self {
1124 self.width = Some(width);
1125 self
1126 }
1127
1128 pub fn with_height(mut self, height: i64) -> Self {
1129 self.height = Some(height);
1130 self
1131 }
1132
1133 pub fn with_duration(mut self, duration: i64) -> Self {
1134 self.duration = Some(duration);
1135 self
1136 }
1137
1138 pub fn with_has_spoiler(mut self, has_spoiler: bool) -> Self {
1139 self.has_spoiler = Some(has_spoiler);
1140 self
1141 }
1142
1143}
1144
1145impl crate::TgObject for InputMediaAnimation {
1146 fn add_file(&self, mut form: reqwest::multipart::Form) -> reqwest::multipart::Form {
1147 form = self.thumb.add_file(form);
1148 form
1149 }
1150}
1151
1152impl InputMediaAudio {
1153 pub fn new(media: String, ) -> Self {
1154 Self {
1155 media,
1156 thumb: None,
1157 caption: None,
1158 parse_mode: None,
1159 caption_entities: None,
1160 duration: None,
1161 performer: None,
1162 title: None,
1163 }
1164 }
1165}
1166
1167impl InputMediaAudio {
1168 pub fn with_thumb(mut self, thumb: InputFile) -> Self {
1169 self.thumb = Some(thumb);
1170 self
1171 }
1172
1173 pub fn with_caption(mut self, caption: String) -> Self {
1174 self.caption = Some(caption);
1175 self
1176 }
1177
1178 pub fn with_parse_mode(mut self, parse_mode: ParseMode) -> Self {
1179 self.parse_mode = Some(parse_mode);
1180 self
1181 }
1182
1183 pub fn with_caption_entities(mut self, caption_entities: Vec<MessageEntity>) -> Self {
1184 self.caption_entities = Some(caption_entities);
1185 self
1186 }
1187
1188 pub fn with_duration(mut self, duration: i64) -> Self {
1189 self.duration = Some(duration);
1190 self
1191 }
1192
1193 pub fn with_performer(mut self, performer: String) -> Self {
1194 self.performer = Some(performer);
1195 self
1196 }
1197
1198 pub fn with_title(mut self, title: String) -> Self {
1199 self.title = Some(title);
1200 self
1201 }
1202
1203}
1204
1205impl crate::TgObject for InputMediaAudio {
1206 fn add_file(&self, mut form: reqwest::multipart::Form) -> reqwest::multipart::Form {
1207 form = self.thumb.add_file(form);
1208 form
1209 }
1210}
1211
1212impl InputMediaDocument {
1213 pub fn new(media: String, ) -> Self {
1214 Self {
1215 media,
1216 thumb: None,
1217 caption: None,
1218 parse_mode: None,
1219 caption_entities: None,
1220 disable_content_type_detection: None,
1221 }
1222 }
1223}
1224
1225impl InputMediaDocument {
1226 pub fn with_thumb(mut self, thumb: InputFile) -> Self {
1227 self.thumb = Some(thumb);
1228 self
1229 }
1230
1231 pub fn with_caption(mut self, caption: String) -> Self {
1232 self.caption = Some(caption);
1233 self
1234 }
1235
1236 pub fn with_parse_mode(mut self, parse_mode: ParseMode) -> Self {
1237 self.parse_mode = Some(parse_mode);
1238 self
1239 }
1240
1241 pub fn with_caption_entities(mut self, caption_entities: Vec<MessageEntity>) -> Self {
1242 self.caption_entities = Some(caption_entities);
1243 self
1244 }
1245
1246 pub fn with_disable_content_type_detection(mut self, disable_content_type_detection: bool) -> Self {
1247 self.disable_content_type_detection = Some(disable_content_type_detection);
1248 self
1249 }
1250
1251}
1252
1253impl crate::TgObject for InputMediaDocument {
1254 fn add_file(&self, mut form: reqwest::multipart::Form) -> reqwest::multipart::Form {
1255 form = self.thumb.add_file(form);
1256 form
1257 }
1258}
1259
1260impl MaskPosition {
1261 pub fn new(point: String, x_shift: f64, y_shift: f64, scale: f64, ) -> Self {
1262 Self {
1263 point,
1264 x_shift,
1265 y_shift,
1266 scale,
1267 }
1268 }
1269}
1270
1271impl InlineQueryResultArticle {
1272 pub fn new(id: String, title: String, input_message_content: InputMessageContent, ) -> Self {
1273 Self {
1274 id,
1275 title,
1276 input_message_content,
1277 reply_markup: None,
1278 url: None,
1279 hide_url: None,
1280 description: None,
1281 thumb_url: None,
1282 thumb_width: None,
1283 thumb_height: None,
1284 }
1285 }
1286}
1287
1288impl InlineQueryResultArticle {
1289 pub fn with_reply_markup(mut self, reply_markup: InlineKeyboardMarkup) -> Self {
1290 self.reply_markup = Some(reply_markup);
1291 self
1292 }
1293
1294 pub fn with_url(mut self, url: String) -> Self {
1295 self.url = Some(url);
1296 self
1297 }
1298
1299 pub fn with_hide_url(mut self, hide_url: bool) -> Self {
1300 self.hide_url = Some(hide_url);
1301 self
1302 }
1303
1304 pub fn with_description(mut self, description: String) -> Self {
1305 self.description = Some(description);
1306 self
1307 }
1308
1309 pub fn with_thumb_url(mut self, thumb_url: String) -> Self {
1310 self.thumb_url = Some(thumb_url);
1311 self
1312 }
1313
1314 pub fn with_thumb_width(mut self, thumb_width: i64) -> Self {
1315 self.thumb_width = Some(thumb_width);
1316 self
1317 }
1318
1319 pub fn with_thumb_height(mut self, thumb_height: i64) -> Self {
1320 self.thumb_height = Some(thumb_height);
1321 self
1322 }
1323
1324}
1325
1326impl InlineQueryResultPhoto {
1327 pub fn new(id: String, photo_url: String, thumb_url: String, ) -> Self {
1328 Self {
1329 id,
1330 photo_url,
1331 thumb_url,
1332 photo_width: None,
1333 photo_height: None,
1334 title: None,
1335 description: None,
1336 caption: None,
1337 parse_mode: None,
1338 caption_entities: None,
1339 reply_markup: None,
1340 input_message_content: None,
1341 }
1342 }
1343}
1344
1345impl InlineQueryResultPhoto {
1346 pub fn with_photo_width(mut self, photo_width: i64) -> Self {
1347 self.photo_width = Some(photo_width);
1348 self
1349 }
1350
1351 pub fn with_photo_height(mut self, photo_height: i64) -> Self {
1352 self.photo_height = Some(photo_height);
1353 self
1354 }
1355
1356 pub fn with_title(mut self, title: String) -> Self {
1357 self.title = Some(title);
1358 self
1359 }
1360
1361 pub fn with_description(mut self, description: String) -> Self {
1362 self.description = Some(description);
1363 self
1364 }
1365
1366 pub fn with_caption(mut self, caption: String) -> Self {
1367 self.caption = Some(caption);
1368 self
1369 }
1370
1371 pub fn with_parse_mode(mut self, parse_mode: ParseMode) -> Self {
1372 self.parse_mode = Some(parse_mode);
1373 self
1374 }
1375
1376 pub fn with_caption_entities(mut self, caption_entities: Vec<MessageEntity>) -> Self {
1377 self.caption_entities = Some(caption_entities);
1378 self
1379 }
1380
1381 pub fn with_reply_markup(mut self, reply_markup: InlineKeyboardMarkup) -> Self {
1382 self.reply_markup = Some(reply_markup);
1383 self
1384 }
1385
1386 pub fn with_input_message_content(mut self, input_message_content: InputMessageContent) -> Self {
1387 self.input_message_content = Some(input_message_content);
1388 self
1389 }
1390
1391}
1392
1393impl InlineQueryResultGif {
1394 pub fn new(id: String, gif_url: String, thumb_url: String, ) -> Self {
1395 Self {
1396 id,
1397 gif_url,
1398 gif_width: None,
1399 gif_height: None,
1400 gif_duration: None,
1401 thumb_url,
1402 thumb_mime_type: None,
1403 title: None,
1404 caption: None,
1405 parse_mode: None,
1406 caption_entities: None,
1407 reply_markup: None,
1408 input_message_content: None,
1409 }
1410 }
1411}
1412
1413impl InlineQueryResultGif {
1414 pub fn with_gif_width(mut self, gif_width: i64) -> Self {
1415 self.gif_width = Some(gif_width);
1416 self
1417 }
1418
1419 pub fn with_gif_height(mut self, gif_height: i64) -> Self {
1420 self.gif_height = Some(gif_height);
1421 self
1422 }
1423
1424 pub fn with_gif_duration(mut self, gif_duration: i64) -> Self {
1425 self.gif_duration = Some(gif_duration);
1426 self
1427 }
1428
1429 pub fn with_thumb_mime_type(mut self, thumb_mime_type: String) -> Self {
1430 self.thumb_mime_type = Some(thumb_mime_type);
1431 self
1432 }
1433
1434 pub fn with_title(mut self, title: String) -> Self {
1435 self.title = Some(title);
1436 self
1437 }
1438
1439 pub fn with_caption(mut self, caption: String) -> Self {
1440 self.caption = Some(caption);
1441 self
1442 }
1443
1444 pub fn with_parse_mode(mut self, parse_mode: ParseMode) -> Self {
1445 self.parse_mode = Some(parse_mode);
1446 self
1447 }
1448
1449 pub fn with_caption_entities(mut self, caption_entities: Vec<MessageEntity>) -> Self {
1450 self.caption_entities = Some(caption_entities);
1451 self
1452 }
1453
1454 pub fn with_reply_markup(mut self, reply_markup: InlineKeyboardMarkup) -> Self {
1455 self.reply_markup = Some(reply_markup);
1456 self
1457 }
1458
1459 pub fn with_input_message_content(mut self, input_message_content: InputMessageContent) -> Self {
1460 self.input_message_content = Some(input_message_content);
1461 self
1462 }
1463
1464}
1465
1466impl InlineQueryResultMpeg4Gif {
1467 pub fn new(id: String, mpeg4_url: String, thumb_url: String, ) -> Self {
1468 Self {
1469 id,
1470 mpeg4_url,
1471 mpeg4_width: None,
1472 mpeg4_height: None,
1473 mpeg4_duration: None,
1474 thumb_url,
1475 thumb_mime_type: None,
1476 title: None,
1477 caption: None,
1478 parse_mode: None,
1479 caption_entities: None,
1480 reply_markup: None,
1481 input_message_content: None,
1482 }
1483 }
1484}
1485
1486impl InlineQueryResultMpeg4Gif {
1487 pub fn with_mpeg4_width(mut self, mpeg4_width: i64) -> Self {
1488 self.mpeg4_width = Some(mpeg4_width);
1489 self
1490 }
1491
1492 pub fn with_mpeg4_height(mut self, mpeg4_height: i64) -> Self {
1493 self.mpeg4_height = Some(mpeg4_height);
1494 self
1495 }
1496
1497 pub fn with_mpeg4_duration(mut self, mpeg4_duration: i64) -> Self {
1498 self.mpeg4_duration = Some(mpeg4_duration);
1499 self
1500 }
1501
1502 pub fn with_thumb_mime_type(mut self, thumb_mime_type: String) -> Self {
1503 self.thumb_mime_type = Some(thumb_mime_type);
1504 self
1505 }
1506
1507 pub fn with_title(mut self, title: String) -> Self {
1508 self.title = Some(title);
1509 self
1510 }
1511
1512 pub fn with_caption(mut self, caption: String) -> Self {
1513 self.caption = Some(caption);
1514 self
1515 }
1516
1517 pub fn with_parse_mode(mut self, parse_mode: ParseMode) -> Self {
1518 self.parse_mode = Some(parse_mode);
1519 self
1520 }
1521
1522 pub fn with_caption_entities(mut self, caption_entities: Vec<MessageEntity>) -> Self {
1523 self.caption_entities = Some(caption_entities);
1524 self
1525 }
1526
1527 pub fn with_reply_markup(mut self, reply_markup: InlineKeyboardMarkup) -> Self {
1528 self.reply_markup = Some(reply_markup);
1529 self
1530 }
1531
1532 pub fn with_input_message_content(mut self, input_message_content: InputMessageContent) -> Self {
1533 self.input_message_content = Some(input_message_content);
1534 self
1535 }
1536
1537}
1538
1539impl InlineQueryResultVideo {
1540 pub fn new(id: String, video_url: String, mime_type: String, thumb_url: String, title: String, ) -> Self {
1541 Self {
1542 id,
1543 video_url,
1544 mime_type,
1545 thumb_url,
1546 title,
1547 caption: None,
1548 parse_mode: None,
1549 caption_entities: None,
1550 video_width: None,
1551 video_height: None,
1552 video_duration: None,
1553 description: None,
1554 reply_markup: None,
1555 input_message_content: None,
1556 }
1557 }
1558}
1559
1560impl InlineQueryResultVideo {
1561 pub fn with_caption(mut self, caption: String) -> Self {
1562 self.caption = Some(caption);
1563 self
1564 }
1565
1566 pub fn with_parse_mode(mut self, parse_mode: ParseMode) -> Self {
1567 self.parse_mode = Some(parse_mode);
1568 self
1569 }
1570
1571 pub fn with_caption_entities(mut self, caption_entities: Vec<MessageEntity>) -> Self {
1572 self.caption_entities = Some(caption_entities);
1573 self
1574 }
1575
1576 pub fn with_video_width(mut self, video_width: i64) -> Self {
1577 self.video_width = Some(video_width);
1578 self
1579 }
1580
1581 pub fn with_video_height(mut self, video_height: i64) -> Self {
1582 self.video_height = Some(video_height);
1583 self
1584 }
1585
1586 pub fn with_video_duration(mut self, video_duration: i64) -> Self {
1587 self.video_duration = Some(video_duration);
1588 self
1589 }
1590
1591 pub fn with_description(mut self, description: String) -> Self {
1592 self.description = Some(description);
1593 self
1594 }
1595
1596 pub fn with_reply_markup(mut self, reply_markup: InlineKeyboardMarkup) -> Self {
1597 self.reply_markup = Some(reply_markup);
1598 self
1599 }
1600
1601 pub fn with_input_message_content(mut self, input_message_content: InputMessageContent) -> Self {
1602 self.input_message_content = Some(input_message_content);
1603 self
1604 }
1605
1606}
1607
1608impl InlineQueryResultAudio {
1609 pub fn new(id: String, audio_url: String, title: String, ) -> Self {
1610 Self {
1611 id,
1612 audio_url,
1613 title,
1614 caption: None,
1615 parse_mode: None,
1616 caption_entities: None,
1617 performer: None,
1618 audio_duration: None,
1619 reply_markup: None,
1620 input_message_content: None,
1621 }
1622 }
1623}
1624
1625impl InlineQueryResultAudio {
1626 pub fn with_caption(mut self, caption: String) -> Self {
1627 self.caption = Some(caption);
1628 self
1629 }
1630
1631 pub fn with_parse_mode(mut self, parse_mode: ParseMode) -> Self {
1632 self.parse_mode = Some(parse_mode);
1633 self
1634 }
1635
1636 pub fn with_caption_entities(mut self, caption_entities: Vec<MessageEntity>) -> Self {
1637 self.caption_entities = Some(caption_entities);
1638 self
1639 }
1640
1641 pub fn with_performer(mut self, performer: String) -> Self {
1642 self.performer = Some(performer);
1643 self
1644 }
1645
1646 pub fn with_audio_duration(mut self, audio_duration: i64) -> Self {
1647 self.audio_duration = Some(audio_duration);
1648 self
1649 }
1650
1651 pub fn with_reply_markup(mut self, reply_markup: InlineKeyboardMarkup) -> Self {
1652 self.reply_markup = Some(reply_markup);
1653 self
1654 }
1655
1656 pub fn with_input_message_content(mut self, input_message_content: InputMessageContent) -> Self {
1657 self.input_message_content = Some(input_message_content);
1658 self
1659 }
1660
1661}
1662
1663impl InlineQueryResultVoice {
1664 pub fn new(id: String, voice_url: String, title: String, ) -> Self {
1665 Self {
1666 id,
1667 voice_url,
1668 title,
1669 caption: None,
1670 parse_mode: None,
1671 caption_entities: None,
1672 voice_duration: None,
1673 reply_markup: None,
1674 input_message_content: None,
1675 }
1676 }
1677}
1678
1679impl InlineQueryResultVoice {
1680 pub fn with_caption(mut self, caption: String) -> Self {
1681 self.caption = Some(caption);
1682 self
1683 }
1684
1685 pub fn with_parse_mode(mut self, parse_mode: ParseMode) -> Self {
1686 self.parse_mode = Some(parse_mode);
1687 self
1688 }
1689
1690 pub fn with_caption_entities(mut self, caption_entities: Vec<MessageEntity>) -> Self {
1691 self.caption_entities = Some(caption_entities);
1692 self
1693 }
1694
1695 pub fn with_voice_duration(mut self, voice_duration: i64) -> Self {
1696 self.voice_duration = Some(voice_duration);
1697 self
1698 }
1699
1700 pub fn with_reply_markup(mut self, reply_markup: InlineKeyboardMarkup) -> Self {
1701 self.reply_markup = Some(reply_markup);
1702 self
1703 }
1704
1705 pub fn with_input_message_content(mut self, input_message_content: InputMessageContent) -> Self {
1706 self.input_message_content = Some(input_message_content);
1707 self
1708 }
1709
1710}
1711
1712impl InlineQueryResultDocument {
1713 pub fn new(id: String, title: String, document_url: String, mime_type: String, ) -> Self {
1714 Self {
1715 id,
1716 title,
1717 caption: None,
1718 parse_mode: None,
1719 caption_entities: None,
1720 document_url,
1721 mime_type,
1722 description: None,
1723 reply_markup: None,
1724 input_message_content: None,
1725 thumb_url: None,
1726 thumb_width: None,
1727 thumb_height: None,
1728 }
1729 }
1730}
1731
1732impl InlineQueryResultDocument {
1733 pub fn with_caption(mut self, caption: String) -> Self {
1734 self.caption = Some(caption);
1735 self
1736 }
1737
1738 pub fn with_parse_mode(mut self, parse_mode: ParseMode) -> Self {
1739 self.parse_mode = Some(parse_mode);
1740 self
1741 }
1742
1743 pub fn with_caption_entities(mut self, caption_entities: Vec<MessageEntity>) -> Self {
1744 self.caption_entities = Some(caption_entities);
1745 self
1746 }
1747
1748 pub fn with_description(mut self, description: String) -> Self {
1749 self.description = Some(description);
1750 self
1751 }
1752
1753 pub fn with_reply_markup(mut self, reply_markup: InlineKeyboardMarkup) -> Self {
1754 self.reply_markup = Some(reply_markup);
1755 self
1756 }
1757
1758 pub fn with_input_message_content(mut self, input_message_content: InputMessageContent) -> Self {
1759 self.input_message_content = Some(input_message_content);
1760 self
1761 }
1762
1763 pub fn with_thumb_url(mut self, thumb_url: String) -> Self {
1764 self.thumb_url = Some(thumb_url);
1765 self
1766 }
1767
1768 pub fn with_thumb_width(mut self, thumb_width: i64) -> Self {
1769 self.thumb_width = Some(thumb_width);
1770 self
1771 }
1772
1773 pub fn with_thumb_height(mut self, thumb_height: i64) -> Self {
1774 self.thumb_height = Some(thumb_height);
1775 self
1776 }
1777
1778}
1779
1780impl InlineQueryResultLocation {
1781 pub fn new(id: String, latitude: f64, longitude: f64, title: String, ) -> Self {
1782 Self {
1783 id,
1784 latitude,
1785 longitude,
1786 title,
1787 horizontal_accuracy: None,
1788 live_period: None,
1789 heading: None,
1790 proximity_alert_radius: None,
1791 reply_markup: None,
1792 input_message_content: None,
1793 thumb_url: None,
1794 thumb_width: None,
1795 thumb_height: None,
1796 }
1797 }
1798}
1799
1800impl InlineQueryResultLocation {
1801 pub fn with_horizontal_accuracy(mut self, horizontal_accuracy: f64) -> Self {
1802 self.horizontal_accuracy = Some(horizontal_accuracy);
1803 self
1804 }
1805
1806 pub fn with_live_period(mut self, live_period: i64) -> Self {
1807 self.live_period = Some(live_period);
1808 self
1809 }
1810
1811 pub fn with_heading(mut self, heading: i64) -> Self {
1812 self.heading = Some(heading);
1813 self
1814 }
1815
1816 pub fn with_proximity_alert_radius(mut self, proximity_alert_radius: i64) -> Self {
1817 self.proximity_alert_radius = Some(proximity_alert_radius);
1818 self
1819 }
1820
1821 pub fn with_reply_markup(mut self, reply_markup: InlineKeyboardMarkup) -> Self {
1822 self.reply_markup = Some(reply_markup);
1823 self
1824 }
1825
1826 pub fn with_input_message_content(mut self, input_message_content: InputMessageContent) -> Self {
1827 self.input_message_content = Some(input_message_content);
1828 self
1829 }
1830
1831 pub fn with_thumb_url(mut self, thumb_url: String) -> Self {
1832 self.thumb_url = Some(thumb_url);
1833 self
1834 }
1835
1836 pub fn with_thumb_width(mut self, thumb_width: i64) -> Self {
1837 self.thumb_width = Some(thumb_width);
1838 self
1839 }
1840
1841 pub fn with_thumb_height(mut self, thumb_height: i64) -> Self {
1842 self.thumb_height = Some(thumb_height);
1843 self
1844 }
1845
1846}
1847
1848impl InlineQueryResultVenue {
1849 pub fn new(id: String, latitude: f64, longitude: f64, title: String, address: String, ) -> Self {
1850 Self {
1851 id,
1852 latitude,
1853 longitude,
1854 title,
1855 address,
1856 foursquare_id: None,
1857 foursquare_type: None,
1858 google_place_id: None,
1859 google_place_type: None,
1860 reply_markup: None,
1861 input_message_content: None,
1862 thumb_url: None,
1863 thumb_width: None,
1864 thumb_height: None,
1865 }
1866 }
1867}
1868
1869impl InlineQueryResultVenue {
1870 pub fn with_foursquare_id(mut self, foursquare_id: String) -> Self {
1871 self.foursquare_id = Some(foursquare_id);
1872 self
1873 }
1874
1875 pub fn with_foursquare_type(mut self, foursquare_type: String) -> Self {
1876 self.foursquare_type = Some(foursquare_type);
1877 self
1878 }
1879
1880 pub fn with_google_place_id(mut self, google_place_id: String) -> Self {
1881 self.google_place_id = Some(google_place_id);
1882 self
1883 }
1884
1885 pub fn with_google_place_type(mut self, google_place_type: String) -> Self {
1886 self.google_place_type = Some(google_place_type);
1887 self
1888 }
1889
1890 pub fn with_reply_markup(mut self, reply_markup: InlineKeyboardMarkup) -> Self {
1891 self.reply_markup = Some(reply_markup);
1892 self
1893 }
1894
1895 pub fn with_input_message_content(mut self, input_message_content: InputMessageContent) -> Self {
1896 self.input_message_content = Some(input_message_content);
1897 self
1898 }
1899
1900 pub fn with_thumb_url(mut self, thumb_url: String) -> Self {
1901 self.thumb_url = Some(thumb_url);
1902 self
1903 }
1904
1905 pub fn with_thumb_width(mut self, thumb_width: i64) -> Self {
1906 self.thumb_width = Some(thumb_width);
1907 self
1908 }
1909
1910 pub fn with_thumb_height(mut self, thumb_height: i64) -> Self {
1911 self.thumb_height = Some(thumb_height);
1912 self
1913 }
1914
1915}
1916
1917impl InlineQueryResultContact {
1918 pub fn new(id: String, phone_number: String, first_name: String, ) -> Self {
1919 Self {
1920 id,
1921 phone_number,
1922 first_name,
1923 last_name: None,
1924 vcard: None,
1925 reply_markup: None,
1926 input_message_content: None,
1927 thumb_url: None,
1928 thumb_width: None,
1929 thumb_height: None,
1930 }
1931 }
1932}
1933
1934impl InlineQueryResultContact {
1935 pub fn with_last_name(mut self, last_name: String) -> Self {
1936 self.last_name = Some(last_name);
1937 self
1938 }
1939
1940 pub fn with_vcard(mut self, vcard: String) -> Self {
1941 self.vcard = Some(vcard);
1942 self
1943 }
1944
1945 pub fn with_reply_markup(mut self, reply_markup: InlineKeyboardMarkup) -> Self {
1946 self.reply_markup = Some(reply_markup);
1947 self
1948 }
1949
1950 pub fn with_input_message_content(mut self, input_message_content: InputMessageContent) -> Self {
1951 self.input_message_content = Some(input_message_content);
1952 self
1953 }
1954
1955 pub fn with_thumb_url(mut self, thumb_url: String) -> Self {
1956 self.thumb_url = Some(thumb_url);
1957 self
1958 }
1959
1960 pub fn with_thumb_width(mut self, thumb_width: i64) -> Self {
1961 self.thumb_width = Some(thumb_width);
1962 self
1963 }
1964
1965 pub fn with_thumb_height(mut self, thumb_height: i64) -> Self {
1966 self.thumb_height = Some(thumb_height);
1967 self
1968 }
1969
1970}
1971
1972impl InlineQueryResultGame {
1973 pub fn new(id: String, game_short_name: String, ) -> Self {
1974 Self {
1975 id,
1976 game_short_name,
1977 reply_markup: None,
1978 }
1979 }
1980}
1981
1982impl InlineQueryResultGame {
1983 pub fn with_reply_markup(mut self, reply_markup: InlineKeyboardMarkup) -> Self {
1984 self.reply_markup = Some(reply_markup);
1985 self
1986 }
1987
1988}
1989
1990impl InlineQueryResultCachedPhoto {
1991 pub fn new(id: String, photo_file_id: String, ) -> Self {
1992 Self {
1993 id,
1994 photo_file_id,
1995 title: None,
1996 description: None,
1997 caption: None,
1998 parse_mode: None,
1999 caption_entities: None,
2000 reply_markup: None,
2001 input_message_content: None,
2002 }
2003 }
2004}
2005
2006impl InlineQueryResultCachedPhoto {
2007 pub fn with_title(mut self, title: String) -> Self {
2008 self.title = Some(title);
2009 self
2010 }
2011
2012 pub fn with_description(mut self, description: String) -> Self {
2013 self.description = Some(description);
2014 self
2015 }
2016
2017 pub fn with_caption(mut self, caption: String) -> Self {
2018 self.caption = Some(caption);
2019 self
2020 }
2021
2022 pub fn with_parse_mode(mut self, parse_mode: ParseMode) -> Self {
2023 self.parse_mode = Some(parse_mode);
2024 self
2025 }
2026
2027 pub fn with_caption_entities(mut self, caption_entities: Vec<MessageEntity>) -> Self {
2028 self.caption_entities = Some(caption_entities);
2029 self
2030 }
2031
2032 pub fn with_reply_markup(mut self, reply_markup: InlineKeyboardMarkup) -> Self {
2033 self.reply_markup = Some(reply_markup);
2034 self
2035 }
2036
2037 pub fn with_input_message_content(mut self, input_message_content: InputMessageContent) -> Self {
2038 self.input_message_content = Some(input_message_content);
2039 self
2040 }
2041
2042}
2043
2044impl InlineQueryResultCachedGif {
2045 pub fn new(id: String, gif_file_id: String, ) -> Self {
2046 Self {
2047 id,
2048 gif_file_id,
2049 title: None,
2050 caption: None,
2051 parse_mode: None,
2052 caption_entities: None,
2053 reply_markup: None,
2054 input_message_content: None,
2055 }
2056 }
2057}
2058
2059impl InlineQueryResultCachedGif {
2060 pub fn with_title(mut self, title: String) -> Self {
2061 self.title = Some(title);
2062 self
2063 }
2064
2065 pub fn with_caption(mut self, caption: String) -> Self {
2066 self.caption = Some(caption);
2067 self
2068 }
2069
2070 pub fn with_parse_mode(mut self, parse_mode: ParseMode) -> Self {
2071 self.parse_mode = Some(parse_mode);
2072 self
2073 }
2074
2075 pub fn with_caption_entities(mut self, caption_entities: Vec<MessageEntity>) -> Self {
2076 self.caption_entities = Some(caption_entities);
2077 self
2078 }
2079
2080 pub fn with_reply_markup(mut self, reply_markup: InlineKeyboardMarkup) -> Self {
2081 self.reply_markup = Some(reply_markup);
2082 self
2083 }
2084
2085 pub fn with_input_message_content(mut self, input_message_content: InputMessageContent) -> Self {
2086 self.input_message_content = Some(input_message_content);
2087 self
2088 }
2089
2090}
2091
2092impl InlineQueryResultCachedMpeg4Gif {
2093 pub fn new(id: String, mpeg4_file_id: String, ) -> Self {
2094 Self {
2095 id,
2096 mpeg4_file_id,
2097 title: None,
2098 caption: None,
2099 parse_mode: None,
2100 caption_entities: None,
2101 reply_markup: None,
2102 input_message_content: None,
2103 }
2104 }
2105}
2106
2107impl InlineQueryResultCachedMpeg4Gif {
2108 pub fn with_title(mut self, title: String) -> Self {
2109 self.title = Some(title);
2110 self
2111 }
2112
2113 pub fn with_caption(mut self, caption: String) -> Self {
2114 self.caption = Some(caption);
2115 self
2116 }
2117
2118 pub fn with_parse_mode(mut self, parse_mode: ParseMode) -> Self {
2119 self.parse_mode = Some(parse_mode);
2120 self
2121 }
2122
2123 pub fn with_caption_entities(mut self, caption_entities: Vec<MessageEntity>) -> Self {
2124 self.caption_entities = Some(caption_entities);
2125 self
2126 }
2127
2128 pub fn with_reply_markup(mut self, reply_markup: InlineKeyboardMarkup) -> Self {
2129 self.reply_markup = Some(reply_markup);
2130 self
2131 }
2132
2133 pub fn with_input_message_content(mut self, input_message_content: InputMessageContent) -> Self {
2134 self.input_message_content = Some(input_message_content);
2135 self
2136 }
2137
2138}
2139
2140impl InlineQueryResultCachedSticker {
2141 pub fn new(id: String, sticker_file_id: String, ) -> Self {
2142 Self {
2143 id,
2144 sticker_file_id,
2145 reply_markup: None,
2146 input_message_content: None,
2147 }
2148 }
2149}
2150
2151impl InlineQueryResultCachedSticker {
2152 pub fn with_reply_markup(mut self, reply_markup: InlineKeyboardMarkup) -> Self {
2153 self.reply_markup = Some(reply_markup);
2154 self
2155 }
2156
2157 pub fn with_input_message_content(mut self, input_message_content: InputMessageContent) -> Self {
2158 self.input_message_content = Some(input_message_content);
2159 self
2160 }
2161
2162}
2163
2164impl InlineQueryResultCachedDocument {
2165 pub fn new(id: String, title: String, document_file_id: String, ) -> Self {
2166 Self {
2167 id,
2168 title,
2169 document_file_id,
2170 description: None,
2171 caption: None,
2172 parse_mode: None,
2173 caption_entities: None,
2174 reply_markup: None,
2175 input_message_content: None,
2176 }
2177 }
2178}
2179
2180impl InlineQueryResultCachedDocument {
2181 pub fn with_description(mut self, description: String) -> Self {
2182 self.description = Some(description);
2183 self
2184 }
2185
2186 pub fn with_caption(mut self, caption: String) -> Self {
2187 self.caption = Some(caption);
2188 self
2189 }
2190
2191 pub fn with_parse_mode(mut self, parse_mode: ParseMode) -> Self {
2192 self.parse_mode = Some(parse_mode);
2193 self
2194 }
2195
2196 pub fn with_caption_entities(mut self, caption_entities: Vec<MessageEntity>) -> Self {
2197 self.caption_entities = Some(caption_entities);
2198 self
2199 }
2200
2201 pub fn with_reply_markup(mut self, reply_markup: InlineKeyboardMarkup) -> Self {
2202 self.reply_markup = Some(reply_markup);
2203 self
2204 }
2205
2206 pub fn with_input_message_content(mut self, input_message_content: InputMessageContent) -> Self {
2207 self.input_message_content = Some(input_message_content);
2208 self
2209 }
2210
2211}
2212
2213impl InlineQueryResultCachedVideo {
2214 pub fn new(id: String, video_file_id: String, title: String, ) -> Self {
2215 Self {
2216 id,
2217 video_file_id,
2218 title,
2219 description: None,
2220 caption: None,
2221 parse_mode: None,
2222 caption_entities: None,
2223 reply_markup: None,
2224 input_message_content: None,
2225 }
2226 }
2227}
2228
2229impl InlineQueryResultCachedVideo {
2230 pub fn with_description(mut self, description: String) -> Self {
2231 self.description = Some(description);
2232 self
2233 }
2234
2235 pub fn with_caption(mut self, caption: String) -> Self {
2236 self.caption = Some(caption);
2237 self
2238 }
2239
2240 pub fn with_parse_mode(mut self, parse_mode: ParseMode) -> Self {
2241 self.parse_mode = Some(parse_mode);
2242 self
2243 }
2244
2245 pub fn with_caption_entities(mut self, caption_entities: Vec<MessageEntity>) -> Self {
2246 self.caption_entities = Some(caption_entities);
2247 self
2248 }
2249
2250 pub fn with_reply_markup(mut self, reply_markup: InlineKeyboardMarkup) -> Self {
2251 self.reply_markup = Some(reply_markup);
2252 self
2253 }
2254
2255 pub fn with_input_message_content(mut self, input_message_content: InputMessageContent) -> Self {
2256 self.input_message_content = Some(input_message_content);
2257 self
2258 }
2259
2260}
2261
2262impl InlineQueryResultCachedVoice {
2263 pub fn new(id: String, voice_file_id: String, title: String, ) -> Self {
2264 Self {
2265 id,
2266 voice_file_id,
2267 title,
2268 caption: None,
2269 parse_mode: None,
2270 caption_entities: None,
2271 reply_markup: None,
2272 input_message_content: None,
2273 }
2274 }
2275}
2276
2277impl InlineQueryResultCachedVoice {
2278 pub fn with_caption(mut self, caption: String) -> Self {
2279 self.caption = Some(caption);
2280 self
2281 }
2282
2283 pub fn with_parse_mode(mut self, parse_mode: ParseMode) -> Self {
2284 self.parse_mode = Some(parse_mode);
2285 self
2286 }
2287
2288 pub fn with_caption_entities(mut self, caption_entities: Vec<MessageEntity>) -> Self {
2289 self.caption_entities = Some(caption_entities);
2290 self
2291 }
2292
2293 pub fn with_reply_markup(mut self, reply_markup: InlineKeyboardMarkup) -> Self {
2294 self.reply_markup = Some(reply_markup);
2295 self
2296 }
2297
2298 pub fn with_input_message_content(mut self, input_message_content: InputMessageContent) -> Self {
2299 self.input_message_content = Some(input_message_content);
2300 self
2301 }
2302
2303}
2304
2305impl InlineQueryResultCachedAudio {
2306 pub fn new(id: String, audio_file_id: String, ) -> Self {
2307 Self {
2308 id,
2309 audio_file_id,
2310 caption: None,
2311 parse_mode: None,
2312 caption_entities: None,
2313 reply_markup: None,
2314 input_message_content: None,
2315 }
2316 }
2317}
2318
2319impl InlineQueryResultCachedAudio {
2320 pub fn with_caption(mut self, caption: String) -> Self {
2321 self.caption = Some(caption);
2322 self
2323 }
2324
2325 pub fn with_parse_mode(mut self, parse_mode: ParseMode) -> Self {
2326 self.parse_mode = Some(parse_mode);
2327 self
2328 }
2329
2330 pub fn with_caption_entities(mut self, caption_entities: Vec<MessageEntity>) -> Self {
2331 self.caption_entities = Some(caption_entities);
2332 self
2333 }
2334
2335 pub fn with_reply_markup(mut self, reply_markup: InlineKeyboardMarkup) -> Self {
2336 self.reply_markup = Some(reply_markup);
2337 self
2338 }
2339
2340 pub fn with_input_message_content(mut self, input_message_content: InputMessageContent) -> Self {
2341 self.input_message_content = Some(input_message_content);
2342 self
2343 }
2344
2345}
2346
2347impl InputTextMessageContent {
2348 pub fn new(message_text: String, ) -> Self {
2349 Self {
2350 message_text,
2351 parse_mode: None,
2352 entities: None,
2353 disable_web_page_preview: None,
2354 }
2355 }
2356}
2357
2358impl InputTextMessageContent {
2359 pub fn with_parse_mode(mut self, parse_mode: ParseMode) -> Self {
2360 self.parse_mode = Some(parse_mode);
2361 self
2362 }
2363
2364 pub fn with_entities(mut self, entities: Vec<MessageEntity>) -> Self {
2365 self.entities = Some(entities);
2366 self
2367 }
2368
2369 pub fn with_disable_web_page_preview(mut self, disable_web_page_preview: bool) -> Self {
2370 self.disable_web_page_preview = Some(disable_web_page_preview);
2371 self
2372 }
2373
2374}
2375
2376impl InputLocationMessageContent {
2377 pub fn new(latitude: f64, longitude: f64, ) -> Self {
2378 Self {
2379 latitude,
2380 longitude,
2381 horizontal_accuracy: None,
2382 live_period: None,
2383 heading: None,
2384 proximity_alert_radius: None,
2385 }
2386 }
2387}
2388
2389impl InputLocationMessageContent {
2390 pub fn with_horizontal_accuracy(mut self, horizontal_accuracy: f64) -> Self {
2391 self.horizontal_accuracy = Some(horizontal_accuracy);
2392 self
2393 }
2394
2395 pub fn with_live_period(mut self, live_period: i64) -> Self {
2396 self.live_period = Some(live_period);
2397 self
2398 }
2399
2400 pub fn with_heading(mut self, heading: i64) -> Self {
2401 self.heading = Some(heading);
2402 self
2403 }
2404
2405 pub fn with_proximity_alert_radius(mut self, proximity_alert_radius: i64) -> Self {
2406 self.proximity_alert_radius = Some(proximity_alert_radius);
2407 self
2408 }
2409
2410}
2411
2412impl InputVenueMessageContent {
2413 pub fn new(latitude: f64, longitude: f64, title: String, address: String, ) -> Self {
2414 Self {
2415 latitude,
2416 longitude,
2417 title,
2418 address,
2419 foursquare_id: None,
2420 foursquare_type: None,
2421 google_place_id: None,
2422 google_place_type: None,
2423 }
2424 }
2425}
2426
2427impl InputVenueMessageContent {
2428 pub fn with_foursquare_id(mut self, foursquare_id: String) -> Self {
2429 self.foursquare_id = Some(foursquare_id);
2430 self
2431 }
2432
2433 pub fn with_foursquare_type(mut self, foursquare_type: String) -> Self {
2434 self.foursquare_type = Some(foursquare_type);
2435 self
2436 }
2437
2438 pub fn with_google_place_id(mut self, google_place_id: String) -> Self {
2439 self.google_place_id = Some(google_place_id);
2440 self
2441 }
2442
2443 pub fn with_google_place_type(mut self, google_place_type: String) -> Self {
2444 self.google_place_type = Some(google_place_type);
2445 self
2446 }
2447
2448}
2449
2450impl InputContactMessageContent {
2451 pub fn new(phone_number: String, first_name: String, ) -> Self {
2452 Self {
2453 phone_number,
2454 first_name,
2455 last_name: None,
2456 vcard: None,
2457 }
2458 }
2459}
2460
2461impl InputContactMessageContent {
2462 pub fn with_last_name(mut self, last_name: String) -> Self {
2463 self.last_name = Some(last_name);
2464 self
2465 }
2466
2467 pub fn with_vcard(mut self, vcard: String) -> Self {
2468 self.vcard = Some(vcard);
2469 self
2470 }
2471
2472}
2473
2474impl InputInvoiceMessageContent {
2475 pub fn new(title: String, description: String, payload: String, provider_token: String, currency: String, prices: Vec<LabeledPrice>, ) -> Self {
2476 Self {
2477 title,
2478 description,
2479 payload,
2480 provider_token,
2481 currency,
2482 prices,
2483 max_tip_amount: None,
2484 suggested_tip_amounts: None,
2485 provider_data: None,
2486 photo_url: None,
2487 photo_size: None,
2488 photo_width: None,
2489 photo_height: None,
2490 need_name: None,
2491 need_phone_number: None,
2492 need_email: None,
2493 need_shipping_address: None,
2494 send_phone_number_to_provider: None,
2495 send_email_to_provider: None,
2496 is_flexible: None,
2497 }
2498 }
2499}
2500
2501impl InputInvoiceMessageContent {
2502 pub fn with_max_tip_amount(mut self, max_tip_amount: i64) -> Self {
2503 self.max_tip_amount = Some(max_tip_amount);
2504 self
2505 }
2506
2507 pub fn with_suggested_tip_amounts(mut self, suggested_tip_amounts: Vec<i64>) -> Self {
2508 self.suggested_tip_amounts = Some(suggested_tip_amounts);
2509 self
2510 }
2511
2512 pub fn with_provider_data(mut self, provider_data: String) -> Self {
2513 self.provider_data = Some(provider_data);
2514 self
2515 }
2516
2517 pub fn with_photo_url(mut self, photo_url: String) -> Self {
2518 self.photo_url = Some(photo_url);
2519 self
2520 }
2521
2522 pub fn with_photo_size(mut self, photo_size: i64) -> Self {
2523 self.photo_size = Some(photo_size);
2524 self
2525 }
2526
2527 pub fn with_photo_width(mut self, photo_width: i64) -> Self {
2528 self.photo_width = Some(photo_width);
2529 self
2530 }
2531
2532 pub fn with_photo_height(mut self, photo_height: i64) -> Self {
2533 self.photo_height = Some(photo_height);
2534 self
2535 }
2536
2537 pub fn with_need_name(mut self, need_name: bool) -> Self {
2538 self.need_name = Some(need_name);
2539 self
2540 }
2541
2542 pub fn with_need_phone_number(mut self, need_phone_number: bool) -> Self {
2543 self.need_phone_number = Some(need_phone_number);
2544 self
2545 }
2546
2547 pub fn with_need_email(mut self, need_email: bool) -> Self {
2548 self.need_email = Some(need_email);
2549 self
2550 }
2551
2552 pub fn with_need_shipping_address(mut self, need_shipping_address: bool) -> Self {
2553 self.need_shipping_address = Some(need_shipping_address);
2554 self
2555 }
2556
2557 pub fn with_send_phone_number_to_provider(mut self, send_phone_number_to_provider: bool) -> Self {
2558 self.send_phone_number_to_provider = Some(send_phone_number_to_provider);
2559 self
2560 }
2561
2562 pub fn with_send_email_to_provider(mut self, send_email_to_provider: bool) -> Self {
2563 self.send_email_to_provider = Some(send_email_to_provider);
2564 self
2565 }
2566
2567 pub fn with_is_flexible(mut self, is_flexible: bool) -> Self {
2568 self.is_flexible = Some(is_flexible);
2569 self
2570 }
2571
2572}
2573
2574impl LabeledPrice {
2575 pub fn new(label: String, amount: i64, ) -> Self {
2576 Self {
2577 label,
2578 amount,
2579 }
2580 }
2581}
2582
2583impl ShippingOption {
2584 pub fn new(id: String, title: String, prices: Vec<LabeledPrice>, ) -> Self {
2585 Self {
2586 id,
2587 title,
2588 prices,
2589 }
2590 }
2591}
2592
2593impl PassportElementErrorDataField {
2594 pub fn new(type_: String, field_name: String, data_hash: String, message: String, ) -> Self {
2595 Self {
2596 type_,
2597 field_name,
2598 data_hash,
2599 message,
2600 }
2601 }
2602}
2603
2604impl PassportElementErrorFrontSide {
2605 pub fn new(type_: String, file_hash: String, message: String, ) -> Self {
2606 Self {
2607 type_,
2608 file_hash,
2609 message,
2610 }
2611 }
2612}
2613
2614impl PassportElementErrorReverseSide {
2615 pub fn new(type_: String, file_hash: String, message: String, ) -> Self {
2616 Self {
2617 type_,
2618 file_hash,
2619 message,
2620 }
2621 }
2622}
2623
2624impl PassportElementErrorSelfie {
2625 pub fn new(type_: String, file_hash: String, message: String, ) -> Self {
2626 Self {
2627 type_,
2628 file_hash,
2629 message,
2630 }
2631 }
2632}
2633
2634impl PassportElementErrorFile {
2635 pub fn new(type_: String, file_hash: String, message: String, ) -> Self {
2636 Self {
2637 type_,
2638 file_hash,
2639 message,
2640 }
2641 }
2642}
2643
2644impl PassportElementErrorFiles {
2645 pub fn new(type_: String, file_hashes: Vec<String>, message: String, ) -> Self {
2646 Self {
2647 type_,
2648 file_hashes,
2649 message,
2650 }
2651 }
2652}
2653
2654impl PassportElementErrorTranslationFile {
2655 pub fn new(type_: String, file_hash: String, message: String, ) -> Self {
2656 Self {
2657 type_,
2658 file_hash,
2659 message,
2660 }
2661 }
2662}
2663
2664impl PassportElementErrorTranslationFiles {
2665 pub fn new(type_: String, file_hashes: Vec<String>, message: String, ) -> Self {
2666 Self {
2667 type_,
2668 file_hashes,
2669 message,
2670 }
2671 }
2672}
2673
2674impl PassportElementErrorUnspecified {
2675 pub fn new(type_: String, element_hash: String, message: String, ) -> Self {
2676 Self {
2677 type_,
2678 element_hash,
2679 message,
2680 }
2681 }
2682}
2683