class Slack::API::Channels

Public Instance Methods

all(exclude_archived=false, page: nil) click to toggle source
# File lib/laziness/api/channels.rb, line 4
def all(exclude_archived=false, page: nil)
  responses = with_paging(page) do |pager|
    request :get,
            'channels.list',
            exclude_archived: exclude_archived ? 1 : 0,
            **pager.to_h
  end

  Slack::Channel.parse_all responses, 'channels'
end
archive(id) click to toggle source
# File lib/laziness/api/channels.rb, line 15
def archive(id)
  with_nil_response { request :post, 'channels.archive', channel: id }
end
create(name) click to toggle source
# File lib/laziness/api/channels.rb, line 19
def create(name)
  response = request :post, 'channels.create', name: name
  Slack::Channel.parse response, 'channel'
end
find(id) click to toggle source
# File lib/laziness/api/channels.rb, line 24
def find(id)
  response = request :get, 'channels.info', channel: id
  Slack::Channel.parse response, 'channel'
end
unarchive(id) click to toggle source
# File lib/laziness/api/channels.rb, line 29
def unarchive(id)
  with_nil_response { request :post, 'channels.unarchive', channel: id }
end