dialogflow

package module
v0.0.0-...-c32f04a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 8, 2018 License: Apache-2.0 Imports: 8 Imported by: 5

README

dialogflow-go-client

CircleCI License Go Report Card

This library allows integrating agents from the DialogFlow natural language processing service with your Golang application.

Prerequsites

Create an DialogFlow account.

Installation

go get github.com/mlabouardy/dialogflow-go-client

Features

  • Queries
  • Contexts
  • Intents
  • UserIntents
  • Entities

Usage

  • Create main.go file with the following code:
package main

import (
	"fmt"
	. "github.com/mlabouardy/dialogflow-go-client"
	. "github.com/mlabouardy/dialogflow-go-client/models"
	"log"
)

func main() {
	err, client := NewDialogFlowClient(Options{
		AccessToken: "<API.AI TOKEN GOES HERE>",
	})
	if err != nil {
		log.Fatal(err)
	}

	entities, err := client.EntitiesFindAllRequest()
	if err != nil {
		log.Fatal(err)
	}
	for _, entity := range entities {
		fmt.Println(entity.Name)
	}
}
  • Run following command.
go run main.go
  • Your can find more examples in examples directory.

Tutorials

Documentation

Documentation is available at https://dialogflow.com/docs.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DialogFlowClient

type DialogFlowClient struct {
	// contains filtered or unexported fields
}

func NewDialogFlowClient

func NewDialogFlowClient(options Options) (error, *DialogFlowClient)

Create API.AI instance

func (*DialogFlowClient) ContextsCreateRequest

func (client *DialogFlowClient) ContextsCreateRequest(contexts []Context) (QueryResponse, error)

Adds new active contexts to the specified session

func (*DialogFlowClient) ContextsDeleteByNameRequest

func (client *DialogFlowClient) ContextsDeleteByNameRequest(name string) (QueryResponse, error)

Deletes the specified context from the specified session

func (*DialogFlowClient) ContextsDeleteRequest

func (client *DialogFlowClient) ContextsDeleteRequest() (QueryResponse, error)

Deletes all contexts from the specified session

func (*DialogFlowClient) ContextsFindAllRequest

func (client *DialogFlowClient) ContextsFindAllRequest() ([]Context, error)

retrieves the list of all currently active contexts for the specified session

func (*DialogFlowClient) ContextsFindByNameRequest

func (client *DialogFlowClient) ContextsFindByNameRequest(name string) (Context, error)

Retrieves the specified context for the specified session

func (*DialogFlowClient) EntitiesAddEntryRequest

func (client *DialogFlowClient) EntitiesAddEntryRequest(eid string, entries []Entry) (QueryResponse, error)

Adds entries to the specified entity.

func (*DialogFlowClient) EntitiesCreateRequest

func (client *DialogFlowClient) EntitiesCreateRequest(entity Entity) (QueryResponse, error)

Creates a new entity

func (*DialogFlowClient) EntitiesDeleteEntriesRequest

func (client *DialogFlowClient) EntitiesDeleteEntriesRequest(eid string, values []string) (QueryResponse, error)

Deletes entity entries

func (*DialogFlowClient) EntitiesDeleteRequest

func (client *DialogFlowClient) EntitiesDeleteRequest(eid string) (QueryResponse, error)

Deletes the specified entity

func (*DialogFlowClient) EntitiesFindAllRequest

func (client *DialogFlowClient) EntitiesFindAllRequest() ([]Entity, error)

Retrieves a list of all entities for the agent

func (*DialogFlowClient) EntitiesFindByIdRequest

func (client *DialogFlowClient) EntitiesFindByIdRequest(eid string) (Entity, error)

Retrieves the specified entity

func (*DialogFlowClient) EntitiesUpdateEntityEntriesRequest

func (client *DialogFlowClient) EntitiesUpdateEntityEntriesRequest(eid string, entries []Entry) (QueryResponse, error)

Updates entity entries

func (*DialogFlowClient) EntitiesUpdateEntityRequest

func (client *DialogFlowClient) EntitiesUpdateEntityRequest(eid string, entity Entity) (QueryResponse, error)

Updates the specified entity

func (*DialogFlowClient) EntitiesUpdateRequest

func (client *DialogFlowClient) EntitiesUpdateRequest(entities []Entity) (QueryResponse, error)

Creates or updates an array of entities

func (*DialogFlowClient) GetAccessToken

func (client *DialogFlowClient) GetAccessToken() string

GET API.AI access token

func (*DialogFlowClient) GetApiLang

func (client *DialogFlowClient) GetApiLang() string

GET API.AI language

func (*DialogFlowClient) GetApiVersion

func (client *DialogFlowClient) GetApiVersion() string

GET API.AI version

func (*DialogFlowClient) GetBaseUrl

func (client *DialogFlowClient) GetBaseUrl() string

Get API.AI base url

func (*DialogFlowClient) GetSessionID

func (client *DialogFlowClient) GetSessionID() string

Get current session ID

func (*DialogFlowClient) IntentsCreateRequest

func (client *DialogFlowClient) IntentsCreateRequest(intent Intent) (QueryResponse, error)

Creates a new intent

func (*DialogFlowClient) IntentsDeleteRequest

func (client *DialogFlowClient) IntentsDeleteRequest(id string) (QueryResponse, error)

Deletes the specified intent

func (*DialogFlowClient) IntentsFindAllRequest

func (client *DialogFlowClient) IntentsFindAllRequest() ([]IntentAgent, error)

Retrieves a list of all intents for the agent

func (*DialogFlowClient) IntentsFindByIdRequest

func (client *DialogFlowClient) IntentsFindByIdRequest(id string) (Intent, error)

Retrieves the specified intent

func (*DialogFlowClient) IntentsUpdateRequest

func (client *DialogFlowClient) IntentsUpdateRequest(id string, intent Intent) (QueryResponse, error)

Updates the specified intent

func (*DialogFlowClient) QueryCreateRequest

func (client *DialogFlowClient) QueryCreateRequest(query Query) (QueryResponse, error)

Takes natural language text and information as JSON in the POST body and returns information as JSON

func (*DialogFlowClient) QueryFindRequest

func (client *DialogFlowClient) QueryFindRequest(query Query) (QueryResponse, error)

Takes natural language text and information as query parameters and returns information as JSON

func (*DialogFlowClient) SetSessionID

func (client *DialogFlowClient) SetSessionID(sessionID string)

Set a new seesion ID

func (*DialogFlowClient) UserEntitiesCreateRequest

func (client *DialogFlowClient) UserEntitiesCreateRequest(userEntities []UserEntity) (QueryResponse, error)

Adds one or multiple user entities for a session.

func (*DialogFlowClient) UserEntitiesDeleteByNameRequest

func (client *DialogFlowClient) UserEntitiesDeleteByNameRequest(name string) (QueryResponse, error)

Deletes a user entity object with a specified name

func (*DialogFlowClient) UserEntitiesFindByNameRequest

func (client *DialogFlowClient) UserEntitiesFindByNameRequest(name string) (UserEntity, error)

Gets a user entity object by name

func (*DialogFlowClient) UserEntitiesUpdateRequest

func (client *DialogFlowClient) UserEntitiesUpdateRequest(name string, userEntity UserEntity) (QueryResponse, error)

Updates user entity specified by name

type Request

type Request struct {
	URI         string
	Method      string
	Headers     map[string]string
	Body        interface{}
	QueryParams map[string]string
}

func NewRequest

func NewRequest(client *DialogFlowClient, overridedRequestOptions RequestOptions) *Request

Initialize a new HTTP request

func (*Request) Perform

func (r *Request) Perform() ([]byte, error)

Execute an HTTP request

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL