Class: GetStream::Generated::Models::UnreadCountsChannel

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/getstream_ruby/generated/models/unread_counts_channel.rb

Overview

The unread information of a channel.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#==, #inspect, omit_empty_fields, #to_h, #to_json

Constructor Details

#initialize(attributes = {}) ⇒ UnreadCountsChannel

Initialize with attributes



29
30
31
32
33
34
35
36
# File 'lib/getstream_ruby/generated/models/unread_counts_channel.rb', line 29

def initialize(attributes = {})
  super(attributes)
  @channel_id = attributes.fetch(:channel_id) { attributes.fetch('channel_id', nil) }
  @has_unread = attributes.fetch(:has_unread) { attributes.fetch('has_unread', nil) }
  @last_read = attributes.fetch(:last_read) { attributes.fetch('last_read', nil) }
  @unread_count = attributes.fetch(:unread_count) { attributes.fetch('unread_count', nil) }
  @soft_unread = attributes.fetch(:soft_unread) { attributes.fetch('soft_unread', nil) }
end

Instance Attribute Details

#channel_id ⇒ String

Returns The channel CID (type:id).

Returns:

  • (String) —

    The channel CID (type:id).



14
15
16
# File 'lib/getstream_ruby/generated/models/unread_counts_channel.rb', line 14

def channel_id
  @channel_id
end

#has_unread ⇒ Boolean

Returns Whether the channel counts as unread for the user: it has messages newer than the user's last read, or the user marked it unread without a message (soft_unread). It is true for soft-unread channels even though unread_count is 0. Large channels have no unread_count and only report this.

Returns:

  • (Boolean) —

    Whether the channel counts as unread for the user: it has messages newer than the user's last read, or the user marked it unread without a message (soft_unread). It is true for soft-unread channels even though unread_count is 0. Large channels have no unread_count and only report this.



17
18
19
# File 'lib/getstream_ruby/generated/models/unread_counts_channel.rb', line 17

def has_unread
  @has_unread
end

#last_read ⇒ DateTime

Returns The date which the current user last read the channel.

Returns:

  • (DateTime) —

    The date which the current user last read the channel.



20
21
22
# File 'lib/getstream_ruby/generated/models/unread_counts_channel.rb', line 20

def last_read
  @last_read
end

#soft_unread ⇒ Boolean

Returns True when the user marked the channel unread without a message. unread_count stays 0, and the channel adds 1 to total_unread_count; clients should key off has_unread and this field rather than unread_count > 0.

Returns:

  • (Boolean) —

    True when the user marked the channel unread without a message. unread_count stays 0, and the channel adds 1 to total_unread_count; clients should key off has_unread and this field rather than unread_count > 0.



26
27
28
# File 'lib/getstream_ruby/generated/models/unread_counts_channel.rb', line 26

def soft_unread
  @soft_unread
end

#unread_count ⇒ Integer

Returns The number of unread messages inside the channel.

Returns:

  • (Integer) —

    The number of unread messages inside the channel.



23
24
25
# File 'lib/getstream_ruby/generated/models/unread_counts_channel.rb', line 23

def unread_count
  @unread_count
end

Class Method Details

.json_field_mappings ⇒ Object

Override field mappings for JSON serialization



39
40
41
42
43
44
45
46
47
# File 'lib/getstream_ruby/generated/models/unread_counts_channel.rb', line 39

def self.json_field_mappings
  {
    channel_id: 'channel_id',
    has_unread: 'has_unread',
    last_read: 'last_read',
    unread_count: 'unread_count',
    soft_unread: 'soft_unread'
  }
end