Class: Sendbird::MessageApi

Inherits:
Object
  • Object
show all
Extended by:
Client
Defined in:
lib/sendbird/message_api.rb

Constant Summary

Constants included from Client

Client::PUBLIC_METHODS

Class Method Summary collapse

Methods included from Client

build_url

Class Method Details

.build_url(*args) ⇒ Object



37
38
39
40
# File 'lib/sendbird/message_api.rb', line 37

def self.build_url(*args)
  args_dup = args.dup
  args_dup.join('/')
end

.count(channel_type, channel_url) ⇒ Object



28
29
30
# File 'lib/sendbird/message_api.rb', line 28

def count(channel_type, channel_url)
  get(path: build_url(channel_type, channel_url, 'messages', 'total_count'))
end

.destroy(channel_type, channel_url, message_id) ⇒ Object



20
21
22
# File 'lib/sendbird/message_api.rb', line 20

def destroy(channel_type, channel_url, message_id)
  delete(path: build_url(channel_type, channel_url, 'messages', message_id))
end

.list(channel_type, channel_url, params) ⇒ Object

Get messages function can be called only

from Park or Enterprise plan.


12
13
14
# File 'lib/sendbird/message_api.rb', line 12

def list(channel_type, channel_url, params)
  get(path: build_url(channel_type, channel_url, 'messages'), params: params)
end

.mark_as_read(channel_type, channel_url, body) ⇒ Object



24
25
26
# File 'lib/sendbird/message_api.rb', line 24

def mark_as_read(channel_type, channel_url, body)
  put(path: build_url(channel_type, channel_url, 'messages', 'mark_as_read'), body: body)
end

.send(channel_type, channel_url, body) ⇒ Object



6
7
8
# File 'lib/sendbird/message_api.rb', line 6

def send(channel_type, channel_url, body)
  post(path: build_url(channel_type, channel_url, 'messages'), body: body)
end

.unread_count(channel_type, channel_url, params) ⇒ Object



32
33
34
# File 'lib/sendbird/message_api.rb', line 32

def unread_count(channel_type, channel_url, params)
  get(path: build_url(channel_type, channel_url, 'messages', 'unread_count'), params: params)
end

.view(channel_type, channel_url, message_id) ⇒ Object



16
17
18
# File 'lib/sendbird/message_api.rb', line 16

def view(channel_type, channel_url, message_id)
  get(path: build_url(channel_type, channel_url, 'messages', message_id))
end