dblock/slack-ruby-client

View on GitHub
bin/commands/bookmarks.rb

Summary

Maintainability
A
1 hr
Test Coverage
# frozen_string_literal: true
# This file was auto-generated by lib/tasks/web.rake

module Slack
  module Cli
    class App
      desc 'Bookmarks methods.'
      command 'bookmarks' do |g|
        g.desc 'Add bookmark to a channel.'
        g.long_desc %( Add bookmark to a channel. )
        g.command 'add' do |c|
          c.flag 'channel_id', desc: 'Channel to add bookmark in.'
          c.flag 'title', desc: 'Title for the bookmark.'
          c.flag 'type', desc: 'Type of the bookmark i.e link.'
          c.flag 'emoji', desc: 'Emoji tag to apply to the link.'
          c.flag 'entity_id', desc: 'ID of the entity being bookmarked. Only applies to message and file types.'
          c.flag 'link', desc: 'Link to bookmark.'
          c.flag 'parent_id', desc: "Id of this bookmark's parent."
          c.action do |_global_options, options, _args|
            puts JSON.dump(@client.bookmarks_add(options))
          end
        end

        g.desc 'Edit bookmark.'
        g.long_desc %( Edit bookmark. )
        g.command 'edit' do |c|
          c.flag 'bookmark_id', desc: 'Bookmark to update.'
          c.flag 'channel_id', desc: 'Channel to update bookmark in.'
          c.flag 'emoji', desc: 'Emoji tag to apply to the link.'
          c.flag 'link', desc: 'Link to bookmark.'
          c.flag 'title', desc: 'Title for the bookmark.'
          c.action do |_global_options, options, _args|
            puts JSON.dump(@client.bookmarks_edit(options))
          end
        end

        g.desc 'List bookmark for the channel.'
        g.long_desc %( List bookmark for the channel. )
        g.command 'list' do |c|
          c.flag 'channel_id', desc: 'Channel to list bookmarks in.'
          c.action do |_global_options, options, _args|
            puts JSON.dump(@client.bookmarks_list(options))
          end
        end

        g.desc 'Remove bookmark from the channel.'
        g.long_desc %( Remove bookmark from the channel. )
        g.command 'remove' do |c|
          c.flag 'bookmark_id', desc: 'Bookmark to remove.'
          c.flag 'channel_id', desc: 'Channel to remove bookmark.'
          c.flag 'quip_section_id', desc: 'Quip section ID to unbookmark.'
          c.action do |_global_options, options, _args|
            puts JSON.dump(@client.bookmarks_remove(options))
          end
        end
      end
    end
  end
end