dblock/slack-ruby-client

View on GitHub
bin/commands/views.rb

Summary

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

module Slack
  module Cli
    class App
      desc 'Views methods.'
      command 'views' do |g|
        g.desc 'Open a view for a user.'
        g.long_desc %( Open a view for a user. )
        g.command 'open' do |c|
          c.flag 'view', desc: 'A view payload. This must be a JSON-encoded string.'
          c.flag 'trigger_id', desc: 'Exchange a trigger to post to the user.'
          c.flag 'interactivity_pointer', desc: 'Exchange an interactivity pointer to post to the user.'
          c.action do |_global_options, options, _args|
            puts JSON.dump(@client.views_open(options))
          end
        end

        g.desc 'Publish a static view for a User.'
        g.long_desc %( Publish a static view for a User. )
        g.command 'publish' do |c|
          c.flag 'user_id', desc: 'id of the user you want publish a view to.'
          c.flag 'view', desc: 'A view payload. This must be a JSON-encoded string.'
          c.flag 'hash', desc: 'A string that represents view state to protect against possible race conditions.'
          c.action do |_global_options, options, _args|
            puts JSON.dump(@client.views_publish(options))
          end
        end

        g.desc 'Push a view onto the stack of a root view.'
        g.long_desc %( Push a view onto the stack of a root view. )
        g.command 'push' do |c|
          c.flag 'view', desc: 'A view payload. This must be a JSON-encoded string.'
          c.flag 'trigger_id', desc: 'Exchange a trigger to post to the user.'
          c.flag 'interactivity_pointer', desc: 'Exchange an interactivity pointer to post to the user.'
          c.action do |_global_options, options, _args|
            puts JSON.dump(@client.views_push(options))
          end
        end

        g.desc 'Update an existing view.'
        g.long_desc %( Update an existing view. )
        g.command 'update' do |c|
          c.flag 'view', desc: 'A view object. This must be a JSON-encoded string.'
          c.flag 'external_id', desc: 'A unique identifier of the view set by the developer. Must be unique for all views on a team. Max length of 255 characters. Either view_id or external_id is required.'
          c.flag 'view_id', desc: 'A unique identifier of the view to be updated. Either view_id or external_id is required.'
          c.flag 'hash', desc: 'A string that represents view state to protect against possible race conditions.'
          c.action do |_global_options, options, _args|
            puts JSON.dump(@client.views_update(options))
          end
        end
      end
    end
  end
end