max_api_client 0.1.0
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.
- checksums.yaml +7 -0
- data/.rubocop.yml +377 -0
- data/CHANGELOG.md +8 -0
- data/CODE_OF_CONDUCT.md +132 -0
- data/LICENSE.txt +21 -0
- data/README.md +272 -0
- data/Rakefile +12 -0
- data/lib/max_api_client/api.rb +194 -0
- data/lib/max_api_client/attachments.rb +111 -0
- data/lib/max_api_client/base_api.rb +37 -0
- data/lib/max_api_client/client.rb +178 -0
- data/lib/max_api_client/error.rb +25 -0
- data/lib/max_api_client/polling.rb +95 -0
- data/lib/max_api_client/raw_api.rb +169 -0
- data/lib/max_api_client/upload.rb +147 -0
- data/lib/max_api_client/version.rb +6 -0
- data/lib/max_api_client.rb +23 -0
- data/sig/max_api_client.rbs +162 -0
- metadata +61 -0
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
module MaxApiClient
|
|
2
|
+
VERSION: String
|
|
3
|
+
@logger: untyped
|
|
4
|
+
type bot_command = Hash[Symbol | String, untyped]
|
|
5
|
+
def self.logger: () -> untyped
|
|
6
|
+
def self.logger=: (untyped logger) -> untyped
|
|
7
|
+
|
|
8
|
+
class Error < StandardError
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
class ApiError < Error
|
|
12
|
+
attr_reader status: Integer
|
|
13
|
+
attr_reader response: untyped
|
|
14
|
+
def code: () -> untyped
|
|
15
|
+
def description: () -> String
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
class Client
|
|
19
|
+
DEFAULT_BASE_URL: String
|
|
20
|
+
attr_reader token: String
|
|
21
|
+
attr_reader base_url: String
|
|
22
|
+
def initialize: (token: String, ?base_url: String, ?adapter: untyped, ?open_timeout: Numeric?, ?read_timeout: Numeric?, ?logger: untyped) -> void
|
|
23
|
+
def call: (method: Symbol | String, ?path: String?, ?query: untyped, ?body: untyped, ?path_params: untyped, ?headers: untyped, ?url: String?, ?raw_body: untyped, ?parse_json: bool) -> Hash[Symbol, untyped]
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
class RawApi
|
|
27
|
+
def initialize: (Client) -> void
|
|
28
|
+
def get: (String, ?query: untyped, ?path_params: untyped) -> untyped
|
|
29
|
+
def post: (String, ?query: untyped, ?body: untyped, ?path_params: untyped) -> untyped
|
|
30
|
+
def put: (String, ?query: untyped, ?body: untyped, ?path_params: untyped) -> untyped
|
|
31
|
+
def patch: (String, ?query: untyped, ?body: untyped, ?path_params: untyped) -> untyped
|
|
32
|
+
def delete: (String, ?query: untyped, ?body: untyped, ?path_params: untyped) -> untyped
|
|
33
|
+
def bots: () -> BotsApi
|
|
34
|
+
def chats: () -> ChatsApi
|
|
35
|
+
def messages: () -> MessagesApi
|
|
36
|
+
def subscriptions: () -> SubscriptionsApi
|
|
37
|
+
def uploads: () -> UploadsApi
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
class BotsApi
|
|
41
|
+
def get_my_info: () -> untyped
|
|
42
|
+
def edit_my_info: (untyped extra) -> untyped
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
class ChatsApi
|
|
46
|
+
def get_all: (?untyped extra) -> untyped
|
|
47
|
+
def get_by_id: (chat_id: Integer) -> untyped
|
|
48
|
+
def get_by_link: (chat_link: String) -> untyped
|
|
49
|
+
def edit: (chat_id: Integer, **untyped extra) -> untyped
|
|
50
|
+
def get_chat_membership: (chat_id: Integer) -> untyped
|
|
51
|
+
def get_chat_admins: (chat_id: Integer) -> untyped
|
|
52
|
+
def add_chat_members: (chat_id: Integer, user_ids: Array[Integer]) -> untyped
|
|
53
|
+
def get_chat_members: (chat_id: Integer, **untyped query) -> untyped
|
|
54
|
+
def remove_chat_member: (chat_id: Integer, user_id: Integer, ?block: bool?) -> untyped
|
|
55
|
+
def get_pinned_message: (chat_id: Integer) -> untyped
|
|
56
|
+
def pin_message: (chat_id: Integer, message_id: String, ?notify: bool?) -> untyped
|
|
57
|
+
def unpin_message: (chat_id: Integer) -> untyped
|
|
58
|
+
def send_action: (chat_id: Integer, action: String | Symbol) -> untyped
|
|
59
|
+
def leave_chat: (chat_id: Integer) -> untyped
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
class MessagesApi
|
|
63
|
+
def get: (**untyped query) -> untyped
|
|
64
|
+
def get_by_id: (message_id: String) -> untyped
|
|
65
|
+
def send: (?chat_id: Integer?, ?user_id: Integer?, ?disable_link_preview: bool?, **untyped body) -> untyped
|
|
66
|
+
def edit: (message_id: String, **untyped body) -> untyped
|
|
67
|
+
def delete: (message_id: String) -> untyped
|
|
68
|
+
def answer_on_callback: (callback_id: String, **untyped body) -> untyped
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
class SubscriptionsApi
|
|
72
|
+
def get_subscriptions: () -> untyped
|
|
73
|
+
def subscribe: (url: String, ?update_types: Array[String] | String?, ?secret: String?) -> untyped
|
|
74
|
+
def unsubscribe: (url: String) -> untyped
|
|
75
|
+
def get_updates: (?limit: Integer?, ?timeout: Integer?, ?marker: Integer?, ?types: String?, ?read_timeout: Numeric?) -> untyped
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
class UploadsApi
|
|
79
|
+
def get_upload_url: (type: String | Symbol) -> untyped
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
class Attachment
|
|
83
|
+
def to_h: () -> Hash[Symbol, untyped]
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
class ImageAttachment < Attachment
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
class VideoAttachment < Attachment
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
class AudioAttachment < Attachment
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
class FileAttachment < Attachment
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
class StickerAttachment < Attachment
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
class LocationAttachment < Attachment
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
class ShareAttachment < Attachment
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
class Upload
|
|
108
|
+
def initialize: (Api) -> void
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
class Polling
|
|
112
|
+
DEFAULT_TIMEOUT: Integer
|
|
113
|
+
DEFAULT_RETRY_INTERVAL: Integer
|
|
114
|
+
READ_TIMEOUT_PADDING: Integer
|
|
115
|
+
def initialize: (Api api, ?types: Array[String] | String, ?marker: Integer?, ?timeout: Integer, ?retry_interval: Integer, ?read_timeout: Numeric?) -> void
|
|
116
|
+
def each: () { (untyped update) -> void } -> self
|
|
117
|
+
def each: () -> Enumerator[untyped, self]
|
|
118
|
+
def stop: () -> bool
|
|
119
|
+
def stopped?: () -> bool
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
class Api
|
|
123
|
+
attr_reader raw: RawApi
|
|
124
|
+
attr_reader upload: Upload
|
|
125
|
+
attr_reader client: Client
|
|
126
|
+
def initialize: (token: String, ?base_url: String, ?adapter: untyped, ?open_timeout: Numeric?, ?read_timeout: Numeric?, ?logger: untyped) -> void
|
|
127
|
+
def get_my_info: () -> untyped
|
|
128
|
+
def edit_my_info: (untyped extra) -> untyped
|
|
129
|
+
def set_my_commands: (Array[bot_command] commands) -> untyped
|
|
130
|
+
def delete_my_commands: () -> untyped
|
|
131
|
+
def get_all_chats: (?untyped extra) -> untyped
|
|
132
|
+
def get_chat: (Integer chat_id) -> untyped
|
|
133
|
+
def get_chat_by_link: (String chat_link) -> untyped
|
|
134
|
+
def edit_chat_info: (Integer chat_id, untyped extra) -> untyped
|
|
135
|
+
def get_chat_membership: (Integer chat_id) -> untyped
|
|
136
|
+
def get_chat_admins: (Integer chat_id) -> untyped
|
|
137
|
+
def add_chat_members: (Integer chat_id, Array[Integer] user_ids) -> untyped
|
|
138
|
+
def get_chat_members: (Integer chat_id, ?untyped extra) -> untyped
|
|
139
|
+
def remove_chat_member: (Integer chat_id, Integer user_id, ?block: bool?) -> untyped
|
|
140
|
+
def get_pinned_message: (Integer chat_id) -> untyped
|
|
141
|
+
def pin_message: (Integer chat_id, String message_id, ?untyped extra) -> untyped
|
|
142
|
+
def unpin_message: (Integer chat_id) -> untyped
|
|
143
|
+
def send_action: (Integer chat_id, String | Symbol action) -> untyped
|
|
144
|
+
def leave_chat: (Integer chat_id) -> untyped
|
|
145
|
+
def send_message_to_chat: (Integer chat_id, String text, ?untyped extra) -> untyped
|
|
146
|
+
def send_message_to_user: (Integer user_id, String text, ?untyped extra) -> untyped
|
|
147
|
+
def get_messages: (Integer chat_id, ?untyped extra) -> untyped
|
|
148
|
+
def get_message: (String message_id) -> untyped
|
|
149
|
+
def edit_message: (String message_id, ?untyped extra) -> untyped
|
|
150
|
+
def delete_message: (String message_id, ?untyped extra) -> untyped
|
|
151
|
+
def answer_on_callback: (String callback_id, ?untyped extra) -> untyped
|
|
152
|
+
def get_subscriptions: () -> untyped
|
|
153
|
+
def subscribe: (String url, ?update_types: Array[String] | String?, ?secret: String?) -> untyped
|
|
154
|
+
def unsubscribe: (String url) -> untyped
|
|
155
|
+
def poll_updates: (?Array[String] | String types, ?marker: Integer?, ?timeout: Integer, ?retry_interval: Integer, ?read_timeout: Numeric?) { (untyped update) -> void } -> Polling
|
|
156
|
+
def poll_updates: (?Array[String] | String types, ?marker: Integer?, ?timeout: Integer, ?retry_interval: Integer, ?read_timeout: Numeric?) -> Enumerator[untyped, Polling]
|
|
157
|
+
def upload_image: (Hash[Symbol, untyped] options) -> ImageAttachment
|
|
158
|
+
def upload_video: (Hash[Symbol, untyped] options) -> VideoAttachment
|
|
159
|
+
def upload_audio: (Hash[Symbol, untyped] options) -> AudioAttachment
|
|
160
|
+
def upload_file: (Hash[Symbol, untyped] options) -> FileAttachment
|
|
161
|
+
end
|
|
162
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: max_api_client
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Alexandr Zimin
|
|
8
|
+
bindir: exe
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 2026-03-26 00:00:00.000000000 Z
|
|
11
|
+
dependencies: []
|
|
12
|
+
description: Ruby client for Max Bot API.
|
|
13
|
+
email:
|
|
14
|
+
- ziminav@gmail.com
|
|
15
|
+
executables: []
|
|
16
|
+
extensions: []
|
|
17
|
+
extra_rdoc_files: []
|
|
18
|
+
files:
|
|
19
|
+
- ".rubocop.yml"
|
|
20
|
+
- CHANGELOG.md
|
|
21
|
+
- CODE_OF_CONDUCT.md
|
|
22
|
+
- LICENSE.txt
|
|
23
|
+
- README.md
|
|
24
|
+
- Rakefile
|
|
25
|
+
- lib/max_api_client.rb
|
|
26
|
+
- lib/max_api_client/api.rb
|
|
27
|
+
- lib/max_api_client/attachments.rb
|
|
28
|
+
- lib/max_api_client/base_api.rb
|
|
29
|
+
- lib/max_api_client/client.rb
|
|
30
|
+
- lib/max_api_client/error.rb
|
|
31
|
+
- lib/max_api_client/polling.rb
|
|
32
|
+
- lib/max_api_client/raw_api.rb
|
|
33
|
+
- lib/max_api_client/upload.rb
|
|
34
|
+
- lib/max_api_client/version.rb
|
|
35
|
+
- sig/max_api_client.rbs
|
|
36
|
+
homepage: https://github.com/Ziaw/max_api_client
|
|
37
|
+
licenses:
|
|
38
|
+
- MIT
|
|
39
|
+
metadata:
|
|
40
|
+
homepage_uri: https://github.com/Ziaw/max_api_client
|
|
41
|
+
source_code_uri: https://github.com/Ziaw/max_api_client
|
|
42
|
+
changelog_uri: https://github.com/Ziaw/max_api_client/blob/master/CHANGELOG.md
|
|
43
|
+
rubygems_mfa_required: 'true'
|
|
44
|
+
rdoc_options: []
|
|
45
|
+
require_paths:
|
|
46
|
+
- lib
|
|
47
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
48
|
+
requirements:
|
|
49
|
+
- - ">="
|
|
50
|
+
- !ruby/object:Gem::Version
|
|
51
|
+
version: 3.1.0
|
|
52
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
53
|
+
requirements:
|
|
54
|
+
- - ">="
|
|
55
|
+
- !ruby/object:Gem::Version
|
|
56
|
+
version: '0'
|
|
57
|
+
requirements: []
|
|
58
|
+
rubygems_version: 3.6.2
|
|
59
|
+
specification_version: 4
|
|
60
|
+
summary: Ruby client for Max Bot API
|
|
61
|
+
test_files: []
|