Documentation ¶
Overview ¶
Package dialogflow is an auto-generated package for the Dialogflow API.
NOTE: This package is in alpha. It is not stable, and is likely to change.
An end-to-end development suite for conversational interfaces (e.g., chatbots, voice-powered apps and devices).
Index ¶
- func DefaultAuthScopes() []string
- type AgentIterator
- type AgentsCallOptions
- type AgentsClient
- func (c *AgentsClient) Close() error
- func (c *AgentsClient) Connection() *grpc.ClientConn
- func (c *AgentsClient) ExportAgent(ctx context.Context, req *dialogflowpb.ExportAgentRequest, ...) (*ExportAgentOperation, error)
- func (c *AgentsClient) ExportAgentOperation(name string) *ExportAgentOperation
- func (c *AgentsClient) GetAgent(ctx context.Context, req *dialogflowpb.GetAgentRequest, opts ...gax.CallOption) (*dialogflowpb.Agent, error)
- func (c *AgentsClient) ImportAgent(ctx context.Context, req *dialogflowpb.ImportAgentRequest, ...) (*ImportAgentOperation, error)
- func (c *AgentsClient) ImportAgentOperation(name string) *ImportAgentOperation
- func (c *AgentsClient) RestoreAgent(ctx context.Context, req *dialogflowpb.RestoreAgentRequest, ...) (*RestoreAgentOperation, error)
- func (c *AgentsClient) RestoreAgentOperation(name string) *RestoreAgentOperation
- func (c *AgentsClient) SearchAgents(ctx context.Context, req *dialogflowpb.SearchAgentsRequest, ...) *AgentIterator
- func (c *AgentsClient) TrainAgent(ctx context.Context, req *dialogflowpb.TrainAgentRequest, ...) (*TrainAgentOperation, error)
- func (c *AgentsClient) TrainAgentOperation(name string) *TrainAgentOperation
- type BatchCreateEntitiesOperation
- func (op *BatchCreateEntitiesOperation) Done() bool
- func (op *BatchCreateEntitiesOperation) Metadata() (*structpbpb.Struct, error)
- func (op *BatchCreateEntitiesOperation) Name() string
- func (op *BatchCreateEntitiesOperation) Poll(ctx context.Context, opts ...gax.CallOption) error
- func (op *BatchCreateEntitiesOperation) Wait(ctx context.Context, opts ...gax.CallOption) error
- type BatchDeleteEntitiesOperation
- func (op *BatchDeleteEntitiesOperation) Done() bool
- func (op *BatchDeleteEntitiesOperation) Metadata() (*structpbpb.Struct, error)
- func (op *BatchDeleteEntitiesOperation) Name() string
- func (op *BatchDeleteEntitiesOperation) Poll(ctx context.Context, opts ...gax.CallOption) error
- func (op *BatchDeleteEntitiesOperation) Wait(ctx context.Context, opts ...gax.CallOption) error
- type BatchDeleteEntityTypesOperation
- func (op *BatchDeleteEntityTypesOperation) Done() bool
- func (op *BatchDeleteEntityTypesOperation) Metadata() (*structpbpb.Struct, error)
- func (op *BatchDeleteEntityTypesOperation) Name() string
- func (op *BatchDeleteEntityTypesOperation) Poll(ctx context.Context, opts ...gax.CallOption) error
- func (op *BatchDeleteEntityTypesOperation) Wait(ctx context.Context, opts ...gax.CallOption) error
- type BatchDeleteIntentsOperation
- func (op *BatchDeleteIntentsOperation) Done() bool
- func (op *BatchDeleteIntentsOperation) Metadata() (*structpbpb.Struct, error)
- func (op *BatchDeleteIntentsOperation) Name() string
- func (op *BatchDeleteIntentsOperation) Poll(ctx context.Context, opts ...gax.CallOption) error
- func (op *BatchDeleteIntentsOperation) Wait(ctx context.Context, opts ...gax.CallOption) error
- type BatchUpdateEntitiesOperation
- func (op *BatchUpdateEntitiesOperation) Done() bool
- func (op *BatchUpdateEntitiesOperation) Metadata() (*structpbpb.Struct, error)
- func (op *BatchUpdateEntitiesOperation) Name() string
- func (op *BatchUpdateEntitiesOperation) Poll(ctx context.Context, opts ...gax.CallOption) error
- func (op *BatchUpdateEntitiesOperation) Wait(ctx context.Context, opts ...gax.CallOption) error
- type BatchUpdateEntityTypesOperation
- func (op *BatchUpdateEntityTypesOperation) Done() bool
- func (op *BatchUpdateEntityTypesOperation) Metadata() (*structpbpb.Struct, error)
- func (op *BatchUpdateEntityTypesOperation) Name() string
- func (op *BatchUpdateEntityTypesOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*dialogflowpb.BatchUpdateEntityTypesResponse, error)
- func (op *BatchUpdateEntityTypesOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*dialogflowpb.BatchUpdateEntityTypesResponse, error)
- type BatchUpdateIntentsOperation
- func (op *BatchUpdateIntentsOperation) Done() bool
- func (op *BatchUpdateIntentsOperation) Metadata() (*structpbpb.Struct, error)
- func (op *BatchUpdateIntentsOperation) Name() string
- func (op *BatchUpdateIntentsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*dialogflowpb.BatchUpdateIntentsResponse, error)
- func (op *BatchUpdateIntentsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*dialogflowpb.BatchUpdateIntentsResponse, error)
- type ContextIterator
- type ContextsCallOptions
- type ContextsClient
- func (c *ContextsClient) Close() error
- func (c *ContextsClient) Connection() *grpc.ClientConn
- func (c *ContextsClient) CreateContext(ctx context.Context, req *dialogflowpb.CreateContextRequest, ...) (*dialogflowpb.Context, error)
- func (c *ContextsClient) DeleteAllContexts(ctx context.Context, req *dialogflowpb.DeleteAllContextsRequest, ...) error
- func (c *ContextsClient) DeleteContext(ctx context.Context, req *dialogflowpb.DeleteContextRequest, ...) error
- func (c *ContextsClient) GetContext(ctx context.Context, req *dialogflowpb.GetContextRequest, ...) (*dialogflowpb.Context, error)
- func (c *ContextsClient) ListContexts(ctx context.Context, req *dialogflowpb.ListContextsRequest, ...) *ContextIterator
- func (c *ContextsClient) UpdateContext(ctx context.Context, req *dialogflowpb.UpdateContextRequest, ...) (*dialogflowpb.Context, error)
- type EntityTypeIterator
- type EntityTypesCallOptions
- type EntityTypesClient
- func (c *EntityTypesClient) BatchCreateEntities(ctx context.Context, req *dialogflowpb.BatchCreateEntitiesRequest, ...) (*BatchCreateEntitiesOperation, error)
- func (c *EntityTypesClient) BatchCreateEntitiesOperation(name string) *BatchCreateEntitiesOperation
- func (c *EntityTypesClient) BatchDeleteEntities(ctx context.Context, req *dialogflowpb.BatchDeleteEntitiesRequest, ...) (*BatchDeleteEntitiesOperation, error)
- func (c *EntityTypesClient) BatchDeleteEntitiesOperation(name string) *BatchDeleteEntitiesOperation
- func (c *EntityTypesClient) BatchDeleteEntityTypes(ctx context.Context, req *dialogflowpb.BatchDeleteEntityTypesRequest, ...) (*BatchDeleteEntityTypesOperation, error)
- func (c *EntityTypesClient) BatchDeleteEntityTypesOperation(name string) *BatchDeleteEntityTypesOperation
- func (c *EntityTypesClient) BatchUpdateEntities(ctx context.Context, req *dialogflowpb.BatchUpdateEntitiesRequest, ...) (*BatchUpdateEntitiesOperation, error)
- func (c *EntityTypesClient) BatchUpdateEntitiesOperation(name string) *BatchUpdateEntitiesOperation
- func (c *EntityTypesClient) BatchUpdateEntityTypes(ctx context.Context, req *dialogflowpb.BatchUpdateEntityTypesRequest, ...) (*BatchUpdateEntityTypesOperation, error)
- func (c *EntityTypesClient) BatchUpdateEntityTypesOperation(name string) *BatchUpdateEntityTypesOperation
- func (c *EntityTypesClient) Close() error
- func (c *EntityTypesClient) Connection() *grpc.ClientConn
- func (c *EntityTypesClient) CreateEntityType(ctx context.Context, req *dialogflowpb.CreateEntityTypeRequest, ...) (*dialogflowpb.EntityType, error)
- func (c *EntityTypesClient) DeleteEntityType(ctx context.Context, req *dialogflowpb.DeleteEntityTypeRequest, ...) error
- func (c *EntityTypesClient) GetEntityType(ctx context.Context, req *dialogflowpb.GetEntityTypeRequest, ...) (*dialogflowpb.EntityType, error)
- func (c *EntityTypesClient) ListEntityTypes(ctx context.Context, req *dialogflowpb.ListEntityTypesRequest, ...) *EntityTypeIterator
- func (c *EntityTypesClient) UpdateEntityType(ctx context.Context, req *dialogflowpb.UpdateEntityTypeRequest, ...) (*dialogflowpb.EntityType, error)
- type ExportAgentOperation
- func (op *ExportAgentOperation) Done() bool
- func (op *ExportAgentOperation) Metadata() (*structpbpb.Struct, error)
- func (op *ExportAgentOperation) Name() string
- func (op *ExportAgentOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*dialogflowpb.ExportAgentResponse, error)
- func (op *ExportAgentOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*dialogflowpb.ExportAgentResponse, error)
- type ImportAgentOperation
- func (op *ImportAgentOperation) Done() bool
- func (op *ImportAgentOperation) Metadata() (*structpbpb.Struct, error)
- func (op *ImportAgentOperation) Name() string
- func (op *ImportAgentOperation) Poll(ctx context.Context, opts ...gax.CallOption) error
- func (op *ImportAgentOperation) Wait(ctx context.Context, opts ...gax.CallOption) error
- type IntentIterator
- type IntentsCallOptions
- type IntentsClient
- func (c *IntentsClient) BatchDeleteIntents(ctx context.Context, req *dialogflowpb.BatchDeleteIntentsRequest, ...) (*BatchDeleteIntentsOperation, error)
- func (c *IntentsClient) BatchDeleteIntentsOperation(name string) *BatchDeleteIntentsOperation
- func (c *IntentsClient) BatchUpdateIntents(ctx context.Context, req *dialogflowpb.BatchUpdateIntentsRequest, ...) (*BatchUpdateIntentsOperation, error)
- func (c *IntentsClient) BatchUpdateIntentsOperation(name string) *BatchUpdateIntentsOperation
- func (c *IntentsClient) Close() error
- func (c *IntentsClient) Connection() *grpc.ClientConn
- func (c *IntentsClient) CreateIntent(ctx context.Context, req *dialogflowpb.CreateIntentRequest, ...) (*dialogflowpb.Intent, error)
- func (c *IntentsClient) DeleteIntent(ctx context.Context, req *dialogflowpb.DeleteIntentRequest, ...) error
- func (c *IntentsClient) GetIntent(ctx context.Context, req *dialogflowpb.GetIntentRequest, ...) (*dialogflowpb.Intent, error)
- func (c *IntentsClient) ListIntents(ctx context.Context, req *dialogflowpb.ListIntentsRequest, ...) *IntentIterator
- func (c *IntentsClient) UpdateIntent(ctx context.Context, req *dialogflowpb.UpdateIntentRequest, ...) (*dialogflowpb.Intent, error)
- type RestoreAgentOperation
- func (op *RestoreAgentOperation) Done() bool
- func (op *RestoreAgentOperation) Metadata() (*structpbpb.Struct, error)
- func (op *RestoreAgentOperation) Name() string
- func (op *RestoreAgentOperation) Poll(ctx context.Context, opts ...gax.CallOption) error
- func (op *RestoreAgentOperation) Wait(ctx context.Context, opts ...gax.CallOption) error
- type SessionEntityTypeIterator
- type SessionEntityTypesCallOptions
- type SessionEntityTypesClient
- func (c *SessionEntityTypesClient) Close() error
- func (c *SessionEntityTypesClient) Connection() *grpc.ClientConn
- func (c *SessionEntityTypesClient) CreateSessionEntityType(ctx context.Context, req *dialogflowpb.CreateSessionEntityTypeRequest, ...) (*dialogflowpb.SessionEntityType, error)
- func (c *SessionEntityTypesClient) DeleteSessionEntityType(ctx context.Context, req *dialogflowpb.DeleteSessionEntityTypeRequest, ...) error
- func (c *SessionEntityTypesClient) GetSessionEntityType(ctx context.Context, req *dialogflowpb.GetSessionEntityTypeRequest, ...) (*dialogflowpb.SessionEntityType, error)
- func (c *SessionEntityTypesClient) ListSessionEntityTypes(ctx context.Context, req *dialogflowpb.ListSessionEntityTypesRequest, ...) *SessionEntityTypeIterator
- func (c *SessionEntityTypesClient) UpdateSessionEntityType(ctx context.Context, req *dialogflowpb.UpdateSessionEntityTypeRequest, ...) (*dialogflowpb.SessionEntityType, error)
- type SessionsCallOptions
- type SessionsClient
- func (c *SessionsClient) Close() error
- func (c *SessionsClient) Connection() *grpc.ClientConn
- func (c *SessionsClient) DetectIntent(ctx context.Context, req *dialogflowpb.DetectIntentRequest, ...) (*dialogflowpb.DetectIntentResponse, error)
- func (c *SessionsClient) StreamingDetectIntent(ctx context.Context, opts ...gax.CallOption) (dialogflowpb.Sessions_StreamingDetectIntentClient, error)
- type TrainAgentOperation
- func (op *TrainAgentOperation) Done() bool
- func (op *TrainAgentOperation) Metadata() (*structpbpb.Struct, error)
- func (op *TrainAgentOperation) Name() string
- func (op *TrainAgentOperation) Poll(ctx context.Context, opts ...gax.CallOption) error
- func (op *TrainAgentOperation) Wait(ctx context.Context, opts ...gax.CallOption) error
Examples ¶
- AgentsClient.ExportAgent
- AgentsClient.GetAgent
- AgentsClient.ImportAgent
- AgentsClient.RestoreAgent
- AgentsClient.SearchAgents
- AgentsClient.TrainAgent
- ContextsClient.CreateContext
- ContextsClient.DeleteAllContexts
- ContextsClient.DeleteContext
- ContextsClient.GetContext
- ContextsClient.ListContexts
- ContextsClient.UpdateContext
- EntityTypesClient.BatchCreateEntities
- EntityTypesClient.BatchDeleteEntities
- EntityTypesClient.BatchDeleteEntityTypes
- EntityTypesClient.BatchUpdateEntities
- EntityTypesClient.BatchUpdateEntityTypes
- EntityTypesClient.CreateEntityType
- EntityTypesClient.DeleteEntityType
- EntityTypesClient.GetEntityType
- EntityTypesClient.ListEntityTypes
- EntityTypesClient.UpdateEntityType
- IntentsClient.BatchDeleteIntents
- IntentsClient.BatchUpdateIntents
- IntentsClient.CreateIntent
- IntentsClient.DeleteIntent
- IntentsClient.GetIntent
- IntentsClient.ListIntents
- IntentsClient.UpdateIntent
- NewAgentsClient
- NewContextsClient
- NewEntityTypesClient
- NewIntentsClient
- NewSessionEntityTypesClient
- NewSessionsClient
- SessionEntityTypesClient.CreateSessionEntityType
- SessionEntityTypesClient.DeleteSessionEntityType
- SessionEntityTypesClient.GetSessionEntityType
- SessionEntityTypesClient.ListSessionEntityTypes
- SessionEntityTypesClient.UpdateSessionEntityType
- SessionsClient.DetectIntent
- SessionsClient.StreamingDetectIntent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultAuthScopes ¶
func DefaultAuthScopes() []string
DefaultAuthScopes reports the default set of authentication scopes to use with this package.
Types ¶
type AgentIterator ¶
type AgentIterator struct { // InternalFetch is for use by the Google Cloud Libraries only. // It is not part of the stable interface of this package. // // InternalFetch returns results from a single call to the underlying RPC. // The number of results is no greater than pageSize. // If there are no more results, nextPageToken is empty and err is nil. InternalFetch func(pageSize int, pageToken string) (results []*dialogflowpb.Agent, nextPageToken string, err error) // contains filtered or unexported fields }
AgentIterator manages a stream of *dialogflowpb.Agent.
func (*AgentIterator) Next ¶
func (it *AgentIterator) Next() (*dialogflowpb.Agent, error)
Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*AgentIterator) PageInfo ¶
func (it *AgentIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type AgentsCallOptions ¶
type AgentsCallOptions struct { GetAgent []gax.CallOption SearchAgents []gax.CallOption TrainAgent []gax.CallOption ExportAgent []gax.CallOption ImportAgent []gax.CallOption RestoreAgent []gax.CallOption }
AgentsCallOptions contains the retry settings for each method of AgentsClient.
type AgentsClient ¶
type AgentsClient struct { // LROClient is used internally to handle longrunning operations. // It is exposed so that its CallOptions can be modified if required. // Users should not Close this client. LROClient *lroauto.OperationsClient // The call options for this service. CallOptions *AgentsCallOptions // contains filtered or unexported fields }
AgentsClient is a client for interacting with Dialogflow API.
Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
func NewAgentsClient ¶
func NewAgentsClient(ctx context.Context, opts ...option.ClientOption) (*AgentsClient, error)
NewAgentsClient creates a new agents client.
Agents are best described as Natural Language Understanding (NLU) modules that transform user requests into actionable data. You can include agents in your app, product, or service to determine user intent and respond to the user in a natural way.
After you create an agent, you can add [Intents][google.cloud.dialogflow.v2.Intents], [Contexts][google.cloud.dialogflow.v2.Contexts], [Entity Types][google.cloud.dialogflow.v2.EntityTypes], [Webhooks][google.cloud.dialogflow.v2.WebhookRequest], and so on to manage the flow of a conversation and match user input to predefined intents and actions.
You can create an agent using both Dialogflow Standard Edition and Dialogflow Enterprise Edition. For details, see Dialogflow Editions (at /dialogflow-enterprise/docs/editions).
You can save your agent for backup or versioning by exporting the agent by using the [ExportAgent][google.cloud.dialogflow.v2.Agents.ExportAgent] method. You can import a saved agent by using the [ImportAgent][google.cloud.dialogflow.v2.Agents.ImportAgent] method.
Dialogflow provides several prebuilt agents (at https://dialogflow.com/docs/prebuilt-agents) for common conversation scenarios such as determining a date and time, converting currency, and so on.
For more information about agents, see the Dialogflow documentation (at https://dialogflow.com/docs/agents).
Example ¶
package main import ( "context" dialogflow "cloud.google.com/go/dialogflow/apiv2" ) func main() { ctx := context.Background() c, err := dialogflow.NewAgentsClient(ctx) if err != nil { // TODO: Handle error. } // TODO: Use client. _ = c }
Output:
func (*AgentsClient) Close ¶
func (c *AgentsClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*AgentsClient) Connection ¶
func (c *AgentsClient) Connection() *grpc.ClientConn
Connection returns the client's connection to the API service.
func (*AgentsClient) ExportAgent ¶
func (c *AgentsClient) ExportAgent(ctx context.Context, req *dialogflowpb.ExportAgentRequest, opts ...gax.CallOption) (*ExportAgentOperation, error)
ExportAgent exports the specified agent to a ZIP file.
Operation <response: [ExportAgentResponse][google.cloud.dialogflow.v2.ExportAgentResponse], metadata: [google.protobuf.Struct][google.protobuf.Struct]>
Example ¶
package main import ( "context" dialogflow "cloud.google.com/go/dialogflow/apiv2" dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" ) func main() { ctx := context.Background() c, err := dialogflow.NewAgentsClient(ctx) if err != nil { // TODO: Handle error. } req := &dialogflowpb.ExportAgentRequest{ // TODO: Fill request struct fields. } op, err := c.ExportAgent(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*AgentsClient) ExportAgentOperation ¶
func (c *AgentsClient) ExportAgentOperation(name string) *ExportAgentOperation
ExportAgentOperation returns a new ExportAgentOperation from a given name. The name must be that of a previously created ExportAgentOperation, possibly from a different process.
func (*AgentsClient) GetAgent ¶
func (c *AgentsClient) GetAgent(ctx context.Context, req *dialogflowpb.GetAgentRequest, opts ...gax.CallOption) (*dialogflowpb.Agent, error)
GetAgent retrieves the specified agent.
Example ¶
package main import ( "context" dialogflow "cloud.google.com/go/dialogflow/apiv2" dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" ) func main() { ctx := context.Background() c, err := dialogflow.NewAgentsClient(ctx) if err != nil { // TODO: Handle error. } req := &dialogflowpb.GetAgentRequest{ // TODO: Fill request struct fields. } resp, err := c.GetAgent(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*AgentsClient) ImportAgent ¶
func (c *AgentsClient) ImportAgent(ctx context.Context, req *dialogflowpb.ImportAgentRequest, opts ...gax.CallOption) (*ImportAgentOperation, error)
ImportAgent imports the specified agent from a ZIP file.
Uploads new intents and entity types without deleting the existing ones. Intents and entity types with the same name are replaced with the new versions from ImportAgentRequest.
Operation <response: [google.protobuf.Empty][google.protobuf.Empty], metadata: [google.protobuf.Struct][google.protobuf.Struct]>
Example ¶
package main import ( "context" dialogflow "cloud.google.com/go/dialogflow/apiv2" dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" ) func main() { ctx := context.Background() c, err := dialogflow.NewAgentsClient(ctx) if err != nil { // TODO: Handle error. } req := &dialogflowpb.ImportAgentRequest{ // TODO: Fill request struct fields. } op, err := c.ImportAgent(ctx, req) if err != nil { // TODO: Handle error. } err = op.Wait(ctx) // TODO: Handle error. }
Output:
func (*AgentsClient) ImportAgentOperation ¶
func (c *AgentsClient) ImportAgentOperation(name string) *ImportAgentOperation
ImportAgentOperation returns a new ImportAgentOperation from a given name. The name must be that of a previously created ImportAgentOperation, possibly from a different process.
func (*AgentsClient) RestoreAgent ¶
func (c *AgentsClient) RestoreAgent(ctx context.Context, req *dialogflowpb.RestoreAgentRequest, opts ...gax.CallOption) (*RestoreAgentOperation, error)
RestoreAgent restores the specified agent from a ZIP file.
Replaces the current agent version with a new one. All the intents and entity types in the older version are deleted.
Operation <response: [google.protobuf.Empty][google.protobuf.Empty], metadata: [google.protobuf.Struct][google.protobuf.Struct]>
Example ¶
package main import ( "context" dialogflow "cloud.google.com/go/dialogflow/apiv2" dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" ) func main() { ctx := context.Background() c, err := dialogflow.NewAgentsClient(ctx) if err != nil { // TODO: Handle error. } req := &dialogflowpb.RestoreAgentRequest{ // TODO: Fill request struct fields. } op, err := c.RestoreAgent(ctx, req) if err != nil { // TODO: Handle error. } err = op.Wait(ctx) // TODO: Handle error. }
Output:
func (*AgentsClient) RestoreAgentOperation ¶
func (c *AgentsClient) RestoreAgentOperation(name string) *RestoreAgentOperation
RestoreAgentOperation returns a new RestoreAgentOperation from a given name. The name must be that of a previously created RestoreAgentOperation, possibly from a different process.
func (*AgentsClient) SearchAgents ¶
func (c *AgentsClient) SearchAgents(ctx context.Context, req *dialogflowpb.SearchAgentsRequest, opts ...gax.CallOption) *AgentIterator
SearchAgents returns the list of agents.
Since there is at most one conversational agent per project, this method is useful primarily for listing all agents across projects the caller has access to. One can achieve that with a wildcard project collection id "-". Refer to List Sub-Collections (at https://cloud.google.com/apis/design/design_patterns#list_sub-collections).
Example ¶
package main import ( "context" dialogflow "cloud.google.com/go/dialogflow/apiv2" "google.golang.org/api/iterator" dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" ) func main() { ctx := context.Background() c, err := dialogflow.NewAgentsClient(ctx) if err != nil { // TODO: Handle error. } req := &dialogflowpb.SearchAgentsRequest{ // TODO: Fill request struct fields. } it := c.SearchAgents(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } }
Output:
func (*AgentsClient) TrainAgent ¶
func (c *AgentsClient) TrainAgent(ctx context.Context, req *dialogflowpb.TrainAgentRequest, opts ...gax.CallOption) (*TrainAgentOperation, error)
TrainAgent trains the specified agent.
Operation <response: [google.protobuf.Empty][google.protobuf.Empty], metadata: [google.protobuf.Struct][google.protobuf.Struct]>
Example ¶
package main import ( "context" dialogflow "cloud.google.com/go/dialogflow/apiv2" dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" ) func main() { ctx := context.Background() c, err := dialogflow.NewAgentsClient(ctx) if err != nil { // TODO: Handle error. } req := &dialogflowpb.TrainAgentRequest{ // TODO: Fill request struct fields. } op, err := c.TrainAgent(ctx, req) if err != nil { // TODO: Handle error. } err = op.Wait(ctx) // TODO: Handle error. }
Output:
func (*AgentsClient) TrainAgentOperation ¶
func (c *AgentsClient) TrainAgentOperation(name string) *TrainAgentOperation
TrainAgentOperation returns a new TrainAgentOperation from a given name. The name must be that of a previously created TrainAgentOperation, possibly from a different process.
type BatchCreateEntitiesOperation ¶
type BatchCreateEntitiesOperation struct {
// contains filtered or unexported fields
}
BatchCreateEntitiesOperation manages a long-running operation from BatchCreateEntities.
func (*BatchCreateEntitiesOperation) Done ¶
func (op *BatchCreateEntitiesOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*BatchCreateEntitiesOperation) Metadata ¶
func (op *BatchCreateEntitiesOperation) Metadata() (*structpbpb.Struct, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*BatchCreateEntitiesOperation) Name ¶
func (op *BatchCreateEntitiesOperation) Name() string
Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*BatchCreateEntitiesOperation) Poll ¶
func (op *BatchCreateEntitiesOperation) Poll(ctx context.Context, opts ...gax.CallOption) error
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true.
func (*BatchCreateEntitiesOperation) Wait ¶
func (op *BatchCreateEntitiesOperation) Wait(ctx context.Context, opts ...gax.CallOption) error
Wait blocks until the long-running operation is completed, returning any error encountered.
See documentation of Poll for error-handling information.
type BatchDeleteEntitiesOperation ¶
type BatchDeleteEntitiesOperation struct {
// contains filtered or unexported fields
}
BatchDeleteEntitiesOperation manages a long-running operation from BatchDeleteEntities.
func (*BatchDeleteEntitiesOperation) Done ¶
func (op *BatchDeleteEntitiesOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*BatchDeleteEntitiesOperation) Metadata ¶
func (op *BatchDeleteEntitiesOperation) Metadata() (*structpbpb.Struct, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*BatchDeleteEntitiesOperation) Name ¶
func (op *BatchDeleteEntitiesOperation) Name() string
Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*BatchDeleteEntitiesOperation) Poll ¶
func (op *BatchDeleteEntitiesOperation) Poll(ctx context.Context, opts ...gax.CallOption) error
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true.
func (*BatchDeleteEntitiesOperation) Wait ¶
func (op *BatchDeleteEntitiesOperation) Wait(ctx context.Context, opts ...gax.CallOption) error
Wait blocks until the long-running operation is completed, returning any error encountered.
See documentation of Poll for error-handling information.
type BatchDeleteEntityTypesOperation ¶
type BatchDeleteEntityTypesOperation struct {
// contains filtered or unexported fields
}
BatchDeleteEntityTypesOperation manages a long-running operation from BatchDeleteEntityTypes.
func (*BatchDeleteEntityTypesOperation) Done ¶
func (op *BatchDeleteEntityTypesOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*BatchDeleteEntityTypesOperation) Metadata ¶
func (op *BatchDeleteEntityTypesOperation) Metadata() (*structpbpb.Struct, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*BatchDeleteEntityTypesOperation) Name ¶
func (op *BatchDeleteEntityTypesOperation) Name() string
Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*BatchDeleteEntityTypesOperation) Poll ¶
func (op *BatchDeleteEntityTypesOperation) Poll(ctx context.Context, opts ...gax.CallOption) error
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true.
func (*BatchDeleteEntityTypesOperation) Wait ¶
func (op *BatchDeleteEntityTypesOperation) Wait(ctx context.Context, opts ...gax.CallOption) error
Wait blocks until the long-running operation is completed, returning any error encountered.
See documentation of Poll for error-handling information.
type BatchDeleteIntentsOperation ¶
type BatchDeleteIntentsOperation struct {
// contains filtered or unexported fields
}
BatchDeleteIntentsOperation manages a long-running operation from BatchDeleteIntents.
func (*BatchDeleteIntentsOperation) Done ¶
func (op *BatchDeleteIntentsOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*BatchDeleteIntentsOperation) Metadata ¶
func (op *BatchDeleteIntentsOperation) Metadata() (*structpbpb.Struct, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*BatchDeleteIntentsOperation) Name ¶
func (op *BatchDeleteIntentsOperation) Name() string
Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*BatchDeleteIntentsOperation) Poll ¶
func (op *BatchDeleteIntentsOperation) Poll(ctx context.Context, opts ...gax.CallOption) error
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true.
func (*BatchDeleteIntentsOperation) Wait ¶
func (op *BatchDeleteIntentsOperation) Wait(ctx context.Context, opts ...gax.CallOption) error
Wait blocks until the long-running operation is completed, returning any error encountered.
See documentation of Poll for error-handling information.
type BatchUpdateEntitiesOperation ¶
type BatchUpdateEntitiesOperation struct {
// contains filtered or unexported fields
}
BatchUpdateEntitiesOperation manages a long-running operation from BatchUpdateEntities.
func (*BatchUpdateEntitiesOperation) Done ¶
func (op *BatchUpdateEntitiesOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*BatchUpdateEntitiesOperation) Metadata ¶
func (op *BatchUpdateEntitiesOperation) Metadata() (*structpbpb.Struct, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*BatchUpdateEntitiesOperation) Name ¶
func (op *BatchUpdateEntitiesOperation) Name() string
Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*BatchUpdateEntitiesOperation) Poll ¶
func (op *BatchUpdateEntitiesOperation) Poll(ctx context.Context, opts ...gax.CallOption) error
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true.
func (*BatchUpdateEntitiesOperation) Wait ¶
func (op *BatchUpdateEntitiesOperation) Wait(ctx context.Context, opts ...gax.CallOption) error
Wait blocks until the long-running operation is completed, returning any error encountered.
See documentation of Poll for error-handling information.
type BatchUpdateEntityTypesOperation ¶
type BatchUpdateEntityTypesOperation struct {
// contains filtered or unexported fields
}
BatchUpdateEntityTypesOperation manages a long-running operation from BatchUpdateEntityTypes.
func (*BatchUpdateEntityTypesOperation) Done ¶
func (op *BatchUpdateEntityTypesOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*BatchUpdateEntityTypesOperation) Metadata ¶
func (op *BatchUpdateEntityTypesOperation) Metadata() (*structpbpb.Struct, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*BatchUpdateEntityTypesOperation) Name ¶
func (op *BatchUpdateEntityTypesOperation) Name() string
Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*BatchUpdateEntityTypesOperation) Poll ¶
func (op *BatchUpdateEntityTypesOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*dialogflowpb.BatchUpdateEntityTypesResponse, error)
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*BatchUpdateEntityTypesOperation) Wait ¶
func (op *BatchUpdateEntityTypesOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*dialogflowpb.BatchUpdateEntityTypesResponse, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
type BatchUpdateIntentsOperation ¶
type BatchUpdateIntentsOperation struct {
// contains filtered or unexported fields
}
BatchUpdateIntentsOperation manages a long-running operation from BatchUpdateIntents.
func (*BatchUpdateIntentsOperation) Done ¶
func (op *BatchUpdateIntentsOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*BatchUpdateIntentsOperation) Metadata ¶
func (op *BatchUpdateIntentsOperation) Metadata() (*structpbpb.Struct, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*BatchUpdateIntentsOperation) Name ¶
func (op *BatchUpdateIntentsOperation) Name() string
Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*BatchUpdateIntentsOperation) Poll ¶
func (op *BatchUpdateIntentsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*dialogflowpb.BatchUpdateIntentsResponse, error)
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*BatchUpdateIntentsOperation) Wait ¶
func (op *BatchUpdateIntentsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*dialogflowpb.BatchUpdateIntentsResponse, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
type ContextIterator ¶
type ContextIterator struct { // InternalFetch is for use by the Google Cloud Libraries only. // It is not part of the stable interface of this package. // // InternalFetch returns results from a single call to the underlying RPC. // The number of results is no greater than pageSize. // If there are no more results, nextPageToken is empty and err is nil. InternalFetch func(pageSize int, pageToken string) (results []*dialogflowpb.Context, nextPageToken string, err error) // contains filtered or unexported fields }
ContextIterator manages a stream of *dialogflowpb.Context.
func (*ContextIterator) Next ¶
func (it *ContextIterator) Next() (*dialogflowpb.Context, error)
Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*ContextIterator) PageInfo ¶
func (it *ContextIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type ContextsCallOptions ¶
type ContextsCallOptions struct { ListContexts []gax.CallOption GetContext []gax.CallOption CreateContext []gax.CallOption UpdateContext []gax.CallOption DeleteContext []gax.CallOption DeleteAllContexts []gax.CallOption }
ContextsCallOptions contains the retry settings for each method of ContextsClient.
type ContextsClient ¶
type ContextsClient struct { // The call options for this service. CallOptions *ContextsCallOptions // contains filtered or unexported fields }
ContextsClient is a client for interacting with Dialogflow API.
Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
func NewContextsClient ¶
func NewContextsClient(ctx context.Context, opts ...option.ClientOption) (*ContextsClient, error)
NewContextsClient creates a new contexts client.
A context represents additional information included with user input or with an intent returned by the Dialogflow API. Contexts are helpful for differentiating user input which may be vague or have a different meaning depending on additional details from your application such as user setting and preferences, previous user input, where the user is in your application, geographic location, and so on.
You can include contexts as input parameters of a [DetectIntent][google.cloud.dialogflow.v2.Sessions.DetectIntent] (or [StreamingDetectIntent][google.cloud.dialogflow.v2.Sessions.StreamingDetectIntent]) request, or as output contexts included in the returned intent. Contexts expire when an intent is matched, after the number of DetectIntent requests specified by the lifespan_count parameter, or after 10 minutes if no intents are matched for a DetectIntent request.
For more information about contexts, see the Dialogflow documentation (at https://dialogflow.com/docs/contexts).
Example ¶
package main import ( "context" dialogflow "cloud.google.com/go/dialogflow/apiv2" ) func main() { ctx := context.Background() c, err := dialogflow.NewContextsClient(ctx) if err != nil { // TODO: Handle error. } // TODO: Use client. _ = c }
Output:
func (*ContextsClient) Close ¶
func (c *ContextsClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*ContextsClient) Connection ¶
func (c *ContextsClient) Connection() *grpc.ClientConn
Connection returns the client's connection to the API service.
func (*ContextsClient) CreateContext ¶
func (c *ContextsClient) CreateContext(ctx context.Context, req *dialogflowpb.CreateContextRequest, opts ...gax.CallOption) (*dialogflowpb.Context, error)
CreateContext creates a context.
Example ¶
package main import ( "context" dialogflow "cloud.google.com/go/dialogflow/apiv2" dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" ) func main() { ctx := context.Background() c, err := dialogflow.NewContextsClient(ctx) if err != nil { // TODO: Handle error. } req := &dialogflowpb.CreateContextRequest{ // TODO: Fill request struct fields. } resp, err := c.CreateContext(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*ContextsClient) DeleteAllContexts ¶
func (c *ContextsClient) DeleteAllContexts(ctx context.Context, req *dialogflowpb.DeleteAllContextsRequest, opts ...gax.CallOption) error
DeleteAllContexts deletes all active contexts in the specified session.
Example ¶
package main import ( "context" dialogflow "cloud.google.com/go/dialogflow/apiv2" dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" ) func main() { ctx := context.Background() c, err := dialogflow.NewContextsClient(ctx) if err != nil { // TODO: Handle error. } req := &dialogflowpb.DeleteAllContextsRequest{ // TODO: Fill request struct fields. } err = c.DeleteAllContexts(ctx, req) if err != nil { // TODO: Handle error. } }
Output:
func (*ContextsClient) DeleteContext ¶
func (c *ContextsClient) DeleteContext(ctx context.Context, req *dialogflowpb.DeleteContextRequest, opts ...gax.CallOption) error
DeleteContext deletes the specified context.
Example ¶
package main import ( "context" dialogflow "cloud.google.com/go/dialogflow/apiv2" dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" ) func main() { ctx := context.Background() c, err := dialogflow.NewContextsClient(ctx) if err != nil { // TODO: Handle error. } req := &dialogflowpb.DeleteContextRequest{ // TODO: Fill request struct fields. } err = c.DeleteContext(ctx, req) if err != nil { // TODO: Handle error. } }
Output:
func (*ContextsClient) GetContext ¶
func (c *ContextsClient) GetContext(ctx context.Context, req *dialogflowpb.GetContextRequest, opts ...gax.CallOption) (*dialogflowpb.Context, error)
GetContext retrieves the specified context.
Example ¶
package main import ( "context" dialogflow "cloud.google.com/go/dialogflow/apiv2" dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" ) func main() { ctx := context.Background() c, err := dialogflow.NewContextsClient(ctx) if err != nil { // TODO: Handle error. } req := &dialogflowpb.GetContextRequest{ // TODO: Fill request struct fields. } resp, err := c.GetContext(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*ContextsClient) ListContexts ¶
func (c *ContextsClient) ListContexts(ctx context.Context, req *dialogflowpb.ListContextsRequest, opts ...gax.CallOption) *ContextIterator
ListContexts returns the list of all contexts in the specified session.
Example ¶
package main import ( "context" dialogflow "cloud.google.com/go/dialogflow/apiv2" "google.golang.org/api/iterator" dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" ) func main() { ctx := context.Background() c, err := dialogflow.NewContextsClient(ctx) if err != nil { // TODO: Handle error. } req := &dialogflowpb.ListContextsRequest{ // TODO: Fill request struct fields. } it := c.ListContexts(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } }
Output:
func (*ContextsClient) UpdateContext ¶
func (c *ContextsClient) UpdateContext(ctx context.Context, req *dialogflowpb.UpdateContextRequest, opts ...gax.CallOption) (*dialogflowpb.Context, error)
UpdateContext updates the specified context.
Example ¶
package main import ( "context" dialogflow "cloud.google.com/go/dialogflow/apiv2" dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" ) func main() { ctx := context.Background() c, err := dialogflow.NewContextsClient(ctx) if err != nil { // TODO: Handle error. } req := &dialogflowpb.UpdateContextRequest{ // TODO: Fill request struct fields. } resp, err := c.UpdateContext(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
type EntityTypeIterator ¶
type EntityTypeIterator struct { // InternalFetch is for use by the Google Cloud Libraries only. // It is not part of the stable interface of this package. // // InternalFetch returns results from a single call to the underlying RPC. // The number of results is no greater than pageSize. // If there are no more results, nextPageToken is empty and err is nil. InternalFetch func(pageSize int, pageToken string) (results []*dialogflowpb.EntityType, nextPageToken string, err error) // contains filtered or unexported fields }
EntityTypeIterator manages a stream of *dialogflowpb.EntityType.
func (*EntityTypeIterator) Next ¶
func (it *EntityTypeIterator) Next() (*dialogflowpb.EntityType, error)
Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*EntityTypeIterator) PageInfo ¶
func (it *EntityTypeIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type EntityTypesCallOptions ¶
type EntityTypesCallOptions struct { ListEntityTypes []gax.CallOption GetEntityType []gax.CallOption CreateEntityType []gax.CallOption UpdateEntityType []gax.CallOption DeleteEntityType []gax.CallOption BatchUpdateEntityTypes []gax.CallOption BatchDeleteEntityTypes []gax.CallOption BatchCreateEntities []gax.CallOption BatchUpdateEntities []gax.CallOption BatchDeleteEntities []gax.CallOption }
EntityTypesCallOptions contains the retry settings for each method of EntityTypesClient.
type EntityTypesClient ¶
type EntityTypesClient struct { // LROClient is used internally to handle longrunning operations. // It is exposed so that its CallOptions can be modified if required. // Users should not Close this client. LROClient *lroauto.OperationsClient // The call options for this service. CallOptions *EntityTypesCallOptions // contains filtered or unexported fields }
EntityTypesClient is a client for interacting with Dialogflow API.
Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
func NewEntityTypesClient ¶
func NewEntityTypesClient(ctx context.Context, opts ...option.ClientOption) (*EntityTypesClient, error)
NewEntityTypesClient creates a new entity types client.
Entities are extracted from user input and represent parameters that are meaningful to your application. For example, a date range, a proper name such as a geographic location or landmark, and so on. Entities represent actionable data for your application.
When you define an entity, you can also include synonyms that all map to that entity. For example, "soft drink", "soda", "pop", and so on.
There are three types of entities:
- **System** - entities that are defined by the Dialogflow API for common data types such as date, time, currency, and so on. A system entity is represented by the `EntityType` type.
- **Developer** - entities that are defined by you that represent actionable data that is meaningful to your application. For example, you could define a `pizza.sauce` entity for red or white pizza sauce, a `pizza.cheese` entity for the different types of cheese on a pizza, a `pizza.topping` entity for different toppings, and so on. A developer entity is represented by the `EntityType` type.
- **User** - entities that are built for an individual user such as favorites, preferences, playlists, and so on. A user entity is represented by the [SessionEntityType][google.cloud.dialogflow.v2.SessionEntityType] type.
For more information about entity types, see the [Dialogflow documentation](https://dialogflow.com/docs/entities).
Example ¶
package main import ( "context" dialogflow "cloud.google.com/go/dialogflow/apiv2" ) func main() { ctx := context.Background() c, err := dialogflow.NewEntityTypesClient(ctx) if err != nil { // TODO: Handle error. } // TODO: Use client. _ = c }
Output:
func (*EntityTypesClient) BatchCreateEntities ¶
func (c *EntityTypesClient) BatchCreateEntities(ctx context.Context, req *dialogflowpb.BatchCreateEntitiesRequest, opts ...gax.CallOption) (*BatchCreateEntitiesOperation, error)
BatchCreateEntities creates multiple new entities in the specified entity type (extends the existing collection of entries).
Operation <response: [google.protobuf.Empty][google.protobuf.Empty]>
Example ¶
package main import ( "context" dialogflow "cloud.google.com/go/dialogflow/apiv2" dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" ) func main() { ctx := context.Background() c, err := dialogflow.NewEntityTypesClient(ctx) if err != nil { // TODO: Handle error. } req := &dialogflowpb.BatchCreateEntitiesRequest{ // TODO: Fill request struct fields. } op, err := c.BatchCreateEntities(ctx, req) if err != nil { // TODO: Handle error. } err = op.Wait(ctx) // TODO: Handle error. }
Output:
func (*EntityTypesClient) BatchCreateEntitiesOperation ¶
func (c *EntityTypesClient) BatchCreateEntitiesOperation(name string) *BatchCreateEntitiesOperation
BatchCreateEntitiesOperation returns a new BatchCreateEntitiesOperation from a given name. The name must be that of a previously created BatchCreateEntitiesOperation, possibly from a different process.
func (*EntityTypesClient) BatchDeleteEntities ¶
func (c *EntityTypesClient) BatchDeleteEntities(ctx context.Context, req *dialogflowpb.BatchDeleteEntitiesRequest, opts ...gax.CallOption) (*BatchDeleteEntitiesOperation, error)
BatchDeleteEntities deletes entities in the specified entity type.
Operation <response: [google.protobuf.Empty][google.protobuf.Empty], metadata: [google.protobuf.Struct][google.protobuf.Struct]>
Example ¶
package main import ( "context" dialogflow "cloud.google.com/go/dialogflow/apiv2" dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" ) func main() { ctx := context.Background() c, err := dialogflow.NewEntityTypesClient(ctx) if err != nil { // TODO: Handle error. } req := &dialogflowpb.BatchDeleteEntitiesRequest{ // TODO: Fill request struct fields. } op, err := c.BatchDeleteEntities(ctx, req) if err != nil { // TODO: Handle error. } err = op.Wait(ctx) // TODO: Handle error. }
Output:
func (*EntityTypesClient) BatchDeleteEntitiesOperation ¶
func (c *EntityTypesClient) BatchDeleteEntitiesOperation(name string) *BatchDeleteEntitiesOperation
BatchDeleteEntitiesOperation returns a new BatchDeleteEntitiesOperation from a given name. The name must be that of a previously created BatchDeleteEntitiesOperation, possibly from a different process.
func (*EntityTypesClient) BatchDeleteEntityTypes ¶
func (c *EntityTypesClient) BatchDeleteEntityTypes(ctx context.Context, req *dialogflowpb.BatchDeleteEntityTypesRequest, opts ...gax.CallOption) (*BatchDeleteEntityTypesOperation, error)
BatchDeleteEntityTypes deletes entity types in the specified agent.
Operation <response: [google.protobuf.Empty][google.protobuf.Empty], metadata: [google.protobuf.Struct][google.protobuf.Struct]>
Example ¶
package main import ( "context" dialogflow "cloud.google.com/go/dialogflow/apiv2" dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" ) func main() { ctx := context.Background() c, err := dialogflow.NewEntityTypesClient(ctx) if err != nil { // TODO: Handle error. } req := &dialogflowpb.BatchDeleteEntityTypesRequest{ // TODO: Fill request struct fields. } op, err := c.BatchDeleteEntityTypes(ctx, req) if err != nil { // TODO: Handle error. } err = op.Wait(ctx) // TODO: Handle error. }
Output:
func (*EntityTypesClient) BatchDeleteEntityTypesOperation ¶
func (c *EntityTypesClient) BatchDeleteEntityTypesOperation(name string) *BatchDeleteEntityTypesOperation
BatchDeleteEntityTypesOperation returns a new BatchDeleteEntityTypesOperation from a given name. The name must be that of a previously created BatchDeleteEntityTypesOperation, possibly from a different process.
func (*EntityTypesClient) BatchUpdateEntities ¶
func (c *EntityTypesClient) BatchUpdateEntities(ctx context.Context, req *dialogflowpb.BatchUpdateEntitiesRequest, opts ...gax.CallOption) (*BatchUpdateEntitiesOperation, error)
BatchUpdateEntities updates entities in the specified entity type (replaces the existing collection of entries).
Operation <response: [google.protobuf.Empty][google.protobuf.Empty], metadata: [google.protobuf.Struct][google.protobuf.Struct]>
Example ¶
package main import ( "context" dialogflow "cloud.google.com/go/dialogflow/apiv2" dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" ) func main() { ctx := context.Background() c, err := dialogflow.NewEntityTypesClient(ctx) if err != nil { // TODO: Handle error. } req := &dialogflowpb.BatchUpdateEntitiesRequest{ // TODO: Fill request struct fields. } op, err := c.BatchUpdateEntities(ctx, req) if err != nil { // TODO: Handle error. } err = op.Wait(ctx) // TODO: Handle error. }
Output:
func (*EntityTypesClient) BatchUpdateEntitiesOperation ¶
func (c *EntityTypesClient) BatchUpdateEntitiesOperation(name string) *BatchUpdateEntitiesOperation
BatchUpdateEntitiesOperation returns a new BatchUpdateEntitiesOperation from a given name. The name must be that of a previously created BatchUpdateEntitiesOperation, possibly from a different process.
func (*EntityTypesClient) BatchUpdateEntityTypes ¶
func (c *EntityTypesClient) BatchUpdateEntityTypes(ctx context.Context, req *dialogflowpb.BatchUpdateEntityTypesRequest, opts ...gax.CallOption) (*BatchUpdateEntityTypesOperation, error)
BatchUpdateEntityTypes updates/Creates multiple entity types in the specified agent.
Operation <response: [BatchUpdateEntityTypesResponse][google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse], metadata: [google.protobuf.Struct][google.protobuf.Struct]>
Example ¶
package main import ( "context" dialogflow "cloud.google.com/go/dialogflow/apiv2" dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" ) func main() { ctx := context.Background() c, err := dialogflow.NewEntityTypesClient(ctx) if err != nil { // TODO: Handle error. } req := &dialogflowpb.BatchUpdateEntityTypesRequest{ // TODO: Fill request struct fields. } op, err := c.BatchUpdateEntityTypes(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*EntityTypesClient) BatchUpdateEntityTypesOperation ¶
func (c *EntityTypesClient) BatchUpdateEntityTypesOperation(name string) *BatchUpdateEntityTypesOperation
BatchUpdateEntityTypesOperation returns a new BatchUpdateEntityTypesOperation from a given name. The name must be that of a previously created BatchUpdateEntityTypesOperation, possibly from a different process.
func (*EntityTypesClient) Close ¶
func (c *EntityTypesClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*EntityTypesClient) Connection ¶
func (c *EntityTypesClient) Connection() *grpc.ClientConn
Connection returns the client's connection to the API service.
func (*EntityTypesClient) CreateEntityType ¶
func (c *EntityTypesClient) CreateEntityType(ctx context.Context, req *dialogflowpb.CreateEntityTypeRequest, opts ...gax.CallOption) (*dialogflowpb.EntityType, error)
CreateEntityType creates an entity type in the specified agent.
Example ¶
package main import ( "context" dialogflow "cloud.google.com/go/dialogflow/apiv2" dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" ) func main() { ctx := context.Background() c, err := dialogflow.NewEntityTypesClient(ctx) if err != nil { // TODO: Handle error. } req := &dialogflowpb.CreateEntityTypeRequest{ // TODO: Fill request struct fields. } resp, err := c.CreateEntityType(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*EntityTypesClient) DeleteEntityType ¶
func (c *EntityTypesClient) DeleteEntityType(ctx context.Context, req *dialogflowpb.DeleteEntityTypeRequest, opts ...gax.CallOption) error
DeleteEntityType deletes the specified entity type.
Example ¶
package main import ( "context" dialogflow "cloud.google.com/go/dialogflow/apiv2" dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" ) func main() { ctx := context.Background() c, err := dialogflow.NewEntityTypesClient(ctx) if err != nil { // TODO: Handle error. } req := &dialogflowpb.DeleteEntityTypeRequest{ // TODO: Fill request struct fields. } err = c.DeleteEntityType(ctx, req) if err != nil { // TODO: Handle error. } }
Output:
func (*EntityTypesClient) GetEntityType ¶
func (c *EntityTypesClient) GetEntityType(ctx context.Context, req *dialogflowpb.GetEntityTypeRequest, opts ...gax.CallOption) (*dialogflowpb.EntityType, error)
GetEntityType retrieves the specified entity type.
Example ¶
package main import ( "context" dialogflow "cloud.google.com/go/dialogflow/apiv2" dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" ) func main() { ctx := context.Background() c, err := dialogflow.NewEntityTypesClient(ctx) if err != nil { // TODO: Handle error. } req := &dialogflowpb.GetEntityTypeRequest{ // TODO: Fill request struct fields. } resp, err := c.GetEntityType(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*EntityTypesClient) ListEntityTypes ¶
func (c *EntityTypesClient) ListEntityTypes(ctx context.Context, req *dialogflowpb.ListEntityTypesRequest, opts ...gax.CallOption) *EntityTypeIterator
ListEntityTypes returns the list of all entity types in the specified agent.
Example ¶
package main import ( "context" dialogflow "cloud.google.com/go/dialogflow/apiv2" "google.golang.org/api/iterator" dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" ) func main() { ctx := context.Background() c, err := dialogflow.NewEntityTypesClient(ctx) if err != nil { // TODO: Handle error. } req := &dialogflowpb.ListEntityTypesRequest{ // TODO: Fill request struct fields. } it := c.ListEntityTypes(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } }
Output:
func (*EntityTypesClient) UpdateEntityType ¶
func (c *EntityTypesClient) UpdateEntityType(ctx context.Context, req *dialogflowpb.UpdateEntityTypeRequest, opts ...gax.CallOption) (*dialogflowpb.EntityType, error)
UpdateEntityType updates the specified entity type.
Example ¶
package main import ( "context" dialogflow "cloud.google.com/go/dialogflow/apiv2" dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" ) func main() { ctx := context.Background() c, err := dialogflow.NewEntityTypesClient(ctx) if err != nil { // TODO: Handle error. } req := &dialogflowpb.UpdateEntityTypeRequest{ // TODO: Fill request struct fields. } resp, err := c.UpdateEntityType(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
type ExportAgentOperation ¶
type ExportAgentOperation struct {
// contains filtered or unexported fields
}
ExportAgentOperation manages a long-running operation from ExportAgent.
func (*ExportAgentOperation) Done ¶
func (op *ExportAgentOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*ExportAgentOperation) Metadata ¶
func (op *ExportAgentOperation) Metadata() (*structpbpb.Struct, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*ExportAgentOperation) Name ¶
func (op *ExportAgentOperation) Name() string
Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*ExportAgentOperation) Poll ¶
func (op *ExportAgentOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*dialogflowpb.ExportAgentResponse, error)
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*ExportAgentOperation) Wait ¶
func (op *ExportAgentOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*dialogflowpb.ExportAgentResponse, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
type ImportAgentOperation ¶
type ImportAgentOperation struct {
// contains filtered or unexported fields
}
ImportAgentOperation manages a long-running operation from ImportAgent.
func (*ImportAgentOperation) Done ¶
func (op *ImportAgentOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*ImportAgentOperation) Metadata ¶
func (op *ImportAgentOperation) Metadata() (*structpbpb.Struct, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*ImportAgentOperation) Name ¶
func (op *ImportAgentOperation) Name() string
Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*ImportAgentOperation) Poll ¶
func (op *ImportAgentOperation) Poll(ctx context.Context, opts ...gax.CallOption) error
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true.
func (*ImportAgentOperation) Wait ¶
func (op *ImportAgentOperation) Wait(ctx context.Context, opts ...gax.CallOption) error
Wait blocks until the long-running operation is completed, returning any error encountered.
See documentation of Poll for error-handling information.
type IntentIterator ¶
type IntentIterator struct { // InternalFetch is for use by the Google Cloud Libraries only. // It is not part of the stable interface of this package. // // InternalFetch returns results from a single call to the underlying RPC. // The number of results is no greater than pageSize. // If there are no more results, nextPageToken is empty and err is nil. InternalFetch func(pageSize int, pageToken string) (results []*dialogflowpb.Intent, nextPageToken string, err error) // contains filtered or unexported fields }
IntentIterator manages a stream of *dialogflowpb.Intent.
func (*IntentIterator) Next ¶
func (it *IntentIterator) Next() (*dialogflowpb.Intent, error)
Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*IntentIterator) PageInfo ¶
func (it *IntentIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type IntentsCallOptions ¶
type IntentsCallOptions struct { ListIntents []gax.CallOption GetIntent []gax.CallOption CreateIntent []gax.CallOption UpdateIntent []gax.CallOption DeleteIntent []gax.CallOption BatchUpdateIntents []gax.CallOption BatchDeleteIntents []gax.CallOption }
IntentsCallOptions contains the retry settings for each method of IntentsClient.
type IntentsClient ¶
type IntentsClient struct { // LROClient is used internally to handle longrunning operations. // It is exposed so that its CallOptions can be modified if required. // Users should not Close this client. LROClient *lroauto.OperationsClient // The call options for this service. CallOptions *IntentsCallOptions // contains filtered or unexported fields }
IntentsClient is a client for interacting with Dialogflow API.
Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
func NewIntentsClient ¶
func NewIntentsClient(ctx context.Context, opts ...option.ClientOption) (*IntentsClient, error)
NewIntentsClient creates a new intents client.
An intent represents a mapping between input from a user and an action to be taken by your application. When you pass user input to the [DetectIntent][google.cloud.dialogflow.v2.Sessions.DetectIntent] (or [StreamingDetectIntent][google.cloud.dialogflow.v2.Sessions.StreamingDetectIntent]) method, the Dialogflow API analyzes the input and searches for a matching intent. If no match is found, the Dialogflow API returns a fallback intent (`is_fallback` = true).
You can provide additional information for the Dialogflow API to use to match user input to an intent by adding the following to your intent.
- **Contexts** - provide additional context for intent analysis. For example, if an intent is related to an object in your application that plays music, you can provide a context to determine when to match the intent if the user input is “turn it off”. You can include a context that matches the intent when there is previous user input of "play music", and not when there is previous user input of "turn on the light".
- **Events** - allow for matching an intent by using an event name instead of user input. Your application can provide an event name and related parameters to the Dialogflow API to match an intent. For example, when your application starts, you can send a welcome event with a user name parameter to the Dialogflow API to match an intent with a personalized welcome message for the user.
- **Training phrases** - provide examples of user input to train the Dialogflow API agent to better match intents.
For more information about intents, see the [Dialogflow documentation](https://dialogflow.com/docs/intents).
Example ¶
package main import ( "context" dialogflow "cloud.google.com/go/dialogflow/apiv2" ) func main() { ctx := context.Background() c, err := dialogflow.NewIntentsClient(ctx) if err != nil { // TODO: Handle error. } // TODO: Use client. _ = c }
Output:
func (*IntentsClient) BatchDeleteIntents ¶
func (c *IntentsClient) BatchDeleteIntents(ctx context.Context, req *dialogflowpb.BatchDeleteIntentsRequest, opts ...gax.CallOption) (*BatchDeleteIntentsOperation, error)
BatchDeleteIntents deletes intents in the specified agent.
Operation <response: [google.protobuf.Empty][google.protobuf.Empty]>
Example ¶
package main import ( "context" dialogflow "cloud.google.com/go/dialogflow/apiv2" dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" ) func main() { ctx := context.Background() c, err := dialogflow.NewIntentsClient(ctx) if err != nil { // TODO: Handle error. } req := &dialogflowpb.BatchDeleteIntentsRequest{ // TODO: Fill request struct fields. } op, err := c.BatchDeleteIntents(ctx, req) if err != nil { // TODO: Handle error. } err = op.Wait(ctx) // TODO: Handle error. }
Output:
func (*IntentsClient) BatchDeleteIntentsOperation ¶
func (c *IntentsClient) BatchDeleteIntentsOperation(name string) *BatchDeleteIntentsOperation
BatchDeleteIntentsOperation returns a new BatchDeleteIntentsOperation from a given name. The name must be that of a previously created BatchDeleteIntentsOperation, possibly from a different process.
func (*IntentsClient) BatchUpdateIntents ¶
func (c *IntentsClient) BatchUpdateIntents(ctx context.Context, req *dialogflowpb.BatchUpdateIntentsRequest, opts ...gax.CallOption) (*BatchUpdateIntentsOperation, error)
BatchUpdateIntents updates/Creates multiple intents in the specified agent.
Operation <response: [BatchUpdateIntentsResponse][google.cloud.dialogflow.v2.BatchUpdateIntentsResponse]>
Example ¶
package main import ( "context" dialogflow "cloud.google.com/go/dialogflow/apiv2" dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" ) func main() { ctx := context.Background() c, err := dialogflow.NewIntentsClient(ctx) if err != nil { // TODO: Handle error. } req := &dialogflowpb.BatchUpdateIntentsRequest{ // TODO: Fill request struct fields. } op, err := c.BatchUpdateIntents(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*IntentsClient) BatchUpdateIntentsOperation ¶
func (c *IntentsClient) BatchUpdateIntentsOperation(name string) *BatchUpdateIntentsOperation
BatchUpdateIntentsOperation returns a new BatchUpdateIntentsOperation from a given name. The name must be that of a previously created BatchUpdateIntentsOperation, possibly from a different process.
func (*IntentsClient) Close ¶
func (c *IntentsClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*IntentsClient) Connection ¶
func (c *IntentsClient) Connection() *grpc.ClientConn
Connection returns the client's connection to the API service.
func (*IntentsClient) CreateIntent ¶
func (c *IntentsClient) CreateIntent(ctx context.Context, req *dialogflowpb.CreateIntentRequest, opts ...gax.CallOption) (*dialogflowpb.Intent, error)
CreateIntent creates an intent in the specified agent.
Example ¶
package main import ( "context" dialogflow "cloud.google.com/go/dialogflow/apiv2" dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" ) func main() { ctx := context.Background() c, err := dialogflow.NewIntentsClient(ctx) if err != nil { // TODO: Handle error. } req := &dialogflowpb.CreateIntentRequest{ // TODO: Fill request struct fields. } resp, err := c.CreateIntent(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*IntentsClient) DeleteIntent ¶
func (c *IntentsClient) DeleteIntent(ctx context.Context, req *dialogflowpb.DeleteIntentRequest, opts ...gax.CallOption) error
DeleteIntent deletes the specified intent.
Example ¶
package main import ( "context" dialogflow "cloud.google.com/go/dialogflow/apiv2" dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" ) func main() { ctx := context.Background() c, err := dialogflow.NewIntentsClient(ctx) if err != nil { // TODO: Handle error. } req := &dialogflowpb.DeleteIntentRequest{ // TODO: Fill request struct fields. } err = c.DeleteIntent(ctx, req) if err != nil { // TODO: Handle error. } }
Output:
func (*IntentsClient) GetIntent ¶
func (c *IntentsClient) GetIntent(ctx context.Context, req *dialogflowpb.GetIntentRequest, opts ...gax.CallOption) (*dialogflowpb.Intent, error)
GetIntent retrieves the specified intent.
Example ¶
package main import ( "context" dialogflow "cloud.google.com/go/dialogflow/apiv2" dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" ) func main() { ctx := context.Background() c, err := dialogflow.NewIntentsClient(ctx) if err != nil { // TODO: Handle error. } req := &dialogflowpb.GetIntentRequest{ // TODO: Fill request struct fields. } resp, err := c.GetIntent(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*IntentsClient) ListIntents ¶
func (c *IntentsClient) ListIntents(ctx context.Context, req *dialogflowpb.ListIntentsRequest, opts ...gax.CallOption) *IntentIterator
ListIntents returns the list of all intents in the specified agent.
Example ¶
package main import ( "context" dialogflow "cloud.google.com/go/dialogflow/apiv2" "google.golang.org/api/iterator" dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" ) func main() { ctx := context.Background() c, err := dialogflow.NewIntentsClient(ctx) if err != nil { // TODO: Handle error. } req := &dialogflowpb.ListIntentsRequest{ // TODO: Fill request struct fields. } it := c.ListIntents(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } }
Output:
func (*IntentsClient) UpdateIntent ¶
func (c *IntentsClient) UpdateIntent(ctx context.Context, req *dialogflowpb.UpdateIntentRequest, opts ...gax.CallOption) (*dialogflowpb.Intent, error)
UpdateIntent updates the specified intent.
Example ¶
package main import ( "context" dialogflow "cloud.google.com/go/dialogflow/apiv2" dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" ) func main() { ctx := context.Background() c, err := dialogflow.NewIntentsClient(ctx) if err != nil { // TODO: Handle error. } req := &dialogflowpb.UpdateIntentRequest{ // TODO: Fill request struct fields. } resp, err := c.UpdateIntent(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
type RestoreAgentOperation ¶
type RestoreAgentOperation struct {
// contains filtered or unexported fields
}
RestoreAgentOperation manages a long-running operation from RestoreAgent.
func (*RestoreAgentOperation) Done ¶
func (op *RestoreAgentOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*RestoreAgentOperation) Metadata ¶
func (op *RestoreAgentOperation) Metadata() (*structpbpb.Struct, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*RestoreAgentOperation) Name ¶
func (op *RestoreAgentOperation) Name() string
Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*RestoreAgentOperation) Poll ¶
func (op *RestoreAgentOperation) Poll(ctx context.Context, opts ...gax.CallOption) error
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true.
func (*RestoreAgentOperation) Wait ¶
func (op *RestoreAgentOperation) Wait(ctx context.Context, opts ...gax.CallOption) error
Wait blocks until the long-running operation is completed, returning any error encountered.
See documentation of Poll for error-handling information.
type SessionEntityTypeIterator ¶
type SessionEntityTypeIterator struct { // InternalFetch is for use by the Google Cloud Libraries only. // It is not part of the stable interface of this package. // // InternalFetch returns results from a single call to the underlying RPC. // The number of results is no greater than pageSize. // If there are no more results, nextPageToken is empty and err is nil. InternalFetch func(pageSize int, pageToken string) (results []*dialogflowpb.SessionEntityType, nextPageToken string, err error) // contains filtered or unexported fields }
SessionEntityTypeIterator manages a stream of *dialogflowpb.SessionEntityType.
func (*SessionEntityTypeIterator) Next ¶
func (it *SessionEntityTypeIterator) Next() (*dialogflowpb.SessionEntityType, error)
Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*SessionEntityTypeIterator) PageInfo ¶
func (it *SessionEntityTypeIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type SessionEntityTypesCallOptions ¶
type SessionEntityTypesCallOptions struct { ListSessionEntityTypes []gax.CallOption GetSessionEntityType []gax.CallOption CreateSessionEntityType []gax.CallOption UpdateSessionEntityType []gax.CallOption DeleteSessionEntityType []gax.CallOption }
SessionEntityTypesCallOptions contains the retry settings for each method of SessionEntityTypesClient.
type SessionEntityTypesClient ¶
type SessionEntityTypesClient struct { // The call options for this service. CallOptions *SessionEntityTypesCallOptions // contains filtered or unexported fields }
SessionEntityTypesClient is a client for interacting with Dialogflow API.
Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
func NewSessionEntityTypesClient ¶
func NewSessionEntityTypesClient(ctx context.Context, opts ...option.ClientOption) (*SessionEntityTypesClient, error)
NewSessionEntityTypesClient creates a new session entity types client.
Entities are extracted from user input and represent parameters that are meaningful to your application. For example, a date range, a proper name such as a geographic location or landmark, and so on. Entities represent actionable data for your application.
Session entity types are referred to as **User** entity types and are entities that are built for an individual user such as favorites, preferences, playlists, and so on. You can redefine a session entity type at the session level.
For more information about entity types, see the [Dialogflow documentation](https://dialogflow.com/docs/entities).
Example ¶
package main import ( "context" dialogflow "cloud.google.com/go/dialogflow/apiv2" ) func main() { ctx := context.Background() c, err := dialogflow.NewSessionEntityTypesClient(ctx) if err != nil { // TODO: Handle error. } // TODO: Use client. _ = c }
Output:
func (*SessionEntityTypesClient) Close ¶
func (c *SessionEntityTypesClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*SessionEntityTypesClient) Connection ¶
func (c *SessionEntityTypesClient) Connection() *grpc.ClientConn
Connection returns the client's connection to the API service.
func (*SessionEntityTypesClient) CreateSessionEntityType ¶
func (c *SessionEntityTypesClient) CreateSessionEntityType(ctx context.Context, req *dialogflowpb.CreateSessionEntityTypeRequest, opts ...gax.CallOption) (*dialogflowpb.SessionEntityType, error)
CreateSessionEntityType creates a session entity type.
Example ¶
package main import ( "context" dialogflow "cloud.google.com/go/dialogflow/apiv2" dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" ) func main() { ctx := context.Background() c, err := dialogflow.NewSessionEntityTypesClient(ctx) if err != nil { // TODO: Handle error. } req := &dialogflowpb.CreateSessionEntityTypeRequest{ // TODO: Fill request struct fields. } resp, err := c.CreateSessionEntityType(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*SessionEntityTypesClient) DeleteSessionEntityType ¶
func (c *SessionEntityTypesClient) DeleteSessionEntityType(ctx context.Context, req *dialogflowpb.DeleteSessionEntityTypeRequest, opts ...gax.CallOption) error
DeleteSessionEntityType deletes the specified session entity type.
Example ¶
package main import ( "context" dialogflow "cloud.google.com/go/dialogflow/apiv2" dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" ) func main() { ctx := context.Background() c, err := dialogflow.NewSessionEntityTypesClient(ctx) if err != nil { // TODO: Handle error. } req := &dialogflowpb.DeleteSessionEntityTypeRequest{ // TODO: Fill request struct fields. } err = c.DeleteSessionEntityType(ctx, req) if err != nil { // TODO: Handle error. } }
Output:
func (*SessionEntityTypesClient) GetSessionEntityType ¶
func (c *SessionEntityTypesClient) GetSessionEntityType(ctx context.Context, req *dialogflowpb.GetSessionEntityTypeRequest, opts ...gax.CallOption) (*dialogflowpb.SessionEntityType, error)
GetSessionEntityType retrieves the specified session entity type.
Example ¶
package main import ( "context" dialogflow "cloud.google.com/go/dialogflow/apiv2" dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" ) func main() { ctx := context.Background() c, err := dialogflow.NewSessionEntityTypesClient(ctx) if err != nil { // TODO: Handle error. } req := &dialogflowpb.GetSessionEntityTypeRequest{ // TODO: Fill request struct fields. } resp, err := c.GetSessionEntityType(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*SessionEntityTypesClient) ListSessionEntityTypes ¶
func (c *SessionEntityTypesClient) ListSessionEntityTypes(ctx context.Context, req *dialogflowpb.ListSessionEntityTypesRequest, opts ...gax.CallOption) *SessionEntityTypeIterator
ListSessionEntityTypes returns the list of all session entity types in the specified session.
Example ¶
package main import ( "context" dialogflow "cloud.google.com/go/dialogflow/apiv2" "google.golang.org/api/iterator" dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" ) func main() { ctx := context.Background() c, err := dialogflow.NewSessionEntityTypesClient(ctx) if err != nil { // TODO: Handle error. } req := &dialogflowpb.ListSessionEntityTypesRequest{ // TODO: Fill request struct fields. } it := c.ListSessionEntityTypes(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } }
Output:
func (*SessionEntityTypesClient) UpdateSessionEntityType ¶
func (c *SessionEntityTypesClient) UpdateSessionEntityType(ctx context.Context, req *dialogflowpb.UpdateSessionEntityTypeRequest, opts ...gax.CallOption) (*dialogflowpb.SessionEntityType, error)
UpdateSessionEntityType updates the specified session entity type.
Example ¶
package main import ( "context" dialogflow "cloud.google.com/go/dialogflow/apiv2" dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" ) func main() { ctx := context.Background() c, err := dialogflow.NewSessionEntityTypesClient(ctx) if err != nil { // TODO: Handle error. } req := &dialogflowpb.UpdateSessionEntityTypeRequest{ // TODO: Fill request struct fields. } resp, err := c.UpdateSessionEntityType(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
type SessionsCallOptions ¶
type SessionsCallOptions struct { DetectIntent []gax.CallOption StreamingDetectIntent []gax.CallOption }
SessionsCallOptions contains the retry settings for each method of SessionsClient.
type SessionsClient ¶
type SessionsClient struct { // The call options for this service. CallOptions *SessionsCallOptions // contains filtered or unexported fields }
SessionsClient is a client for interacting with Dialogflow API.
Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
func NewSessionsClient ¶
func NewSessionsClient(ctx context.Context, opts ...option.ClientOption) (*SessionsClient, error)
NewSessionsClient creates a new sessions client.
A session represents an interaction with a user. You retrieve user input and pass it to the [DetectIntent][google.cloud.dialogflow.v2.Sessions.DetectIntent] (or [StreamingDetectIntent][google.cloud.dialogflow.v2.Sessions.StreamingDetectIntent]) method to determine user intent and respond.
Example ¶
package main import ( "context" dialogflow "cloud.google.com/go/dialogflow/apiv2" ) func main() { ctx := context.Background() c, err := dialogflow.NewSessionsClient(ctx) if err != nil { // TODO: Handle error. } // TODO: Use client. _ = c }
Output:
func (*SessionsClient) Close ¶
func (c *SessionsClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*SessionsClient) Connection ¶
func (c *SessionsClient) Connection() *grpc.ClientConn
Connection returns the client's connection to the API service.
func (*SessionsClient) DetectIntent ¶
func (c *SessionsClient) DetectIntent(ctx context.Context, req *dialogflowpb.DetectIntentRequest, opts ...gax.CallOption) (*dialogflowpb.DetectIntentResponse, error)
DetectIntent processes a natural language query and returns structured, actionable data as a result. This method is not idempotent, because it may cause contexts and session entity types to be updated, which in turn might affect results of future queries.
Example ¶
package main import ( "context" dialogflow "cloud.google.com/go/dialogflow/apiv2" dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" ) func main() { ctx := context.Background() c, err := dialogflow.NewSessionsClient(ctx) if err != nil { // TODO: Handle error. } req := &dialogflowpb.DetectIntentRequest{ // TODO: Fill request struct fields. } resp, err := c.DetectIntent(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*SessionsClient) StreamingDetectIntent ¶
func (c *SessionsClient) StreamingDetectIntent(ctx context.Context, opts ...gax.CallOption) (dialogflowpb.Sessions_StreamingDetectIntentClient, error)
StreamingDetectIntent processes a natural language query in audio format in a streaming fashion and returns structured, actionable data as a result. This method is only available via the gRPC API (not REST).
Example ¶
package main import ( "context" "io" dialogflow "cloud.google.com/go/dialogflow/apiv2" dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" ) func main() { ctx := context.Background() c, err := dialogflow.NewSessionsClient(ctx) if err != nil { // TODO: Handle error. } stream, err := c.StreamingDetectIntent(ctx) if err != nil { // TODO: Handle error. } go func() { reqs := []*dialogflowpb.StreamingDetectIntentRequest{ // TODO: Create requests. } for _, req := range reqs { if err := stream.Send(req); err != nil { // TODO: Handle error. } } stream.CloseSend() }() for { resp, err := stream.Recv() if err == io.EOF { break } if err != nil { // TODO: handle error. } // TODO: Use resp. _ = resp } }
Output:
type TrainAgentOperation ¶
type TrainAgentOperation struct {
// contains filtered or unexported fields
}
TrainAgentOperation manages a long-running operation from TrainAgent.
func (*TrainAgentOperation) Done ¶
func (op *TrainAgentOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*TrainAgentOperation) Metadata ¶
func (op *TrainAgentOperation) Metadata() (*structpbpb.Struct, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*TrainAgentOperation) Name ¶
func (op *TrainAgentOperation) Name() string
Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*TrainAgentOperation) Poll ¶
func (op *TrainAgentOperation) Poll(ctx context.Context, opts ...gax.CallOption) error
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true.
func (*TrainAgentOperation) Wait ¶
func (op *TrainAgentOperation) Wait(ctx context.Context, opts ...gax.CallOption) error
Wait blocks until the long-running operation is completed, returning any error encountered.
See documentation of Poll for error-handling information.