Class: MTProto::TL::GetDialogs

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Binary

#b_u32, #b_u64, #u32_b, #u64_b

Constructor Details

#initialize(offset_date: 0, offset_id: 0, offset_peer: nil, limit: 100, exclude_pinned: false, folder_id: nil) ⇒ GetDialogs

Returns a new instance of GetDialogs.



10
11
12
13
14
15
16
17
# File 'lib/mtproto/tl/objects/get_dialogs.rb', line 10

def initialize(offset_date: 0, offset_id: 0, offset_peer: nil, limit: 100, exclude_pinned: false, folder_id: nil)
  @offset_date = offset_date
  @offset_id = offset_id
  @offset_peer = offset_peer
  @limit = limit
  @exclude_pinned = exclude_pinned
  @folder_id = folder_id
end

Instance Attribute Details

#exclude_pinnedObject (readonly)

Returns the value of attribute exclude_pinned.



8
9
10
# File 'lib/mtproto/tl/objects/get_dialogs.rb', line 8

def exclude_pinned
  @exclude_pinned
end

#folder_idObject (readonly)

Returns the value of attribute folder_id.



8
9
10
# File 'lib/mtproto/tl/objects/get_dialogs.rb', line 8

def folder_id
  @folder_id
end

#limitObject (readonly)

Returns the value of attribute limit.



8
9
10
# File 'lib/mtproto/tl/objects/get_dialogs.rb', line 8

def limit
  @limit
end

#offset_dateObject (readonly)

Returns the value of attribute offset_date.



8
9
10
# File 'lib/mtproto/tl/objects/get_dialogs.rb', line 8

def offset_date
  @offset_date
end

#offset_idObject (readonly)

Returns the value of attribute offset_id.



8
9
10
# File 'lib/mtproto/tl/objects/get_dialogs.rb', line 8

def offset_id
  @offset_id
end

#offset_peerObject (readonly)

Returns the value of attribute offset_peer.



8
9
10
# File 'lib/mtproto/tl/objects/get_dialogs.rb', line 8

def offset_peer
  @offset_peer
end

Instance Method Details

#serializeObject



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/mtproto/tl/objects/get_dialogs.rb', line 19

def serialize
  flags = 0
  flags |= (1 << 0) if @exclude_pinned
  flags |= (1 << 1) if @folder_id

  result = u32_b(Constructors::MESSAGES_GET_DIALOGS) + u32_b(flags)
  result += u32_b(@folder_id) if @folder_id
  result += u32_b(@offset_date) + u32_b(@offset_id)
  result += serialize_input_peer
  result += u32_b(@limit)
  result += u64_b(0) # hash
  result
end