Current section
Files
Jump to
Current section
Files
lib/rasa_sdk/api/default.ex
# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
# https://openapi-generator.tech
# Do not edit the class manually.
defmodule RasaSDK.Api.Default do
@moduledoc """
API calls for all endpoints tagged `Default`.
"""
alias RasaSDK.Connection
import RasaSDK.RequestBuilder
@doc """
Core request to execute a custom action
Rasa Core sends a request to the action server to execute a certain custom action. As a response to the action call from Core, you can modify the tracker, e.g. by setting slots and send responses back to the user.
## Parameters
- connection (RasaSDK.Connection): Connection to server
- request (Request): Describes the action to be called and provides information on the current state of the conversation.
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, %RasaSDK.Model.ResponseOk{}} on success
{:error, info} on failure
"""
@spec call_action(Tesla.Env.client(), RasaSDK.Model.Request.t(), keyword()) ::
{:ok, RasaSDK.Model.ResponseOk.t()} | {:error, Tesla.Env.t()}
def call_action(connection, request, _opts \\ []) do
%{}
|> method(:post)
|> url("/")
|> add_param(:body, :body, request)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> evaluate_response([
{200, %RasaSDK.Model.ResponseOk{}},
{400, %RasaSDK.Model.ResponseRejected{}},
{500, false}
])
end
end