dblock/slack-ruby-client

View on GitHub
bin/commands/apps_datastore.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 'AppsDatastore methods.'
      command 'apps_datastore' do |g|
        g.desc 'Delete an item from a datastore'
        g.long_desc %( Delete an item from a datastore )
        g.command 'delete' do |c|
          c.flag 'datastore', desc: 'name of the datastore.'
          c.flag 'id', desc: 'item id.'
          c.flag 'app_id', desc: '.'
          c.action do |_global_options, options, _args|
            puts JSON.dump(@client.apps_datastore_delete(options))
          end
        end

        g.desc 'Get an item from a datastore'
        g.long_desc %( Get an item from a datastore )
        g.command 'get' do |c|
          c.flag 'datastore', desc: 'name of the datastore.'
          c.flag 'id', desc: 'item id.'
          c.flag 'app_id', desc: '.'
          c.action do |_global_options, options, _args|
            puts JSON.dump(@client.apps_datastore_get(options))
          end
        end

        g.desc 'Creates a new item, or replaces an old item with a new item.'
        g.long_desc %( Creates a new item, or replaces an old item with a new item. )
        g.command 'put' do |c|
          c.flag 'datastore', desc: 'name of the datastore.'
          c.flag 'item', desc: 'attribute names and values of the item.'
          c.flag 'app_id', desc: '.'
          c.action do |_global_options, options, _args|
            puts JSON.dump(@client.apps_datastore_put(options))
          end
        end

        g.desc 'Query a datastore for items'
        g.long_desc %( Query a datastore for items )
        g.command 'query' do |c|
          c.flag 'datastore', desc: 'Name of the datastore.'
          c.flag 'app_id', desc: 'Required if calling with user token.'
          c.flag 'cursor', desc: 'Set cursor to next_cursor returned by the previous call to list items in the next page.'
          c.flag 'expression', desc: 'A query filter expression https://api.slack.com/future/datastores.'
          c.flag 'expression_attributes', desc: 'A map of attributes referenced in expression.'
          c.flag 'expression_values', desc: 'A map of values referenced in expression.'
          c.flag 'limit', desc: 'The maximum number of items to evaluate for a given request (not necessarily the number of matching items). If the given request dataset size exceeds 1 MB before reaching the limit, the returned item count will likely be less than the limit. In any case where there are more items available beyond an imposed limit, a next_cursor value will be provided for use in subsequent requests.'
          c.action do |_global_options, options, _args|
            puts JSON.dump(@client.apps_datastore_query(options))
          end
        end

        g.desc "Edits an existing item's attributes, or adds a new item if it does not already exist."
        g.long_desc %( Edits an existing item's attributes, or adds a new item if it does not already exist. )
        g.command 'update' do |c|
          c.flag 'datastore', desc: 'name of the datastore.'
          c.flag 'item', desc: 'attribute names and values to be updated.'
          c.flag 'app_id', desc: '.'
          c.action do |_global_options, options, _args|
            puts JSON.dump(@client.apps_datastore_update(options))
          end
        end
      end
    end
  end
end