slack-ruby/slack-ruby-client

View on GitHub
lib/slack/web/api/endpoints/functions.rb

Summary

Maintainability
A
20 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 Functions
          #
          # Signal that a function failed to complete
          #
          # @option options [string] :error
          #   A human-readable error message that contains information about why the function failed to complete.
          # @option options [string] :function_execution_id
          #   Context identifier that maps to the executed function.
          # @see https://api.slack.com/methods/functions.completeError
          # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/functions/functions.completeError.json
          def functions_completeError(options = {})
            raise ArgumentError, 'Required arguments :error missing' if options[:error].nil?
            raise ArgumentError, 'Required arguments :function_execution_id missing' if options[:function_execution_id].nil?
            post('functions.completeError', options)
          end

          #
          # Signal the successful completion of a function
          #
          # @option options [string] :function_execution_id
          #   Context identifier that maps to the executed function.
          # @option options [object] :outputs
          #   A JSON-based object that conforms to the output parameters schema for the custom function defined in the manifest.
          # @see https://api.slack.com/methods/functions.completeSuccess
          # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/functions/functions.completeSuccess.json
          def functions_completeSuccess(options = {})
            raise ArgumentError, 'Required arguments :function_execution_id missing' if options[:function_execution_id].nil?
            raise ArgumentError, 'Required arguments :outputs missing' if options[:outputs].nil?
            options = encode_options_as_json(options, %i[outputs])
            post('functions.completeSuccess', options)
          end
        end
      end
    end
  end
end