Documentation
¶
Overview ¶
pb package implements pandorabots API as seen in https://developer.pandorabots.com/docs
Index ¶
- Constants
- Variables
- func SetErrorLog(logger *log.Logger) func(*Client) error
- func SetTraceLog(logger *log.Logger) func(*Client) error
- type BotEntry
- type BotFile
- type BotFiles
- type Client
- func (c *Client) CreateBot(name string) error
- func (c *Client) DeleteBot(name string) error
- func (c *Client) DeleteFile(name, filename string) error
- func (c *Client) DownloadFiles(name string, zip io.Writer) error
- func (c *Client) DownloadFilesToPath(name, path string) error
- func (c *Client) GetFile(name, filename string, out io.Writer) error
- func (c *Client) GetFileToPath(name, path string) error
- func (c *Client) List() ([]BotEntry, error)
- func (c *Client) ListFiles(name string) (BotFiles, error)
- func (c *Client) Talk(name, input, clientName string, sessionId int, recent bool) (*Reply, error)
- func (c *Client) TalkDebug(name, input, clientName string, sessionId int, recent bool, that, topic string, ...) (*Reply, error)
- func (c *Client) UploadFile(name, filename string, data io.Reader) error
- func (c *Client) UploadFileFromPath(name, path string) error
- func (c *Client) Verify(name string) error
- type OptionFunc
- type Reply
Constants ¶
const (
DefaultURL = "https://aiaas.pandorabots.com"
)
Variables ¶
var ( // The error raised when credentials are not provided ErrNoCred = errors.New("Missing application ID or user key") )
Functions ¶
func SetErrorLog ¶
SetErrorLog sets the logger for critical messages. It is nil by default.
Types ¶
type BotFiles ¶
type BotFiles struct { Username string `json:"username"` Appname string `json:"appname"` Botname string `json:"botname"` Description string `json:"description"` Language string `json:"language"` Created time.Time `json:"created"` Open string `json:"open"` Files []BotFile `json:"files"` Sets []BotFile `json:"sets"` Maps []BotFile `json:"maps"` Substitutions []BotFile `json:"substitutions"` Properties []BotFile `json:"properties"` Pdefaults []BotFile `json:"pdefaults"` }
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client interacts with the services provided by pandorabots.
func New ¶
func New(options ...OptionFunc) (*Client, error)
New creates a new pandorabots client.
The caller can configure the new client by passing configuration options to the func.
Example:
client, err := pb.New( pb.SetErrorLog(log.New(os.Stderr, "PB: ", log.Lshortfile), pb.SetCredentials(appId, userKey))
If no URL is configured, Client uses DefaultURL by default.
If no HttpClient is configured, then http.DefaultClient is used. You can use your own http.Client with some http.Transport for advanced scenarios.
An error is also returned when some configuration option is invalid.
func (*Client) CreateBot ¶
See https://developer.pandorabots.com/docs#!/pandorabots_api_swagger_1_2_beta/createBot
func (*Client) DeleteBot ¶
See https://developer.pandorabots.com/docs#!/pandorabots_api_swagger_1_2_beta/deleteBot
func (*Client) DeleteFile ¶
See https://developer.pandorabots.com/docs#!/pandorabots_api_swagger_1_2_beta/deleteBotFile1 See https://developer.pandorabots.com/docs#!/pandorabots_api_swagger_1_2_beta/deleteBotFile2
func (*Client) DownloadFiles ¶
See https://developer.pandorabots.com/docs#!/pandorabots_api_swagger_1_2_beta/listBotFiles
func (*Client) DownloadFilesToPath ¶
See https://developer.pandorabots.com/docs#!/pandorabots_api_swagger_1_2_beta/listBotFiles
func (*Client) GetFile ¶
See https://developer.pandorabots.com/docs#!/pandorabots_api_swagger_1_2_beta/getBotFile1 See https://developer.pandorabots.com/docs#!/pandorabots_api_swagger_1_2_beta/getBotFile2
func (*Client) GetFileToPath ¶
See https://developer.pandorabots.com/docs#!/pandorabots_api_swagger_1_2_beta/getBotFile1 See https://developer.pandorabots.com/docs#!/pandorabots_api_swagger_1_2_beta/getBotFile2
func (*Client) List ¶
See https://developer.pandorabots.com/docs#!/pandorabots_api_swagger_1_2_beta/listBots
func (*Client) ListFiles ¶
See https://developer.pandorabots.com/docs#!/pandorabots_api_swagger_1_2_beta/listBotFiles
func (*Client) Talk ¶
See https://developer.pandorabots.com/docs#!/pandorabots_api_swagger_1_2_beta/talkBot
func (*Client) TalkDebug ¶
func (c *Client) TalkDebug(name, input, clientName string, sessionId int, recent bool, that, topic string, extra, reset, trace, reload bool) (*Reply, error)
See https://developer.pandorabots.com/docs#!/pandorabots_api_swagger_1_2_beta/debugBot
func (*Client) UploadFile ¶
See https://developer.pandorabots.com/docs#!/pandorabots_api_swagger_1_2_beta/uploadFile1 See https://developer.pandorabots.com/docs#!/pandorabots_api_swagger_1_2_beta/uploadFile2
type OptionFunc ¶
OptionFunc is a function that configures a Client. It is used in New
func SetCredentials ¶
func SetCredentials(appId, userKey string) OptionFunc
SetCredentials sets the app id and user key to use with pandorabots
func SetHttpClient ¶
func SetHttpClient(httpClient *http.Client) OptionFunc
SetHttpClient can be used to specify the http.Client to use when making HTTP requests to pandorabots.