ng-bot-api 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (193) hide show
  1. ng_bot_api/__init__.py +56 -0
  2. ng_bot_api/api_version.py +2 -0
  3. ng_bot_api/async_bot.py +97 -0
  4. ng_bot_api/core/__init__.py +31 -0
  5. ng_bot_api/core/base.py +36 -0
  6. ng_bot_api/core/caller.py +17 -0
  7. ng_bot_api/core/decoding.py +85 -0
  8. ng_bot_api/core/encoding.py +42 -0
  9. ng_bot_api/core/errors.py +75 -0
  10. ng_bot_api/core/input_file.py +56 -0
  11. ng_bot_api/core/polling.py +39 -0
  12. ng_bot_api/core/registry.py +72 -0
  13. ng_bot_api/core/request.py +67 -0
  14. ng_bot_api/core/typespec.py +57 -0
  15. ng_bot_api/dispatcher/__init__.py +17 -0
  16. ng_bot_api/dispatcher/dispatcher.py +95 -0
  17. ng_bot_api/dispatcher/filter_base.py +78 -0
  18. ng_bot_api/dispatcher/filters.py +124 -0
  19. ng_bot_api/dispatcher/handler.py +34 -0
  20. ng_bot_api/dispatcher/router.py +69 -0
  21. ng_bot_api/methods/__init__.py +115 -0
  22. ng_bot_api/methods/async_01.py +99 -0
  23. ng_bot_api/methods/async_02.py +114 -0
  24. ng_bot_api/methods/async_03.py +85 -0
  25. ng_bot_api/methods/async_04.py +110 -0
  26. ng_bot_api/methods/async_05.py +114 -0
  27. ng_bot_api/methods/async_06.py +74 -0
  28. ng_bot_api/methods/async_07.py +114 -0
  29. ng_bot_api/methods/async_08.py +106 -0
  30. ng_bot_api/methods/async_09.py +97 -0
  31. ng_bot_api/methods/async_10.py +92 -0
  32. ng_bot_api/methods/async_11.py +107 -0
  33. ng_bot_api/methods/async_12.py +119 -0
  34. ng_bot_api/methods/async_13.py +119 -0
  35. ng_bot_api/methods/async_14.py +113 -0
  36. ng_bot_api/methods/async_15.py +117 -0
  37. ng_bot_api/methods/async_16.py +115 -0
  38. ng_bot_api/methods/async_17.py +121 -0
  39. ng_bot_api/methods/async_18.py +118 -0
  40. ng_bot_api/methods/async_19.py +128 -0
  41. ng_bot_api/methods/async_20.py +115 -0
  42. ng_bot_api/methods/async_21.py +127 -0
  43. ng_bot_api/methods/async_22.py +110 -0
  44. ng_bot_api/methods/async_23.py +116 -0
  45. ng_bot_api/methods/async_24.py +118 -0
  46. ng_bot_api/methods/async_25.py +109 -0
  47. ng_bot_api/methods/async_26.py +124 -0
  48. ng_bot_api/methods/async_27.py +119 -0
  49. ng_bot_api/methods/async_28.py +119 -0
  50. ng_bot_api/methods/async_29.py +108 -0
  51. ng_bot_api/methods/async_30.py +115 -0
  52. ng_bot_api/methods/async_31.py +112 -0
  53. ng_bot_api/methods/async_32.py +126 -0
  54. ng_bot_api/methods/async_33.py +105 -0
  55. ng_bot_api/methods/async_34.py +117 -0
  56. ng_bot_api/methods/async_35.py +122 -0
  57. ng_bot_api/methods/async_36.py +121 -0
  58. ng_bot_api/methods/async_37.py +126 -0
  59. ng_bot_api/methods/async_38.py +112 -0
  60. ng_bot_api/methods/async_39.py +84 -0
  61. ng_bot_api/methods/async_40.py +125 -0
  62. ng_bot_api/methods/async_41.py +115 -0
  63. ng_bot_api/methods/async_42.py +30 -0
  64. ng_bot_api/methods/sync_01.py +99 -0
  65. ng_bot_api/methods/sync_02.py +114 -0
  66. ng_bot_api/methods/sync_03.py +85 -0
  67. ng_bot_api/methods/sync_04.py +110 -0
  68. ng_bot_api/methods/sync_05.py +114 -0
  69. ng_bot_api/methods/sync_06.py +74 -0
  70. ng_bot_api/methods/sync_07.py +114 -0
  71. ng_bot_api/methods/sync_08.py +106 -0
  72. ng_bot_api/methods/sync_09.py +97 -0
  73. ng_bot_api/methods/sync_10.py +92 -0
  74. ng_bot_api/methods/sync_11.py +107 -0
  75. ng_bot_api/methods/sync_12.py +119 -0
  76. ng_bot_api/methods/sync_13.py +119 -0
  77. ng_bot_api/methods/sync_14.py +113 -0
  78. ng_bot_api/methods/sync_15.py +117 -0
  79. ng_bot_api/methods/sync_16.py +115 -0
  80. ng_bot_api/methods/sync_17.py +121 -0
  81. ng_bot_api/methods/sync_18.py +118 -0
  82. ng_bot_api/methods/sync_19.py +128 -0
  83. ng_bot_api/methods/sync_20.py +115 -0
  84. ng_bot_api/methods/sync_21.py +127 -0
  85. ng_bot_api/methods/sync_22.py +110 -0
  86. ng_bot_api/methods/sync_23.py +116 -0
  87. ng_bot_api/methods/sync_24.py +118 -0
  88. ng_bot_api/methods/sync_25.py +109 -0
  89. ng_bot_api/methods/sync_26.py +124 -0
  90. ng_bot_api/methods/sync_27.py +119 -0
  91. ng_bot_api/methods/sync_28.py +119 -0
  92. ng_bot_api/methods/sync_29.py +108 -0
  93. ng_bot_api/methods/sync_30.py +115 -0
  94. ng_bot_api/methods/sync_31.py +112 -0
  95. ng_bot_api/methods/sync_32.py +126 -0
  96. ng_bot_api/methods/sync_33.py +105 -0
  97. ng_bot_api/methods/sync_34.py +117 -0
  98. ng_bot_api/methods/sync_35.py +122 -0
  99. ng_bot_api/methods/sync_36.py +121 -0
  100. ng_bot_api/methods/sync_37.py +126 -0
  101. ng_bot_api/methods/sync_38.py +112 -0
  102. ng_bot_api/methods/sync_39.py +84 -0
  103. ng_bot_api/methods/sync_40.py +125 -0
  104. ng_bot_api/methods/sync_41.py +115 -0
  105. ng_bot_api/methods/sync_42.py +30 -0
  106. ng_bot_api/py.typed +0 -0
  107. ng_bot_api/sync_bot.py +95 -0
  108. ng_bot_api/types/__init__.py +82 -0
  109. ng_bot_api/types/available_types_01.py +102 -0
  110. ng_bot_api/types/available_types_02.py +141 -0
  111. ng_bot_api/types/available_types_03.py +311 -0
  112. ng_bot_api/types/available_types_04.py +84 -0
  113. ng_bot_api/types/available_types_05.py +134 -0
  114. ng_bot_api/types/available_types_06.py +126 -0
  115. ng_bot_api/types/available_types_07.py +119 -0
  116. ng_bot_api/types/available_types_08.py +120 -0
  117. ng_bot_api/types/available_types_09.py +115 -0
  118. ng_bot_api/types/available_types_10.py +109 -0
  119. ng_bot_api/types/available_types_11.py +121 -0
  120. ng_bot_api/types/available_types_12.py +120 -0
  121. ng_bot_api/types/available_types_13.py +128 -0
  122. ng_bot_api/types/available_types_14.py +124 -0
  123. ng_bot_api/types/available_types_15.py +129 -0
  124. ng_bot_api/types/available_types_16.py +121 -0
  125. ng_bot_api/types/available_types_17.py +124 -0
  126. ng_bot_api/types/available_types_18.py +128 -0
  127. ng_bot_api/types/available_types_19.py +115 -0
  128. ng_bot_api/types/available_types_20.py +123 -0
  129. ng_bot_api/types/available_types_21.py +101 -0
  130. ng_bot_api/types/available_types_22.py +121 -0
  131. ng_bot_api/types/available_types_23.py +128 -0
  132. ng_bot_api/types/available_types_24.py +107 -0
  133. ng_bot_api/types/available_types_25.py +100 -0
  134. ng_bot_api/types/available_types_26.py +81 -0
  135. ng_bot_api/types/available_types_27.py +114 -0
  136. ng_bot_api/types/available_types_28.py +125 -0
  137. ng_bot_api/types/available_types_29.py +118 -0
  138. ng_bot_api/types/available_types_30.py +113 -0
  139. ng_bot_api/types/available_types_31.py +120 -0
  140. ng_bot_api/types/available_types_32.py +124 -0
  141. ng_bot_api/types/available_types_33.py +125 -0
  142. ng_bot_api/types/available_types_34.py +113 -0
  143. ng_bot_api/types/available_types_35.py +125 -0
  144. ng_bot_api/types/available_types_36.py +119 -0
  145. ng_bot_api/types/available_types_37.py +126 -0
  146. ng_bot_api/types/available_types_38.py +118 -0
  147. ng_bot_api/types/available_types_39.py +121 -0
  148. ng_bot_api/types/available_types_40.py +121 -0
  149. ng_bot_api/types/available_types_41.py +116 -0
  150. ng_bot_api/types/available_types_42.py +112 -0
  151. ng_bot_api/types/available_types_43.py +110 -0
  152. ng_bot_api/types/available_types_44.py +30 -0
  153. ng_bot_api/types/games_01.py +57 -0
  154. ng_bot_api/types/getting_updates_01.py +123 -0
  155. ng_bot_api/types/inline_mode_01.py +124 -0
  156. ng_bot_api/types/inline_mode_02.py +91 -0
  157. ng_bot_api/types/inline_mode_03.py +116 -0
  158. ng_bot_api/types/inline_mode_04.py +126 -0
  159. ng_bot_api/types/inline_mode_05.py +124 -0
  160. ng_bot_api/types/inline_mode_06.py +124 -0
  161. ng_bot_api/types/inline_mode_07.py +119 -0
  162. ng_bot_api/types/inline_mode_08.py +104 -0
  163. ng_bot_api/types/inline_mode_09.py +84 -0
  164. ng_bot_api/types/payments_01.py +124 -0
  165. ng_bot_api/types/payments_02.py +124 -0
  166. ng_bot_api/types/payments_03.py +119 -0
  167. ng_bot_api/types/payments_04.py +70 -0
  168. ng_bot_api/types/rich_messages_01.py +126 -0
  169. ng_bot_api/types/rich_messages_02.py +125 -0
  170. ng_bot_api/types/rich_messages_03.py +115 -0
  171. ng_bot_api/types/rich_messages_04.py +116 -0
  172. ng_bot_api/types/rich_messages_05.py +128 -0
  173. ng_bot_api/types/rich_messages_06.py +125 -0
  174. ng_bot_api/types/rich_messages_07.py +114 -0
  175. ng_bot_api/types/rich_messages_08.py +118 -0
  176. ng_bot_api/types/rich_messages_09.py +124 -0
  177. ng_bot_api/types/rich_messages_10.py +125 -0
  178. ng_bot_api/types/rich_messages_11.py +122 -0
  179. ng_bot_api/types/rich_messages_12.py +122 -0
  180. ng_bot_api/types/stickers_01.py +107 -0
  181. ng_bot_api/types/telegram_passport_01.py +120 -0
  182. ng_bot_api/types/telegram_passport_02.py +113 -0
  183. ng_bot_api/types/telegram_passport_03.py +24 -0
  184. ng_bot_api/types/unions_01.py +140 -0
  185. ng_bot_api/types/unions_02.py +132 -0
  186. ng_bot_api/types/unions_03.py +134 -0
  187. ng_bot_api/types/unions_04.py +149 -0
  188. ng_bot_api/types/unions_05.py +96 -0
  189. ng_bot_api/webhook.py +78 -0
  190. ng_bot_api-0.1.0.dist-info/METADATA +179 -0
  191. ng_bot_api-0.1.0.dist-info/RECORD +193 -0
  192. ng_bot_api-0.1.0.dist-info/WHEEL +4 -0
  193. ng_bot_api-0.1.0.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,104 @@
1
+ from __future__ import annotations
2
+
3
+ from dataclasses import dataclass
4
+ from typing import TYPE_CHECKING
5
+
6
+ from ..core.base import BotObject
7
+
8
+ if TYPE_CHECKING:
9
+ from .payments_01 import LabeledPrice
10
+
11
+ __all__ = [
12
+ 'InputContactMessageContent', 'InputInvoiceMessageContent', 'InputVenueMessageContent',
13
+ ]
14
+
15
+
16
+ @dataclass(kw_only=True, slots=True)
17
+ class InputVenueMessageContent(BotObject):
18
+ """Represents the content of a venue message to be sent as the result of an inline query.
19
+
20
+ https://core.telegram.org/bots/api#inputvenuemessagecontent
21
+ """
22
+
23
+ latitude: float
24
+ """Latitude of the venue in degrees"""
25
+ longitude: float
26
+ """Longitude of the venue in degrees"""
27
+ title: str
28
+ """Name of the venue"""
29
+ address: str
30
+ """Address of the venue"""
31
+ foursquare_id: str | None = None
32
+ """Optional. Foursquare identifier of the venue, if known"""
33
+ foursquare_type: str | None = None
34
+ """Optional. Foursquare type of the venue, if known. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.)"""
35
+ google_place_id: str | None = None
36
+ """Optional. Google Places identifier of the venue"""
37
+ google_place_type: str | None = None
38
+ """Optional. Google Places type of the venue. (See supported types.)"""
39
+
40
+
41
+ @dataclass(kw_only=True, slots=True)
42
+ class InputContactMessageContent(BotObject):
43
+ """Represents the content of a contact message to be sent as the result of an inline query.
44
+
45
+ https://core.telegram.org/bots/api#inputcontactmessagecontent
46
+ """
47
+
48
+ phone_number: str
49
+ """Contact's phone number"""
50
+ first_name: str
51
+ """Contact's first name"""
52
+ last_name: str | None = None
53
+ """Optional. Contact's last name"""
54
+ vcard: str | None = None
55
+ """Optional. Additional data about the contact in the form of a vCard, 0-2048 bytes"""
56
+
57
+
58
+ @dataclass(kw_only=True, slots=True)
59
+ class InputInvoiceMessageContent(BotObject):
60
+ """Represents the content of an invoice message to be sent as the result of an inline query.
61
+
62
+ https://core.telegram.org/bots/api#inputinvoicemessagecontent
63
+ """
64
+
65
+ title: str
66
+ """Product name, 1-32 characters"""
67
+ description: str
68
+ """Product description, 1-255 characters"""
69
+ payload: str
70
+ """Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user; use it for your internal processes."""
71
+ provider_token: str | None = None
72
+ """Optional. Payment provider token, obtained via @BotFather. Pass an empty string for payments in Telegram Stars."""
73
+ currency: str
74
+ """Three-letter ISO 4217 currency code, see more on currencies. Pass “XTR” for payments in Telegram Stars."""
75
+ prices: list[LabeledPrice]
76
+ """Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in Telegram Stars."""
77
+ max_tip_amount: int | None = None
78
+ """Optional. The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double). For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the exp parameter in currencies.json; it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0. Not supported for payments in Telegram Stars."""
79
+ suggested_tip_amounts: list[int] | None = None
80
+ """Optional. A JSON-serialized Array of suggested amounts of tips in the smallest units of the currency (integer, not float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increasing order and must not exceed max_tip_amount."""
81
+ provider_data: str | None = None
82
+ """Optional. A JSON-serialized object for data about the invoice, which will be shared with the payment provider. A detailed description of the required fields should be provided by the payment provider."""
83
+ photo_url: str | None = None
84
+ """Optional. URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service."""
85
+ photo_size: int | None = None
86
+ """Optional. Photo size in bytes"""
87
+ photo_width: int | None = None
88
+ """Optional. Photo width"""
89
+ photo_height: int | None = None
90
+ """Optional. Photo height"""
91
+ need_name: bool | None = None
92
+ """Optional. Pass True if you require the user's full name to complete the order. Ignored for payments in Telegram Stars."""
93
+ need_phone_number: bool | None = None
94
+ """Optional. Pass True if you require the user's phone number to complete the order. Ignored for payments in Telegram Stars."""
95
+ need_email: bool | None = None
96
+ """Optional. Pass True if you require the user's email address to complete the order. Ignored for payments in Telegram Stars."""
97
+ need_shipping_address: bool | None = None
98
+ """Optional. Pass True if you require the user's shipping address to complete the order. Ignored for payments in Telegram Stars."""
99
+ send_phone_number_to_provider: bool | None = None
100
+ """Optional. Pass True if the user's phone number should be sent to the provider. Ignored for payments in Telegram Stars."""
101
+ send_email_to_provider: bool | None = None
102
+ """Optional. Pass True if the user's email address should be sent to the provider. Ignored for payments in Telegram Stars."""
103
+ is_flexible: bool | None = None
104
+ """Optional. Pass True if the final price depends on the shipping method. Ignored for payments in Telegram Stars."""
@@ -0,0 +1,84 @@
1
+ from __future__ import annotations
2
+
3
+ from dataclasses import dataclass, field
4
+ from typing import TYPE_CHECKING
5
+
6
+ from ..core.base import BotObject
7
+
8
+ if TYPE_CHECKING:
9
+ from .available_types_01 import User
10
+ from .available_types_04 import MessageEntity
11
+ from .available_types_12 import Location
12
+
13
+ __all__ = ['ChosenInlineResult', 'InputSharedWidgetMessageContent', 'InputWidgetMessageContent']
14
+
15
+
16
+ @dataclass(kw_only=True, slots=True)
17
+ class InputWidgetMessageContent(BotObject):
18
+ """Represents the content of a message with an HTML widget to be sent as the result of an inline query. Currently, widgets can't be sent in response to inline queries in the production environment.
19
+
20
+ https://core.telegram.org/bots/api#inputwidgetmessagecontent
21
+ """
22
+
23
+ html: str
24
+ """HTML code of the widget, 1-32768 bytes. The code must not exceed 4096 bytes when compressed by zlib with the maximum compression level."""
25
+ width: int | None = None
26
+ """Optional. Width of the widget in logical pixels; omit if the widget must occupy the whole width of the message bubble. The width is clamped by the app to the range from 200 to the maximum width of the message bubble."""
27
+ height: int | None = None
28
+ """Optional. Height of the widget in logical pixels; omit if the height of the widget isn't fixed. The height is clamped by the app to the range 50-600."""
29
+ public_data: str | None = None
30
+ """Optional. Public data of the widget, 0-1024 bytes, which will be available wherever the widget is shown. If the widget is shared, then all messages with it will have the same public data."""
31
+ chat_data: str | None = None
32
+ """Optional. Data of the widget, which is specific to the message, 0-1024 bytes"""
33
+ caption: str | None = None
34
+ """Optional. Widget caption, 0-1024 characters after entities parsing"""
35
+ parse_mode: str | None = None
36
+ """Optional. Mode for parsing entities in the widget caption. See formatting options for more details."""
37
+ caption_entities: list[MessageEntity] | None = None
38
+ """Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode"""
39
+ show_caption_above_media: bool | None = None
40
+ """Optional. Pass True if the caption must be shown above the widget"""
41
+ allow_queries: bool | None = None
42
+ """Optional. Pass True to allow the widget to send queries to the bot"""
43
+ is_shared: bool | None = None
44
+ """Optional. Pass True to create a shared widget. Each message sent from the result creates a separate shared widget, whose identifier is received by the bot only in the field widget_id of queries from the widget. To send an existing shared widget in response to an inline query, use InputSharedWidgetMessageContent instead."""
45
+
46
+
47
+ @dataclass(kw_only=True, slots=True)
48
+ class InputSharedWidgetMessageContent(BotObject):
49
+ """Represents the content of a message with a shared widget to be sent as the result of an inline query. Currently, widgets can't be sent in response to inline queries in the production environment.
50
+
51
+ https://core.telegram.org/bots/api#inputsharedwidgetmessagecontent
52
+ """
53
+
54
+ widget_id: str
55
+ """Unique identifier of the shared widget created by the bot"""
56
+ chat_data: str | None = None
57
+ """Optional. Data of the widget, which is specific to the message, 0-1024 bytes"""
58
+ caption: str | None = None
59
+ """Optional. Widget caption, 0-1024 characters after entities parsing"""
60
+ parse_mode: str | None = None
61
+ """Optional. Mode for parsing entities in the widget caption. See formatting options for more details."""
62
+ caption_entities: list[MessageEntity] | None = None
63
+ """Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode"""
64
+ show_caption_above_media: bool | None = None
65
+ """Optional. Pass True if the caption must be shown above the widget"""
66
+
67
+
68
+ @dataclass(kw_only=True, slots=True)
69
+ class ChosenInlineResult(BotObject):
70
+ """Represents a result of an inline query that was chosen by the user and sent to their chat partner.
71
+
72
+ https://core.telegram.org/bots/api#choseninlineresult
73
+ """
74
+
75
+ result_id: str
76
+ """The unique identifier for the result that was chosen"""
77
+ from_user: User = field(metadata={"wire": 'from'})
78
+ """The user that chose the result"""
79
+ location: Location | None = None
80
+ """Optional. Sender location, only for bots that enabled user location requests via @BotFather or using the parameter needs_inline_query_location of the method setMySettings"""
81
+ inline_message_id: str | None = None
82
+ """Optional. Identifier of the sent inline message. Available only if there is an inline keyboard attached to the message. Will also be received in callback queries and can be used to edit the message."""
83
+ query: str
84
+ """The query that was used to obtain the result"""
@@ -0,0 +1,124 @@
1
+ from __future__ import annotations
2
+
3
+ from dataclasses import dataclass
4
+
5
+ from ..core.base import BotObject
6
+
7
+ __all__ = [
8
+ 'Invoice', 'LabeledPrice', 'OrderInfo', 'ShippingAddress', 'ShippingOption',
9
+ 'SuccessfulPayment',
10
+ ]
11
+
12
+
13
+ @dataclass(kw_only=True, slots=True)
14
+ class LabeledPrice(BotObject):
15
+ """This object represents a portion of the price for goods or services.
16
+
17
+ https://core.telegram.org/bots/api#labeledprice
18
+ """
19
+
20
+ label: str
21
+ """Portion label"""
22
+ amount: int
23
+ """Price of the product in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json; it shows the number of digits past the decimal point for each currency (2 for the majority of currencies)."""
24
+
25
+
26
+ @dataclass(kw_only=True, slots=True)
27
+ class Invoice(BotObject):
28
+ """This object contains basic information about an invoice.
29
+
30
+ https://core.telegram.org/bots/api#invoice
31
+ """
32
+
33
+ title: str
34
+ """Product name"""
35
+ description: str
36
+ """Product description"""
37
+ start_parameter: str
38
+ """Unique bot deep-linking parameter that can be used to generate this invoice"""
39
+ currency: str
40
+ """Three-letter ISO 4217 currency code, or “XTR” for payments in Telegram Stars"""
41
+ total_amount: int
42
+ """Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45, total_amount = 145. See the exp parameter in currencies.json; it shows the number of digits past the decimal point for each currency (2 for the majority of currencies)."""
43
+
44
+
45
+ @dataclass(kw_only=True, slots=True)
46
+ class ShippingAddress(BotObject):
47
+ """This object represents a shipping address.
48
+
49
+ https://core.telegram.org/bots/api#shippingaddress
50
+ """
51
+
52
+ country_code: str
53
+ """Two-letter ISO 3166-1 alpha-2 country code"""
54
+ state: str
55
+ """State, if applicable"""
56
+ city: str
57
+ """City"""
58
+ street_line1: str
59
+ """First line for the address"""
60
+ street_line2: str
61
+ """Second line for the address"""
62
+ post_code: str
63
+ """Address post code"""
64
+
65
+
66
+ @dataclass(kw_only=True, slots=True)
67
+ class OrderInfo(BotObject):
68
+ """This object represents information about an order.
69
+
70
+ https://core.telegram.org/bots/api#orderinfo
71
+ """
72
+
73
+ name: str | None = None
74
+ """Optional. User name"""
75
+ phone_number: str | None = None
76
+ """Optional. User's phone number"""
77
+ email: str | None = None
78
+ """Optional. User email"""
79
+ shipping_address: ShippingAddress | None = None
80
+ """Optional. User shipping address"""
81
+
82
+
83
+ @dataclass(kw_only=True, slots=True)
84
+ class ShippingOption(BotObject):
85
+ """This object represents one shipping option.
86
+
87
+ https://core.telegram.org/bots/api#shippingoption
88
+ """
89
+
90
+ id: str
91
+ """Shipping option identifier"""
92
+ title: str
93
+ """Option title"""
94
+ prices: list[LabeledPrice]
95
+ """List of price portions"""
96
+
97
+
98
+ @dataclass(kw_only=True, slots=True)
99
+ class SuccessfulPayment(BotObject):
100
+ """This object contains basic information about a successful payment. Note that if the buyer initiates a chargeback with the relevant payment provider following this transaction, the funds may be debited from your balance. This is outside of Telegram's control.
101
+
102
+ https://core.telegram.org/bots/api#successfulpayment
103
+ """
104
+
105
+ currency: str
106
+ """Three-letter ISO 4217 currency code, or “XTR” for payments in Telegram Stars"""
107
+ total_amount: int
108
+ """Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45, total_amount = 145. See the exp parameter in currencies.json; it shows the number of digits past the decimal point for each currency (2 for the majority of currencies)."""
109
+ invoice_payload: str
110
+ """Bot-specified invoice payload"""
111
+ subscription_expiration_date: int | None = None
112
+ """Optional. Expiration date of the subscription, in Unix time; for recurring payments only"""
113
+ is_recurring: bool | None = None
114
+ """Optional. True, if the payment is a recurring payment for a subscription"""
115
+ is_first_recurring: bool | None = None
116
+ """Optional. True, if the payment is the first payment for a subscription"""
117
+ shipping_option_id: str | None = None
118
+ """Optional. Identifier of the shipping option chosen by the user"""
119
+ order_info: OrderInfo | None = None
120
+ """Optional. Order information provided by the user"""
121
+ telegram_payment_charge_id: str
122
+ """Telegram payment identifier"""
123
+ provider_payment_charge_id: str
124
+ """Provider payment identifier"""
@@ -0,0 +1,124 @@
1
+ from __future__ import annotations
2
+
3
+ from dataclasses import dataclass, field
4
+ from typing import TYPE_CHECKING
5
+
6
+ from ..core.base import BotObject
7
+
8
+ if TYPE_CHECKING:
9
+ from .available_types_01 import User
10
+ from .payments_01 import OrderInfo, ShippingAddress
11
+
12
+ __all__ = [
13
+ 'PaidMediaPurchased', 'PreCheckoutQuery', 'RefundedPayment', 'RevenueWithdrawalStateFailed',
14
+ 'RevenueWithdrawalStatePending', 'RevenueWithdrawalStateSucceeded', 'ShippingQuery',
15
+ ]
16
+
17
+
18
+ @dataclass(kw_only=True, slots=True)
19
+ class RefundedPayment(BotObject):
20
+ """This object contains basic information about a refunded payment.
21
+
22
+ https://core.telegram.org/bots/api#refundedpayment
23
+ """
24
+
25
+ currency: str = 'XTR'
26
+ """Three-letter ISO 4217 currency code, or “XTR” for payments in Telegram Stars. Currently, always “XTR”."""
27
+ total_amount: int
28
+ """Total refunded price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45, total_amount = 145. See the exp parameter in currencies.json; it shows the number of digits past the decimal point for each currency (2 for the majority of currencies)."""
29
+ invoice_payload: str
30
+ """Bot-specified invoice payload"""
31
+ telegram_payment_charge_id: str
32
+ """Telegram payment identifier"""
33
+ provider_payment_charge_id: str | None = None
34
+ """Optional. Provider payment identifier"""
35
+
36
+
37
+ @dataclass(kw_only=True, slots=True)
38
+ class ShippingQuery(BotObject):
39
+ """This object contains information about an incoming shipping query.
40
+
41
+ https://core.telegram.org/bots/api#shippingquery
42
+ """
43
+
44
+ id: str
45
+ """Unique query identifier"""
46
+ from_user: User = field(metadata={"wire": 'from'})
47
+ """User who sent the query"""
48
+ invoice_payload: str
49
+ """Bot-specified invoice payload"""
50
+ shipping_address: ShippingAddress
51
+ """User-specified shipping address"""
52
+
53
+
54
+ @dataclass(kw_only=True, slots=True)
55
+ class PreCheckoutQuery(BotObject):
56
+ """This object contains information about an incoming pre-checkout query.
57
+
58
+ https://core.telegram.org/bots/api#precheckoutquery
59
+ """
60
+
61
+ id: str
62
+ """Unique query identifier"""
63
+ from_user: User = field(metadata={"wire": 'from'})
64
+ """User who sent the query"""
65
+ currency: str
66
+ """Three-letter ISO 4217 currency code, or “XTR” for payments in Telegram Stars"""
67
+ total_amount: int
68
+ """Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45, total_amount = 145. See the exp parameter in currencies.json; it shows the number of digits past the decimal point for each currency (2 for the majority of currencies)."""
69
+ invoice_payload: str
70
+ """Bot-specified invoice payload"""
71
+ shipping_option_id: str | None = None
72
+ """Optional. Identifier of the shipping option chosen by the user"""
73
+ order_info: OrderInfo | None = None
74
+ """Optional. Order information provided by the user"""
75
+
76
+
77
+ @dataclass(kw_only=True, slots=True)
78
+ class PaidMediaPurchased(BotObject):
79
+ """This object contains information about a paid media purchase.
80
+
81
+ https://core.telegram.org/bots/api#paidmediapurchased
82
+ """
83
+
84
+ from_user: User = field(metadata={"wire": 'from'})
85
+ """User who purchased the media"""
86
+ paid_media_payload: str
87
+ """Bot-specified paid media payload"""
88
+
89
+
90
+ @dataclass(kw_only=True, slots=True)
91
+ class RevenueWithdrawalStatePending(BotObject):
92
+ """The withdrawal is in progress.
93
+
94
+ https://core.telegram.org/bots/api#revenuewithdrawalstatepending
95
+ """
96
+
97
+ type: str = 'pending'
98
+ """Type of the state, always “pending”"""
99
+
100
+
101
+ @dataclass(kw_only=True, slots=True)
102
+ class RevenueWithdrawalStateSucceeded(BotObject):
103
+ """The withdrawal succeeded.
104
+
105
+ https://core.telegram.org/bots/api#revenuewithdrawalstatesucceeded
106
+ """
107
+
108
+ type: str = 'succeeded'
109
+ """Type of the state, always “succeeded”"""
110
+ date: int
111
+ """Date the withdrawal was completed in Unix time"""
112
+ url: str
113
+ """An HTTPS URL that can be used to see transaction details"""
114
+
115
+
116
+ @dataclass(kw_only=True, slots=True)
117
+ class RevenueWithdrawalStateFailed(BotObject):
118
+ """The withdrawal failed and the transaction was refunded.
119
+
120
+ https://core.telegram.org/bots/api#revenuewithdrawalstatefailed
121
+ """
122
+
123
+ type: str = 'failed'
124
+ """Type of the state, always “failed”"""
@@ -0,0 +1,119 @@
1
+ from __future__ import annotations
2
+
3
+ from dataclasses import dataclass
4
+ from typing import TYPE_CHECKING
5
+
6
+ from ..core.base import BotObject
7
+
8
+ if TYPE_CHECKING:
9
+ from .available_types_01 import Chat, User
10
+ from .available_types_33 import Gift
11
+ from .unions_01 import PaidMedia
12
+ from .unions_05 import RevenueWithdrawalState
13
+
14
+ __all__ = [
15
+ 'AffiliateInfo', 'TransactionPartnerAffiliateProgram', 'TransactionPartnerChat',
16
+ 'TransactionPartnerFragment', 'TransactionPartnerTelegramAds', 'TransactionPartnerUser',
17
+ ]
18
+
19
+
20
+ @dataclass(kw_only=True, slots=True)
21
+ class AffiliateInfo(BotObject):
22
+ """Contains information about the affiliate that received a commission via this transaction.
23
+
24
+ https://core.telegram.org/bots/api#affiliateinfo
25
+ """
26
+
27
+ affiliate_user: User | None = None
28
+ """Optional. The bot or the user that received an affiliate commission if it was received by a bot or a user"""
29
+ affiliate_chat: Chat | None = None
30
+ """Optional. The chat that received an affiliate commission if it was received by a chat"""
31
+ commission_per_mille: int
32
+ """The number of Telegram Stars received by the affiliate for each 1000 Telegram Stars received by the bot from referred users"""
33
+ amount: int
34
+ """Integer amount of Telegram Stars received by the affiliate from the transaction, rounded to 0; can be negative for refunds"""
35
+ nanostar_amount: int | None = None
36
+ """Optional. The number of 1/1000000000 shares of Telegram Stars received by the affiliate; from -999999999 to 999999999; can be negative for refunds"""
37
+
38
+
39
+ @dataclass(kw_only=True, slots=True)
40
+ class TransactionPartnerUser(BotObject):
41
+ """Describes a transaction with a user.
42
+
43
+ https://core.telegram.org/bots/api#transactionpartneruser
44
+ """
45
+
46
+ type: str = 'user'
47
+ """Type of the transaction partner, always “user”"""
48
+ transaction_type: str
49
+ """Type of the transaction, currently one of “invoice_payment” for payments via invoices, “paid_media_payment” for payments for paid media, “gift_purchase” for gifts sent by the bot, “premium_purchase” for Telegram Premium subscriptions gifted by the bot, “business_account_transfer” for direct transfers from managed business accounts"""
50
+ user: User
51
+ """Information about the user"""
52
+ affiliate: AffiliateInfo | None = None
53
+ """Optional. Information about the affiliate that received a commission via this transaction. Can be available only for “invoice_payment” and “paid_media_payment” transactions."""
54
+ invoice_payload: str | None = None
55
+ """Optional. Bot-specified invoice payload. Can be available only for “invoice_payment” transactions."""
56
+ subscription_period: int | None = None
57
+ """Optional. The duration of the paid subscription. Can be available only for “invoice_payment” transactions."""
58
+ paid_media: list[PaidMedia] | None = None
59
+ """Optional. Information about the paid media bought by the user; for “paid_media_payment” transactions only"""
60
+ paid_media_payload: str | None = None
61
+ """Optional. Bot-specified paid media payload. Can be available only for “paid_media_payment” transactions."""
62
+ gift: Gift | None = None
63
+ """Optional. The gift sent to the user by the bot; for “gift_purchase” transactions only"""
64
+ premium_subscription_duration: int | None = None
65
+ """Optional. Number of months the gifted Telegram Premium subscription will be active for; for “premium_purchase” transactions only"""
66
+
67
+
68
+ @dataclass(kw_only=True, slots=True)
69
+ class TransactionPartnerChat(BotObject):
70
+ """Describes a transaction with a chat.
71
+
72
+ https://core.telegram.org/bots/api#transactionpartnerchat
73
+ """
74
+
75
+ type: str = 'chat'
76
+ """Type of the transaction partner, always “chat”"""
77
+ chat: Chat
78
+ """Information about the chat"""
79
+ gift: Gift | None = None
80
+ """Optional. The gift sent to the chat by the bot"""
81
+
82
+
83
+ @dataclass(kw_only=True, slots=True)
84
+ class TransactionPartnerAffiliateProgram(BotObject):
85
+ """Describes the affiliate program that issued the affiliate commission received via this transaction.
86
+
87
+ https://core.telegram.org/bots/api#transactionpartneraffiliateprogram
88
+ """
89
+
90
+ type: str = 'affiliate_program'
91
+ """Type of the transaction partner, always “affiliate_program”"""
92
+ sponsor_user: User | None = None
93
+ """Optional. Information about the bot that sponsored the affiliate program"""
94
+ commission_per_mille: int
95
+ """The number of Telegram Stars received by the bot for each 1000 Telegram Stars received by the affiliate program sponsor from referred users"""
96
+
97
+
98
+ @dataclass(kw_only=True, slots=True)
99
+ class TransactionPartnerFragment(BotObject):
100
+ """Describes a withdrawal transaction with Fragment.
101
+
102
+ https://core.telegram.org/bots/api#transactionpartnerfragment
103
+ """
104
+
105
+ type: str = 'fragment'
106
+ """Type of the transaction partner, always “fragment”"""
107
+ withdrawal_state: RevenueWithdrawalState | None = None
108
+ """Optional. State of the transaction if the transaction is outgoing"""
109
+
110
+
111
+ @dataclass(kw_only=True, slots=True)
112
+ class TransactionPartnerTelegramAds(BotObject):
113
+ """Describes a withdrawal transaction to the Telegram Ads platform.
114
+
115
+ https://core.telegram.org/bots/api#transactionpartnertelegramads
116
+ """
117
+
118
+ type: str = 'telegram_ads'
119
+ """Type of the transaction partner, always “telegram_ads”"""
@@ -0,0 +1,70 @@
1
+ from __future__ import annotations
2
+
3
+ from dataclasses import dataclass
4
+ from typing import TYPE_CHECKING
5
+
6
+ from ..core.base import BotObject
7
+
8
+ if TYPE_CHECKING:
9
+ from .unions_05 import TransactionPartner
10
+
11
+ __all__ = [
12
+ 'StarTransaction', 'StarTransactions', 'TransactionPartnerOther',
13
+ 'TransactionPartnerTelegramApi',
14
+ ]
15
+
16
+
17
+ @dataclass(kw_only=True, slots=True)
18
+ class TransactionPartnerTelegramApi(BotObject):
19
+ """Describes a transaction with payment for paid broadcasting.
20
+
21
+ https://core.telegram.org/bots/api#transactionpartnertelegramapi
22
+ """
23
+
24
+ type: str = 'telegram_api'
25
+ """Type of the transaction partner, always “telegram_api”"""
26
+ request_count: int
27
+ """The number of successful requests that exceeded regular limits and were therefore billed"""
28
+
29
+
30
+ @dataclass(kw_only=True, slots=True)
31
+ class TransactionPartnerOther(BotObject):
32
+ """Describes a transaction with an unknown source or recipient.
33
+
34
+ https://core.telegram.org/bots/api#transactionpartnerother
35
+ """
36
+
37
+ type: str = 'other'
38
+ """Type of the transaction partner, always “other”"""
39
+
40
+
41
+ @dataclass(kw_only=True, slots=True)
42
+ class StarTransaction(BotObject):
43
+ """Describes a Telegram Star transaction. Note that if the buyer initiates a chargeback with the payment provider from whom they acquired Stars (e.g., Apple, Google) following this transaction, the refunded Stars will be deducted from the bot's balance. This is outside of Telegram's control.
44
+
45
+ https://core.telegram.org/bots/api#startransaction
46
+ """
47
+
48
+ id: str
49
+ """Unique identifier of the transaction. Coincides with the identifier of the original transaction for refund transactions. Coincides with SuccessfulPayment.telegram_payment_charge_id for successful incoming payments from users."""
50
+ amount: int
51
+ """Integer amount of Telegram Stars transferred by the transaction"""
52
+ nanostar_amount: int | None = None
53
+ """Optional. The number of 1/1000000000 shares of Telegram Stars transferred by the transaction; from 0 to 999999999"""
54
+ date: int
55
+ """Date the transaction was created in Unix time"""
56
+ source: TransactionPartner | None = None
57
+ """Optional. Source of an incoming transaction (e.g., a user purchasing goods or services, Fragment refunding a failed withdrawal). Only for incoming transactions."""
58
+ receiver: TransactionPartner | None = None
59
+ """Optional. Receiver of an outgoing transaction (e.g., a user for a purchase refund, Fragment for a withdrawal). Only for outgoing transactions."""
60
+
61
+
62
+ @dataclass(kw_only=True, slots=True)
63
+ class StarTransactions(BotObject):
64
+ """Contains a list of Telegram Star transactions.
65
+
66
+ https://core.telegram.org/bots/api#startransactions
67
+ """
68
+
69
+ transactions: list[StarTransaction]
70
+ """The list of transactions"""