maxapi-python 2.4.0__py3-none-any.whl → 2.5.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 (101) hide show
  1. {maxapi_python-2.4.0.dist-info → maxapi_python-2.5.0.dist-info}/METADATA +22 -12
  2. maxapi_python-2.5.0.dist-info/RECORD +195 -0
  3. {maxapi_python-2.4.0.dist-info → maxapi_python-2.5.0.dist-info}/WHEEL +1 -1
  4. pymax/__init__.py +8 -2
  5. pymax/_data/apk_fingerprints.json +374 -17
  6. pymax/_data/rootca_ssl_rsa2022.crt +33 -0
  7. pymax/api/auth/service.py +15 -2
  8. pymax/api/auth/types.py +3 -0
  9. pymax/api/bots/payloads.py +8 -0
  10. pymax/api/bots/service.py +13 -1
  11. pymax/api/chats/enums.py +1 -0
  12. pymax/api/chats/payloads.py +21 -1
  13. pymax/api/chats/service.py +41 -0
  14. pymax/api/facade.py +2 -0
  15. pymax/api/messages/__init__.py +1 -1
  16. pymax/api/messages/enums.py +1 -0
  17. pymax/api/messages/payloads.py +56 -4
  18. pymax/api/messages/service.py +405 -27
  19. pymax/api/response.py +1 -1
  20. pymax/api/stories/__init__.py +2 -0
  21. pymax/api/stories/enums.py +19 -0
  22. pymax/api/stories/payloads.py +64 -0
  23. pymax/api/stories/service.py +198 -0
  24. pymax/api/uploads/payloads.py +42 -1
  25. pymax/api/uploads/service.py +171 -69
  26. pymax/app.py +39 -8
  27. pymax/auth/__init__.py +2 -0
  28. pymax/auth/exceptions.py +9 -0
  29. pymax/auth/providers.py +6 -2
  30. pymax/auth/qr.py +11 -1
  31. pymax/auth/sms.py +11 -1
  32. pymax/base.py +146 -27
  33. pymax/client.py +39 -11
  34. pymax/client_web.py +15 -12
  35. pymax/config.py +101 -53
  36. pymax/di/__init__.py +2 -0
  37. pymax/di/context.py +18 -0
  38. pymax/di/resolver.py +38 -0
  39. pymax/dispatch/__init__.py +7 -0
  40. pymax/dispatch/dispatcher.py +143 -40
  41. pymax/dispatch/enums.py +1 -0
  42. pymax/dispatch/mapping.py +23 -3
  43. pymax/dispatch/middleware.py +32 -0
  44. pymax/dispatch/resolvers.py +4 -0
  45. pymax/dispatch/router.py +86 -34
  46. pymax/files/base.py +58 -1
  47. pymax/files/video.py +32 -40
  48. pymax/files/voice.py +18 -4
  49. pymax/filters/__init__.py +15 -0
  50. pymax/filters/base.py +218 -0
  51. pymax/filters/containers/__init__.py +2 -0
  52. pymax/filters/containers/chat.py +240 -0
  53. pymax/filters/containers/message.py +147 -0
  54. pymax/filters/filters.py +211 -0
  55. pymax/filters/magic.py +13 -0
  56. pymax/filters/presets.py +88 -0
  57. pymax/filters/refs.py +56 -0
  58. pymax/fingerprint/fingerprint.py +5 -22
  59. pymax/fingerprint/models.py +1 -0
  60. pymax/formatting/markdown.py +55 -1
  61. pymax/fsm/__init__.py +3 -0
  62. pymax/fsm/context.py +30 -0
  63. pymax/fsm/protocol.py +14 -0
  64. pymax/fsm/state.py +70 -0
  65. pymax/fsm/storage.py +151 -0
  66. pymax/infra/base.py +2 -0
  67. pymax/infra/bots.py +20 -0
  68. pymax/infra/chat.py +37 -5
  69. pymax/infra/message.py +204 -9
  70. pymax/infra/protocol.py +5 -1
  71. pymax/infra/stories.py +205 -0
  72. pymax/integrations/__init__.py +0 -0
  73. pymax/integrations/dishka.py +109 -0
  74. pymax/protocol/enums.py +2 -0
  75. pymax/protocol/tcp/payload.py +0 -2
  76. pymax/session/__init__.py +1 -1
  77. pymax/session/models.py +30 -0
  78. pymax/session/protocol.py +33 -7
  79. pymax/session/store.py +73 -5
  80. pymax/transport/tcp.py +11 -3
  81. pymax/types/domain/__init__.py +23 -1
  82. pymax/types/domain/attachments/__init__.py +1 -1
  83. pymax/types/domain/attachments/call.py +7 -1
  84. pymax/types/domain/attachments/contact.py +3 -3
  85. pymax/types/domain/attachments/control.py +3 -0
  86. pymax/types/domain/attachments/enums.py +16 -0
  87. pymax/types/domain/attachments/keyboards/__init__.py +1 -1
  88. pymax/types/domain/attachments/keyboards/enums.py +12 -0
  89. pymax/types/domain/attachments/keyboards/inline.py +74 -3
  90. pymax/types/domain/attachments/video.py +3 -3
  91. pymax/types/domain/callback.py +19 -0
  92. pymax/types/domain/comment.py +24 -0
  93. pymax/types/domain/enums.py +7 -0
  94. pymax/types/domain/message.py +158 -9
  95. pymax/types/domain/story.py +126 -0
  96. pymax/types/events/reaction.py +28 -4
  97. pymax/versions/__init__.py +2 -0
  98. pymax/versions/catalog.py +104 -0
  99. pymax/versions/exceptions.py +10 -0
  100. maxapi_python-2.4.0.dist-info/RECORD +0 -161
  101. {maxapi_python-2.4.0.dist-info → maxapi_python-2.5.0.dist-info}/licenses/LICENSE +0 -0
pymax/api/facade.py CHANGED
@@ -10,6 +10,7 @@ from .chats import ChatService
10
10
  from .messages import MessageService
11
11
  from .self import SelfService
12
12
  from .session import SessionService
13
+ from .stories import StoriesService
13
14
  from .uploads import UploadService
14
15
  from .users import UserService
15
16
 
@@ -31,4 +32,5 @@ class ApiFacade:
31
32
  self.session = SessionService(app)
32
33
  self.auth = AuthService(app)
33
34
  self.uploads = UploadService(app)
35
+ self.stories = StoriesService(app)
34
36
  logger.debug("api facade initialized")
@@ -1 +1 @@
1
- from .service import MessageService
1
+ from .service import DateTimeUnion, MessageService
@@ -16,3 +16,4 @@ class MessagePayloadKey(str, Enum):
16
16
  MESSAGES = "messages"
17
17
  REACTION_INFO = "reactionInfo"
18
18
  MESSAGES_REACTIONS = "messagesReactions"
19
+ COMMENTS_INFO_UPDATES = "commentsInfoUpdates"
@@ -18,6 +18,10 @@ class GetMessagesPayload(CamelModel):
18
18
  message_ids: list[int]
19
19
 
20
20
 
21
+ class GetCommentsPayload(GetMessagesPayload):
22
+ post_id: int
23
+
24
+
21
25
  class EditMessagePayload(CamelModel):
22
26
  chat_id: int
23
27
  message_id: int
@@ -28,17 +32,27 @@ class EditMessagePayload(CamelModel):
28
32
  )
29
33
 
30
34
 
35
+ class EditCommentPayload(EditMessagePayload):
36
+ post_id: int
37
+
38
+
31
39
  class ReplyLink(CamelModel):
32
40
  type: str = "REPLY" # TODO: enum?
33
41
  message_id: int
34
42
 
35
43
 
44
+ class DelayedAttributes(CamelModel):
45
+ time_to_fire: int
46
+ notify_sender: bool
47
+
48
+
36
49
  class SendMessagePayloadMessage(CamelModel):
37
50
  text: str | None = None
38
51
  cid: int
39
52
  elements: list[Any]
40
53
  attaches: list[AttachPhotoPayload | VideoAttachPayload | AttachFilePayload | Poll]
41
54
  link: ReplyLink | None = None
55
+ delayed_attributes: DelayedAttributes | None = None
42
56
 
43
57
 
44
58
  class SendMessagePayload(CamelModel):
@@ -47,6 +61,10 @@ class SendMessagePayload(CamelModel):
47
61
  notify: bool = False
48
62
 
49
63
 
64
+ class SendCommentPayload(SendMessagePayload):
65
+ post_id: int
66
+
67
+
50
68
  class ForwardLink(CamelModel):
51
69
  type: Literal["FORWARD"] = "FORWARD"
52
70
  message_id: str
@@ -80,6 +98,10 @@ class ChatHistoryPayload(CamelModel):
80
98
  interactive: bool = False
81
99
 
82
100
 
101
+ class CommentsHistoryPayload(ChatHistoryPayload):
102
+ post_id: int
103
+
104
+
83
105
  class DeleteMessagePayload(CamelModel):
84
106
  chat_id: int
85
107
  message_ids: list[int]
@@ -111,24 +133,24 @@ class ReactionInfoPayload(CamelModel):
111
133
 
112
134
  class AddReactionPayload(CamelModel):
113
135
  chat_id: int
114
- message_id: str
136
+ message_id: int
115
137
  reaction: ReactionInfoPayload
116
138
 
117
139
 
118
140
  class GetReactionsPayload(CamelModel):
119
141
  chat_id: int
120
- message_ids: list[str]
142
+ message_ids: list[int]
121
143
 
122
144
 
123
145
  class RemoveReactionPayload(CamelModel):
124
146
  chat_id: int
125
- message_id: str
147
+ message_id: int
126
148
 
127
149
 
128
150
  class ReadMessagesPayload(CamelModel):
129
151
  type: ReadAction
130
152
  chat_id: int
131
- message_id: str | int # Сокет просит int а вс str
153
+ message_id: int
132
154
  mark: int
133
155
 
134
156
 
@@ -137,3 +159,33 @@ class VotePollPayload(CamelModel):
137
159
  message_id: int
138
160
  poll_id: int
139
161
  answers_ids: list[int]
162
+
163
+
164
+ class DeleteCommentPayload(DeleteMessagePayload):
165
+ post_id: int
166
+
167
+
168
+ class AddCommentReactionPayload(AddReactionPayload):
169
+ post_id: int
170
+
171
+
172
+ class RemoveCommentReactionPayload(RemoveReactionPayload):
173
+ post_id: int
174
+
175
+
176
+ class SubscribeCommentsPayload(CamelModel):
177
+ chat_id: int
178
+ post_id: int
179
+ subscribe: bool = True
180
+
181
+
182
+ class GetCommentsInfoPayload(CamelModel):
183
+ chat_id: int
184
+ post_ids: list[int]
185
+
186
+
187
+ class DeleteUserCommentsPayload(CamelModel):
188
+ chat_id: int
189
+ post_id: int
190
+ user_id: int
191
+ message_id: int