1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//! Autogenerated telegram bot api wrapper using api spec from <https://github.com/PaulSonOfLars/telegram-bot-api-spec>.
//! Generates a full serde-based telegram bot api wrapper with idiomatic design patterns.
//! # Features
//! - Automatically kept up to date with the latest telegram api
//! - Minimal fluff and boilerplate
//! - Full async support with tokio
//! - Support for both long polling and webhooks
//! - Automatically generated documentation
//! # Examples
//! ## Use webhooks to fetch updates
//! ```no_run
//! use botapi::gen_types::FileData;
//! use botapi::bot::Bot;
//! use botapi::ext::{Webhook, BotUrl};
//! use std::net::{SocketAddr, Ipv4Addr, IpAddr};
//! use futures_util::StreamExt;
//! # tokio_test::block_on(async {
//! let client = Bot::new("sometoken").unwrap();
//! Webhook::new(
//! &client,
//! BotUrl::Host("example.com".to_owned()),
//! false,
//! SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 8080),
//! None,
//! )
//! .get_updates()
//! .await.unwrap()
//! .for_each_concurrent(
//! None,
//! |update| async move {
//! //handle update
//! },
//! );
//! })
//! ```
//! ## Send messages or media
//! ```no_run
//! use botapi::gen_types::{FileData, Message, ReplyParametersBuilder};
//! use botapi::bot::Bot;
//! # tokio_test::block_on(async {
//! # let message = Message::default();
//! let client = Bot::new("sometoken").unwrap();
//! let bytes = vec![1,2,3];
//! client
//! .build_send_photo(
//! message.get_chat().get_id(),
//! FileData::Bytes(bytes),
//! )
//! .caption("If you do not solve this captcha correctly you will be terminated by memetic kill agent")
//! .reply_parameters(&ReplyParametersBuilder::new(message.get_message_id()).build())
//! .build()
//! .await.unwrap();
//! })
//! ```
/// Wrapper type for telegram bot api
/// Various helpers to manage receiving updates via webhooks or long polling,
/// or to better map json types onto rust design patterns
/// Autogenerated REST api methods
///Autogenerated REST api types from json