Class: MTProto::TL::Search

Inherits:
Object
  • Object
show all
Includes:
Binary
Defined in:
lib/mtproto/tl/objects/search.rb

Overview

messages.search. None of the optional (flag-driven) fields are sent, so flags is always 0. Returns messages.Messages.

Constant Summary collapse

CONSTRUCTOR =
0x29ee847a
INPUT_MESSAGES_FILTER_PINNED =
0x1bb00451

Instance Method Summary collapse

Methods included from Binary

#b_u32, #b_u64, #u32_b, #u64_b

Constructor Details

#initialize(peer:, filter: INPUT_MESSAGES_FILTER_PINNED, q: '', limit: 100, offset_id: 0, add_offset: 0, max_id: 0, min_id: 0, min_date: 0, max_date: 0) ⇒ Search

Returns a new instance of Search.



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/mtproto/tl/objects/search.rb', line 13

def initialize(peer:, filter: INPUT_MESSAGES_FILTER_PINNED, q: '', limit: 100,
               offset_id: 0, add_offset: 0, max_id: 0, min_id: 0, min_date: 0, max_date: 0)
  @peer = peer
  @filter = filter
  @q = q
  @limit = limit
  @offset_id = offset_id
  @add_offset = add_offset
  @max_id = max_id
  @min_id = min_id
  @min_date = min_date
  @max_date = max_date
end

Instance Method Details

#serializeObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/mtproto/tl/objects/search.rb', line 27

def serialize
  result = u32_b(CONSTRUCTOR)
  result += u32_b(0) # flags
  result += serialize_input_peer
  result += serialize_tl_string(@q)
  result += u32_b(@filter)
  result += u32_b(@min_date)
  result += u32_b(@max_date)
  result += u32_b(@offset_id)
  result += u32_b(@add_offset)
  result += u32_b(@limit)
  result += u32_b(@max_id)
  result += u32_b(@min_id)
  result += u64_b(0) # hash
  result
end