Module: Mattermost::Endpoint::Channels
- Included in:
- Mattermost::Endpoint
- Defined in:
- lib/mattermost/endpoint/channels.rb
Instance Method Summary collapse
- #add_user_to_channel(channel_id, user_id) ⇒ Object
- #create_channel(channel = {}) ⇒ Object
- #create_direct_channel(user_id_1, user_id_2) ⇒ Object
- #create_group_message(user_ids = []) ⇒ Object
- #delete_channel(channel_id) ⇒ Object
- #get_channel(channel_id) ⇒ Object
- #get_channel_by_name(team_id, channel_name) ⇒ Object
- #get_channel_by_name_and_team_name(team_name, channel_name) ⇒ Object
- #get_channel_list_by_ids(team_id, channel_ids = []) ⇒ Object
- #get_channel_member(channel_id, user_id) ⇒ Object
- #get_channel_members(channel_id, max = 60) ⇒ Object
- #get_channel_members_by_ids(channel_id, user_ids = []) ⇒ Object
- #get_channel_members_for_user(user_id, team_id) ⇒ Object
- #get_channel_stats(channel_id) ⇒ Object
- #get_channels_for_user(user_id, team_id) ⇒ Object
- #get_deleted_channels(team_id, max = 60) ⇒ Object
- #get_pinned_posts(channel_id) ⇒ Object
- #get_public_channels(team_id, max = 60) ⇒ Object
- #get_unread_messages(user_id, channel_id) ⇒ Object
- #patch_channel(channel_id, patch = {}) ⇒ Object
- #remove_user_from_channel(channel_id, user_id) ⇒ Object
- #restore_channel(channel_id) ⇒ Object
- #search_channels(team_id, term) ⇒ Object
- #update_channel(channel_id, channel = {}) ⇒ Object
- #update_channel_notifications(channel_id, user_id, notify_props = {}) ⇒ Object
- #update_channel_roles(channel_id, user_id, roles) ⇒ Object
- #view_channel(user_id, channel_id, prev_channel_id) ⇒ Object
Instance Method Details
#add_user_to_channel(channel_id, user_id) ⇒ Object
74 75 76 |
# File 'lib/mattermost/endpoint/channels.rb', line 74 def add_user_to_channel(channel_id, user_id) post("/channels/#{channel_id}/members", :body => {:user_id => user_id}.to_json) end |
#create_channel(channel = {}) ⇒ Object
6 7 8 |
# File 'lib/mattermost/endpoint/channels.rb', line 6 def create_channel(channel = {}) post("/channels", :body => channel.to_json) end |
#create_direct_channel(user_id_1, user_id_2) ⇒ Object
10 11 12 |
# File 'lib/mattermost/endpoint/channels.rb', line 10 def create_direct_channel(user_id_1, user_id_2) post("/channels/direct", :body => JSON.generate([user_id_1, user_id_2])) end |
#create_group_message(user_ids = []) ⇒ Object
14 15 16 |
# File 'lib/mattermost/endpoint/channels.rb', line 14 def (user_ids = []) post("/channels/group", :body => JSON.generate(user_ids)) end |
#delete_channel(channel_id) ⇒ Object
30 31 32 |
# File 'lib/mattermost/endpoint/channels.rb', line 30 def delete_channel(channel_id) delete("/channels/#{channel_id}") end |
#get_channel(channel_id) ⇒ Object
22 23 24 |
# File 'lib/mattermost/endpoint/channels.rb', line 22 def get_channel(channel_id) get("/channels/#{channel_id}") end |
#get_channel_by_name(team_id, channel_name) ⇒ Object
62 63 64 |
# File 'lib/mattermost/endpoint/channels.rb', line 62 def get_channel_by_name(team_id, channel_name) get("/teams/#{team_id}/channels/name/#{channel_name}") end |
#get_channel_by_name_and_team_name(team_name, channel_name) ⇒ Object
66 67 68 |
# File 'lib/mattermost/endpoint/channels.rb', line 66 def get_channel_by_name_and_team_name(team_name, channel_name) get("/teams/name/#{team_name}/channels/name/#{channel_name}") end |
#get_channel_list_by_ids(team_id, channel_ids = []) ⇒ Object
18 19 20 |
# File 'lib/mattermost/endpoint/channels.rb', line 18 def get_channel_list_by_ids(team_id, channel_ids = []) post("/teams/#{team_id}/channels/ids", :body => JSON.generate(channel_ids)) end |
#get_channel_member(channel_id, user_id) ⇒ Object
82 83 84 |
# File 'lib/mattermost/endpoint/channels.rb', line 82 def get_channel_member(channel_id, user_id) get("/channels/#{channel_id}/members/#{user_id}") end |
#get_channel_members(channel_id, max = 60) ⇒ Object
70 71 72 |
# File 'lib/mattermost/endpoint/channels.rb', line 70 def get_channel_members(channel_id, max = 60) get("/channels/#{channel_id}/members?per_page=#{max}") end |
#get_channel_members_by_ids(channel_id, user_ids = []) ⇒ Object
78 79 80 |
# File 'lib/mattermost/endpoint/channels.rb', line 78 def get_channel_members_by_ids(channel_id, user_ids = []) post("/channels/#{channel_id}/members/ids", :body => JSON.generate(user_ids)) end |
#get_channel_members_for_user(user_id, team_id) ⇒ Object
105 106 107 |
# File 'lib/mattermost/endpoint/channels.rb', line 105 def get_channel_members_for_user(user_id, team_id) get("/users/#{user_id}/teams/#{team_id}/channels/members") end |
#get_channel_stats(channel_id) ⇒ Object
42 43 44 |
# File 'lib/mattermost/endpoint/channels.rb', line 42 def get_channel_stats(channel_id) get("/channels/#{channel_id}/stats") end |
#get_channels_for_user(user_id, team_id) ⇒ Object
109 110 111 |
# File 'lib/mattermost/endpoint/channels.rb', line 109 def get_channels_for_user(user_id, team_id) get("/users/#{user_id}/teams/#{team_id}/channels") end |
#get_deleted_channels(team_id, max = 60) ⇒ Object
54 55 56 |
# File 'lib/mattermost/endpoint/channels.rb', line 54 def get_deleted_channels(team_id, max = 60) get("/teams/#{team_id}/channels/deleted?per_page=#{max}") end |
#get_pinned_posts(channel_id) ⇒ Object
46 47 48 |
# File 'lib/mattermost/endpoint/channels.rb', line 46 def get_pinned_posts(channel_id) get("/channels/#{channel_id}/pinned") end |
#get_public_channels(team_id, max = 60) ⇒ Object
50 51 52 |
# File 'lib/mattermost/endpoint/channels.rb', line 50 def get_public_channels(team_id, max = 60) get("/teams/#{team_id}/channels?per_page=#{max}") end |
#get_unread_messages(user_id, channel_id) ⇒ Object
113 114 115 |
# File 'lib/mattermost/endpoint/channels.rb', line 113 def (user_id, channel_id) get("/users/#{user_id}/channels/#{channel_id}/unread") end |
#patch_channel(channel_id, patch = {}) ⇒ Object
34 35 36 |
# File 'lib/mattermost/endpoint/channels.rb', line 34 def patch_channel(channel_id, patch = {}) put("/channels/#{channel_id}/patch", patch.to_json) end |
#remove_user_from_channel(channel_id, user_id) ⇒ Object
86 87 88 |
# File 'lib/mattermost/endpoint/channels.rb', line 86 def remove_user_from_channel(channel_id, user_id) delete("/channels/#{channel_id}/members/#{user_id}") end |
#restore_channel(channel_id) ⇒ Object
38 39 40 |
# File 'lib/mattermost/endpoint/channels.rb', line 38 def restore_channel(channel_id) post("/channels/#{channel_id}/restore") end |
#search_channels(team_id, term) ⇒ Object
58 59 60 |
# File 'lib/mattermost/endpoint/channels.rb', line 58 def search_channels(team_id, term) post("/teams/#{team_id}/channels/search", :body => {:term => term}.to_json) end |
#update_channel(channel_id, channel = {}) ⇒ Object
26 27 28 |
# File 'lib/mattermost/endpoint/channels.rb', line 26 def update_channel(channel_id, channel = {}) put("/channels/#{channel_id}", channel.to_json) end |
#update_channel_notifications(channel_id, user_id, notify_props = {}) ⇒ Object
94 95 96 |
# File 'lib/mattermost/endpoint/channels.rb', line 94 def update_channel_notifications(channel_id, user_id, notify_props = {}) put("/channels/#{channel_id}/members/#{user_id}/notify_props", notify_props.to_json) end |
#update_channel_roles(channel_id, user_id, roles) ⇒ Object
90 91 92 |
# File 'lib/mattermost/endpoint/channels.rb', line 90 def update_channel_roles(channel_id, user_id, roles) put("/channels/#{channel_id}/members/#{user_id}/roles", :body => {:roles => roles}.to_json) end |
#view_channel(user_id, channel_id, prev_channel_id) ⇒ Object
98 99 100 101 102 103 |
# File 'lib/mattermost/endpoint/channels.rb', line 98 def view_channel(user_id, channel_id, prev_channel_id) post("/channels/members/#{user_id}/view", :body => { :channel_id => channel_id, :prev_channel_id => prev_channel_id }.to_json) end |