slack-ruby/slack-ruby-client

View on GitHub
lib/slack/web/api/endpoints/apps_datastore.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 Web
    module Api
      module Endpoints
        module AppsDatastore
          #
          # Delete items from a datastore in bulk
          #
          # @option options [string] :datastore
          #   name of the datastore.
          # @option options [array] :ids
          #   IDs of items to be deleted.
          # @option options [Object] :app_id
          #   .
          # @see https://api.slack.com/methods/apps.datastore.bulkDelete
          # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/apps.datastore/apps.datastore.bulkDelete.json
          def apps_datastore_bulkDelete(options = {})
            raise ArgumentError, 'Required arguments :datastore missing' if options[:datastore].nil?
            raise ArgumentError, 'Required arguments :ids missing' if options[:ids].nil?
            post('apps.datastore.bulkDelete', options)
          end

          #
          # Get items from a datastore in bulk
          #
          # @option options [string] :datastore
          #   name of the datastore.
          # @option options [array] :ids
          #   items' ids.
          # @option options [Object] :app_id
          #   .
          # @see https://api.slack.com/methods/apps.datastore.bulkGet
          # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/apps.datastore/apps.datastore.bulkGet.json
          def apps_datastore_bulkGet(options = {})
            raise ArgumentError, 'Required arguments :datastore missing' if options[:datastore].nil?
            raise ArgumentError, 'Required arguments :ids missing' if options[:ids].nil?
            post('apps.datastore.bulkGet', options)
          end

          #
          # Creates or replaces existing items in bulk
          #
          # @option options [string] :datastore
          #   name of the datastore.
          # @option options [array] :items
          #   attribute names and values of the items; limit of 25.
          # @option options [Object] :app_id
          #   .
          # @see https://api.slack.com/methods/apps.datastore.bulkPut
          # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/apps.datastore/apps.datastore.bulkPut.json
          def apps_datastore_bulkPut(options = {})
            raise ArgumentError, 'Required arguments :datastore missing' if options[:datastore].nil?
            raise ArgumentError, 'Required arguments :items missing' if options[:items].nil?
            post('apps.datastore.bulkPut', options)
          end

          #
          # Count the number of items in a datastore that match a query
          #
          # @option options [string] :datastore
          #   Name of the datastore.
          # @option options [Object] :app_id
          #   Required if calling with user token.
          # @option options [string] :expression
          #   A query filter expression https://api.slack.com/future/datastores.
          # @option options [object] :expression_attributes
          #   A map of attributes referenced in expression.
          # @option options [object] :expression_values
          #   A map of values referenced in expression.
          # @see https://api.slack.com/methods/apps.datastore.count
          # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/apps.datastore/apps.datastore.count.json
          def apps_datastore_count(options = {})
            raise ArgumentError, 'Required arguments :datastore missing' if options[:datastore].nil?
            post('apps.datastore.count', options)
          end

          #
          # Delete an item from a datastore
          #
          # @option options [string] :datastore
          #   name of the datastore.
          # @option options [string] :id
          #   item id.
          # @option options [Object] :app_id
          #   .
          # @see https://api.slack.com/methods/apps.datastore.delete
          # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/apps.datastore/apps.datastore.delete.json
          def apps_datastore_delete(options = {})
            raise ArgumentError, 'Required arguments :datastore missing' if options[:datastore].nil?
            raise ArgumentError, 'Required arguments :id missing' if options[:id].nil?
            post('apps.datastore.delete', options)
          end

          #
          # Get an item from a datastore
          #
          # @option options [string] :datastore
          #   name of the datastore.
          # @option options [string] :id
          #   item id.
          # @option options [Object] :app_id
          #   .
          # @see https://api.slack.com/methods/apps.datastore.get
          # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/apps.datastore/apps.datastore.get.json
          def apps_datastore_get(options = {})
            raise ArgumentError, 'Required arguments :datastore missing' if options[:datastore].nil?
            raise ArgumentError, 'Required arguments :id missing' if options[:id].nil?
            post('apps.datastore.get', options)
          end

          #
          # Creates a new item, or replaces an old item with a new item.
          #
          # @option options [string] :datastore
          #   name of the datastore.
          # @option options [object] :item
          #   attribute names and values of the item.
          # @option options [Object] :app_id
          #   .
          # @see https://api.slack.com/methods/apps.datastore.put
          # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/apps.datastore/apps.datastore.put.json
          def apps_datastore_put(options = {})
            raise ArgumentError, 'Required arguments :datastore missing' if options[:datastore].nil?
            raise ArgumentError, 'Required arguments :item missing' if options[:item].nil?
            post('apps.datastore.put', options)
          end

          #
          # Query a datastore for items
          #
          # @option options [string] :datastore
          #   Name of the datastore.
          # @option options [Object] :app_id
          #   Required if calling with user token.
          # @option options [string] :cursor
          #   Set cursor to next_cursor returned by the previous call to list items in the next page.
          # @option options [string] :expression
          #   A query filter expression https://api.slack.com/future/datastores.
          # @option options [object] :expression_attributes
          #   A map of attributes referenced in expression.
          # @option options [object] :expression_values
          #   A map of values referenced in expression.
          # @option options [integer] :limit
          #   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.
          # @see https://api.slack.com/methods/apps.datastore.query
          # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/apps.datastore/apps.datastore.query.json
          def apps_datastore_query(options = {})
            raise ArgumentError, 'Required arguments :datastore missing' if options[:datastore].nil?
            if block_given?
              Pagination::Cursor.new(self, :apps_datastore_query, options).each do |page|
                yield page
              end
            else
              post('apps.datastore.query', options)
            end
          end

          #
          # Edits an existing item's attributes, or adds a new item if it does not already exist.
          #
          # @option options [string] :datastore
          #   name of the datastore.
          # @option options [object] :item
          #   attribute names and values to be updated.
          # @option options [Object] :app_id
          #   .
          # @see https://api.slack.com/methods/apps.datastore.update
          # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/apps.datastore/apps.datastore.update.json
          def apps_datastore_update(options = {})
            raise ArgumentError, 'Required arguments :datastore missing' if options[:datastore].nil?
            raise ArgumentError, 'Required arguments :item missing' if options[:item].nil?
            post('apps.datastore.update', options)
          end
        end
      end
    end
  end
end