teloxide-core 0.13.0

Core part of the `teloxide` library - telegram bot API client
Documentation
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
macro_rules! req_future {
    (
        $v2:vis def: | $( $arg:ident: $ArgTy:ty ),* $(,)? | $body:block

        $(#[$($meta:tt)*])*
        $v:vis $i:ident<$T:ident> ($inner:ident) -> $Out:ty
        $(where $($wh:tt)*)?
    ) => {
        #[pin_project::pin_project]
        $v
        struct $i<$T>
        $(where $($wh)*)?
        {
            #[pin]
            inner: $inner::$i<$T>
        }

        impl<$T> $i<$T>
        $(where $($wh)*)?
        {
            $v2 fn new($( $arg: $ArgTy ),*) -> Self {
                Self { inner: $inner::def($( $arg ),*) }
            }
        }

        // HACK(waffle): workaround for https://github.com/rust-lang/rust/issues/55997
        mod $inner {
            #![allow(type_alias_bounds)]

            // Mostly to bring `use`s
            #[allow(unused_imports)]
            use super::{*, $i as _};

            #[cfg(feature = "nightly")]
            pub(crate) type $i<$T>
            $(where $($wh)*)? = impl ::core::future::Future<Output = $Out>;

            #[cfg(feature = "nightly")]
            #[define_opaque($i)]
            pub(crate) fn def<$T>($( $arg: $ArgTy ),*) -> $i<$T>
            $(where $($wh)*)?
            {
                $body
            }

            #[cfg(not(feature = "nightly"))]
            pub(crate) type $i<$T>
            $(where $($wh)*)?  = ::core::pin::Pin<Box<dyn ::core::future::Future<Output = $Out> + ::core::marker::Send + 'static>>;

            #[cfg(not(feature = "nightly"))]
            pub(crate) fn def<$T>($( $arg: $ArgTy ),*) -> $i<$T>
            $(where $($wh)*)?
            {
                Box::pin($body)
            }
        }

        impl<$T> ::core::future::Future for $i<$T>
        $(where $($wh)*)?
        {
            type Output = $Out;

            fn poll(self: ::core::pin::Pin<&mut Self>, cx: &mut ::core::task::Context<'_>) -> ::core::task::Poll<Self::Output> {
                let this = self.project();
                this.inner.poll(cx)
            }
        }

    };
}

/// Declares an item with a doc attribute computed by some macro expression.
/// This allows documentation to be dynamically generated based on input.
/// Necessary to work around https://github.com/rust-lang/rust/issues/52607.
macro_rules! calculated_doc {
    (
        $(
            #[doc = $doc:expr]
            $thing:item
        )*
    ) => (
        $(
            #[doc = $doc]
            $thing
        )*
    );
}

/// Declare payload type, implement `Payload` trait and ::new method for it,
/// declare setters trait and implement it for all type which have payload.
macro_rules! impl_payload {
    (
        $(
            @[multipart = $($multipart_attr:ident),*]
        )?
        $(
            @[timeout_secs = $timeout_secs:ident]
        )?
        $(
            #[ $($method_meta:tt)* ]
        )*
        $vi:vis $Method:ident ($Setters:ident) => $Ret:ty {
            $(
                required {
                    $(
                        $(
                            #[ $($field_meta:tt)* ]
                        )*
                        $v:vis $fields:ident : $FTy:ty $([$conv:ident])?
                        ,
                    )*
                }
            )?

            $(
                optional {
                    $(
                        $(
                            #[ $($opt_field_meta:tt)* ]
                        )*
                        $opt_v:vis $opt_fields:ident : $OptFTy:ty $([$opt_conv:ident])?
                    ),*
                    $(,)?
                }
            )?
        }
    ) => {
        #[serde_with::skip_serializing_none]
        #[must_use = "Requests do nothing unless sent"]
        $(
            #[ $($method_meta)* ]
        )*
        $vi struct $Method {
            $(
                $(
                    // FIXME: fix the cause of this warning
                    #[allow(rustdoc::invalid_html_tags)]
                    $(
                        #[ $($field_meta)* ]
                    )*
                    $v $fields : $FTy,
                )*
            )?
            $(
                $(
                    $(
                        #[ $($opt_field_meta)* ]
                    )*
                    $opt_v $opt_fields : core::option::Option<$OptFTy>,
                )*
            )?
        }

        impl $Method {
            // We mirror Telegram API and can't do anything with too many arguments.
            #[allow(clippy::too_many_arguments)]
            // It's just easier for macros to generate such code.
            #[allow(clippy::redundant_field_names)]
            // It's obvious what this method does. (If you think it's not, feel free to open a PR)
            #[allow(missing_docs)]
            $vi fn new($($($fields : impl_payload!(@convert? $FTy $([$conv])?)),*)?) -> Self {
                Self {
                    $(
                        $(
                            $fields: impl_payload!(@convert_map ($fields) $([$conv])?),
                        )*
                    )?
                    $(
                        $(
                            $opt_fields: None,
                        )*
                    )?
                }
            }
        }

        impl $crate::requests::Payload for $Method {
            type Output = $Ret;

            const NAME: &'static str = stringify!($Method);

            $(
                fn timeout_hint(&self) -> Option<std::time::Duration> {
                    self.$timeout_secs.map(<_>::into).map(std::time::Duration::from_secs)
                }
            )?
        }

        calculated_doc! {
            #[doc = concat!(
                "Setters for fields of [`",
                stringify!($Method),
                "`]"
            )]
            $vi trait $Setters: $crate::requests::HasPayload<Payload = $Method> + ::core::marker::Sized {
                $(
                    $(
                        impl_payload! { @setter $Method $fields : $FTy $([$conv])? }
                    )*
                )?
                $(
                    $(
                        impl_payload! { @setter_opt $Method $opt_fields : $OptFTy $([$opt_conv])? }
                    )*
                )?
            }
        }

        impl<P> $Setters for P where P: crate::requests::HasPayload<Payload = $Method> {}

        impl_payload! { @[$(multipart = $($multipart_attr),*)?] $Method req { $($($fields),*)? } opt { $($($opt_fields),*)? } }
    };
    (@setter_opt $Method:ident $field:ident : $FTy:ty [into]) => {
        calculated_doc! {
            #[doc = concat!(
                "Setter for [`",
                stringify!($field),
                "`](",
                stringify!($Method),
                "::",
                stringify!($field),
                ") field."
            )]
            #[allow(clippy::wrong_self_convention)]
            #[must_use = "Payloads and requests do nothing unless sent"]
            fn $field<T>(mut self, value: T) -> Self
            where
                T: Into<$FTy>,
            {
                self.payload_mut().$field = Some(value.into());
                self
            }
        }
    };
    (@setter_opt $Method:ident $field:ident : $FTy:ty [collect]) => {
        calculated_doc! {
            #[doc = concat!(
                "Setter for [`",
                stringify!($field),
                "`](",
                stringify!($Method),
                "::",
                stringify!($field),
                ") field."
            )]
            #[allow(clippy::wrong_self_convention)]
            #[must_use = "Payloads and requests do nothing unless sent"]
            fn $field<T>(mut self, value: T) -> Self
            where
                T: ::core::iter::IntoIterator<Item = <$FTy as ::core::iter::IntoIterator>::Item>,
            {
                self.payload_mut().$field = Some(value.into_iter().collect());
                self
            }
        }
    };
    (@setter_opt $Method:ident $field:ident : $FTy:ty) => {
        calculated_doc! {
            #[doc = concat!(
                "Setter for [`",
                stringify!($field),
                "`](",
                stringify!($Method),
                "::",
                stringify!($field),
                ") field."
            )]
            #[allow(clippy::wrong_self_convention)]
            #[must_use = "Payloads and requests do nothing unless sent"]
            fn $field(mut self, value: $FTy) -> Self {
                self.payload_mut().$field = Some(value);
                self
            }
        }
    };
    (@setter $Method:ident $field:ident : $FTy:ty [into]) => {
        calculated_doc! {
            #[doc = concat!(
                "Setter for [`",
                stringify!($field),
                "`](",
                stringify!($Method),
                "::",
                stringify!($field),
                ") field."
            )]
            #[allow(clippy::wrong_self_convention)]
            #[must_use = "Payloads and requests do nothing unless sent"]
            fn $field<T>(mut self, value: T) -> Self
            where
                T: Into<$FTy>,
            {
                self.payload_mut().$field = value.into();
                self
            }
        }
    };
    (@setter $Method:ident $field:ident : $FTy:ty [collect]) => {
        calculated_doc! {
            #[doc = concat!(
                "Setter for [`",
                stringify!($field),
                "`](",
                stringify!($Method),
                "::",
                stringify!($field),
                ") field."
            )]
            #[allow(clippy::wrong_self_convention)]
            #[must_use = "Payloads and requests do nothing unless sent"]
            fn $field<T>(mut self, value: T) -> Self
            where
                T: ::core::iter::IntoIterator<Item = <$FTy as ::core::iter::IntoIterator>::Item>,
            {
                self.payload_mut().$field = value.into_iter().collect();
                self
            }
        }
    };
    (@setter $Method:ident $field:ident : $FTy:ty) => {
        calculated_doc! {
            #[doc = concat!(
                "Setter for [`",
                stringify!($field),
                "`](",
                stringify!($Method),
                "::",
                stringify!($field),
                ") field."
            )]
            #[allow(clippy::wrong_self_convention)]
            #[must_use = "Payloads and requests do nothing unless sent"]
            fn $field(mut self, value: $FTy) -> Self {
                self.payload_mut().$field = value;
                self
            }
        }
    };
    (@convert? $T:ty [into]) => {
        impl ::core::convert::Into<$T>
    };
    (@convert? $T:ty [collect]) => {
        impl ::core::iter::IntoIterator<Item = <$T as ::core::iter::IntoIterator>::Item>
    };
    (@convert? $T:ty) => {
        $T
    };
    (@convert_map ($e:expr) [into]) => {
        $e.into()
    };
    (@convert_map ($e:expr) [collect]) => {
        $e.into_iter().collect()
    };
    (@convert_map ($e:expr)) => {
        $e
    };
    (@[multipart = $($multipart_attr:ident),*] $Method:ident req { $($reqf:ident),* } opt { $($optf:ident),*} ) => {
        impl crate::requests::MultipartPayload for $Method {
            fn copy_files(&self, into: &mut dyn FnMut(crate::types::InputFile)) {
                $(
                    crate::types::InputFileLike::copy_into(&self.$multipart_attr, into);
                )*
            }

            fn move_files(&mut self, into: &mut dyn FnMut(crate::types::InputFile)) {
                $(
                    crate::types::InputFileLike::move_into(&mut self.$multipart_attr, into);
                )*
            }
        }
    };
    (@[] $($ignored:tt)*) => {}
}

macro_rules! download_forward {
    ($T:ident $S:ty {$this:ident => $inner:expr}) => {
        impl<$T: $crate::net::Download> $crate::net::Download for $S {
            type Err<'dst> = <$T as $crate::net::Download>::Err<'dst>;

            type Fut<'dst> = <$T as $crate::net::Download>::Fut<'dst>;

            fn download_file<'dst>(
                &self,
                path: &str,
                destination: &'dst mut (dyn tokio::io::AsyncWrite
                               + core::marker::Unpin
                               + core::marker::Send),
            ) -> Self::Fut<'dst> {
                let $this = self;
                ($inner).download_file(path, destination)
            }

            type StreamErr = <$T as $crate::net::Download>::StreamErr;

            type Stream = <$T as $crate::net::Download>::Stream;

            fn download_file_stream(&self, path: &str) -> Self::Stream {
                let $this = self;
                ($inner).download_file_stream(path)
            }
        }
    };
}

macro_rules! requester_forward {
    ($i:ident $(, $rest:ident )* $(,)? => $body:ident, $ty:ident ) => {
        requester_forward!(@method $i $body $ty);
        $(
            requester_forward!(@method $rest $body $ty);
        )*
    };

// START BLOCK requester_forward_at_method
// Generated by `codegen_requester_forward`, do not edit by hand.


    (@method get_updates $body:ident $ty:ident) => {
        type GetUpdates = $ty![GetUpdates];

        fn get_updates(&self, ) -> Self::GetUpdates {
            let this = self;
            $body!(get_updates this ())
        }
    };
    (@method set_webhook $body:ident $ty:ident) => {
        type SetWebhook = $ty![SetWebhook];

        fn set_webhook(&self, url: Url) -> Self::SetWebhook {
            let this = self;
            $body!(set_webhook this (url: Url))
        }
    };
    (@method delete_webhook $body:ident $ty:ident) => {
        type DeleteWebhook = $ty![DeleteWebhook];

        fn delete_webhook(&self, ) -> Self::DeleteWebhook {
            let this = self;
            $body!(delete_webhook this ())
        }
    };
    (@method get_webhook_info $body:ident $ty:ident) => {
        type GetWebhookInfo = $ty![GetWebhookInfo];

        fn get_webhook_info(&self, ) -> Self::GetWebhookInfo {
            let this = self;
            $body!(get_webhook_info this ())
        }
    };
    (@method get_me $body:ident $ty:ident) => {
        type GetMe = $ty![GetMe];

        fn get_me(&self, ) -> Self::GetMe {
            let this = self;
            $body!(get_me this ())
        }
    };
    (@method log_out $body:ident $ty:ident) => {
        type LogOut = $ty![LogOut];

        fn log_out(&self, ) -> Self::LogOut {
            let this = self;
            $body!(log_out this ())
        }
    };
    (@method close $body:ident $ty:ident) => {
        type Close = $ty![Close];

        fn close(&self, ) -> Self::Close {
            let this = self;
            $body!(close this ())
        }
    };
    (@method send_message $body:ident $ty:ident) => {
        type SendMessage = $ty![SendMessage];

        fn send_message<C, T>(&self, chat_id: C, text: T) -> Self::SendMessage where C: Into<Recipient>,
        T: Into<String> {
            let this = self;
            $body!(send_message this (chat_id: C, text: T))
        }
    };
    (@method forward_message $body:ident $ty:ident) => {
        type ForwardMessage = $ty![ForwardMessage];

        fn forward_message<C, F>(&self, chat_id: C, from_chat_id: F, message_id: MessageId) -> Self::ForwardMessage where C: Into<Recipient>,
        F: Into<Recipient> {
            let this = self;
            $body!(forward_message this (chat_id: C, from_chat_id: F, message_id: MessageId))
        }
    };
    (@method forward_messages $body:ident $ty:ident) => {
        type ForwardMessages = $ty![ForwardMessages];

        fn forward_messages<C, F, M>(&self, chat_id: C, from_chat_id: F, message_ids: M) -> Self::ForwardMessages where C: Into<Recipient>,
        F: Into<Recipient>,
        M: IntoIterator<Item = MessageId> {
            let this = self;
            $body!(forward_messages this (chat_id: C, from_chat_id: F, message_ids: M))
        }
    };
    (@method copy_message $body:ident $ty:ident) => {
        type CopyMessage = $ty![CopyMessage];

        fn copy_message<C, F>(&self, chat_id: C, from_chat_id: F, message_id: MessageId) -> Self::CopyMessage where C: Into<Recipient>,
        F: Into<Recipient> {
            let this = self;
            $body!(copy_message this (chat_id: C, from_chat_id: F, message_id: MessageId))
        }
    };
    (@method copy_messages $body:ident $ty:ident) => {
        type CopyMessages = $ty![CopyMessages];

        fn copy_messages<C, F, M>(&self, chat_id: C, from_chat_id: F, message_ids: M) -> Self::CopyMessages where C: Into<Recipient>,
        F: Into<Recipient>,
        M: IntoIterator<Item = MessageId> {
            let this = self;
            $body!(copy_messages this (chat_id: C, from_chat_id: F, message_ids: M))
        }
    };
    (@method send_photo $body:ident $ty:ident) => {
        type SendPhoto = $ty![SendPhoto];

        fn send_photo<C>(&self, chat_id: C, photo: InputFile) -> Self::SendPhoto where C: Into<Recipient> {
            let this = self;
            $body!(send_photo this (chat_id: C, photo: InputFile))
        }
    };
    (@method send_audio $body:ident $ty:ident) => {
        type SendAudio = $ty![SendAudio];

        fn send_audio<C>(&self, chat_id: C, audio: InputFile) -> Self::SendAudio where C: Into<Recipient> {
            let this = self;
            $body!(send_audio this (chat_id: C, audio: InputFile))
        }
    };
    (@method send_document $body:ident $ty:ident) => {
        type SendDocument = $ty![SendDocument];

        fn send_document<C>(&self, chat_id: C, document: InputFile) -> Self::SendDocument where C: Into<Recipient> {
            let this = self;
            $body!(send_document this (chat_id: C, document: InputFile))
        }
    };
    (@method send_video $body:ident $ty:ident) => {
        type SendVideo = $ty![SendVideo];

        fn send_video<C>(&self, chat_id: C, video: InputFile) -> Self::SendVideo where C: Into<Recipient> {
            let this = self;
            $body!(send_video this (chat_id: C, video: InputFile))
        }
    };
    (@method send_animation $body:ident $ty:ident) => {
        type SendAnimation = $ty![SendAnimation];

        fn send_animation<C>(&self, chat_id: C, animation: InputFile) -> Self::SendAnimation where C: Into<Recipient> {
            let this = self;
            $body!(send_animation this (chat_id: C, animation: InputFile))
        }
    };
    (@method send_voice $body:ident $ty:ident) => {
        type SendVoice = $ty![SendVoice];

        fn send_voice<C>(&self, chat_id: C, voice: InputFile) -> Self::SendVoice where C: Into<Recipient> {
            let this = self;
            $body!(send_voice this (chat_id: C, voice: InputFile))
        }
    };
    (@method send_video_note $body:ident $ty:ident) => {
        type SendVideoNote = $ty![SendVideoNote];

        fn send_video_note<C>(&self, chat_id: C, video_note: InputFile) -> Self::SendVideoNote where C: Into<Recipient> {
            let this = self;
            $body!(send_video_note this (chat_id: C, video_note: InputFile))
        }
    };
    (@method send_paid_media $body:ident $ty:ident) => {
        type SendPaidMedia = $ty![SendPaidMedia];

        fn send_paid_media<C, M>(&self, chat_id: C, star_count: u32, media: M) -> Self::SendPaidMedia where C: Into<Recipient>,
        M: IntoIterator<Item = InputPaidMedia> {
            let this = self;
            $body!(send_paid_media this (chat_id: C, star_count: u32, media: M))
        }
    };
    (@method send_media_group $body:ident $ty:ident) => {
        type SendMediaGroup = $ty![SendMediaGroup];

        fn send_media_group<C, M>(&self, chat_id: C, media: M) -> Self::SendMediaGroup where C: Into<Recipient>,
        M: IntoIterator<Item = InputMedia> {
            let this = self;
            $body!(send_media_group this (chat_id: C, media: M))
        }
    };
    (@method send_location $body:ident $ty:ident) => {
        type SendLocation = $ty![SendLocation];

        fn send_location<C>(&self, chat_id: C, latitude: f64, longitude: f64) -> Self::SendLocation where C: Into<Recipient> {
            let this = self;
            $body!(send_location this (chat_id: C, latitude: f64, longitude: f64))
        }
    };
    (@method edit_message_live_location $body:ident $ty:ident) => {
        type EditMessageLiveLocation = $ty![EditMessageLiveLocation];

        fn edit_message_live_location<C>(&self, chat_id: C, message_id: MessageId, latitude: f64, longitude: f64) -> Self::EditMessageLiveLocation where C: Into<Recipient> {
            let this = self;
            $body!(edit_message_live_location this (chat_id: C, message_id: MessageId, latitude: f64, longitude: f64))
        }
    };
    (@method edit_message_live_location_inline $body:ident $ty:ident) => {
        type EditMessageLiveLocationInline = $ty![EditMessageLiveLocationInline];

        fn edit_message_live_location_inline<I>(&self, inline_message_id: I, latitude: f64, longitude: f64) -> Self::EditMessageLiveLocationInline where I: Into<String> {
            let this = self;
            $body!(edit_message_live_location_inline this (inline_message_id: I, latitude: f64, longitude: f64))
        }
    };
    (@method stop_message_live_location $body:ident $ty:ident) => {
        type StopMessageLiveLocation = $ty![StopMessageLiveLocation];

        fn stop_message_live_location<C>(&self, chat_id: C, message_id: MessageId) -> Self::StopMessageLiveLocation where C: Into<Recipient> {
            let this = self;
            $body!(stop_message_live_location this (chat_id: C, message_id: MessageId))
        }
    };
    (@method stop_message_live_location_inline $body:ident $ty:ident) => {
        type StopMessageLiveLocationInline = $ty![StopMessageLiveLocationInline];

        fn stop_message_live_location_inline<I>(&self, inline_message_id: I) -> Self::StopMessageLiveLocationInline where I: Into<String> {
            let this = self;
            $body!(stop_message_live_location_inline this (inline_message_id: I))
        }
    };
    (@method edit_message_checklist $body:ident $ty:ident) => {
        type EditMessageChecklist = $ty![EditMessageChecklist];

        fn edit_message_checklist<C>(&self, business_connection_id: BusinessConnectionId, chat_id: C, message_id: MessageId, checklist: InputChecklist) -> Self::EditMessageChecklist where C: Into<ChatId> {
            let this = self;
            $body!(edit_message_checklist this (business_connection_id: BusinessConnectionId, chat_id: C, message_id: MessageId, checklist: InputChecklist))
        }
    };
    (@method send_venue $body:ident $ty:ident) => {
        type SendVenue = $ty![SendVenue];

        fn send_venue<C, T, A>(&self, chat_id: C, latitude: f64, longitude: f64, title: T, address: A) -> Self::SendVenue where C: Into<Recipient>,
        T: Into<String>,
        A: Into<String> {
            let this = self;
            $body!(send_venue this (chat_id: C, latitude: f64, longitude: f64, title: T, address: A))
        }
    };
    (@method send_contact $body:ident $ty:ident) => {
        type SendContact = $ty![SendContact];

        fn send_contact<C, P, F>(&self, chat_id: C, phone_number: P, first_name: F) -> Self::SendContact where C: Into<Recipient>,
        P: Into<String>,
        F: Into<String> {
            let this = self;
            $body!(send_contact this (chat_id: C, phone_number: P, first_name: F))
        }
    };
    (@method send_poll $body:ident $ty:ident) => {
        type SendPoll = $ty![SendPoll];

        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 = InputPollOption> {
            let this = self;
            $body!(send_poll this (chat_id: C, question: Q, options: O))
        }
    };
    (@method send_checklist $body:ident $ty:ident) => {
        type SendChecklist = $ty![SendChecklist];

        fn send_checklist<C>(&self, business_connection_id: BusinessConnectionId, chat_id: C, checklist: InputChecklist) -> Self::SendChecklist where C: Into<ChatId> {
            let this = self;
            $body!(send_checklist this (business_connection_id: BusinessConnectionId, chat_id: C, checklist: InputChecklist))
        }
    };
    (@method send_dice $body:ident $ty:ident) => {
        type SendDice = $ty![SendDice];

        fn send_dice<C>(&self, chat_id: C) -> Self::SendDice where C: Into<Recipient> {
            let this = self;
            $body!(send_dice this (chat_id: C))
        }
    };
    (@method send_chat_action $body:ident $ty:ident) => {
        type SendChatAction = $ty![SendChatAction];

        fn send_chat_action<C>(&self, chat_id: C, action: ChatAction) -> Self::SendChatAction where C: Into<Recipient> {
            let this = self;
            $body!(send_chat_action this (chat_id: C, action: ChatAction))
        }
    };
    (@method set_message_reaction $body:ident $ty:ident) => {
        type SetMessageReaction = $ty![SetMessageReaction];

        fn set_message_reaction<C>(&self, chat_id: C, message_id: MessageId) -> Self::SetMessageReaction where C: Into<Recipient> {
            let this = self;
            $body!(set_message_reaction this (chat_id: C, message_id: MessageId))
        }
    };
    (@method get_user_profile_photos $body:ident $ty:ident) => {
        type GetUserProfilePhotos = $ty![GetUserProfilePhotos];

        fn get_user_profile_photos(&self, user_id: UserId) -> Self::GetUserProfilePhotos {
            let this = self;
            $body!(get_user_profile_photos this (user_id: UserId))
        }
    };
    (@method set_user_emoji_status $body:ident $ty:ident) => {
        type SetUserEmojiStatus = $ty![SetUserEmojiStatus];

        fn set_user_emoji_status(&self, user_id: UserId) -> Self::SetUserEmojiStatus {
            let this = self;
            $body!(set_user_emoji_status this (user_id: UserId))
        }
    };
    (@method get_file $body:ident $ty:ident) => {
        type GetFile = $ty![GetFile];

        fn get_file(&self, file_id: FileId) -> Self::GetFile {
            let this = self;
            $body!(get_file this (file_id: FileId))
        }
    };
    (@method ban_chat_member $body:ident $ty:ident) => {
        type BanChatMember = $ty![BanChatMember];

        fn ban_chat_member<C>(&self, chat_id: C, user_id: UserId) -> Self::BanChatMember where C: Into<Recipient> {
            let this = self;
            $body!(ban_chat_member this (chat_id: C, user_id: UserId))
        }
    };
    (@method kick_chat_member $body:ident $ty:ident) => {
        type KickChatMember = $ty![KickChatMember];

        fn kick_chat_member<C>(&self, chat_id: C, user_id: UserId) -> Self::KickChatMember where C: Into<Recipient> {
            let this = self;
            $body!(kick_chat_member this (chat_id: C, user_id: UserId))
        }
    };
    (@method unban_chat_member $body:ident $ty:ident) => {
        type UnbanChatMember = $ty![UnbanChatMember];

        fn unban_chat_member<C>(&self, chat_id: C, user_id: UserId) -> Self::UnbanChatMember where C: Into<Recipient> {
            let this = self;
            $body!(unban_chat_member this (chat_id: C, user_id: UserId))
        }
    };
    (@method restrict_chat_member $body:ident $ty:ident) => {
        type RestrictChatMember = $ty![RestrictChatMember];

        fn restrict_chat_member<C>(&self, chat_id: C, user_id: UserId, permissions: ChatPermissions) -> Self::RestrictChatMember where C: Into<Recipient> {
            let this = self;
            $body!(restrict_chat_member this (chat_id: C, user_id: UserId, permissions: ChatPermissions))
        }
    };
    (@method promote_chat_member $body:ident $ty:ident) => {
        type PromoteChatMember = $ty![PromoteChatMember];

        fn promote_chat_member<C>(&self, chat_id: C, user_id: UserId) -> Self::PromoteChatMember where C: Into<Recipient> {
            let this = self;
            $body!(promote_chat_member this (chat_id: C, user_id: UserId))
        }
    };
    (@method set_chat_administrator_custom_title $body:ident $ty:ident) => {
        type SetChatAdministratorCustomTitle = $ty![SetChatAdministratorCustomTitle];

        fn set_chat_administrator_custom_title<Ch, C>(&self, chat_id: Ch, user_id: UserId, custom_title: C) -> Self::SetChatAdministratorCustomTitle where Ch: Into<Recipient>,
        C: Into<String> {
            let this = self;
            $body!(set_chat_administrator_custom_title this (chat_id: Ch, user_id: UserId, custom_title: C))
        }
    };
    (@method ban_chat_sender_chat $body:ident $ty:ident) => {
        type BanChatSenderChat = $ty![BanChatSenderChat];

        fn ban_chat_sender_chat<C, S>(&self, chat_id: C, sender_chat_id: S) -> Self::BanChatSenderChat where C: Into<Recipient>,
        S: Into<ChatId> {
            let this = self;
            $body!(ban_chat_sender_chat this (chat_id: C, sender_chat_id: S))
        }
    };
    (@method unban_chat_sender_chat $body:ident $ty:ident) => {
        type UnbanChatSenderChat = $ty![UnbanChatSenderChat];

        fn unban_chat_sender_chat<C, S>(&self, chat_id: C, sender_chat_id: S) -> Self::UnbanChatSenderChat where C: Into<Recipient>,
        S: Into<ChatId> {
            let this = self;
            $body!(unban_chat_sender_chat this (chat_id: C, sender_chat_id: S))
        }
    };
    (@method set_chat_permissions $body:ident $ty:ident) => {
        type SetChatPermissions = $ty![SetChatPermissions];

        fn set_chat_permissions<C>(&self, chat_id: C, permissions: ChatPermissions) -> Self::SetChatPermissions where C: Into<Recipient> {
            let this = self;
            $body!(set_chat_permissions this (chat_id: C, permissions: ChatPermissions))
        }
    };
    (@method export_chat_invite_link $body:ident $ty:ident) => {
        type ExportChatInviteLink = $ty![ExportChatInviteLink];

        fn export_chat_invite_link<C>(&self, chat_id: C) -> Self::ExportChatInviteLink where C: Into<Recipient> {
            let this = self;
            $body!(export_chat_invite_link this (chat_id: C))
        }
    };
    (@method create_chat_invite_link $body:ident $ty:ident) => {
        type CreateChatInviteLink = $ty![CreateChatInviteLink];

        fn create_chat_invite_link<C>(&self, chat_id: C) -> Self::CreateChatInviteLink where C: Into<Recipient> {
            let this = self;
            $body!(create_chat_invite_link this (chat_id: C))
        }
    };
    (@method edit_chat_invite_link $body:ident $ty:ident) => {
        type EditChatInviteLink = $ty![EditChatInviteLink];

        fn edit_chat_invite_link<C, I>(&self, chat_id: C, invite_link: I) -> Self::EditChatInviteLink where C: Into<Recipient>,
        I: Into<String> {
            let this = self;
            $body!(edit_chat_invite_link this (chat_id: C, invite_link: I))
        }
    };
    (@method create_chat_subscription_invite_link $body:ident $ty:ident) => {
        type CreateChatSubscriptionInviteLink = $ty![CreateChatSubscriptionInviteLink];

        fn create_chat_subscription_invite_link<C>(&self, chat_id: C, subscription_period: Seconds, subscription_price: u32) -> Self::CreateChatSubscriptionInviteLink where C: Into<Recipient> {
            let this = self;
            $body!(create_chat_subscription_invite_link this (chat_id: C, subscription_period: Seconds, subscription_price: u32))
        }
    };
    (@method edit_chat_subscription_invite_link $body:ident $ty:ident) => {
        type EditChatSubscriptionInviteLink = $ty![EditChatSubscriptionInviteLink];

        fn edit_chat_subscription_invite_link<C, I>(&self, chat_id: C, invite_link: I) -> Self::EditChatSubscriptionInviteLink where C: Into<Recipient>,
        I: Into<String> {
            let this = self;
            $body!(edit_chat_subscription_invite_link this (chat_id: C, invite_link: I))
        }
    };
    (@method revoke_chat_invite_link $body:ident $ty:ident) => {
        type RevokeChatInviteLink = $ty![RevokeChatInviteLink];

        fn revoke_chat_invite_link<C, I>(&self, chat_id: C, invite_link: I) -> Self::RevokeChatInviteLink where C: Into<Recipient>,
        I: Into<String> {
            let this = self;
            $body!(revoke_chat_invite_link this (chat_id: C, invite_link: I))
        }
    };
    (@method approve_chat_join_request $body:ident $ty:ident) => {
        type ApproveChatJoinRequest = $ty![ApproveChatJoinRequest];

        fn approve_chat_join_request<C>(&self, chat_id: C, user_id: UserId) -> Self::ApproveChatJoinRequest where C: Into<Recipient> {
            let this = self;
            $body!(approve_chat_join_request this (chat_id: C, user_id: UserId))
        }
    };
    (@method decline_chat_join_request $body:ident $ty:ident) => {
        type DeclineChatJoinRequest = $ty![DeclineChatJoinRequest];

        fn decline_chat_join_request<C>(&self, chat_id: C, user_id: UserId) -> Self::DeclineChatJoinRequest where C: Into<Recipient> {
            let this = self;
            $body!(decline_chat_join_request this (chat_id: C, user_id: UserId))
        }
    };
    (@method set_chat_photo $body:ident $ty:ident) => {
        type SetChatPhoto = $ty![SetChatPhoto];

        fn set_chat_photo<C>(&self, chat_id: C, photo: InputFile) -> Self::SetChatPhoto where C: Into<Recipient> {
            let this = self;
            $body!(set_chat_photo this (chat_id: C, photo: InputFile))
        }
    };
    (@method delete_chat_photo $body:ident $ty:ident) => {
        type DeleteChatPhoto = $ty![DeleteChatPhoto];

        fn delete_chat_photo<C>(&self, chat_id: C) -> Self::DeleteChatPhoto where C: Into<Recipient> {
            let this = self;
            $body!(delete_chat_photo this (chat_id: C))
        }
    };
    (@method set_chat_title $body:ident $ty:ident) => {
        type SetChatTitle = $ty![SetChatTitle];

        fn set_chat_title<C, T>(&self, chat_id: C, title: T) -> Self::SetChatTitle where C: Into<Recipient>,
        T: Into<String> {
            let this = self;
            $body!(set_chat_title this (chat_id: C, title: T))
        }
    };
    (@method set_chat_description $body:ident $ty:ident) => {
        type SetChatDescription = $ty![SetChatDescription];

        fn set_chat_description<C>(&self, chat_id: C) -> Self::SetChatDescription where C: Into<Recipient> {
            let this = self;
            $body!(set_chat_description this (chat_id: C))
        }
    };
    (@method pin_chat_message $body:ident $ty:ident) => {
        type PinChatMessage = $ty![PinChatMessage];

        fn pin_chat_message<C>(&self, chat_id: C, message_id: MessageId) -> Self::PinChatMessage where C: Into<Recipient> {
            let this = self;
            $body!(pin_chat_message this (chat_id: C, message_id: MessageId))
        }
    };
    (@method unpin_chat_message $body:ident $ty:ident) => {
        type UnpinChatMessage = $ty![UnpinChatMessage];

        fn unpin_chat_message<C>(&self, chat_id: C) -> Self::UnpinChatMessage where C: Into<Recipient> {
            let this = self;
            $body!(unpin_chat_message this (chat_id: C))
        }
    };
    (@method unpin_all_chat_messages $body:ident $ty:ident) => {
        type UnpinAllChatMessages = $ty![UnpinAllChatMessages];

        fn unpin_all_chat_messages<C>(&self, chat_id: C) -> Self::UnpinAllChatMessages where C: Into<Recipient> {
            let this = self;
            $body!(unpin_all_chat_messages this (chat_id: C))
        }
    };
    (@method leave_chat $body:ident $ty:ident) => {
        type LeaveChat = $ty![LeaveChat];

        fn leave_chat<C>(&self, chat_id: C) -> Self::LeaveChat where C: Into<Recipient> {
            let this = self;
            $body!(leave_chat this (chat_id: C))
        }
    };
    (@method get_chat $body:ident $ty:ident) => {
        type GetChat = $ty![GetChat];

        fn get_chat<C>(&self, chat_id: C) -> Self::GetChat where C: Into<Recipient> {
            let this = self;
            $body!(get_chat this (chat_id: C))
        }
    };
    (@method get_chat_administrators $body:ident $ty:ident) => {
        type GetChatAdministrators = $ty![GetChatAdministrators];

        fn get_chat_administrators<C>(&self, chat_id: C) -> Self::GetChatAdministrators where C: Into<Recipient> {
            let this = self;
            $body!(get_chat_administrators this (chat_id: C))
        }
    };
    (@method get_chat_member_count $body:ident $ty:ident) => {
        type GetChatMemberCount = $ty![GetChatMemberCount];

        fn get_chat_member_count<C>(&self, chat_id: C) -> Self::GetChatMemberCount where C: Into<Recipient> {
            let this = self;
            $body!(get_chat_member_count this (chat_id: C))
        }
    };
    (@method get_chat_members_count $body:ident $ty:ident) => {
        type GetChatMembersCount = $ty![GetChatMembersCount];

        fn get_chat_members_count<C>(&self, chat_id: C) -> Self::GetChatMembersCount where C: Into<Recipient> {
            let this = self;
            $body!(get_chat_members_count this (chat_id: C))
        }
    };
    (@method get_chat_member $body:ident $ty:ident) => {
        type GetChatMember = $ty![GetChatMember];

        fn get_chat_member<C>(&self, chat_id: C, user_id: UserId) -> Self::GetChatMember where C: Into<Recipient> {
            let this = self;
            $body!(get_chat_member this (chat_id: C, user_id: UserId))
        }
    };
    (@method set_chat_sticker_set $body:ident $ty:ident) => {
        type SetChatStickerSet = $ty![SetChatStickerSet];

        fn set_chat_sticker_set<C, S>(&self, chat_id: C, sticker_set_name: S) -> Self::SetChatStickerSet where C: Into<Recipient>,
        S: Into<String> {
            let this = self;
            $body!(set_chat_sticker_set this (chat_id: C, sticker_set_name: S))
        }
    };
    (@method delete_chat_sticker_set $body:ident $ty:ident) => {
        type DeleteChatStickerSet = $ty![DeleteChatStickerSet];

        fn delete_chat_sticker_set<C>(&self, chat_id: C) -> Self::DeleteChatStickerSet where C: Into<Recipient> {
            let this = self;
            $body!(delete_chat_sticker_set this (chat_id: C))
        }
    };
    (@method get_forum_topic_icon_stickers $body:ident $ty:ident) => {
        type GetForumTopicIconStickers = $ty![GetForumTopicIconStickers];

        fn get_forum_topic_icon_stickers(&self, ) -> Self::GetForumTopicIconStickers {
            let this = self;
            $body!(get_forum_topic_icon_stickers this ())
        }
    };
    (@method create_forum_topic $body:ident $ty:ident) => {
        type CreateForumTopic = $ty![CreateForumTopic];

        fn create_forum_topic<C, N>(&self, chat_id: C, name: N) -> Self::CreateForumTopic where C: Into<Recipient>,
        N: Into<String> {
            let this = self;
            $body!(create_forum_topic this (chat_id: C, name: N))
        }
    };
    (@method edit_forum_topic $body:ident $ty:ident) => {
        type EditForumTopic = $ty![EditForumTopic];

        fn edit_forum_topic<C>(&self, chat_id: C, message_thread_id: ThreadId) -> Self::EditForumTopic where C: Into<Recipient> {
            let this = self;
            $body!(edit_forum_topic this (chat_id: C, message_thread_id: ThreadId))
        }
    };
    (@method close_forum_topic $body:ident $ty:ident) => {
        type CloseForumTopic = $ty![CloseForumTopic];

        fn close_forum_topic<C>(&self, chat_id: C, message_thread_id: ThreadId) -> Self::CloseForumTopic where C: Into<Recipient> {
            let this = self;
            $body!(close_forum_topic this (chat_id: C, message_thread_id: ThreadId))
        }
    };
    (@method reopen_forum_topic $body:ident $ty:ident) => {
        type ReopenForumTopic = $ty![ReopenForumTopic];

        fn reopen_forum_topic<C>(&self, chat_id: C, message_thread_id: ThreadId) -> Self::ReopenForumTopic where C: Into<Recipient> {
            let this = self;
            $body!(reopen_forum_topic this (chat_id: C, message_thread_id: ThreadId))
        }
    };
    (@method delete_forum_topic $body:ident $ty:ident) => {
        type DeleteForumTopic = $ty![DeleteForumTopic];

        fn delete_forum_topic<C>(&self, chat_id: C, message_thread_id: ThreadId) -> Self::DeleteForumTopic where C: Into<Recipient> {
            let this = self;
            $body!(delete_forum_topic this (chat_id: C, message_thread_id: ThreadId))
        }
    };
    (@method unpin_all_forum_topic_messages $body:ident $ty:ident) => {
        type UnpinAllForumTopicMessages = $ty![UnpinAllForumTopicMessages];

        fn unpin_all_forum_topic_messages<C>(&self, chat_id: C, message_thread_id: ThreadId) -> Self::UnpinAllForumTopicMessages where C: Into<Recipient> {
            let this = self;
            $body!(unpin_all_forum_topic_messages this (chat_id: C, message_thread_id: ThreadId))
        }
    };
    (@method edit_general_forum_topic $body:ident $ty:ident) => {
        type EditGeneralForumTopic = $ty![EditGeneralForumTopic];

        fn edit_general_forum_topic<C, N>(&self, chat_id: C, name: N) -> Self::EditGeneralForumTopic where C: Into<Recipient>,
        N: Into<String> {
            let this = self;
            $body!(edit_general_forum_topic this (chat_id: C, name: N))
        }
    };
    (@method close_general_forum_topic $body:ident $ty:ident) => {
        type CloseGeneralForumTopic = $ty![CloseGeneralForumTopic];

        fn close_general_forum_topic<C>(&self, chat_id: C) -> Self::CloseGeneralForumTopic where C: Into<Recipient> {
            let this = self;
            $body!(close_general_forum_topic this (chat_id: C))
        }
    };
    (@method reopen_general_forum_topic $body:ident $ty:ident) => {
        type ReopenGeneralForumTopic = $ty![ReopenGeneralForumTopic];

        fn reopen_general_forum_topic<C>(&self, chat_id: C) -> Self::ReopenGeneralForumTopic where C: Into<Recipient> {
            let this = self;
            $body!(reopen_general_forum_topic this (chat_id: C))
        }
    };
    (@method hide_general_forum_topic $body:ident $ty:ident) => {
        type HideGeneralForumTopic = $ty![HideGeneralForumTopic];

        fn hide_general_forum_topic<C>(&self, chat_id: C) -> Self::HideGeneralForumTopic where C: Into<Recipient> {
            let this = self;
            $body!(hide_general_forum_topic this (chat_id: C))
        }
    };
    (@method unhide_general_forum_topic $body:ident $ty:ident) => {
        type UnhideGeneralForumTopic = $ty![UnhideGeneralForumTopic];

        fn unhide_general_forum_topic<C>(&self, chat_id: C) -> Self::UnhideGeneralForumTopic where C: Into<Recipient> {
            let this = self;
            $body!(unhide_general_forum_topic this (chat_id: C))
        }
    };
    (@method unpin_all_general_forum_topic_messages $body:ident $ty:ident) => {
        type UnpinAllGeneralForumTopicMessages = $ty![UnpinAllGeneralForumTopicMessages];

        fn unpin_all_general_forum_topic_messages<C>(&self, chat_id: C) -> Self::UnpinAllGeneralForumTopicMessages where C: Into<Recipient> {
            let this = self;
            $body!(unpin_all_general_forum_topic_messages this (chat_id: C))
        }
    };
    (@method answer_callback_query $body:ident $ty:ident) => {
        type AnswerCallbackQuery = $ty![AnswerCallbackQuery];

        fn answer_callback_query(&self, callback_query_id: CallbackQueryId) -> Self::AnswerCallbackQuery {
            let this = self;
            $body!(answer_callback_query this (callback_query_id: CallbackQueryId))
        }
    };
    (@method get_user_chat_boosts $body:ident $ty:ident) => {
        type GetUserChatBoosts = $ty![GetUserChatBoosts];

        fn get_user_chat_boosts<C>(&self, chat_id: C, user_id: UserId) -> Self::GetUserChatBoosts where C: Into<Recipient> {
            let this = self;
            $body!(get_user_chat_boosts this (chat_id: C, user_id: UserId))
        }
    };
    (@method set_my_commands $body:ident $ty:ident) => {
        type SetMyCommands = $ty![SetMyCommands];

        fn set_my_commands<C>(&self, commands: C) -> Self::SetMyCommands where C: IntoIterator<Item = BotCommand> {
            let this = self;
            $body!(set_my_commands this (commands: C))
        }
    };
    (@method get_business_connection $body:ident $ty:ident) => {
        type GetBusinessConnection = $ty![GetBusinessConnection];

        fn get_business_connection(&self, business_connection_id: BusinessConnectionId) -> Self::GetBusinessConnection {
            let this = self;
            $body!(get_business_connection this (business_connection_id: BusinessConnectionId))
        }
    };
    (@method get_my_commands $body:ident $ty:ident) => {
        type GetMyCommands = $ty![GetMyCommands];

        fn get_my_commands(&self, ) -> Self::GetMyCommands {
            let this = self;
            $body!(get_my_commands this ())
        }
    };
    (@method set_my_name $body:ident $ty:ident) => {
        type SetMyName = $ty![SetMyName];

        fn set_my_name(&self, ) -> Self::SetMyName {
            let this = self;
            $body!(set_my_name this ())
        }
    };
    (@method get_my_name $body:ident $ty:ident) => {
        type GetMyName = $ty![GetMyName];

        fn get_my_name(&self, ) -> Self::GetMyName {
            let this = self;
            $body!(get_my_name this ())
        }
    };
    (@method set_my_description $body:ident $ty:ident) => {
        type SetMyDescription = $ty![SetMyDescription];

        fn set_my_description(&self, ) -> Self::SetMyDescription {
            let this = self;
            $body!(set_my_description this ())
        }
    };
    (@method get_my_description $body:ident $ty:ident) => {
        type GetMyDescription = $ty![GetMyDescription];

        fn get_my_description(&self, ) -> Self::GetMyDescription {
            let this = self;
            $body!(get_my_description this ())
        }
    };
    (@method set_my_short_description $body:ident $ty:ident) => {
        type SetMyShortDescription = $ty![SetMyShortDescription];

        fn set_my_short_description(&self, ) -> Self::SetMyShortDescription {
            let this = self;
            $body!(set_my_short_description this ())
        }
    };
    (@method get_my_short_description $body:ident $ty:ident) => {
        type GetMyShortDescription = $ty![GetMyShortDescription];

        fn get_my_short_description(&self, ) -> Self::GetMyShortDescription {
            let this = self;
            $body!(get_my_short_description this ())
        }
    };
    (@method set_chat_menu_button $body:ident $ty:ident) => {
        type SetChatMenuButton = $ty![SetChatMenuButton];

        fn set_chat_menu_button(&self, ) -> Self::SetChatMenuButton {
            let this = self;
            $body!(set_chat_menu_button this ())
        }
    };
    (@method get_chat_menu_button $body:ident $ty:ident) => {
        type GetChatMenuButton = $ty![GetChatMenuButton];

        fn get_chat_menu_button(&self, ) -> Self::GetChatMenuButton {
            let this = self;
            $body!(get_chat_menu_button this ())
        }
    };
    (@method set_my_default_administrator_rights $body:ident $ty:ident) => {
        type SetMyDefaultAdministratorRights = $ty![SetMyDefaultAdministratorRights];

        fn set_my_default_administrator_rights(&self, ) -> Self::SetMyDefaultAdministratorRights {
            let this = self;
            $body!(set_my_default_administrator_rights this ())
        }
    };
    (@method get_my_default_administrator_rights $body:ident $ty:ident) => {
        type GetMyDefaultAdministratorRights = $ty![GetMyDefaultAdministratorRights];

        fn get_my_default_administrator_rights(&self, ) -> Self::GetMyDefaultAdministratorRights {
            let this = self;
            $body!(get_my_default_administrator_rights this ())
        }
    };
    (@method delete_my_commands $body:ident $ty:ident) => {
        type DeleteMyCommands = $ty![DeleteMyCommands];

        fn delete_my_commands(&self, ) -> Self::DeleteMyCommands {
            let this = self;
            $body!(delete_my_commands this ())
        }
    };
    (@method answer_inline_query $body:ident $ty:ident) => {
        type AnswerInlineQuery = $ty![AnswerInlineQuery];

        fn answer_inline_query<R>(&self, inline_query_id: InlineQueryId, results: R) -> Self::AnswerInlineQuery where R: IntoIterator<Item = InlineQueryResult> {
            let this = self;
            $body!(answer_inline_query this (inline_query_id: InlineQueryId, results: R))
        }
    };
    (@method answer_web_app_query $body:ident $ty:ident) => {
        type AnswerWebAppQuery = $ty![AnswerWebAppQuery];

        fn answer_web_app_query<W>(&self, web_app_query_id: W, result: InlineQueryResult) -> Self::AnswerWebAppQuery where W: Into<String> {
            let this = self;
            $body!(answer_web_app_query this (web_app_query_id: W, result: InlineQueryResult))
        }
    };
    (@method save_prepared_inline_message $body:ident $ty:ident) => {
        type SavePreparedInlineMessage = $ty![SavePreparedInlineMessage];

        fn save_prepared_inline_message(&self, user_id: UserId, result: InlineQueryResult) -> Self::SavePreparedInlineMessage {
            let this = self;
            $body!(save_prepared_inline_message this (user_id: UserId, result: InlineQueryResult))
        }
    };
    (@method edit_message_text $body:ident $ty:ident) => {
        type EditMessageText = $ty![EditMessageText];

        fn edit_message_text<C, T>(&self, chat_id: C, message_id: MessageId, text: T) -> Self::EditMessageText where C: Into<Recipient>,
        T: Into<String> {
            let this = self;
            $body!(edit_message_text this (chat_id: C, message_id: MessageId, text: T))
        }
    };
    (@method edit_message_text_inline $body:ident $ty:ident) => {
        type EditMessageTextInline = $ty![EditMessageTextInline];

        fn edit_message_text_inline<I, T>(&self, inline_message_id: I, text: T) -> Self::EditMessageTextInline where I: Into<String>,
        T: Into<String> {
            let this = self;
            $body!(edit_message_text_inline this (inline_message_id: I, text: T))
        }
    };
    (@method edit_message_caption $body:ident $ty:ident) => {
        type EditMessageCaption = $ty![EditMessageCaption];

        fn edit_message_caption<C>(&self, chat_id: C, message_id: MessageId) -> Self::EditMessageCaption where C: Into<Recipient> {
            let this = self;
            $body!(edit_message_caption this (chat_id: C, message_id: MessageId))
        }
    };
    (@method edit_message_caption_inline $body:ident $ty:ident) => {
        type EditMessageCaptionInline = $ty![EditMessageCaptionInline];

        fn edit_message_caption_inline<I>(&self, inline_message_id: I) -> Self::EditMessageCaptionInline where I: Into<String> {
            let this = self;
            $body!(edit_message_caption_inline this (inline_message_id: I))
        }
    };
    (@method edit_message_media $body:ident $ty:ident) => {
        type EditMessageMedia = $ty![EditMessageMedia];

        fn edit_message_media<C>(&self, chat_id: C, message_id: MessageId, media: InputMedia) -> Self::EditMessageMedia where C: Into<Recipient> {
            let this = self;
            $body!(edit_message_media this (chat_id: C, message_id: MessageId, media: InputMedia))
        }
    };
    (@method edit_message_media_inline $body:ident $ty:ident) => {
        type EditMessageMediaInline = $ty![EditMessageMediaInline];

        fn edit_message_media_inline<I>(&self, inline_message_id: I, media: InputMedia) -> Self::EditMessageMediaInline where I: Into<String> {
            let this = self;
            $body!(edit_message_media_inline this (inline_message_id: I, media: InputMedia))
        }
    };
    (@method edit_message_reply_markup $body:ident $ty:ident) => {
        type EditMessageReplyMarkup = $ty![EditMessageReplyMarkup];

        fn edit_message_reply_markup<C>(&self, chat_id: C, message_id: MessageId) -> Self::EditMessageReplyMarkup where C: Into<Recipient> {
            let this = self;
            $body!(edit_message_reply_markup this (chat_id: C, message_id: MessageId))
        }
    };
    (@method edit_message_reply_markup_inline $body:ident $ty:ident) => {
        type EditMessageReplyMarkupInline = $ty![EditMessageReplyMarkupInline];

        fn edit_message_reply_markup_inline<I>(&self, inline_message_id: I) -> Self::EditMessageReplyMarkupInline where I: Into<String> {
            let this = self;
            $body!(edit_message_reply_markup_inline this (inline_message_id: I))
        }
    };
    (@method stop_poll $body:ident $ty:ident) => {
        type StopPoll = $ty![StopPoll];

        fn stop_poll<C>(&self, chat_id: C, message_id: MessageId) -> Self::StopPoll where C: Into<Recipient> {
            let this = self;
            $body!(stop_poll this (chat_id: C, message_id: MessageId))
        }
    };
    (@method delete_message $body:ident $ty:ident) => {
        type DeleteMessage = $ty![DeleteMessage];

        fn delete_message<C>(&self, chat_id: C, message_id: MessageId) -> Self::DeleteMessage where C: Into<Recipient> {
            let this = self;
            $body!(delete_message this (chat_id: C, message_id: MessageId))
        }
    };
    (@method delete_messages $body:ident $ty:ident) => {
        type DeleteMessages = $ty![DeleteMessages];

        fn delete_messages<C, M>(&self, chat_id: C, message_ids: M) -> Self::DeleteMessages where C: Into<Recipient>,
        M: IntoIterator<Item = MessageId> {
            let this = self;
            $body!(delete_messages this (chat_id: C, message_ids: M))
        }
    };
    (@method send_sticker $body:ident $ty:ident) => {
        type SendSticker = $ty![SendSticker];

        fn send_sticker<C>(&self, chat_id: C, sticker: InputFile) -> Self::SendSticker where C: Into<Recipient> {
            let this = self;
            $body!(send_sticker this (chat_id: C, sticker: InputFile))
        }
    };
    (@method get_sticker_set $body:ident $ty:ident) => {
        type GetStickerSet = $ty![GetStickerSet];

        fn get_sticker_set<N>(&self, name: N) -> Self::GetStickerSet where N: Into<String> {
            let this = self;
            $body!(get_sticker_set this (name: N))
        }
    };
    (@method get_custom_emoji_stickers $body:ident $ty:ident) => {
        type GetCustomEmojiStickers = $ty![GetCustomEmojiStickers];

        fn get_custom_emoji_stickers<C>(&self, custom_emoji_ids: C) -> Self::GetCustomEmojiStickers where C: IntoIterator<Item = CustomEmojiId> {
            let this = self;
            $body!(get_custom_emoji_stickers this (custom_emoji_ids: C))
        }
    };
    (@method upload_sticker_file $body:ident $ty:ident) => {
        type UploadStickerFile = $ty![UploadStickerFile];

        fn upload_sticker_file(&self, user_id: UserId, sticker: InputFile, sticker_format: StickerFormat) -> Self::UploadStickerFile {
            let this = self;
            $body!(upload_sticker_file this (user_id: UserId, sticker: InputFile, sticker_format: StickerFormat))
        }
    };
    (@method create_new_sticker_set $body:ident $ty:ident) => {
        type CreateNewStickerSet = $ty![CreateNewStickerSet];

        fn create_new_sticker_set<N, T, S>(&self, user_id: UserId, name: N, title: T, stickers: S) -> Self::CreateNewStickerSet where N: Into<String>,
        T: Into<String>,
        S: IntoIterator<Item = InputSticker> {
            let this = self;
            $body!(create_new_sticker_set this (user_id: UserId, name: N, title: T, stickers: S))
        }
    };
    (@method add_sticker_to_set $body:ident $ty:ident) => {
        type AddStickerToSet = $ty![AddStickerToSet];

        fn add_sticker_to_set<N>(&self, user_id: UserId, name: N, sticker: InputSticker) -> Self::AddStickerToSet where N: Into<String> {
            let this = self;
            $body!(add_sticker_to_set this (user_id: UserId, name: N, sticker: InputSticker))
        }
    };
    (@method set_sticker_position_in_set $body:ident $ty:ident) => {
        type SetStickerPositionInSet = $ty![SetStickerPositionInSet];

        fn set_sticker_position_in_set<S>(&self, sticker: S, position: u32) -> Self::SetStickerPositionInSet where S: Into<String> {
            let this = self;
            $body!(set_sticker_position_in_set this (sticker: S, position: u32))
        }
    };
    (@method delete_sticker_from_set $body:ident $ty:ident) => {
        type DeleteStickerFromSet = $ty![DeleteStickerFromSet];

        fn delete_sticker_from_set<S>(&self, sticker: S) -> Self::DeleteStickerFromSet where S: Into<String> {
            let this = self;
            $body!(delete_sticker_from_set this (sticker: S))
        }
    };
    (@method replace_sticker_in_set $body:ident $ty:ident) => {
        type ReplaceStickerInSet = $ty![ReplaceStickerInSet];

        fn replace_sticker_in_set<N, O>(&self, user_id: UserId, name: N, old_sticker: O, sticker: InputSticker) -> Self::ReplaceStickerInSet where N: Into<String>,
        O: Into<String> {
            let this = self;
            $body!(replace_sticker_in_set this (user_id: UserId, name: N, old_sticker: O, sticker: InputSticker))
        }
    };
    (@method set_sticker_set_thumbnail $body:ident $ty:ident) => {
        type SetStickerSetThumbnail = $ty![SetStickerSetThumbnail];

        fn set_sticker_set_thumbnail<N>(&self, name: N, user_id: UserId, format: StickerFormat) -> Self::SetStickerSetThumbnail where N: Into<String> {
            let this = self;
            $body!(set_sticker_set_thumbnail this (name: N, user_id: UserId, format: StickerFormat))
        }
    };
    (@method set_custom_emoji_sticker_set_thumbnail $body:ident $ty:ident) => {
        type SetCustomEmojiStickerSetThumbnail = $ty![SetCustomEmojiStickerSetThumbnail];

        fn set_custom_emoji_sticker_set_thumbnail<N>(&self, name: N) -> Self::SetCustomEmojiStickerSetThumbnail where N: Into<String> {
            let this = self;
            $body!(set_custom_emoji_sticker_set_thumbnail this (name: N))
        }
    };
    (@method set_sticker_set_title $body:ident $ty:ident) => {
        type SetStickerSetTitle = $ty![SetStickerSetTitle];

        fn set_sticker_set_title<N, T>(&self, name: N, title: T) -> Self::SetStickerSetTitle where N: Into<String>,
        T: Into<String> {
            let this = self;
            $body!(set_sticker_set_title this (name: N, title: T))
        }
    };
    (@method delete_sticker_set $body:ident $ty:ident) => {
        type DeleteStickerSet = $ty![DeleteStickerSet];

        fn delete_sticker_set<N>(&self, name: N) -> Self::DeleteStickerSet where N: Into<String> {
            let this = self;
            $body!(delete_sticker_set this (name: N))
        }
    };
    (@method set_sticker_emoji_list $body:ident $ty:ident) => {
        type SetStickerEmojiList = $ty![SetStickerEmojiList];

        fn set_sticker_emoji_list<S, E>(&self, sticker: S, emoji_list: E) -> Self::SetStickerEmojiList where S: Into<String>,
        E: IntoIterator<Item = String> {
            let this = self;
            $body!(set_sticker_emoji_list this (sticker: S, emoji_list: E))
        }
    };
    (@method set_sticker_keywords $body:ident $ty:ident) => {
        type SetStickerKeywords = $ty![SetStickerKeywords];

        fn set_sticker_keywords<S>(&self, sticker: S) -> Self::SetStickerKeywords where S: Into<String> {
            let this = self;
            $body!(set_sticker_keywords this (sticker: S))
        }
    };
    (@method set_sticker_mask_position $body:ident $ty:ident) => {
        type SetStickerMaskPosition = $ty![SetStickerMaskPosition];

        fn set_sticker_mask_position<S>(&self, sticker: S) -> Self::SetStickerMaskPosition where S: Into<String> {
            let this = self;
            $body!(set_sticker_mask_position this (sticker: S))
        }
    };
    (@method get_available_gifts $body:ident $ty:ident) => {
        type GetAvailableGifts = $ty![GetAvailableGifts];

        fn get_available_gifts(&self, ) -> Self::GetAvailableGifts {
            let this = self;
            $body!(get_available_gifts this ())
        }
    };
    (@method send_gift $body:ident $ty:ident) => {
        type SendGift = $ty![SendGift];

        fn send_gift(&self, user_id: UserId, gift_id: GiftId) -> Self::SendGift {
            let this = self;
            $body!(send_gift this (user_id: UserId, gift_id: GiftId))
        }
    };
    (@method send_gift_chat $body:ident $ty:ident) => {
        type SendGiftChat = $ty![SendGiftChat];

        fn send_gift_chat<C>(&self, chat_id: C, gift_id: GiftId) -> Self::SendGiftChat where C: Into<Recipient> {
            let this = self;
            $body!(send_gift_chat this (chat_id: C, gift_id: GiftId))
        }
    };
    (@method gift_premium_subscription $body:ident $ty:ident) => {
        type GiftPremiumSubscription = $ty![GiftPremiumSubscription];

        fn gift_premium_subscription(&self, user_id: UserId, month_count: u8, star_count: u32) -> Self::GiftPremiumSubscription {
            let this = self;
            $body!(gift_premium_subscription this (user_id: UserId, month_count: u8, star_count: u32))
        }
    };
    (@method verify_user $body:ident $ty:ident) => {
        type VerifyUser = $ty![VerifyUser];

        fn verify_user(&self, user_id: UserId) -> Self::VerifyUser {
            let this = self;
            $body!(verify_user this (user_id: UserId))
        }
    };
    (@method verify_chat $body:ident $ty:ident) => {
        type VerifyChat = $ty![VerifyChat];

        fn verify_chat<C>(&self, chat_id: C) -> Self::VerifyChat where C: Into<Recipient> {
            let this = self;
            $body!(verify_chat this (chat_id: C))
        }
    };
    (@method remove_user_verification $body:ident $ty:ident) => {
        type RemoveUserVerification = $ty![RemoveUserVerification];

        fn remove_user_verification(&self, user_id: UserId) -> Self::RemoveUserVerification {
            let this = self;
            $body!(remove_user_verification this (user_id: UserId))
        }
    };
    (@method remove_chat_verification $body:ident $ty:ident) => {
        type RemoveChatVerification = $ty![RemoveChatVerification];

        fn remove_chat_verification<C>(&self, chat_id: C) -> Self::RemoveChatVerification where C: Into<Recipient> {
            let this = self;
            $body!(remove_chat_verification this (chat_id: C))
        }
    };
    (@method read_business_message $body:ident $ty:ident) => {
        type ReadBusinessMessage = $ty![ReadBusinessMessage];

        fn read_business_message<C>(&self, business_connection_id: BusinessConnectionId, chat_id: C, message_id: MessageId) -> Self::ReadBusinessMessage where C: Into<ChatId> {
            let this = self;
            $body!(read_business_message this (business_connection_id: BusinessConnectionId, chat_id: C, message_id: MessageId))
        }
    };
    (@method delete_business_messages $body:ident $ty:ident) => {
        type DeleteBusinessMessages = $ty![DeleteBusinessMessages];

        fn delete_business_messages<M>(&self, business_connection_id: BusinessConnectionId, message_ids: M) -> Self::DeleteBusinessMessages where M: IntoIterator<Item = MessageId> {
            let this = self;
            $body!(delete_business_messages this (business_connection_id: BusinessConnectionId, message_ids: M))
        }
    };
    (@method set_business_account_name $body:ident $ty:ident) => {
        type SetBusinessAccountName = $ty![SetBusinessAccountName];

        fn set_business_account_name<F>(&self, business_connection_id: BusinessConnectionId, first_name: F) -> Self::SetBusinessAccountName where F: Into<String> {
            let this = self;
            $body!(set_business_account_name this (business_connection_id: BusinessConnectionId, first_name: F))
        }
    };
    (@method set_business_account_username $body:ident $ty:ident) => {
        type SetBusinessAccountUsername = $ty![SetBusinessAccountUsername];

        fn set_business_account_username(&self, business_connection_id: BusinessConnectionId) -> Self::SetBusinessAccountUsername {
            let this = self;
            $body!(set_business_account_username this (business_connection_id: BusinessConnectionId))
        }
    };
    (@method set_business_account_bio $body:ident $ty:ident) => {
        type SetBusinessAccountBio = $ty![SetBusinessAccountBio];

        fn set_business_account_bio(&self, business_connection_id: BusinessConnectionId) -> Self::SetBusinessAccountBio {
            let this = self;
            $body!(set_business_account_bio this (business_connection_id: BusinessConnectionId))
        }
    };
    (@method set_business_account_profile_photo $body:ident $ty:ident) => {
        type SetBusinessAccountProfilePhoto = $ty![SetBusinessAccountProfilePhoto];

        fn set_business_account_profile_photo(&self, business_connection_id: BusinessConnectionId, photo: InputProfilePhoto) -> Self::SetBusinessAccountProfilePhoto {
            let this = self;
            $body!(set_business_account_profile_photo this (business_connection_id: BusinessConnectionId, photo: InputProfilePhoto))
        }
    };
    (@method remove_business_account_profile_photo $body:ident $ty:ident) => {
        type RemoveBusinessAccountProfilePhoto = $ty![RemoveBusinessAccountProfilePhoto];

        fn remove_business_account_profile_photo(&self, business_connection_id: BusinessConnectionId) -> Self::RemoveBusinessAccountProfilePhoto {
            let this = self;
            $body!(remove_business_account_profile_photo this (business_connection_id: BusinessConnectionId))
        }
    };
    (@method set_business_account_gift_settings $body:ident $ty:ident) => {
        type SetBusinessAccountGiftSettings = $ty![SetBusinessAccountGiftSettings];

        fn set_business_account_gift_settings(&self, business_connection_id: BusinessConnectionId, show_gift_button: bool, accepted_gift_types: AcceptedGiftTypes) -> Self::SetBusinessAccountGiftSettings {
            let this = self;
            $body!(set_business_account_gift_settings this (business_connection_id: BusinessConnectionId, show_gift_button: bool, accepted_gift_types: AcceptedGiftTypes))
        }
    };
    (@method get_business_account_star_balance $body:ident $ty:ident) => {
        type GetBusinessAccountStarBalance = $ty![GetBusinessAccountStarBalance];

        fn get_business_account_star_balance(&self, business_connection_id: BusinessConnectionId) -> Self::GetBusinessAccountStarBalance {
            let this = self;
            $body!(get_business_account_star_balance this (business_connection_id: BusinessConnectionId))
        }
    };
    (@method transfer_business_account_stars $body:ident $ty:ident) => {
        type TransferBusinessAccountStars = $ty![TransferBusinessAccountStars];

        fn transfer_business_account_stars(&self, business_connection_id: BusinessConnectionId, star_count: u32) -> Self::TransferBusinessAccountStars {
            let this = self;
            $body!(transfer_business_account_stars this (business_connection_id: BusinessConnectionId, star_count: u32))
        }
    };
    (@method get_business_account_gifts $body:ident $ty:ident) => {
        type GetBusinessAccountGifts = $ty![GetBusinessAccountGifts];

        fn get_business_account_gifts(&self, business_connection_id: BusinessConnectionId) -> Self::GetBusinessAccountGifts {
            let this = self;
            $body!(get_business_account_gifts this (business_connection_id: BusinessConnectionId))
        }
    };
    (@method convert_gift_to_stars $body:ident $ty:ident) => {
        type ConvertGiftToStars = $ty![ConvertGiftToStars];

        fn convert_gift_to_stars(&self, business_connection_id: BusinessConnectionId, owned_gift_id: OwnedGiftId) -> Self::ConvertGiftToStars {
            let this = self;
            $body!(convert_gift_to_stars this (business_connection_id: BusinessConnectionId, owned_gift_id: OwnedGiftId))
        }
    };
    (@method upgrade_gift $body:ident $ty:ident) => {
        type UpgradeGift = $ty![UpgradeGift];

        fn upgrade_gift(&self, business_connection_id: BusinessConnectionId, owned_gift_id: OwnedGiftId) -> Self::UpgradeGift {
            let this = self;
            $body!(upgrade_gift this (business_connection_id: BusinessConnectionId, owned_gift_id: OwnedGiftId))
        }
    };
    (@method transfer_gift $body:ident $ty:ident) => {
        type TransferGift = $ty![TransferGift];

        fn transfer_gift<N>(&self, business_connection_id: BusinessConnectionId, owned_gift_id: OwnedGiftId, new_owner_chat_id: N) -> Self::TransferGift where N: Into<ChatId> {
            let this = self;
            $body!(transfer_gift this (business_connection_id: BusinessConnectionId, owned_gift_id: OwnedGiftId, new_owner_chat_id: N))
        }
    };
    (@method post_story $body:ident $ty:ident) => {
        type PostStory = $ty![PostStory];

        fn post_story(&self, business_connection_id: BusinessConnectionId, content: InputStoryContent, active_period: Seconds) -> Self::PostStory {
            let this = self;
            $body!(post_story this (business_connection_id: BusinessConnectionId, content: InputStoryContent, active_period: Seconds))
        }
    };
    (@method edit_story $body:ident $ty:ident) => {
        type EditStory = $ty![EditStory];

        fn edit_story(&self, business_connection_id: BusinessConnectionId, story_id: StoryId, content: InputStoryContent) -> Self::EditStory {
            let this = self;
            $body!(edit_story this (business_connection_id: BusinessConnectionId, story_id: StoryId, content: InputStoryContent))
        }
    };
    (@method delete_story $body:ident $ty:ident) => {
        type DeleteStory = $ty![DeleteStory];

        fn delete_story(&self, business_connection_id: BusinessConnectionId, story_id: StoryId) -> Self::DeleteStory {
            let this = self;
            $body!(delete_story this (business_connection_id: BusinessConnectionId, story_id: StoryId))
        }
    };
    (@method send_invoice $body:ident $ty:ident) => {
        type SendInvoice = $ty![SendInvoice];

        fn send_invoice<Ch, T, D, Pa, C, P>(&self, chat_id: Ch, title: T, description: D, payload: Pa, currency: C, prices: P) -> Self::SendInvoice where Ch: Into<Recipient>,
        T: Into<String>,
        D: Into<String>,
        Pa: Into<String>,
        C: Into<String>,
        P: IntoIterator<Item = LabeledPrice> {
            let this = self;
            $body!(send_invoice this (chat_id: Ch, title: T, description: D, payload: Pa, currency: C, prices: P))
        }
    };
    (@method create_invoice_link $body:ident $ty:ident) => {
        type CreateInvoiceLink = $ty![CreateInvoiceLink];

        fn create_invoice_link<T, D, Pa, C, P>(&self, title: T, description: D, payload: Pa, currency: C, prices: P) -> Self::CreateInvoiceLink where T: Into<String>,
        D: Into<String>,
        Pa: Into<String>,
        C: Into<String>,
        P: IntoIterator<Item = LabeledPrice> {
            let this = self;
            $body!(create_invoice_link this (title: T, description: D, payload: Pa, currency: C, prices: P))
        }
    };
    (@method answer_shipping_query $body:ident $ty:ident) => {
        type AnswerShippingQuery = $ty![AnswerShippingQuery];

        fn answer_shipping_query(&self, shipping_query_id: ShippingQueryId, ok: bool) -> Self::AnswerShippingQuery {
            let this = self;
            $body!(answer_shipping_query this (shipping_query_id: ShippingQueryId, ok: bool))
        }
    };
    (@method answer_pre_checkout_query $body:ident $ty:ident) => {
        type AnswerPreCheckoutQuery = $ty![AnswerPreCheckoutQuery];

        fn answer_pre_checkout_query(&self, pre_checkout_query_id: PreCheckoutQueryId, ok: bool) -> Self::AnswerPreCheckoutQuery {
            let this = self;
            $body!(answer_pre_checkout_query this (pre_checkout_query_id: PreCheckoutQueryId, ok: bool))
        }
    };
    (@method get_my_star_balance $body:ident $ty:ident) => {
        type GetMyStarBalance = $ty![GetMyStarBalance];

        fn get_my_star_balance(&self, ) -> Self::GetMyStarBalance {
            let this = self;
            $body!(get_my_star_balance this ())
        }
    };
    (@method get_star_transactions $body:ident $ty:ident) => {
        type GetStarTransactions = $ty![GetStarTransactions];

        fn get_star_transactions(&self, ) -> Self::GetStarTransactions {
            let this = self;
            $body!(get_star_transactions this ())
        }
    };
    (@method refund_star_payment $body:ident $ty:ident) => {
        type RefundStarPayment = $ty![RefundStarPayment];

        fn refund_star_payment(&self, user_id: UserId, telegram_payment_charge_id: TelegramTransactionId) -> Self::RefundStarPayment {
            let this = self;
            $body!(refund_star_payment this (user_id: UserId, telegram_payment_charge_id: TelegramTransactionId))
        }
    };
    (@method edit_user_star_subscription $body:ident $ty:ident) => {
        type EditUserStarSubscription = $ty![EditUserStarSubscription];

        fn edit_user_star_subscription(&self, user_id: UserId, telegram_payment_charge_id: TelegramTransactionId, is_canceled: bool) -> Self::EditUserStarSubscription {
            let this = self;
            $body!(edit_user_star_subscription this (user_id: UserId, telegram_payment_charge_id: TelegramTransactionId, is_canceled: bool))
        }
    };
    (@method set_passport_data_errors $body:ident $ty:ident) => {
        type SetPassportDataErrors = $ty![SetPassportDataErrors];

        fn set_passport_data_errors<E>(&self, user_id: UserId, errors: E) -> Self::SetPassportDataErrors where E: IntoIterator<Item = PassportElementError> {
            let this = self;
            $body!(set_passport_data_errors this (user_id: UserId, errors: E))
        }
    };
    (@method send_game $body:ident $ty:ident) => {
        type SendGame = $ty![SendGame];

        fn send_game<C, G>(&self, chat_id: C, game_short_name: G) -> Self::SendGame where C: Into<ChatId>,
        G: Into<String> {
            let this = self;
            $body!(send_game this (chat_id: C, game_short_name: G))
        }
    };
    (@method set_game_score $body:ident $ty:ident) => {
        type SetGameScore = $ty![SetGameScore];

        fn set_game_score(&self, user_id: UserId, score: u64, chat_id: u32, message_id: MessageId) -> Self::SetGameScore {
            let this = self;
            $body!(set_game_score this (user_id: UserId, score: u64, chat_id: u32, message_id: MessageId))
        }
    };
    (@method set_game_score_inline $body:ident $ty:ident) => {
        type SetGameScoreInline = $ty![SetGameScoreInline];

        fn set_game_score_inline<I>(&self, user_id: UserId, score: u64, inline_message_id: I) -> Self::SetGameScoreInline where I: Into<String> {
            let this = self;
            $body!(set_game_score_inline this (user_id: UserId, score: u64, inline_message_id: I))
        }
    };
    (@method get_game_high_scores $body:ident $ty:ident) => {
        type GetGameHighScores = $ty![GetGameHighScores];

        fn get_game_high_scores<T>(&self, user_id: UserId, target: T) -> Self::GetGameHighScores where T: Into<TargetMessage> {
            let this = self;
            $body!(get_game_high_scores this (user_id: UserId, target: T))
        }
    };// END BLOCK requester_forward_at_method
}

#[test]
// waffle: efficiency is not important here, and I don't want to rewrite this
#[allow(clippy::format_collect)]
fn codegen_requester_forward() {
    use crate::codegen::{
        add_hidden_preamble,
        convert::{convert_for, Convert},
        ensure_file_contents, min_prefix, project_root, reformat, replace_block,
        schema::{self, Type},
        to_uppercase,
    };
    use indexmap::IndexMap;
    use itertools::Itertools;

    let path = project_root().join("src/local_macros.rs");
    let schema = schema::get();

    let contents = schema
        .methods
        .iter()
        .map(|m| {
            let mut convert_params = m
                .params
                .iter()
                .filter(|p| !matches!(p.ty, Type::Option(_)))
                .map(|p| (&p.name, convert_for(&p.ty)))
                .filter(|(_, c)| !matches!(c, Convert::Id(_)))
                .map(|(name, _)| &**name)
                .collect::<Vec<_>>();

            convert_params.sort_unstable();

            let mut prefixes: IndexMap<_, _> = convert_params
                .iter()
                .copied()
                // Workaround to output the last type as the first letter
                .chain(["\0"])
                .tuple_windows()
                .map(|(l, r)| (l, min_prefix(l, r)))
                .collect();

            // FIXME: This hard-coded value has been set to avoid conflicting generic
            // parameter 'B' with impl<B> Requester... in all the adaptors and other places
            //
            // One fix could be to take full abbrevation for all the parameters instead of
            // just the first character. Other fix is to change the generic parameter name
            // in all the impl blocks to something like 'Z' because that is very less likely
            // to conflict in future.
            if prefixes.contains_key("business_connection_id") {
                prefixes["business_connection_id"] = "BCI";
            }
            let prefixes = prefixes;

            let args = m
                .params
                .iter()
                .filter(|p| !matches!(p.ty, Type::Option(_)))
                .map(|p| match prefixes.get(&*p.name) {
                    Some(prefix) => format!("{}: {}", p.name, to_uppercase(prefix)),
                    None => format!("{}: {}", p.name, p.ty),
                })
                .join(", ");

            let generics = m
                .params
                .iter()
                .flat_map(|p| prefixes.get(&*p.name))
                .copied()
                .map(to_uppercase)
                .join(", ");
            let where_clause = m
                .params
                .iter()
                .filter(|p| !matches!(p.ty, Type::Option(_)))
                .flat_map(|p| match convert_for(&p.ty) {
                    Convert::Id(_) => None,
                    Convert::Into(ty) => {
                        Some(format!("{}: Into<{}>", &to_uppercase(prefixes[&*p.name]), ty))
                    }
                    Convert::Collect(ty) => Some(format!(
                        "{}: IntoIterator<Item = {}>",
                        &to_uppercase(prefixes[&*p.name]),
                        ty
                    )),
                })
                .join(",\n        ");

            let generics =
                if generics.is_empty() { String::from("") } else { format!("<{generics}>") };

            let where_clause = if where_clause.is_empty() {
                String::from("")
            } else {
                format!(" where {where_clause}")
            };

            format!(
                "
    (@method {method} $body:ident $ty:ident) => {{
        type {Method} = $ty![{Method}];

        fn {method}{generics}(&self, {args}) -> Self::{Method}{where_clause} {{
            let this = self;
            $body!({method} this ({args}))
        }}
    }};",
                Method = m.names.1,
                method = m.names.2,
            )
        })
        .collect();

    let contents = reformat(replace_block(
        &path,
        "requester_forward_at_method",
        &add_hidden_preamble("codegen_requester_forward", contents),
    ));

    ensure_file_contents(&path, &contents);
}