mtproto 0.0.7 → 0.0.8

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 (63) hide show
  1. checksums.yaml +4 -4
  2. data/.env.example +4 -0
  3. data/lib/mtproto/async/middleware/base.rb +17 -0
  4. data/lib/mtproto/async/middleware/flood_wait.rb +42 -0
  5. data/lib/mtproto/async/request.rb +18 -0
  6. data/lib/mtproto/async/request_queue.rb +63 -0
  7. data/lib/mtproto/async_client.rb +201 -0
  8. data/lib/mtproto/auth_key_generator.rb +21 -21
  9. data/lib/mtproto/client/rpc.rb +44 -20
  10. data/lib/mtproto/client.rb +49 -15
  11. data/lib/mtproto/rpc/get_config.rb +19 -22
  12. data/lib/mtproto/rpc/get_contacts.rb +12 -5
  13. data/lib/mtproto/rpc/get_updates_difference.rb +23 -5
  14. data/lib/mtproto/rpc/get_updates_state.rb +12 -5
  15. data/lib/mtproto/rpc/get_users.rb +12 -5
  16. data/lib/mtproto/rpc/ping.rb +12 -5
  17. data/lib/mtproto/rpc/send_code.rb +19 -22
  18. data/lib/mtproto/rpc/send_message.rb +21 -5
  19. data/lib/mtproto/rpc/sign_in.rb +23 -27
  20. data/lib/mtproto/{tl → type}/auth_key/dh_gen_response.rb +1 -1
  21. data/lib/mtproto/{tl → type}/auth_key/req_dh_params.rb +1 -1
  22. data/lib/mtproto/{tl → type}/auth_key/req_pq_multi.rb +1 -1
  23. data/lib/mtproto/{tl → type}/auth_key/res_pq.rb +1 -1
  24. data/lib/mtproto/{tl → type}/auth_key/server_dh_params.rb +1 -1
  25. data/lib/mtproto/{tl → type}/auth_key/set_client_dh_params.rb +1 -1
  26. data/lib/mtproto/{tl → type}/bad_msg_notification.rb +1 -1
  27. data/lib/mtproto/{tl → type}/client_dh_inner_data.rb +1 -1
  28. data/lib/mtproto/{tl → type}/code_settings.rb +1 -1
  29. data/lib/mtproto/{tl → type}/config.rb +1 -1
  30. data/lib/mtproto/{tl → type}/gzip_packed.rb +1 -1
  31. data/lib/mtproto/{tl → type}/message.rb +1 -1
  32. data/lib/mtproto/{tl → type}/msg_container.rb +1 -1
  33. data/lib/mtproto/{tl → type}/new_session_created.rb +1 -1
  34. data/lib/mtproto/{tl/p_q_inner_data.rb → type/pq_inner_data.rb} +1 -1
  35. data/lib/mtproto/{tl → type}/rpc/auth/authorization.rb +5 -5
  36. data/lib/mtproto/{tl → type}/rpc/auth/send_code.rb +1 -1
  37. data/lib/mtproto/{tl → type}/rpc/auth/sent_code.rb +7 -7
  38. data/lib/mtproto/{tl → type}/rpc/auth/sign_in.rb +1 -1
  39. data/lib/mtproto/{tl → type}/rpc/contacts/contacts.rb +5 -5
  40. data/lib/mtproto/{tl → type}/rpc/contacts/get_contacts.rb +1 -1
  41. data/lib/mtproto/{tl → type}/rpc/help/config.rb +7 -7
  42. data/lib/mtproto/{tl → type}/rpc/help/get_config.rb +1 -1
  43. data/lib/mtproto/type/rpc/init_connection.rb +28 -0
  44. data/lib/mtproto/type/rpc/invoke_with_layer.rb +19 -0
  45. data/lib/mtproto/{tl → type}/rpc/messages/send_message.rb +1 -1
  46. data/lib/mtproto/{tl → type}/rpc/messages/updates.rb +5 -5
  47. data/lib/mtproto/{tl → type}/rpc/ping.rb +1 -1
  48. data/lib/mtproto/{tl → type}/rpc/pong.rb +1 -1
  49. data/lib/mtproto/{tl → type}/rpc/updates/difference.rb +5 -5
  50. data/lib/mtproto/{tl → type}/rpc/updates/get_difference.rb +1 -1
  51. data/lib/mtproto/{tl → type}/rpc/updates/get_state.rb +1 -1
  52. data/lib/mtproto/{tl → type}/rpc/updates/state.rb +5 -5
  53. data/lib/mtproto/{tl → type}/rpc/users/get_users.rb +1 -1
  54. data/lib/mtproto/{tl → type}/rpc/users/users.rb +5 -5
  55. data/lib/mtproto/{tl → type}/rpc_error.rb +1 -1
  56. data/lib/mtproto/{tl → type}/sent_code.rb +1 -1
  57. data/lib/mtproto/{tl → type}/serializer.rb +1 -1
  58. data/lib/mtproto/{tl → type}/server_dh_inner_data.rb +1 -1
  59. data/lib/mtproto/updates_poller.rb +3 -3
  60. data/lib/mtproto/version.rb +1 -1
  61. data/lib/mtproto.rb +18 -13
  62. metadata +59 -39
  63. data/lib/mtproto/tl/method_builder.rb +0 -29
@@ -5,13 +5,15 @@ require 'digest'
5
5
  require 'base64'
6
6
  require_relative 'transport/tcp_connection'
7
7
  require_relative 'transport/abridged_packet_codec'
8
- require_relative 'tl/message'
8
+ require_relative 'type/message'
9
9
  require_relative 'client/rpc'
10
- require_relative 'tl/method_builder'
10
+ require_relative 'type/rpc/help/get_config'
11
+ require_relative 'type/rpc/help/config'
12
+ require_relative 'type/rpc/invoke_with_layer'
13
+ require_relative 'type/rpc/init_connection'
11
14
 
12
15
  module MTProto
13
16
  class Client
14
- include TL::MethodBuilder
15
17
 
16
18
  attr_reader :connection, :server_key, :auth_key, :server_salt, :time_offset, :session, :timeout, :user_id, :access_hash, :dc_number
17
19
  attr_accessor :api_id, :api_hash, :device_model, :system_version, :app_version, :system_lang_code, :lang_pack, :lang_code
@@ -50,6 +52,10 @@ module MTProto
50
52
  @connection.connect!
51
53
  end
52
54
 
55
+ def connected?
56
+ @connection&.connected?
57
+ end
58
+
53
59
  def disconnect!
54
60
  @connection.close if @connection
55
61
  end
@@ -72,8 +78,37 @@ module MTProto
72
78
  @rpc ||= RPC.new(self)
73
79
  end
74
80
 
75
- def save_session
76
- raise 'Cannot save session: auth_key not set' unless @auth_key
81
+ def call(body, content_related: true)
82
+ rpc.call(body, content_related: content_related)
83
+ end
84
+
85
+ def init_connection!
86
+ return if @connection_initialized
87
+
88
+ query = Type::RPC::InvokeWithLayer.build(
89
+ layer: 214,
90
+ query: Type::RPC::InitConnection.build(
91
+ api_id: api_id,
92
+ device_model: device_model,
93
+ system_version: system_version,
94
+ app_version: app_version,
95
+ system_lang_code: system_lang_code,
96
+ lang_pack: lang_pack,
97
+ lang_code: lang_code,
98
+ query: Type::RPC::Help::GetConfig.build
99
+ )
100
+ )
101
+
102
+ response = rpc.call_sync(query)
103
+ config = Type::RPC::Help::Config.parse(response)
104
+
105
+ @connection_initialized = true
106
+
107
+ config
108
+ end
109
+
110
+ def save_auth_data
111
+ raise 'Cannot save auth_data: auth_key not set' unless @auth_key
77
112
 
78
113
  {
79
114
  auth_key: Base64.strict_encode64(@auth_key),
@@ -85,18 +120,17 @@ module MTProto
85
120
  }
86
121
  end
87
122
 
88
- def load_session(session_data)
89
- raise ArgumentError, 'session_data must be a Hash' unless session_data.is_a?(Hash)
90
- raise ArgumentError, 'auth_key is required' unless session_data[:auth_key]
91
- raise ArgumentError, 'server_salt is required' unless session_data[:server_salt]
123
+ def load_auth_data(auth_data)
124
+ raise ArgumentError, 'auth_data must be a Hash' unless auth_data.is_a?(Hash)
125
+ raise ArgumentError, 'auth_key is required' unless auth_data[:auth_key]
126
+ raise ArgumentError, 'server_salt is required' unless auth_data[:server_salt]
92
127
 
93
- @auth_key = Base64.strict_decode64(session_data[:auth_key])
94
- @server_salt = session_data[:server_salt]
95
- @time_offset = session_data[:time_offset] || 0
96
- @user_id = session_data[:user_id]
97
- @access_hash = session_data[:access_hash]
128
+ @auth_key = Base64.strict_decode64(auth_data[:auth_key])
129
+ @server_salt = auth_data[:server_salt]
130
+ @time_offset = auth_data[:time_offset] || 0
131
+ @user_id = auth_data[:user_id]
132
+ @access_hash = auth_data[:access_hash]
98
133
 
99
- # Create a fresh session for the new connection
100
134
  @session = Session.new
101
135
 
102
136
  true
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../tl/rpc/help/get_config'
4
- require_relative '../tl/rpc/help/config'
3
+ require_relative '../type/rpc/help/get_config'
4
+ require_relative '../type/rpc/help/config'
5
5
 
6
6
  module MTProto
7
7
  module RPC
@@ -11,26 +11,23 @@ module MTProto
11
11
  end
12
12
 
13
13
  def call
14
- query = TL::RPC::Help::GetConfig.build
15
-
16
- unless @client.instance_variable_get(:@connection_initialized)
17
- query = @client.init_connection(
18
- api_id: @client.api_id,
19
- device_model: @client.device_model,
20
- system_version: @client.system_version,
21
- app_version: @client.app_version,
22
- system_lang_code: @client.system_lang_code,
23
- lang_pack: @client.lang_pack,
24
- lang_code: @client.lang_code,
25
- query: query
26
- )
27
- query = @client.invoke_with_layer(214, query)
28
- @client.instance_variable_set(:@connection_initialized, true)
29
- end
30
-
31
- response = @client.rpc.call(query)
32
-
33
- TL::RPC::Help::Config.parse(response)
14
+ query = build_query
15
+
16
+ @client.rpc.call(query)
17
+ end
18
+
19
+ def call_sync
20
+ query = build_query
21
+
22
+ response = @client.rpc.call_sync(query)
23
+
24
+ Type::RPC::Help::Config.parse(response)
25
+ end
26
+
27
+ private
28
+
29
+ def build_query
30
+ Type::RPC::Help::GetConfig.build
34
31
  end
35
32
  end
36
33
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../tl/rpc/contacts/get_contacts'
4
- require_relative '../tl/rpc/contacts/contacts'
3
+ require_relative '../type/rpc/contacts/get_contacts'
4
+ require_relative '../type/rpc/contacts/contacts'
5
5
 
6
6
  module MTProto
7
7
  module RPC
@@ -13,9 +13,16 @@ module MTProto
13
13
  def call(hash: 0)
14
14
  raise 'Auth key not generated' unless @client.auth_key
15
15
 
16
- query = TL::RPC::Contacts::GetContacts.build(hash: hash)
17
- response = @client.rpc.call(query)
18
- TL::RPC::Contacts::Contacts.parse(response)
16
+ query = Type::RPC::Contacts::GetContacts.build(hash: hash)
17
+ @client.rpc.call(query)
18
+ end
19
+
20
+ def call_sync(hash: 0)
21
+ raise 'Auth key not generated' unless @client.auth_key
22
+
23
+ query = Type::RPC::Contacts::GetContacts.build(hash: hash)
24
+ response = @client.rpc.call_sync(query)
25
+ Type::RPC::Contacts::Contacts.parse(response)
19
26
  end
20
27
  end
21
28
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../tl/rpc/updates/get_difference'
4
- require_relative '../tl/rpc/updates/difference'
3
+ require_relative '../type/rpc/updates/get_difference'
4
+ require_relative '../type/rpc/updates/difference'
5
5
 
6
6
  module MTProto
7
7
  module RPC
@@ -16,7 +16,7 @@ module MTProto
16
16
  raise ArgumentError, 'date is required' if date.nil?
17
17
  raise ArgumentError, 'qts is required' if qts.nil?
18
18
 
19
- query = TL::RPC::Updates::GetDifference.build(
19
+ query = Type::RPC::Updates::GetDifference.build(
20
20
  pts: pts,
21
21
  pts_limit: pts_limit,
22
22
  pts_total_limit: pts_total_limit,
@@ -25,8 +25,26 @@ module MTProto
25
25
  qts_limit: qts_limit
26
26
  )
27
27
 
28
- response = @client.rpc.call(query)
29
- TL::RPC::Updates::Difference.parse(response)
28
+ @client.rpc.call(query)
29
+ end
30
+
31
+ def call_sync(pts:, date:, qts:, pts_limit: 100, qts_limit: 100, pts_total_limit: nil)
32
+ raise 'Auth key not generated' unless @client.auth_key
33
+ raise ArgumentError, 'pts is required' if pts.nil?
34
+ raise ArgumentError, 'date is required' if date.nil?
35
+ raise ArgumentError, 'qts is required' if qts.nil?
36
+
37
+ query = Type::RPC::Updates::GetDifference.build(
38
+ pts: pts,
39
+ pts_limit: pts_limit,
40
+ pts_total_limit: pts_total_limit,
41
+ date: date,
42
+ qts: qts,
43
+ qts_limit: qts_limit
44
+ )
45
+
46
+ response = @client.rpc.call_sync(query)
47
+ Type::RPC::Updates::Difference.parse(response)
30
48
  end
31
49
  end
32
50
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../tl/rpc/updates/get_state'
4
- require_relative '../tl/rpc/updates/state'
3
+ require_relative '../type/rpc/updates/get_state'
4
+ require_relative '../type/rpc/updates/state'
5
5
 
6
6
  module MTProto
7
7
  module RPC
@@ -13,9 +13,16 @@ module MTProto
13
13
  def call
14
14
  raise 'Auth key not generated' unless @client.auth_key
15
15
 
16
- query = TL::RPC::Updates::GetState.build
17
- response = @client.rpc.call(query)
18
- TL::RPC::Updates::State.parse(response)
16
+ query = Type::RPC::Updates::GetState.build
17
+ @client.rpc.call(query)
18
+ end
19
+
20
+ def call_sync
21
+ raise 'Auth key not generated' unless @client.auth_key
22
+
23
+ query = Type::RPC::Updates::GetState.build
24
+ response = @client.rpc.call_sync(query)
25
+ Type::RPC::Updates::State.parse(response)
19
26
  end
20
27
  end
21
28
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../tl/rpc/users/get_users'
4
- require_relative '../tl/rpc/users/users'
3
+ require_relative '../type/rpc/users/get_users'
4
+ require_relative '../type/rpc/users/users'
5
5
 
6
6
  module MTProto
7
7
  module RPC
@@ -13,9 +13,16 @@ module MTProto
13
13
  def call
14
14
  raise 'Auth key not generated' unless @client.auth_key
15
15
 
16
- query = TL::RPC::Users::GetUsers.build
17
- response = @client.rpc.call(query)
18
- TL::RPC::Users::Users.parse(response)
16
+ query = Type::RPC::Users::GetUsers.build
17
+ @client.rpc.call(query)
18
+ end
19
+
20
+ def call_sync
21
+ raise 'Auth key not generated' unless @client.auth_key
22
+
23
+ query = Type::RPC::Users::GetUsers.build
24
+ response = @client.rpc.call_sync(query)
25
+ Type::RPC::Users::Users.parse(response)
19
26
  end
20
27
  end
21
28
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../tl/rpc/ping'
4
- require_relative '../tl/rpc/pong'
3
+ require_relative '../type/rpc/ping'
4
+ require_relative '../type/rpc/pong'
5
5
 
6
6
  module MTProto
7
7
  module RPC
@@ -12,10 +12,17 @@ module MTProto
12
12
 
13
13
  def call(ping_id = nil)
14
14
  ping_id ||= rand(2**63)
15
- body = TL::RPC::Ping.build(ping_id)
15
+ body = Type::RPC::Ping.build(ping_id)
16
16
 
17
- response_body = @client.rpc.call(body)
18
- pong = TL::RPC::Pong.parse(response_body)
17
+ @client.rpc.call(body)
18
+ end
19
+
20
+ def call_sync(ping_id = nil)
21
+ ping_id ||= rand(2**63)
22
+ body = Type::RPC::Ping.build(ping_id)
23
+
24
+ response_body = @client.rpc.call_sync(body)
25
+ pong = Type::RPC::Pong.parse(response_body)
19
26
 
20
27
  raise PingMismatchError unless pong[:ping_id] == ping_id
21
28
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../tl/rpc/auth/send_code'
4
- require_relative '../tl/rpc/auth/sent_code'
3
+ require_relative '../type/rpc/auth/send_code'
4
+ require_relative '../type/rpc/auth/sent_code'
5
5
 
6
6
  module MTProto
7
7
  module RPC
@@ -11,33 +11,30 @@ module MTProto
11
11
  end
12
12
 
13
13
  def call(phone_number, code_settings: {})
14
+ query = build_query(phone_number, code_settings)
15
+
16
+ @client.rpc.call(query)
17
+ end
18
+
19
+ def call_sync(phone_number, code_settings: {})
20
+ query = build_query(phone_number, code_settings)
21
+
22
+ response = @client.rpc.call_sync(query)
23
+
24
+ Type::RPC::Auth::SentCode.parse(response)
25
+ end
26
+
27
+ private
28
+
29
+ def build_query(phone_number, code_settings)
14
30
  raise ArgumentError, 'phone_number is required' if phone_number.nil? || phone_number.empty?
15
31
 
16
- query = TL::RPC::Auth::SendCode.build(
32
+ Type::RPC::Auth::SendCode.build(
17
33
  phone_number: phone_number,
18
34
  api_id: @client.api_id,
19
35
  api_hash: @client.api_hash,
20
36
  code_settings: code_settings
21
37
  )
22
-
23
- unless @client.instance_variable_get(:@connection_initialized)
24
- query = @client.init_connection(
25
- api_id: @client.api_id,
26
- device_model: @client.device_model,
27
- system_version: @client.system_version,
28
- app_version: @client.app_version,
29
- system_lang_code: @client.system_lang_code,
30
- lang_pack: @client.lang_pack,
31
- lang_code: @client.lang_code,
32
- query: query
33
- )
34
- query = @client.invoke_with_layer(214, query)
35
- @client.instance_variable_set(:@connection_initialized, true)
36
- end
37
-
38
- response = @client.rpc.call(query)
39
-
40
- TL::RPC::Auth::SentCode.parse(response)
41
38
  end
42
39
  end
43
40
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../tl/rpc/messages/send_message'
4
- require_relative '../tl/rpc/messages/updates'
3
+ require_relative '../type/rpc/messages/send_message'
4
+ require_relative '../type/rpc/messages/updates'
5
5
 
6
6
  module MTProto
7
7
  module RPC
@@ -16,15 +16,31 @@ module MTProto
16
16
  raise ArgumentError, 'access_hash is required' if access_hash.nil?
17
17
  raise ArgumentError, 'message is required and cannot be empty' if message.nil? || message.empty?
18
18
 
19
- query = TL::RPC::Messages::SendMessage.build(
19
+ query = Type::RPC::Messages::SendMessage.build(
20
20
  user_id: user_id,
21
21
  access_hash: access_hash,
22
22
  message: message,
23
23
  random_id: random_id
24
24
  )
25
25
 
26
- response = @client.rpc.call(query)
27
- TL::RPC::Messages::Updates.parse(response)
26
+ @client.rpc.call(query)
27
+ end
28
+
29
+ def call_sync(user_id:, access_hash:, message:, random_id: nil)
30
+ raise 'Auth key not generated' unless @client.auth_key
31
+ raise ArgumentError, 'user_id is required' if user_id.nil?
32
+ raise ArgumentError, 'access_hash is required' if access_hash.nil?
33
+ raise ArgumentError, 'message is required and cannot be empty' if message.nil? || message.empty?
34
+
35
+ query = Type::RPC::Messages::SendMessage.build(
36
+ user_id: user_id,
37
+ access_hash: access_hash,
38
+ message: message,
39
+ random_id: random_id
40
+ )
41
+
42
+ response = @client.rpc.call_sync(query)
43
+ Type::RPC::Messages::Updates.parse(response)
28
44
  end
29
45
  end
30
46
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../tl/rpc/auth/sign_in'
4
- require_relative '../tl/rpc/auth/authorization'
3
+ require_relative '../type/rpc/auth/sign_in'
4
+ require_relative '../type/rpc/auth/authorization'
5
5
 
6
6
  module MTProto
7
7
  module RPC
@@ -11,42 +11,38 @@ module MTProto
11
11
  end
12
12
 
13
13
  def call(phone_number:, phone_code_hash:, phone_code:)
14
- raise ArgumentError, 'phone_number is required' if phone_number.nil? || phone_number.empty?
15
- raise ArgumentError, 'phone_code_hash is required' if phone_code_hash.nil? || phone_code_hash.empty?
16
- raise ArgumentError, 'phone_code is required' if phone_code.nil? || phone_code.empty?
14
+ query = build_query(phone_number, phone_code_hash, phone_code)
17
15
 
18
- query = TL::RPC::Auth::SignIn.build(
19
- phone_number: phone_number,
20
- phone_code_hash: phone_code_hash,
21
- phone_code: phone_code
22
- )
16
+ @client.rpc.call(query)
17
+ end
23
18
 
24
- unless @client.instance_variable_get(:@connection_initialized)
25
- query = @client.init_connection(
26
- api_id: @client.api_id,
27
- device_model: @client.device_model,
28
- system_version: @client.system_version,
29
- app_version: @client.app_version,
30
- system_lang_code: @client.system_lang_code,
31
- lang_pack: @client.lang_pack,
32
- lang_code: @client.lang_code,
33
- query: query
34
- )
35
- query = @client.invoke_with_layer(214, query)
36
- @client.instance_variable_set(:@connection_initialized, true)
37
- end
19
+ def call_sync(phone_number:, phone_code_hash:, phone_code:)
20
+ query = build_query(phone_number, phone_code_hash, phone_code)
38
21
 
39
- response = @client.rpc.call(query)
22
+ response = @client.rpc.call_sync(query)
40
23
 
41
- result = TL::RPC::Auth::Authorization.parse(response)
24
+ result = Type::RPC::Auth::Authorization.parse(response)
42
25
 
43
- # Update client with user data if authorization was successful
44
26
  if result[:authorization] && result[:user_id]
45
27
  @client.update_user(user_id: result[:user_id], access_hash: result[:access_hash])
46
28
  end
47
29
 
48
30
  result
49
31
  end
32
+
33
+ private
34
+
35
+ def build_query(phone_number, phone_code_hash, phone_code)
36
+ raise ArgumentError, 'phone_number is required' if phone_number.nil? || phone_number.empty?
37
+ raise ArgumentError, 'phone_code_hash is required' if phone_code_hash.nil? || phone_code_hash.empty?
38
+ raise ArgumentError, 'phone_code is required' if phone_code.nil? || phone_code.empty?
39
+
40
+ Type::RPC::Auth::SignIn.build(
41
+ phone_number: phone_number,
42
+ phone_code_hash: phone_code_hash,
43
+ phone_code: phone_code
44
+ )
45
+ end
50
46
  end
51
47
  end
52
48
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MTProto
4
- module TL
4
+ module Type
5
5
  module AuthKey
6
6
  class DHGenResponse
7
7
  CONSTRUCTOR_DH_GEN_OK = 0x3bcbf734
@@ -3,7 +3,7 @@
3
3
  require_relative '../serializer'
4
4
 
5
5
  module MTProto
6
- module TL
6
+ module Type
7
7
  module AuthKey
8
8
  class ReqDHParams
9
9
  CONSTRUCTOR = 0xd712e4be
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MTProto
4
- module TL
4
+ module Type
5
5
  module AuthKey
6
6
  class ReqPqMulti
7
7
  CONSTRUCTOR = 0xbe7e8ef1
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MTProto
4
- module TL
4
+ module Type
5
5
  module AuthKey
6
6
  class ResPq
7
7
  CONSTRUCTOR = 0x05162463
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MTProto
4
- module TL
4
+ module Type
5
5
  module AuthKey
6
6
  class ServerDHParams
7
7
  CONSTRUCTOR = 0xd0e8075c
@@ -3,7 +3,7 @@
3
3
  require_relative '../serializer'
4
4
 
5
5
  module MTProto
6
- module TL
6
+ module Type
7
7
  module AuthKey
8
8
  class SetClientDHParams
9
9
  CONSTRUCTOR = 0xf5045f1f
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MTProto
4
- module TL
4
+ module Type
5
5
  class BadMsgNotification
6
6
  CONSTRUCTOR = 0xa7eff811
7
7
 
@@ -3,7 +3,7 @@
3
3
  require_relative 'serializer'
4
4
 
5
5
  module MTProto
6
- module TL
6
+ module Type
7
7
  class ClientDHInnerData
8
8
  CONSTRUCTOR = 0x6643b654
9
9
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MTProto
4
- module TL
4
+ module Type
5
5
  class CodeSettings
6
6
  CONSTRUCTOR = 0xad253d78
7
7
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MTProto
4
- module TL
4
+ module Type
5
5
  class Config
6
6
  CONSTRUCTOR = 0xcc1a241e
7
7
  CONSTRUCTOR_ALT = 0x3072cfa1
@@ -4,7 +4,7 @@ require 'zlib'
4
4
  require 'stringio'
5
5
 
6
6
  module MTProto
7
- module TL
7
+ module Type
8
8
  module GzipPacked
9
9
  CONSTRUCTOR = 0x3072cfa1
10
10
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MTProto
4
- module TL
4
+ module Type
5
5
  class Message
6
6
  attr_reader :auth_key_id, :msg_id, :body
7
7
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MTProto
4
- module TL
4
+ module Type
5
5
  class MsgContainer
6
6
  CONSTRUCTOR = 0x73f1f8dc
7
7
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MTProto
4
- module TL
4
+ module Type
5
5
  class NewSessionCreated
6
6
  CONSTRUCTOR = 0x9ec20908
7
7
 
@@ -3,7 +3,7 @@
3
3
  require_relative 'serializer'
4
4
 
5
5
  module MTProto
6
- module TL
6
+ module Type
7
7
  class PQInnerData
8
8
  CONSTRUCTOR_DC = 0xa9f55f95
9
9
  CONSTRUCTOR_TEMP_DC = 0x56fddf88