- 1.62.0 (latest)
- 1.61.0
- 1.60.0
- 1.59.0
- 1.58.1
- 1.57.1
- 1.56.0
- 1.55.0
- 1.54.3
- 1.53.0
- 1.52.0
- 1.51.0
- 1.50.0
- 1.49.0
- 1.48.2
- 1.47.0
- 1.46.0
- 1.45.0
- 1.44.3
- 1.42.0
- 1.41.0
- 1.40.1
- 1.39.0
- 1.38.0
- 1.37.0
- 1.36.0
- 1.35.0
- 1.34.0
- 1.33.0
- 1.32.1
- 1.31.0
- 1.30.0
- 1.29.0
- 1.28.0
- 1.27.0
- 1.26.0
- 1.23.0
- 1.22.0
- 1.21.0
- 1.20.0
- 1.19.0
- 1.18.0
- 1.17.0
- 1.16.1
- 1.15.0
- 1.14.0
- 1.13.0
- 1.12.1
- 1.11.0
- 1.10.0
- 1.9.0
- 1.8.1
- 1.7.0
- 1.6.0
- 1.5.0
- 1.4.0
- 1.3.0
- 1.2.0
- 1.1.0
- 1.0.0
- 0.1.0
Package dialogflow is an auto-generated package for the Dialogflow API.
Builds conversational interfaces (for example, chatbots, and voice-powered apps and devices).
General documentation
For information that is relevant for all client libraries please reference https://pkg.go.dev/cloud.google.com/go#pkg-overview. Some information on this page includes:
- Authentication and Authorization
- Timeouts and Cancellation
- Testing against Client Libraries
- Debugging Client Libraries
- Inspecting errors
Example usage
To get started with this package, create a client.
ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := dialogflow.NewAgentsClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close()
The client will use your default application credentials. Clients should be reused instead of created as needed. The methods of Client are safe for concurrent use by multiple goroutines. The returned client must be Closed when it is done being used.
Using the Client
The following is an example of making an API call with the newly created client.
ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := dialogflow.NewAgentsClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &dialogflowpb.DeleteAgentRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#DeleteAgentRequest. } err = c.DeleteAgent(ctx, req) if err != nil { // TODO: Handle error. }
Use of Context
The ctx passed to NewAgentsClient is used for authentication requests and for creating the underlying connection, but is not used for subsequent calls. Individual methods on the client use the ctx given to them.
To close the open connection, use the Close() method.
Functions
func DefaultAuthScopes
func DefaultAuthScopes() []string
DefaultAuthScopes reports the default set of authentication scopes to use with this package.
AgentIterator
type AgentIterator struct {
// Response is the raw response for the current page.
// It must be cast to the RPC response type.
// Calling Next() or InternalFetch() updates this value.
Response interface{}
// 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) All
func (it *AgentIterator) All() iter.Seq2[*dialogflowpb.Agent, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
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.
AgentsCallOptions
type AgentsCallOptions struct {
GetAgent []gax.CallOption
SetAgent []gax.CallOption
DeleteAgent []gax.CallOption
SearchAgents []gax.CallOption
TrainAgent []gax.CallOption
ExportAgent []gax.CallOption
ImportAgent []gax.CallOption
RestoreAgent []gax.CallOption
GetValidationResult []gax.CallOption
GetLocation []gax.CallOption
ListLocations []gax.CallOption
CancelOperation []gax.CallOption
GetOperation []gax.CallOption
ListOperations []gax.CallOption
}
AgentsCallOptions contains the retry settings for each method of AgentsClient.
AgentsClient
type AgentsClient struct {
// The call options for this service.
CallOptions *AgentsCallOptions
// LROClient is used internally to handle long-running operations.
// It is exposed so that its CallOptions can be modified if required.
// Users should not Close this client.
LROClient *lroauto.OperationsClient
// 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.
Service for managing Agents.
func NewAgentsClient
func NewAgentsClient(ctx context.Context, opts ...option.ClientOption) (*AgentsClient, error)
NewAgentsClient creates a new agents client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service for managing Agents.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewAgentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func NewAgentsRESTClient
func NewAgentsRESTClient(ctx context.Context, opts ...option.ClientOption) (*AgentsClient, error)
NewAgentsRESTClient creates a new agents rest client.
Service for managing Agents.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewAgentsRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*AgentsClient) CancelOperation
func (c *AgentsClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error
CancelOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewAgentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.CancelOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
}
err = c.CancelOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
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 (deprecated)
func (c *AgentsClient) Connection() *grpc.ClientConn
Connection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not always return the same resource.
func (*AgentsClient) DeleteAgent
func (c *AgentsClient) DeleteAgent(ctx context.Context, req *dialogflowpb.DeleteAgentRequest, opts ...gax.CallOption) error
DeleteAgent deletes the specified agent.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewAgentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.DeleteAgentRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#DeleteAgentRequest.
}
err = c.DeleteAgent(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
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.
This method is a long-running operation (at https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned Operation type has the following method-specific fields:
metadata: An empty Struct
message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
response:
ExportAgentResponse
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewAgentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.ExportAgentRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#ExportAgentRequest.
}
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
}
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 "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewAgentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.GetAgentRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#GetAgentRequest.
}
resp, err := c.GetAgent(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*AgentsClient) GetLocation
func (c *AgentsClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error)
GetLocation gets information about a location.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewAgentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.GetLocationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest.
}
resp, err := c.GetLocation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*AgentsClient) GetOperation
func (c *AgentsClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
GetOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewAgentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.GetOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
}
resp, err := c.GetOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*AgentsClient) GetValidationResult
func (c *AgentsClient) GetValidationResult(ctx context.Context, req *dialogflowpb.GetValidationResultRequest, opts ...gax.CallOption) (*dialogflowpb.ValidationResult, error)
GetValidationResult gets agent validation result. Agent validation is performed during training time and is updated automatically when training is completed.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewAgentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.GetValidationResultRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#GetValidationResultRequest.
}
resp, err := c.GetValidationResult(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
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. After the import, the imported draft agent will be trained automatically (unless disabled in agent settings). However, once the import is done, training may not be completed yet. Please call TrainAgent and wait for the operation it returns in order to train explicitly.
This method is a long-running operation (at https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned Operation type has the following method-specific fields:
metadata: An empty Struct
message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
response: An Empty
message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
The operation only tracks when importing is complete, not when it is done training.
Note: You should always train an agent prior to sending it queries. See the training documentation (at https://cloud.google.com/dialogflow/es/docs/training).
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewAgentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.ImportAgentRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#ImportAgentRequest.
}
op, err := c.ImportAgent(ctx, req)
if err != nil {
// TODO: Handle error.
}
err = op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
}
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) ListLocations
func (c *AgentsClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator
ListLocations lists information about the supported locations for this service.
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
"google.golang.org/api/iterator"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewAgentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
it := c.ListLocations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*locationpb.ListLocationsResponse)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewAgentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
for resp, err := range c.ListLocations(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*AgentsClient) ListOperations
func (c *AgentsClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewAgentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
it := c.ListOperations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*longrunningpb.ListOperationsResponse)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewAgentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
for resp, err := range c.ListOperations(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
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. After the restore, the restored draft agent will be trained automatically (unless disabled in agent settings). However, once the restore is done, training may not be completed yet. Please call TrainAgent and wait for the operation it returns in order to train explicitly.
This method is a long-running operation (at https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned Operation type has the following method-specific fields:
metadata: An empty Struct
message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
response: An Empty
message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
The operation only tracks when restoring is complete, not when it is done training.
Note: You should always train an agent prior to sending it queries. See the training documentation (at https://cloud.google.com/dialogflow/es/docs/training).
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewAgentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.RestoreAgentRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#RestoreAgentRequest.
}
op, err := c.RestoreAgent(ctx, req)
if err != nil {
// TODO: Handle error.
}
err = op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
}
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).
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewAgentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.SearchAgentsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#SearchAgentsRequest.
}
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
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*dialogflowpb.SearchAgentsResponse)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewAgentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.SearchAgentsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#SearchAgentsRequest.
}
for resp, err := range c.SearchAgents(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*AgentsClient) SetAgent
func (c *AgentsClient) SetAgent(ctx context.Context, req *dialogflowpb.SetAgentRequest, opts ...gax.CallOption) (*dialogflowpb.Agent, error)
SetAgent creates/updates the specified agent.
Note: You should always train an agent prior to sending it queries. See the training documentation (at https://cloud.google.com/dialogflow/es/docs/training).
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewAgentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.SetAgentRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#SetAgentRequest.
}
resp, err := c.SetAgent(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*AgentsClient) TrainAgent
func (c *AgentsClient) TrainAgent(ctx context.Context, req *dialogflowpb.TrainAgentRequest, opts ...gax.CallOption) (*TrainAgentOperation, error)
TrainAgent trains the specified agent.
This method is a long-running operation (at https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned Operation type has the following method-specific fields:
metadata: An empty Struct
message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
response: An Empty
message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
Note: You should always train an agent prior to sending it queries. See the training documentation (at https://cloud.google.com/dialogflow/es/docs/training).
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewAgentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.TrainAgentRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#TrainAgentRequest.
}
op, err := c.TrainAgent(ctx, req)
if err != nil {
// TODO: Handle error.
}
err = op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
}
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.
AnswerRecordIterator
type AnswerRecordIterator struct {
// Response is the raw response for the current page.
// It must be cast to the RPC response type.
// Calling Next() or InternalFetch() updates this value.
Response interface{}
// 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.AnswerRecord, nextPageToken string, err error)
// contains filtered or unexported fields
}
AnswerRecordIterator manages a stream of *dialogflowpb.AnswerRecord.
func (*AnswerRecordIterator) All
func (it *AnswerRecordIterator) All() iter.Seq2[*dialogflowpb.AnswerRecord, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*AnswerRecordIterator) Next
func (it *AnswerRecordIterator) Next() (*dialogflowpb.AnswerRecord, 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 (*AnswerRecordIterator) PageInfo
func (it *AnswerRecordIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
AnswerRecordsCallOptions
type AnswerRecordsCallOptions struct {
ListAnswerRecords []gax.CallOption
UpdateAnswerRecord []gax.CallOption
GetLocation []gax.CallOption
ListLocations []gax.CallOption
CancelOperation []gax.CallOption
GetOperation []gax.CallOption
ListOperations []gax.CallOption
}
AnswerRecordsCallOptions contains the retry settings for each method of AnswerRecordsClient.
AnswerRecordsClient
type AnswerRecordsClient struct {
// The call options for this service.
CallOptions *AnswerRecordsCallOptions
// contains filtered or unexported fields
}
AnswerRecordsClient 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.
Service for managing AnswerRecords.
func NewAnswerRecordsClient
func NewAnswerRecordsClient(ctx context.Context, opts ...option.ClientOption) (*AnswerRecordsClient, error)
NewAnswerRecordsClient creates a new answer records client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service for managing AnswerRecords.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewAnswerRecordsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func NewAnswerRecordsRESTClient
func NewAnswerRecordsRESTClient(ctx context.Context, opts ...option.ClientOption) (*AnswerRecordsClient, error)
NewAnswerRecordsRESTClient creates a new answer records rest client.
Service for managing AnswerRecords.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewAnswerRecordsRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*AnswerRecordsClient) CancelOperation
func (c *AnswerRecordsClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error
CancelOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewAnswerRecordsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.CancelOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
}
err = c.CancelOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*AnswerRecordsClient) Close
func (c *AnswerRecordsClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*AnswerRecordsClient) Connection (deprecated)
func (c *AnswerRecordsClient) Connection() *grpc.ClientConn
Connection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not always return the same resource.
func (*AnswerRecordsClient) GetLocation
func (c *AnswerRecordsClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error)
GetLocation gets information about a location.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewAnswerRecordsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.GetLocationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest.
}
resp, err := c.GetLocation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*AnswerRecordsClient) GetOperation
func (c *AnswerRecordsClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
GetOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewAnswerRecordsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.GetOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
}
resp, err := c.GetOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*AnswerRecordsClient) ListAnswerRecords
func (c *AnswerRecordsClient) ListAnswerRecords(ctx context.Context, req *dialogflowpb.ListAnswerRecordsRequest, opts ...gax.CallOption) *AnswerRecordIterator
ListAnswerRecords returns the list of all answer records in the specified project in reverse chronological order.
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewAnswerRecordsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.ListAnswerRecordsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#ListAnswerRecordsRequest.
}
it := c.ListAnswerRecords(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*dialogflowpb.ListAnswerRecordsResponse)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewAnswerRecordsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.ListAnswerRecordsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#ListAnswerRecordsRequest.
}
for resp, err := range c.ListAnswerRecords(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*AnswerRecordsClient) ListLocations
func (c *AnswerRecordsClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator
ListLocations lists information about the supported locations for this service.
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
"google.golang.org/api/iterator"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewAnswerRecordsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
it := c.ListLocations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*locationpb.ListLocationsResponse)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewAnswerRecordsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
for resp, err := range c.ListLocations(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*AnswerRecordsClient) ListOperations
func (c *AnswerRecordsClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewAnswerRecordsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
it := c.ListOperations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*longrunningpb.ListOperationsResponse)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewAnswerRecordsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
for resp, err := range c.ListOperations(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*AnswerRecordsClient) UpdateAnswerRecord
func (c *AnswerRecordsClient) UpdateAnswerRecord(ctx context.Context, req *dialogflowpb.UpdateAnswerRecordRequest, opts ...gax.CallOption) (*dialogflowpb.AnswerRecord, error)
UpdateAnswerRecord updates the specified answer record.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewAnswerRecordsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.UpdateAnswerRecordRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#UpdateAnswerRecordRequest.
}
resp, err := c.UpdateAnswerRecord(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
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() (*structpb.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, 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 (*BatchCreateEntitiesOperation) Wait
func (op *BatchCreateEntitiesOperation) Wait(ctx context.Context, opts ...gax.CallOption) 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.
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() (*structpb.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, 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 (*BatchDeleteEntitiesOperation) Wait
func (op *BatchDeleteEntitiesOperation) Wait(ctx context.Context, opts ...gax.CallOption) 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.
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() (*structpb.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, 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 (*BatchDeleteEntityTypesOperation) Wait
func (op *BatchDeleteEntityTypesOperation) Wait(ctx context.Context, opts ...gax.CallOption) 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.
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() (*structpb.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, 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 (*BatchDeleteIntentsOperation) Wait
func (op *BatchDeleteIntentsOperation) Wait(ctx context.Context, opts ...gax.CallOption) 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.
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() (*structpb.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, 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 (*BatchUpdateEntitiesOperation) Wait
func (op *BatchUpdateEntitiesOperation) Wait(ctx context.Context, opts ...gax.CallOption) 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.
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() (*structpb.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.
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() (*structpb.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.
ClearSuggestionFeatureConfigOperation
type ClearSuggestionFeatureConfigOperation struct {
// contains filtered or unexported fields
}
ClearSuggestionFeatureConfigOperation manages a long-running operation from ClearSuggestionFeatureConfig.
func (*ClearSuggestionFeatureConfigOperation) Done
func (op *ClearSuggestionFeatureConfigOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*ClearSuggestionFeatureConfigOperation) Metadata
func (op *ClearSuggestionFeatureConfigOperation) Metadata() (*dialogflowpb.ClearSuggestionFeatureConfigOperationMetadata, 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 (*ClearSuggestionFeatureConfigOperation) Name
func (op *ClearSuggestionFeatureConfigOperation) 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 (*ClearSuggestionFeatureConfigOperation) Poll
func (op *ClearSuggestionFeatureConfigOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*dialogflowpb.ConversationProfile, 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 (*ClearSuggestionFeatureConfigOperation) Wait
func (op *ClearSuggestionFeatureConfigOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*dialogflowpb.ConversationProfile, 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.
ContextIterator
type ContextIterator struct {
// Response is the raw response for the current page.
// It must be cast to the RPC response type.
// Calling Next() or InternalFetch() updates this value.
Response interface{}
// 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) All
func (it *ContextIterator) All() iter.Seq2[*dialogflowpb.Context, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
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.
ContextsCallOptions
type ContextsCallOptions struct {
ListContexts []gax.CallOption
GetContext []gax.CallOption
CreateContext []gax.CallOption
UpdateContext []gax.CallOption
DeleteContext []gax.CallOption
DeleteAllContexts []gax.CallOption
GetLocation []gax.CallOption
ListLocations []gax.CallOption
CancelOperation []gax.CallOption
GetOperation []gax.CallOption
ListOperations []gax.CallOption
}
ContextsCallOptions contains the retry settings for each method of ContextsClient.
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.
Service for managing Contexts.
func NewContextsClient
func NewContextsClient(ctx context.Context, opts ...option.ClientOption) (*ContextsClient, error)
NewContextsClient creates a new contexts client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service for managing Contexts.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewContextsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func NewContextsRESTClient
func NewContextsRESTClient(ctx context.Context, opts ...option.ClientOption) (*ContextsClient, error)
NewContextsRESTClient creates a new contexts rest client.
Service for managing Contexts.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewContextsRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*ContextsClient) CancelOperation
func (c *ContextsClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error
CancelOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewContextsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.CancelOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
}
err = c.CancelOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
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 (deprecated)
func (c *ContextsClient) Connection() *grpc.ClientConn
Connection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not always return the same resource.
func (*ContextsClient) CreateContext
func (c *ContextsClient) CreateContext(ctx context.Context, req *dialogflowpb.CreateContextRequest, opts ...gax.CallOption) (*dialogflowpb.Context, error)
CreateContext creates a context.
If the specified context already exists, overrides the context.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewContextsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.CreateContextRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#CreateContextRequest.
}
resp, err := c.CreateContext(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
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 "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewContextsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.DeleteAllContextsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#DeleteAllContextsRequest.
}
err = c.DeleteAllContexts(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
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 "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewContextsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.DeleteContextRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#DeleteContextRequest.
}
err = c.DeleteContext(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
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 "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewContextsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.GetContextRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#GetContextRequest.
}
resp, err := c.GetContext(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ContextsClient) GetLocation
func (c *ContextsClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error)
GetLocation gets information about a location.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewContextsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.GetLocationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest.
}
resp, err := c.GetLocation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ContextsClient) GetOperation
func (c *ContextsClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
GetOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewContextsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.GetOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
}
resp, err := c.GetOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
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.
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewContextsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.ListContextsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#ListContextsRequest.
}
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
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*dialogflowpb.ListContextsResponse)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewContextsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.ListContextsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#ListContextsRequest.
}
for resp, err := range c.ListContexts(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*ContextsClient) ListLocations
func (c *ContextsClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator
ListLocations lists information about the supported locations for this service.
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
"google.golang.org/api/iterator"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewContextsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
it := c.ListLocations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*locationpb.ListLocationsResponse)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewContextsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
for resp, err := range c.ListLocations(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*ContextsClient) ListOperations
func (c *ContextsClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewContextsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
it := c.ListOperations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*longrunningpb.ListOperationsResponse)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewContextsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
for resp, err := range c.ListOperations(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
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 "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewContextsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.UpdateContextRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#UpdateContextRequest.
}
resp, err := c.UpdateContext(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
ConversationDatasetIterator
type ConversationDatasetIterator struct {
// Response is the raw response for the current page.
// It must be cast to the RPC response type.
// Calling Next() or InternalFetch() updates this value.
Response interface{}
// 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.ConversationDataset, nextPageToken string, err error)
// contains filtered or unexported fields
}
ConversationDatasetIterator manages a stream of *dialogflowpb.ConversationDataset.
func (*ConversationDatasetIterator) All
func (it *ConversationDatasetIterator) All() iter.Seq2[*dialogflowpb.ConversationDataset, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*ConversationDatasetIterator) Next
func (it *ConversationDatasetIterator) Next() (*dialogflowpb.ConversationDataset, 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 (*ConversationDatasetIterator) PageInfo
func (it *ConversationDatasetIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
ConversationDatasetsCallOptions
type ConversationDatasetsCallOptions struct {
CreateConversationDataset []gax.CallOption
GetConversationDataset []gax.CallOption
ListConversationDatasets []gax.CallOption
DeleteConversationDataset []gax.CallOption
ImportConversationData []gax.CallOption
GetLocation []gax.CallOption
ListLocations []gax.CallOption
CancelOperation []gax.CallOption
GetOperation []gax.CallOption
ListOperations []gax.CallOption
}
ConversationDatasetsCallOptions contains the retry settings for each method of ConversationDatasetsClient.
ConversationDatasetsClient
type ConversationDatasetsClient struct {
// The call options for this service.
CallOptions *ConversationDatasetsCallOptions
// LROClient is used internally to handle long-running operations.
// It is exposed so that its CallOptions can be modified if required.
// Users should not Close this client.
LROClient *lroauto.OperationsClient
// contains filtered or unexported fields
}
ConversationDatasetsClient 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.
Conversation datasets.
Conversation datasets contain raw conversation files and their customizable metadata that can be used for model training.
func NewConversationDatasetsClient
func NewConversationDatasetsClient(ctx context.Context, opts ...option.ClientOption) (*ConversationDatasetsClient, error)
NewConversationDatasetsClient creates a new conversation datasets client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Conversation datasets.
Conversation datasets contain raw conversation files and their customizable metadata that can be used for model training.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationDatasetsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func NewConversationDatasetsRESTClient
func NewConversationDatasetsRESTClient(ctx context.Context, opts ...option.ClientOption) (*ConversationDatasetsClient, error)
NewConversationDatasetsRESTClient creates a new conversation datasets rest client.
Conversation datasets.
Conversation datasets contain raw conversation files and their customizable metadata that can be used for model training.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationDatasetsRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*ConversationDatasetsClient) CancelOperation
func (c *ConversationDatasetsClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error
CancelOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationDatasetsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.CancelOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
}
err = c.CancelOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*ConversationDatasetsClient) Close
func (c *ConversationDatasetsClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*ConversationDatasetsClient) Connection (deprecated)
func (c *ConversationDatasetsClient) Connection() *grpc.ClientConn
Connection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not always return the same resource.
func (*ConversationDatasetsClient) CreateConversationDataset
func (c *ConversationDatasetsClient) CreateConversationDataset(ctx context.Context, req *dialogflowpb.CreateConversationDatasetRequest, opts ...gax.CallOption) (*CreateConversationDatasetOperation, error)
CreateConversationDataset creates a new conversation dataset.
This method is a long-running operation (at https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned Operation type has the following method-specific fields:
metadata:
CreateConversationDatasetOperationMetadata
response:
ConversationDataset
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationDatasetsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.CreateConversationDatasetRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#CreateConversationDatasetRequest.
}
op, err := c.CreateConversationDataset(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ConversationDatasetsClient) CreateConversationDatasetOperation
func (c *ConversationDatasetsClient) CreateConversationDatasetOperation(name string) *CreateConversationDatasetOperation
CreateConversationDatasetOperation returns a new CreateConversationDatasetOperation from a given name. The name must be that of a previously created CreateConversationDatasetOperation, possibly from a different process.
func (*ConversationDatasetsClient) DeleteConversationDataset
func (c *ConversationDatasetsClient) DeleteConversationDataset(ctx context.Context, req *dialogflowpb.DeleteConversationDatasetRequest, opts ...gax.CallOption) (*DeleteConversationDatasetOperation, error)
DeleteConversationDataset deletes the specified conversation dataset.
This method is a long-running operation (at https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned Operation type has the following method-specific fields:
metadata:
DeleteConversationDatasetOperationMetadata
response: An Empty
message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationDatasetsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.DeleteConversationDatasetRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#DeleteConversationDatasetRequest.
}
op, err := c.DeleteConversationDataset(ctx, req)
if err != nil {
// TODO: Handle error.
}
err = op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
}
func (*ConversationDatasetsClient) DeleteConversationDatasetOperation
func (c *ConversationDatasetsClient) DeleteConversationDatasetOperation(name string) *DeleteConversationDatasetOperation
DeleteConversationDatasetOperation returns a new DeleteConversationDatasetOperation from a given name. The name must be that of a previously created DeleteConversationDatasetOperation, possibly from a different process.
func (*ConversationDatasetsClient) GetConversationDataset
func (c *ConversationDatasetsClient) GetConversationDataset(ctx context.Context, req *dialogflowpb.GetConversationDatasetRequest, opts ...gax.CallOption) (*dialogflowpb.ConversationDataset, error)
GetConversationDataset retrieves the specified conversation dataset.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationDatasetsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.GetConversationDatasetRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#GetConversationDatasetRequest.
}
resp, err := c.GetConversationDataset(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ConversationDatasetsClient) GetLocation
func (c *ConversationDatasetsClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error)
GetLocation gets information about a location.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationDatasetsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.GetLocationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest.
}
resp, err := c.GetLocation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ConversationDatasetsClient) GetOperation
func (c *ConversationDatasetsClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
GetOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationDatasetsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.GetOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
}
resp, err := c.GetOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ConversationDatasetsClient) ImportConversationData
func (c *ConversationDatasetsClient) ImportConversationData(ctx context.Context, req *dialogflowpb.ImportConversationDataRequest, opts ...gax.CallOption) (*ImportConversationDataOperation, error)
ImportConversationData import data into the specified conversation dataset. Note that it is not allowed to import data to a conversation dataset that already has data in it.
This method is a long-running operation (at https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned Operation type has the following method-specific fields:
metadata:
ImportConversationDataOperationMetadata
response:
ImportConversationDataOperationResponse
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationDatasetsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.ImportConversationDataRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#ImportConversationDataRequest.
}
op, err := c.ImportConversationData(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ConversationDatasetsClient) ImportConversationDataOperation
func (c *ConversationDatasetsClient) ImportConversationDataOperation(name string) *ImportConversationDataOperation
ImportConversationDataOperation returns a new ImportConversationDataOperation from a given name. The name must be that of a previously created ImportConversationDataOperation, possibly from a different process.
func (*ConversationDatasetsClient) ListConversationDatasets
func (c *ConversationDatasetsClient) ListConversationDatasets(ctx context.Context, req *dialogflowpb.ListConversationDatasetsRequest, opts ...gax.CallOption) *ConversationDatasetIterator
ListConversationDatasets returns the list of all conversation datasets in the specified project and location.
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationDatasetsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.ListConversationDatasetsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#ListConversationDatasetsRequest.
}
it := c.ListConversationDatasets(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*dialogflowpb.ListConversationDatasetsResponse)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationDatasetsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.ListConversationDatasetsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#ListConversationDatasetsRequest.
}
for resp, err := range c.ListConversationDatasets(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*ConversationDatasetsClient) ListLocations
func (c *ConversationDatasetsClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator
ListLocations lists information about the supported locations for this service.
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
"google.golang.org/api/iterator"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationDatasetsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
it := c.ListLocations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*locationpb.ListLocationsResponse)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationDatasetsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
for resp, err := range c.ListLocations(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*ConversationDatasetsClient) ListOperations
func (c *ConversationDatasetsClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationDatasetsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
it := c.ListOperations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*longrunningpb.ListOperationsResponse)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationDatasetsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
for resp, err := range c.ListOperations(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
ConversationIterator
type ConversationIterator struct {
// Response is the raw response for the current page.
// It must be cast to the RPC response type.
// Calling Next() or InternalFetch() updates this value.
Response interface{}
// 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.Conversation, nextPageToken string, err error)
// contains filtered or unexported fields
}
ConversationIterator manages a stream of *dialogflowpb.Conversation.
func (*ConversationIterator) All
func (it *ConversationIterator) All() iter.Seq2[*dialogflowpb.Conversation, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*ConversationIterator) Next
func (it *ConversationIterator) Next() (*dialogflowpb.Conversation, 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 (*ConversationIterator) PageInfo
func (it *ConversationIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
ConversationModelEvaluationIterator
type ConversationModelEvaluationIterator struct {
// Response is the raw response for the current page.
// It must be cast to the RPC response type.
// Calling Next() or InternalFetch() updates this value.
Response interface{}
// 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.ConversationModelEvaluation, nextPageToken string, err error)
// contains filtered or unexported fields
}
ConversationModelEvaluationIterator manages a stream of *dialogflowpb.ConversationModelEvaluation.
func (*ConversationModelEvaluationIterator) All
func (it *ConversationModelEvaluationIterator) All() iter.Seq2[*dialogflowpb.ConversationModelEvaluation, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*ConversationModelEvaluationIterator) Next
func (it *ConversationModelEvaluationIterator) Next() (*dialogflowpb.ConversationModelEvaluation, 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 (*ConversationModelEvaluationIterator) PageInfo
func (it *ConversationModelEvaluationIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
ConversationModelIterator
type ConversationModelIterator struct {
// Response is the raw response for the current page.
// It must be cast to the RPC response type.
// Calling Next() or InternalFetch() updates this value.
Response interface{}
// 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.ConversationModel, nextPageToken string, err error)
// contains filtered or unexported fields
}
ConversationModelIterator manages a stream of *dialogflowpb.ConversationModel.
func (*ConversationModelIterator) All
func (it *ConversationModelIterator) All() iter.Seq2[*dialogflowpb.ConversationModel, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*ConversationModelIterator) Next
func (it *ConversationModelIterator) Next() (*dialogflowpb.ConversationModel, 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 (*ConversationModelIterator) PageInfo
func (it *ConversationModelIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
ConversationModelsCallOptions
type ConversationModelsCallOptions struct {
CreateConversationModel []gax.CallOption
GetConversationModel []gax.CallOption
ListConversationModels []gax.CallOption
DeleteConversationModel []gax.CallOption
DeployConversationModel []gax.CallOption
UndeployConversationModel []gax.CallOption
GetConversationModelEvaluation []gax.CallOption
ListConversationModelEvaluations []gax.CallOption
CreateConversationModelEvaluation []gax.CallOption
GetLocation []gax.CallOption
ListLocations []gax.CallOption
CancelOperation []gax.CallOption
GetOperation []gax.CallOption
ListOperations []gax.CallOption
}
ConversationModelsCallOptions contains the retry settings for each method of ConversationModelsClient.
ConversationModelsClient
type ConversationModelsClient struct {
// The call options for this service.
CallOptions *ConversationModelsCallOptions
// LROClient is used internally to handle long-running operations.
// It is exposed so that its CallOptions can be modified if required.
// Users should not Close this client.
LROClient *lroauto.OperationsClient
// contains filtered or unexported fields
}
ConversationModelsClient 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.
Manages a collection of models for human agent assistant.
func NewConversationModelsClient
func NewConversationModelsClient(ctx context.Context, opts ...option.ClientOption) (*ConversationModelsClient, error)
NewConversationModelsClient creates a new conversation models client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Manages a collection of models for human agent assistant.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationModelsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func NewConversationModelsRESTClient
func NewConversationModelsRESTClient(ctx context.Context, opts ...option.ClientOption) (*ConversationModelsClient, error)
NewConversationModelsRESTClient creates a new conversation models rest client.
Manages a collection of models for human agent assistant.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationModelsRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*ConversationModelsClient) CancelOperation
func (c *ConversationModelsClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error
CancelOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationModelsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.CancelOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
}
err = c.CancelOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*ConversationModelsClient) Close
func (c *ConversationModelsClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*ConversationModelsClient) Connection (deprecated)
func (c *ConversationModelsClient) Connection() *grpc.ClientConn
Connection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not always return the same resource.
func (*ConversationModelsClient) CreateConversationModel
func (c *ConversationModelsClient) CreateConversationModel(ctx context.Context, req *dialogflowpb.CreateConversationModelRequest, opts ...gax.CallOption) (*CreateConversationModelOperation, error)
CreateConversationModel creates a model.
This method is a long-running operation (at https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned Operation type has the following method-specific fields:
metadata:
CreateConversationModelOperationMetadata
response:
ConversationModel
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationModelsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.CreateConversationModelRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#CreateConversationModelRequest.
}
op, err := c.CreateConversationModel(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ConversationModelsClient) CreateConversationModelEvaluation
func (c *ConversationModelsClient) CreateConversationModelEvaluation(ctx context.Context, req *dialogflowpb.CreateConversationModelEvaluationRequest, opts ...gax.CallOption) (*CreateConversationModelEvaluationOperation, error)
CreateConversationModelEvaluation creates evaluation of a conversation model.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationModelsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.CreateConversationModelEvaluationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#CreateConversationModelEvaluationRequest.
}
op, err := c.CreateConversationModelEvaluation(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ConversationModelsClient) CreateConversationModelEvaluationOperation
func (c *ConversationModelsClient) CreateConversationModelEvaluationOperation(name string) *CreateConversationModelEvaluationOperation
CreateConversationModelEvaluationOperation returns a new CreateConversationModelEvaluationOperation from a given name. The name must be that of a previously created CreateConversationModelEvaluationOperation, possibly from a different process.
func (*ConversationModelsClient) CreateConversationModelOperation
func (c *ConversationModelsClient) CreateConversationModelOperation(name string) *CreateConversationModelOperation
CreateConversationModelOperation returns a new CreateConversationModelOperation from a given name. The name must be that of a previously created CreateConversationModelOperation, possibly from a different process.
func (*ConversationModelsClient) DeleteConversationModel
func (c *ConversationModelsClient) DeleteConversationModel(ctx context.Context, req *dialogflowpb.DeleteConversationModelRequest, opts ...gax.CallOption) (*DeleteConversationModelOperation, error)
DeleteConversationModel deletes a model.
This method is a long-running operation (at https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned Operation type has the following method-specific fields:
metadata:
DeleteConversationModelOperationMetadata
response: An Empty
message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationModelsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.DeleteConversationModelRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#DeleteConversationModelRequest.
}
op, err := c.DeleteConversationModel(ctx, req)
if err != nil {
// TODO: Handle error.
}
err = op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
}
func (*ConversationModelsClient) DeleteConversationModelOperation
func (c *ConversationModelsClient) DeleteConversationModelOperation(name string) *DeleteConversationModelOperation
DeleteConversationModelOperation returns a new DeleteConversationModelOperation from a given name. The name must be that of a previously created DeleteConversationModelOperation, possibly from a different process.
func (*ConversationModelsClient) DeployConversationModel
func (c *ConversationModelsClient) DeployConversationModel(ctx context.Context, req *dialogflowpb.DeployConversationModelRequest, opts ...gax.CallOption) (*DeployConversationModelOperation, error)
DeployConversationModel deploys a model. If a model is already deployed, deploying it has no effect. A model can only serve prediction requests after it gets deployed. For article suggestion, custom model will not be used unless it is deployed.
This method is a long-running operation (at https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned Operation type has the following method-specific fields:
metadata:
DeployConversationModelOperationMetadata
response: An Empty
message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationModelsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.DeployConversationModelRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#DeployConversationModelRequest.
}
op, err := c.DeployConversationModel(ctx, req)
if err != nil {
// TODO: Handle error.
}
err = op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
}
func (*ConversationModelsClient) DeployConversationModelOperation
func (c *ConversationModelsClient) DeployConversationModelOperation(name string) *DeployConversationModelOperation
DeployConversationModelOperation returns a new DeployConversationModelOperation from a given name. The name must be that of a previously created DeployConversationModelOperation, possibly from a different process.
func (*ConversationModelsClient) GetConversationModel
func (c *ConversationModelsClient) GetConversationModel(ctx context.Context, req *dialogflowpb.GetConversationModelRequest, opts ...gax.CallOption) (*dialogflowpb.ConversationModel, error)
GetConversationModel gets conversation model.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationModelsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.GetConversationModelRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#GetConversationModelRequest.
}
resp, err := c.GetConversationModel(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ConversationModelsClient) GetConversationModelEvaluation
func (c *ConversationModelsClient) GetConversationModelEvaluation(ctx context.Context, req *dialogflowpb.GetConversationModelEvaluationRequest, opts ...gax.CallOption) (*dialogflowpb.ConversationModelEvaluation, error)
GetConversationModelEvaluation gets an evaluation of conversation model.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationModelsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.GetConversationModelEvaluationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#GetConversationModelEvaluationRequest.
}
resp, err := c.GetConversationModelEvaluation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ConversationModelsClient) GetLocation
func (c *ConversationModelsClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error)
GetLocation gets information about a location.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationModelsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.GetLocationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest.
}
resp, err := c.GetLocation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ConversationModelsClient) GetOperation
func (c *ConversationModelsClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
GetOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationModelsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.GetOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
}
resp, err := c.GetOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ConversationModelsClient) ListConversationModelEvaluations
func (c *ConversationModelsClient) ListConversationModelEvaluations(ctx context.Context, req *dialogflowpb.ListConversationModelEvaluationsRequest, opts ...gax.CallOption) *ConversationModelEvaluationIterator
ListConversationModelEvaluations lists evaluations of a conversation model.
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationModelsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.ListConversationModelEvaluationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#ListConversationModelEvaluationsRequest.
}
it := c.ListConversationModelEvaluations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*dialogflowpb.ListConversationModelEvaluationsResponse)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationModelsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.ListConversationModelEvaluationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#ListConversationModelEvaluationsRequest.
}
for resp, err := range c.ListConversationModelEvaluations(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*ConversationModelsClient) ListConversationModels
func (c *ConversationModelsClient) ListConversationModels(ctx context.Context, req *dialogflowpb.ListConversationModelsRequest, opts ...gax.CallOption) *ConversationModelIterator
ListConversationModels lists conversation models.
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationModelsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.ListConversationModelsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#ListConversationModelsRequest.
}
it := c.ListConversationModels(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*dialogflowpb.ListConversationModelsResponse)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationModelsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.ListConversationModelsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#ListConversationModelsRequest.
}
for resp, err := range c.ListConversationModels(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*ConversationModelsClient) ListLocations
func (c *ConversationModelsClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator
ListLocations lists information about the supported locations for this service.
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
"google.golang.org/api/iterator"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationModelsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
it := c.ListLocations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*locationpb.ListLocationsResponse)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationModelsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
for resp, err := range c.ListLocations(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*ConversationModelsClient) ListOperations
func (c *ConversationModelsClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationModelsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
it := c.ListOperations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*longrunningpb.ListOperationsResponse)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationModelsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
for resp, err := range c.ListOperations(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*ConversationModelsClient) UndeployConversationModel
func (c *ConversationModelsClient) UndeployConversationModel(ctx context.Context, req *dialogflowpb.UndeployConversationModelRequest, opts ...gax.CallOption) (*UndeployConversationModelOperation, error)
UndeployConversationModel undeploys a model. If the model is not deployed this method has no effect. If the model is currently being used:
For article suggestion, article suggestion will fallback to the default
model if model is undeployed.
This method is a long-running operation (at https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned Operation type has the following method-specific fields:
metadata:
UndeployConversationModelOperationMetadata
response: An Empty
message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationModelsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.UndeployConversationModelRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#UndeployConversationModelRequest.
}
op, err := c.UndeployConversationModel(ctx, req)
if err != nil {
// TODO: Handle error.
}
err = op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
}
func (*ConversationModelsClient) UndeployConversationModelOperation
func (c *ConversationModelsClient) UndeployConversationModelOperation(name string) *UndeployConversationModelOperation
UndeployConversationModelOperation returns a new UndeployConversationModelOperation from a given name. The name must be that of a previously created UndeployConversationModelOperation, possibly from a different process.
ConversationProfileIterator
type ConversationProfileIterator struct {
// Response is the raw response for the current page.
// It must be cast to the RPC response type.
// Calling Next() or InternalFetch() updates this value.
Response interface{}
// 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.ConversationProfile, nextPageToken string, err error)
// contains filtered or unexported fields
}
ConversationProfileIterator manages a stream of *dialogflowpb.ConversationProfile.
func (*ConversationProfileIterator) All
func (it *ConversationProfileIterator) All() iter.Seq2[*dialogflowpb.ConversationProfile, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*ConversationProfileIterator) Next
func (it *ConversationProfileIterator) Next() (*dialogflowpb.ConversationProfile, 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 (*ConversationProfileIterator) PageInfo
func (it *ConversationProfileIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
ConversationProfilesCallOptions
type ConversationProfilesCallOptions struct {
ListConversationProfiles []gax.CallOption
GetConversationProfile []gax.CallOption
CreateConversationProfile []gax.CallOption
UpdateConversationProfile []gax.CallOption
DeleteConversationProfile []gax.CallOption
SetSuggestionFeatureConfig []gax.CallOption
ClearSuggestionFeatureConfig []gax.CallOption
GetLocation []gax.CallOption
ListLocations []gax.CallOption
CancelOperation []gax.CallOption
GetOperation []gax.CallOption
ListOperations []gax.CallOption
}
ConversationProfilesCallOptions contains the retry settings for each method of ConversationProfilesClient.
ConversationProfilesClient
type ConversationProfilesClient struct {
// The call options for this service.
CallOptions *ConversationProfilesCallOptions
// LROClient is used internally to handle long-running operations.
// It is exposed so that its CallOptions can be modified if required.
// Users should not Close this client.
LROClient *lroauto.OperationsClient
// contains filtered or unexported fields
}
ConversationProfilesClient 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.
Service for managing ConversationProfiles.
func NewConversationProfilesClient
func NewConversationProfilesClient(ctx context.Context, opts ...option.ClientOption) (*ConversationProfilesClient, error)
NewConversationProfilesClient creates a new conversation profiles client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service for managing ConversationProfiles.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationProfilesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func NewConversationProfilesRESTClient
func NewConversationProfilesRESTClient(ctx context.Context, opts ...option.ClientOption) (*ConversationProfilesClient, error)
NewConversationProfilesRESTClient creates a new conversation profiles rest client.
Service for managing ConversationProfiles.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationProfilesRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*ConversationProfilesClient) CancelOperation
func (c *ConversationProfilesClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error
CancelOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationProfilesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.CancelOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
}
err = c.CancelOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*ConversationProfilesClient) ClearSuggestionFeatureConfig
func (c *ConversationProfilesClient) ClearSuggestionFeatureConfig(ctx context.Context, req *dialogflowpb.ClearSuggestionFeatureConfigRequest, opts ...gax.CallOption) (*ClearSuggestionFeatureConfigOperation, error)
ClearSuggestionFeatureConfig clears a suggestion feature from a conversation profile for the given participant role.
This method is a long-running operation (at https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned Operation type has the following method-specific fields:
metadata:
ClearSuggestionFeatureConfigOperationMetadata
response:
ConversationProfile
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationProfilesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.ClearSuggestionFeatureConfigRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#ClearSuggestionFeatureConfigRequest.
}
op, err := c.ClearSuggestionFeatureConfig(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ConversationProfilesClient) ClearSuggestionFeatureConfigOperation
func (c *ConversationProfilesClient) ClearSuggestionFeatureConfigOperation(name string) *ClearSuggestionFeatureConfigOperation
ClearSuggestionFeatureConfigOperation returns a new ClearSuggestionFeatureConfigOperation from a given name. The name must be that of a previously created ClearSuggestionFeatureConfigOperation, possibly from a different process.
func (*ConversationProfilesClient) Close
func (c *ConversationProfilesClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*ConversationProfilesClient) Connection (deprecated)
func (c *ConversationProfilesClient) Connection() *grpc.ClientConn
Connection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not always return the same resource.
func (*ConversationProfilesClient) CreateConversationProfile
func (c *ConversationProfilesClient) CreateConversationProfile(ctx context.Context, req *dialogflowpb.CreateConversationProfileRequest, opts ...gax.CallOption) (*dialogflowpb.ConversationProfile, error)
CreateConversationProfile creates a conversation profile in the specified project.
ConversationProfile.CreateTime and ConversationProfile.UpdateTime aren’t populated in the response. You can retrieve them via GetConversationProfile API.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationProfilesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.CreateConversationProfileRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#CreateConversationProfileRequest.
}
resp, err := c.CreateConversationProfile(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ConversationProfilesClient) DeleteConversationProfile
func (c *ConversationProfilesClient) DeleteConversationProfile(ctx context.Context, req *dialogflowpb.DeleteConversationProfileRequest, opts ...gax.CallOption) error
DeleteConversationProfile deletes the specified conversation profile.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationProfilesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.DeleteConversationProfileRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#DeleteConversationProfileRequest.
}
err = c.DeleteConversationProfile(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*ConversationProfilesClient) GetConversationProfile
func (c *ConversationProfilesClient) GetConversationProfile(ctx context.Context, req *dialogflowpb.GetConversationProfileRequest, opts ...gax.CallOption) (*dialogflowpb.ConversationProfile, error)
GetConversationProfile retrieves the specified conversation profile.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationProfilesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.GetConversationProfileRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#GetConversationProfileRequest.
}
resp, err := c.GetConversationProfile(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ConversationProfilesClient) GetLocation
func (c *ConversationProfilesClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error)
GetLocation gets information about a location.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationProfilesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.GetLocationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest.
}
resp, err := c.GetLocation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ConversationProfilesClient) GetOperation
func (c *ConversationProfilesClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
GetOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationProfilesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.GetOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
}
resp, err := c.GetOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ConversationProfilesClient) ListConversationProfiles
func (c *ConversationProfilesClient) ListConversationProfiles(ctx context.Context, req *dialogflowpb.ListConversationProfilesRequest, opts ...gax.CallOption) *ConversationProfileIterator
ListConversationProfiles returns the list of all conversation profiles in the specified project.
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationProfilesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.ListConversationProfilesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#ListConversationProfilesRequest.
}
it := c.ListConversationProfiles(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*dialogflowpb.ListConversationProfilesResponse)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationProfilesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.ListConversationProfilesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#ListConversationProfilesRequest.
}
for resp, err := range c.ListConversationProfiles(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*ConversationProfilesClient) ListLocations
func (c *ConversationProfilesClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator
ListLocations lists information about the supported locations for this service.
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
"google.golang.org/api/iterator"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationProfilesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
it := c.ListLocations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*locationpb.ListLocationsResponse)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationProfilesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
for resp, err := range c.ListLocations(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*ConversationProfilesClient) ListOperations
func (c *ConversationProfilesClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationProfilesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
it := c.ListOperations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*longrunningpb.ListOperationsResponse)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationProfilesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
for resp, err := range c.ListOperations(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*ConversationProfilesClient) SetSuggestionFeatureConfig
func (c *ConversationProfilesClient) SetSuggestionFeatureConfig(ctx context.Context, req *dialogflowpb.SetSuggestionFeatureConfigRequest, opts ...gax.CallOption) (*SetSuggestionFeatureConfigOperation, error)
SetSuggestionFeatureConfig adds or updates a suggestion feature in a conversation profile. If the conversation profile contains the type of suggestion feature for the participant role, it will update it. Otherwise it will insert the suggestion feature.
This method is a long-running operation (at https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned Operation type has the following method-specific fields:
metadata:
SetSuggestionFeatureConfigOperationMetadata
response:
ConversationProfile
If a long running operation to add or update suggestion feature config for the same conversation profile, participant role and suggestion feature type exists, please cancel the existing long running operation before sending such request, otherwise the request will be rejected.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationProfilesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.SetSuggestionFeatureConfigRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#SetSuggestionFeatureConfigRequest.
}
op, err := c.SetSuggestionFeatureConfig(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ConversationProfilesClient) SetSuggestionFeatureConfigOperation
func (c *ConversationProfilesClient) SetSuggestionFeatureConfigOperation(name string) *SetSuggestionFeatureConfigOperation
SetSuggestionFeatureConfigOperation returns a new SetSuggestionFeatureConfigOperation from a given name. The name must be that of a previously created SetSuggestionFeatureConfigOperation, possibly from a different process.
func (*ConversationProfilesClient) UpdateConversationProfile
func (c *ConversationProfilesClient) UpdateConversationProfile(ctx context.Context, req *dialogflowpb.UpdateConversationProfileRequest, opts ...gax.CallOption) (*dialogflowpb.ConversationProfile, error)
UpdateConversationProfile updates the specified conversation profile.
ConversationProfile.CreateTime and ConversationProfile.UpdateTime aren’t populated in the response. You can retrieve them via GetConversationProfile API.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationProfilesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.UpdateConversationProfileRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#UpdateConversationProfileRequest.
}
resp, err := c.UpdateConversationProfile(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
ConversationsCallOptions
type ConversationsCallOptions struct {
CreateConversation []gax.CallOption
ListConversations []gax.CallOption
GetConversation []gax.CallOption
CompleteConversation []gax.CallOption
ListMessages []gax.CallOption
SuggestConversationSummary []gax.CallOption
GenerateStatelessSummary []gax.CallOption
GenerateStatelessSuggestion []gax.CallOption
SearchKnowledge []gax.CallOption
GetLocation []gax.CallOption
ListLocations []gax.CallOption
CancelOperation []gax.CallOption
GetOperation []gax.CallOption
ListOperations []gax.CallOption
}
ConversationsCallOptions contains the retry settings for each method of ConversationsClient.
ConversationsClient
type ConversationsClient struct {
// The call options for this service.
CallOptions *ConversationsCallOptions
// contains filtered or unexported fields
}
ConversationsClient 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.
Service for managing Conversations.
func NewConversationsClient
func NewConversationsClient(ctx context.Context, opts ...option.ClientOption) (*ConversationsClient, error)
NewConversationsClient creates a new conversations client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service for managing Conversations.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func NewConversationsRESTClient
func NewConversationsRESTClient(ctx context.Context, opts ...option.ClientOption) (*ConversationsClient, error)
NewConversationsRESTClient creates a new conversations rest client.
Service for managing Conversations.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationsRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*ConversationsClient) CancelOperation
func (c *ConversationsClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error
CancelOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.CancelOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
}
err = c.CancelOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*ConversationsClient) Close
func (c *ConversationsClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*ConversationsClient) CompleteConversation
func (c *ConversationsClient) CompleteConversation(ctx context.Context, req *dialogflowpb.CompleteConversationRequest, opts ...gax.CallOption) (*dialogflowpb.Conversation, error)
CompleteConversation completes the specified conversation. Finished conversations are purged from the database after 30 days.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.CompleteConversationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#CompleteConversationRequest.
}
resp, err := c.CompleteConversation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ConversationsClient) Connection (deprecated)
func (c *ConversationsClient) Connection() *grpc.ClientConn
Connection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not always return the same resource.
func (*ConversationsClient) CreateConversation
func (c *ConversationsClient) CreateConversation(ctx context.Context, req *dialogflowpb.CreateConversationRequest, opts ...gax.CallOption) (*dialogflowpb.Conversation, error)
CreateConversation creates a new conversation. Conversations are auto-completed after 24 hours.
Conversation Lifecycle: There are two stages during a conversation: Automated Agent Stage and Assist Stage.
For Automated Agent Stage, there will be a dialogflow agent responding to user queries.
For Assist Stage, there’s no dialogflow agent responding to user queries. But we will provide suggestions which are generated from conversation.
If Conversation.conversation_profile is configured for a dialogflow agent, conversation will start from Automated Agent Stage, otherwise, it will start from Assist Stage. And during Automated Agent Stage, once an Intent with Intent.live_agent_handoff is triggered, conversation will transfer to Assist Stage.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.CreateConversationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#CreateConversationRequest.
}
resp, err := c.CreateConversation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ConversationsClient) GenerateStatelessSuggestion
func (c *ConversationsClient) GenerateStatelessSuggestion(ctx context.Context, req *dialogflowpb.GenerateStatelessSuggestionRequest, opts ...gax.CallOption) (*dialogflowpb.GenerateStatelessSuggestionResponse, error)
GenerateStatelessSuggestion generates and returns a suggestion for a conversation that does not have a resource created for it.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.GenerateStatelessSuggestionRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#GenerateStatelessSuggestionRequest.
}
resp, err := c.GenerateStatelessSuggestion(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ConversationsClient) GenerateStatelessSummary
func (c *ConversationsClient) GenerateStatelessSummary(ctx context.Context, req *dialogflowpb.GenerateStatelessSummaryRequest, opts ...gax.CallOption) (*dialogflowpb.GenerateStatelessSummaryResponse, error)
GenerateStatelessSummary generates and returns a summary for a conversation that does not have a resource created for it.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.GenerateStatelessSummaryRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#GenerateStatelessSummaryRequest.
}
resp, err := c.GenerateStatelessSummary(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ConversationsClient) GetConversation
func (c *ConversationsClient) GetConversation(ctx context.Context, req *dialogflowpb.GetConversationRequest, opts ...gax.CallOption) (*dialogflowpb.Conversation, error)
GetConversation retrieves the specific conversation.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.GetConversationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#GetConversationRequest.
}
resp, err := c.GetConversation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ConversationsClient) GetLocation
func (c *ConversationsClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error)
GetLocation gets information about a location.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.GetLocationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest.
}
resp, err := c.GetLocation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ConversationsClient) GetOperation
func (c *ConversationsClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
GetOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.GetOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
}
resp, err := c.GetOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ConversationsClient) ListConversations
func (c *ConversationsClient) ListConversations(ctx context.Context, req *dialogflowpb.ListConversationsRequest, opts ...gax.CallOption) *ConversationIterator
ListConversations returns the list of all conversations in the specified project.
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.ListConversationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#ListConversationsRequest.
}
it := c.ListConversations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*dialogflowpb.ListConversationsResponse)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.ListConversationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#ListConversationsRequest.
}
for resp, err := range c.ListConversations(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*ConversationsClient) ListLocations
func (c *ConversationsClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator
ListLocations lists information about the supported locations for this service.
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
"google.golang.org/api/iterator"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
it := c.ListLocations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*locationpb.ListLocationsResponse)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
for resp, err := range c.ListLocations(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*ConversationsClient) ListMessages
func (c *ConversationsClient) ListMessages(ctx context.Context, req *dialogflowpb.ListMessagesRequest, opts ...gax.CallOption) *MessageIterator
ListMessages lists messages that belong to a given conversation. messages are ordered by create_time in descending order. To fetch updates without duplication, send request with filter create_time_epoch_microseconds > [first item's create_time of previous request] and empty page_token.
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.ListMessagesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#ListMessagesRequest.
}
it := c.ListMessages(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*dialogflowpb.ListMessagesResponse)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.ListMessagesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#ListMessagesRequest.
}
for resp, err := range c.ListMessages(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*ConversationsClient) ListOperations
func (c *ConversationsClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
it := c.ListOperations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*longrunningpb.ListOperationsResponse)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
for resp, err := range c.ListOperations(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*ConversationsClient) SearchKnowledge
func (c *ConversationsClient) SearchKnowledge(ctx context.Context, req *dialogflowpb.SearchKnowledgeRequest, opts ...gax.CallOption) (*dialogflowpb.SearchKnowledgeResponse, error)
SearchKnowledge get answers for the given query based on knowledge documents.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.SearchKnowledgeRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#SearchKnowledgeRequest.
}
resp, err := c.SearchKnowledge(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ConversationsClient) SuggestConversationSummary
func (c *ConversationsClient) SuggestConversationSummary(ctx context.Context, req *dialogflowpb.SuggestConversationSummaryRequest, opts ...gax.CallOption) (*dialogflowpb.SuggestConversationSummaryResponse, error)
SuggestConversationSummary suggests summary for a conversation based on specific historical messages. The range of the messages to be used for summary can be specified in the request.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewConversationsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.SuggestConversationSummaryRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#SuggestConversationSummaryRequest.
}
resp, err := c.SuggestConversationSummary(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
CreateConversationDatasetOperation
type CreateConversationDatasetOperation struct {
// contains filtered or unexported fields
}
CreateConversationDatasetOperation manages a long-running operation from CreateConversationDataset.
func (*CreateConversationDatasetOperation) Done
func (op *CreateConversationDatasetOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*CreateConversationDatasetOperation) Metadata
func (op *CreateConversationDatasetOperation) Metadata() (*dialogflowpb.CreateConversationDatasetOperationMetadata, 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 (*CreateConversationDatasetOperation) Name
func (op *CreateConversationDatasetOperation) 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 (*CreateConversationDatasetOperation) Poll
func (op *CreateConversationDatasetOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*dialogflowpb.ConversationDataset, 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 (*CreateConversationDatasetOperation) Wait
func (op *CreateConversationDatasetOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*dialogflowpb.ConversationDataset, 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.
CreateConversationModelEvaluationOperation
type CreateConversationModelEvaluationOperation struct {
// contains filtered or unexported fields
}
CreateConversationModelEvaluationOperation manages a long-running operation from CreateConversationModelEvaluation.
func (*CreateConversationModelEvaluationOperation) Done
func (op *CreateConversationModelEvaluationOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*CreateConversationModelEvaluationOperation) Metadata
func (op *CreateConversationModelEvaluationOperation) Metadata() (*dialogflowpb.CreateConversationModelEvaluationOperationMetadata, 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 (*CreateConversationModelEvaluationOperation) Name
func (op *CreateConversationModelEvaluationOperation) 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 (*CreateConversationModelEvaluationOperation) Poll
func (op *CreateConversationModelEvaluationOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*dialogflowpb.ConversationModelEvaluation, 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 (*CreateConversationModelEvaluationOperation) Wait
func (op *CreateConversationModelEvaluationOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*dialogflowpb.ConversationModelEvaluation, 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.
CreateConversationModelOperation
type CreateConversationModelOperation struct {
// contains filtered or unexported fields
}
CreateConversationModelOperation manages a long-running operation from CreateConversationModel.
func (*CreateConversationModelOperation) Done
func (op *CreateConversationModelOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*CreateConversationModelOperation) Metadata
func (op *CreateConversationModelOperation) Metadata() (*dialogflowpb.CreateConversationModelOperationMetadata, 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 (*CreateConversationModelOperation) Name
func (op *CreateConversationModelOperation) 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 (*CreateConversationModelOperation) Poll
func (op *CreateConversationModelOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*dialogflowpb.ConversationModel, 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 (*CreateConversationModelOperation) Wait
func (op *CreateConversationModelOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*dialogflowpb.ConversationModel, 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.
CreateDocumentOperation
type CreateDocumentOperation struct {
// contains filtered or unexported fields
}
CreateDocumentOperation manages a long-running operation from CreateDocument.
func (*CreateDocumentOperation) Done
func (op *CreateDocumentOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*CreateDocumentOperation) Metadata
func (op *CreateDocumentOperation) Metadata() (*dialogflowpb.KnowledgeOperationMetadata, 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 (*CreateDocumentOperation) Name
func (op *CreateDocumentOperation) 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 (*CreateDocumentOperation) Poll
func (op *CreateDocumentOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*dialogflowpb.Document, 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 (*CreateDocumentOperation) Wait
func (op *CreateDocumentOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*dialogflowpb.Document, 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.
DeleteConversationDatasetOperation
type DeleteConversationDatasetOperation struct {
// contains filtered or unexported fields
}
DeleteConversationDatasetOperation manages a long-running operation from DeleteConversationDataset.
func (*DeleteConversationDatasetOperation) Done
func (op *DeleteConversationDatasetOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*DeleteConversationDatasetOperation) Metadata
func (op *DeleteConversationDatasetOperation) Metadata() (*dialogflowpb.DeleteConversationDatasetOperationMetadata, 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 (*DeleteConversationDatasetOperation) Name
func (op *DeleteConversationDatasetOperation) 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 (*DeleteConversationDatasetOperation) Poll
func (op *DeleteConversationDatasetOperation) 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, 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 (*DeleteConversationDatasetOperation) Wait
func (op *DeleteConversationDatasetOperation) Wait(ctx context.Context, opts ...gax.CallOption) 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.
DeleteConversationModelOperation
type DeleteConversationModelOperation struct {
// contains filtered or unexported fields
}
DeleteConversationModelOperation manages a long-running operation from DeleteConversationModel.
func (*DeleteConversationModelOperation) Done
func (op *DeleteConversationModelOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*DeleteConversationModelOperation) Metadata
func (op *DeleteConversationModelOperation) Metadata() (*dialogflowpb.DeleteConversationModelOperationMetadata, 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 (*DeleteConversationModelOperation) Name
func (op *DeleteConversationModelOperation) 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 (*DeleteConversationModelOperation) Poll
func (op *DeleteConversationModelOperation) 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, 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 (*DeleteConversationModelOperation) Wait
func (op *DeleteConversationModelOperation) Wait(ctx context.Context, opts ...gax.CallOption) 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.
DeleteDocumentOperation
type DeleteDocumentOperation struct {
// contains filtered or unexported fields
}
DeleteDocumentOperation manages a long-running operation from DeleteDocument.
func (*DeleteDocumentOperation) Done
func (op *DeleteDocumentOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*DeleteDocumentOperation) Metadata
func (op *DeleteDocumentOperation) Metadata() (*dialogflowpb.KnowledgeOperationMetadata, 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 (*DeleteDocumentOperation) Name
func (op *DeleteDocumentOperation) 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 (*DeleteDocumentOperation) Poll
func (op *DeleteDocumentOperation) 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, 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 (*DeleteDocumentOperation) Wait
func (op *DeleteDocumentOperation) Wait(ctx context.Context, opts ...gax.CallOption) 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.
DeployConversationModelOperation
type DeployConversationModelOperation struct {
// contains filtered or unexported fields
}
DeployConversationModelOperation manages a long-running operation from DeployConversationModel.
func (*DeployConversationModelOperation) Done
func (op *DeployConversationModelOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*DeployConversationModelOperation) Metadata
func (op *DeployConversationModelOperation) Metadata() (*dialogflowpb.DeployConversationModelOperationMetadata, 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 (*DeployConversationModelOperation) Name
func (op *DeployConversationModelOperation) 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 (*DeployConversationModelOperation) Poll
func (op *DeployConversationModelOperation) 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, 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 (*DeployConversationModelOperation) Wait
func (op *DeployConversationModelOperation) Wait(ctx context.Context, opts ...gax.CallOption) 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.
DocumentIterator
type DocumentIterator struct {
// Response is the raw response for the current page.
// It must be cast to the RPC response type.
// Calling Next() or InternalFetch() updates this value.
Response interface{}
// 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.Document, nextPageToken string, err error)
// contains filtered or unexported fields
}
DocumentIterator manages a stream of *dialogflowpb.Document.
func (*DocumentIterator) All
func (it *DocumentIterator) All() iter.Seq2[*dialogflowpb.Document, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*DocumentIterator) Next
func (it *DocumentIterator) Next() (*dialogflowpb.Document, 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 (*DocumentIterator) PageInfo
func (it *DocumentIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
DocumentsCallOptions
type DocumentsCallOptions struct {
ListDocuments []gax.CallOption
GetDocument []gax.CallOption
CreateDocument []gax.CallOption
ImportDocuments []gax.CallOption
DeleteDocument []gax.CallOption
UpdateDocument []gax.CallOption
ReloadDocument []gax.CallOption
ExportDocument []gax.CallOption
GetLocation []gax.CallOption
ListLocations []gax.CallOption
CancelOperation []gax.CallOption
GetOperation []gax.CallOption
ListOperations []gax.CallOption
}
DocumentsCallOptions contains the retry settings for each method of DocumentsClient.
DocumentsClient
type DocumentsClient struct {
// The call options for this service.
CallOptions *DocumentsCallOptions
// LROClient is used internally to handle long-running operations.
// It is exposed so that its CallOptions can be modified if required.
// Users should not Close this client.
LROClient *lroauto.OperationsClient
// contains filtered or unexported fields
}
DocumentsClient 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.
Service for managing knowledge Documents.
func NewDocumentsClient
func NewDocumentsClient(ctx context.Context, opts ...option.ClientOption) (*DocumentsClient, error)
NewDocumentsClient creates a new documents client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service for managing knowledge Documents.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewDocumentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func NewDocumentsRESTClient
func NewDocumentsRESTClient(ctx context.Context, opts ...option.ClientOption) (*DocumentsClient, error)
NewDocumentsRESTClient creates a new documents rest client.
Service for managing knowledge Documents.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewDocumentsRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*DocumentsClient) CancelOperation
func (c *DocumentsClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error
CancelOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewDocumentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.CancelOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
}
err = c.CancelOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*DocumentsClient) Close
func (c *DocumentsClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*DocumentsClient) Connection (deprecated)
func (c *DocumentsClient) Connection() *grpc.ClientConn
Connection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not always return the same resource.
func (*DocumentsClient) CreateDocument
func (c *DocumentsClient) CreateDocument(ctx context.Context, req *dialogflowpb.CreateDocumentRequest, opts ...gax.CallOption) (*CreateDocumentOperation, error)
CreateDocument creates a new document.
This method is a long-running operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned Operation type has the following method-specific fields:
metadata:
KnowledgeOperationMetadata
response: Document
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewDocumentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.CreateDocumentRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#CreateDocumentRequest.
}
op, err := c.CreateDocument(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*DocumentsClient) CreateDocumentOperation
func (c *DocumentsClient) CreateDocumentOperation(name string) *CreateDocumentOperation
CreateDocumentOperation returns a new CreateDocumentOperation from a given name. The name must be that of a previously created CreateDocumentOperation, possibly from a different process.
func (*DocumentsClient) DeleteDocument
func (c *DocumentsClient) DeleteDocument(ctx context.Context, req *dialogflowpb.DeleteDocumentRequest, opts ...gax.CallOption) (*DeleteDocumentOperation, error)
DeleteDocument deletes the specified document.
This method is a long-running operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned Operation type has the following method-specific fields:
metadata:
KnowledgeOperationMetadata
response: An Empty
message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewDocumentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.DeleteDocumentRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#DeleteDocumentRequest.
}
op, err := c.DeleteDocument(ctx, req)
if err != nil {
// TODO: Handle error.
}
err = op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
}
func (*DocumentsClient) DeleteDocumentOperation
func (c *DocumentsClient) DeleteDocumentOperation(name string) *DeleteDocumentOperation
DeleteDocumentOperation returns a new DeleteDocumentOperation from a given name. The name must be that of a previously created DeleteDocumentOperation, possibly from a different process.
func (*DocumentsClient) ExportDocument
func (c *DocumentsClient) ExportDocument(ctx context.Context, req *dialogflowpb.ExportDocumentRequest, opts ...gax.CallOption) (*ExportDocumentOperation, error)
ExportDocument exports a smart messaging candidate document into the specified destination.
This method is a long-running operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned Operation type has the following method-specific fields:
metadata:
KnowledgeOperationMetadata
response: Document
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewDocumentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.ExportDocumentRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#ExportDocumentRequest.
}
op, err := c.ExportDocument(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*DocumentsClient) ExportDocumentOperation
func (c *DocumentsClient) ExportDocumentOperation(name string) *ExportDocumentOperation
ExportDocumentOperation returns a new ExportDocumentOperation from a given name. The name must be that of a previously created ExportDocumentOperation, possibly from a different process.
func (*DocumentsClient) GetDocument
func (c *DocumentsClient) GetDocument(ctx context.Context, req *dialogflowpb.GetDocumentRequest, opts ...gax.CallOption) (*dialogflowpb.Document, error)
GetDocument retrieves the specified document.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewDocumentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.GetDocumentRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#GetDocumentRequest.
}
resp, err := c.GetDocument(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*DocumentsClient) GetLocation
func (c *DocumentsClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error)
GetLocation gets information about a location.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewDocumentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.GetLocationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest.
}
resp, err := c.GetLocation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*DocumentsClient) GetOperation
func (c *DocumentsClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
GetOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewDocumentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.GetOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
}
resp, err := c.GetOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*DocumentsClient) ImportDocuments
func (c *DocumentsClient) ImportDocuments(ctx context.Context, req *dialogflowpb.ImportDocumentsRequest, opts ...gax.CallOption) (*ImportDocumentsOperation, error)
ImportDocuments creates documents by importing data from external sources. Dialogflow supports up to 350 documents in each request. If you try to import more, Dialogflow will return an error.
This method is a long-running operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned Operation type has the following method-specific fields:
metadata:
KnowledgeOperationMetadata
response:
ImportDocumentsResponse
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewDocumentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.ImportDocumentsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#ImportDocumentsRequest.
}
op, err := c.ImportDocuments(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*DocumentsClient) ImportDocumentsOperation
func (c *DocumentsClient) ImportDocumentsOperation(name string) *ImportDocumentsOperation
ImportDocumentsOperation returns a new ImportDocumentsOperation from a given name. The name must be that of a previously created ImportDocumentsOperation, possibly from a different process.
func (*DocumentsClient) ListDocuments
func (c *DocumentsClient) ListDocuments(ctx context.Context, req *dialogflowpb.ListDocumentsRequest, opts ...gax.CallOption) *DocumentIterator
ListDocuments returns the list of all documents of the knowledge base.
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewDocumentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.ListDocumentsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#ListDocumentsRequest.
}
it := c.ListDocuments(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*dialogflowpb.ListDocumentsResponse)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewDocumentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.ListDocumentsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#ListDocumentsRequest.
}
for resp, err := range c.ListDocuments(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*DocumentsClient) ListLocations
func (c *DocumentsClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator
ListLocations lists information about the supported locations for this service.
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
"google.golang.org/api/iterator"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewDocumentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
it := c.ListLocations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*locationpb.ListLocationsResponse)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewDocumentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
for resp, err := range c.ListLocations(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*DocumentsClient) ListOperations
func (c *DocumentsClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewDocumentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
it := c.ListOperations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*longrunningpb.ListOperationsResponse)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewDocumentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
for resp, err := range c.ListOperations(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*DocumentsClient) ReloadDocument
func (c *DocumentsClient) ReloadDocument(ctx context.Context, req *dialogflowpb.ReloadDocumentRequest, opts ...gax.CallOption) (*ReloadDocumentOperation, error)
ReloadDocument reloads the specified document from its specified source, content_uri or content. The previously loaded content of the document will be deleted. Note: Even when the content of the document has not changed, there still may be side effects because of internal implementation changes.
This method is a long-running operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned Operation type has the following method-specific fields:
metadata:
KnowledgeOperationMetadata
response: Document
Note: The projects.agent.knowledgeBases.documents resource is deprecated; only use projects.knowledgeBases.documents.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewDocumentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.ReloadDocumentRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#ReloadDocumentRequest.
}
op, err := c.ReloadDocument(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*DocumentsClient) ReloadDocumentOperation
func (c *DocumentsClient) ReloadDocumentOperation(name string) *ReloadDocumentOperation
ReloadDocumentOperation returns a new ReloadDocumentOperation from a given name. The name must be that of a previously created ReloadDocumentOperation, possibly from a different process.
func (*DocumentsClient) UpdateDocument
func (c *DocumentsClient) UpdateDocument(ctx context.Context, req *dialogflowpb.UpdateDocumentRequest, opts ...gax.CallOption) (*UpdateDocumentOperation, error)
UpdateDocument updates the specified document.
This method is a long-running operation (at https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned Operation type has the following method-specific fields:
metadata:
KnowledgeOperationMetadata
response: Document
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewDocumentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.UpdateDocumentRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#UpdateDocumentRequest.
}
op, err := c.UpdateDocument(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*DocumentsClient) UpdateDocumentOperation
func (c *DocumentsClient) UpdateDocumentOperation(name string) *UpdateDocumentOperation
UpdateDocumentOperation returns a new UpdateDocumentOperation from a given name. The name must be that of a previously created UpdateDocumentOperation, possibly from a different process.
EncryptionSpecCallOptions
type EncryptionSpecCallOptions struct {
GetEncryptionSpec []gax.CallOption
InitializeEncryptionSpec []gax.CallOption
GetLocation []gax.CallOption
ListLocations []gax.CallOption
CancelOperation []gax.CallOption
GetOperation []gax.CallOption
ListOperations []gax.CallOption
}
EncryptionSpecCallOptions contains the retry settings for each method of EncryptionSpecClient.
EncryptionSpecClient
type EncryptionSpecClient struct {
// The call options for this service.
CallOptions *EncryptionSpecCallOptions
// LROClient is used internally to handle long-running operations.
// It is exposed so that its CallOptions can be modified if required.
// Users should not Close this client.
LROClient *lroauto.OperationsClient
// contains filtered or unexported fields
}
EncryptionSpecClient 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.
Manages encryption spec settings for Dialogflow and Agent Assist.
func NewEncryptionSpecClient
func NewEncryptionSpecClient(ctx context.Context, opts ...option.ClientOption) (*EncryptionSpecClient, error)
NewEncryptionSpecClient creates a new encryption spec service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Manages encryption spec settings for Dialogflow and Agent Assist.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewEncryptionSpecClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func NewEncryptionSpecRESTClient
func NewEncryptionSpecRESTClient(ctx context.Context, opts ...option.ClientOption) (*EncryptionSpecClient, error)
NewEncryptionSpecRESTClient creates a new encryption spec service rest client.
Manages encryption spec settings for Dialogflow and Agent Assist.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewEncryptionSpecRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*EncryptionSpecClient) CancelOperation
func (c *EncryptionSpecClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error
CancelOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewEncryptionSpecClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.CancelOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
}
err = c.CancelOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*EncryptionSpecClient) Close
func (c *EncryptionSpecClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*EncryptionSpecClient) Connection (deprecated)
func (c *EncryptionSpecClient) Connection() *grpc.ClientConn
Connection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not always return the same resource.
func (*EncryptionSpecClient) GetEncryptionSpec
func (c *EncryptionSpecClient) GetEncryptionSpec(ctx context.Context, req *dialogflowpb.GetEncryptionSpecRequest, opts ...gax.CallOption) (*dialogflowpb.EncryptionSpec, error)
GetEncryptionSpec gets location-level encryption key specification.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewEncryptionSpecClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.GetEncryptionSpecRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#GetEncryptionSpecRequest.
}
resp, err := c.GetEncryptionSpec(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*EncryptionSpecClient) GetLocation
func (c *EncryptionSpecClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error)
GetLocation gets information about a location.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewEncryptionSpecClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.GetLocationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest.
}
resp, err := c.GetLocation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*EncryptionSpecClient) GetOperation
func (c *EncryptionSpecClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
GetOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewEncryptionSpecClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.GetOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
}
resp, err := c.GetOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*EncryptionSpecClient) InitializeEncryptionSpec
func (c *EncryptionSpecClient) InitializeEncryptionSpec(ctx context.Context, req *dialogflowpb.InitializeEncryptionSpecRequest, opts ...gax.CallOption) (*InitializeEncryptionSpecOperation, error)
InitializeEncryptionSpec initializes a location-level encryption key specification. An error will be thrown if the location has resources already created before the initialization. Once the encryption specification is initialized at a location, it is immutable and all newly created resources under the location will be encrypted with the existing specification.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewEncryptionSpecClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.InitializeEncryptionSpecRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#InitializeEncryptionSpecRequest.
}
op, err := c.InitializeEncryptionSpec(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*EncryptionSpecClient) InitializeEncryptionSpecOperation
func (c *EncryptionSpecClient) InitializeEncryptionSpecOperation(name string) *InitializeEncryptionSpecOperation
InitializeEncryptionSpecOperation returns a new InitializeEncryptionSpecOperation from a given name. The name must be that of a previously created InitializeEncryptionSpecOperation, possibly from a different process.
func (*EncryptionSpecClient) ListLocations
func (c *EncryptionSpecClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator
ListLocations lists information about the supported locations for this service.
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
"google.golang.org/api/iterator"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewEncryptionSpecClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
it := c.ListLocations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*locationpb.ListLocationsResponse)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewEncryptionSpecClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
for resp, err := range c.ListLocations(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*EncryptionSpecClient) ListOperations
func (c *EncryptionSpecClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewEncryptionSpecClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
it := c.ListOperations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*longrunningpb.ListOperationsResponse)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewEncryptionSpecClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
for resp, err := range c.ListOperations(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
EntityTypeIterator
type EntityTypeIterator struct {
// Response is the raw response for the current page.
// It must be cast to the RPC response type.
// Calling Next() or InternalFetch() updates this value.
Response interface{}
// 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) All
func (it *EntityTypeIterator) All() iter.Seq2[*dialogflowpb.EntityType, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
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.
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
GetLocation []gax.CallOption
ListLocations []gax.CallOption
CancelOperation []gax.CallOption
GetOperation []gax.CallOption
ListOperations []gax.CallOption
}
EntityTypesCallOptions contains the retry settings for each method of EntityTypesClient.
EntityTypesClient
type EntityTypesClient struct {
// The call options for this service.
CallOptions *EntityTypesCallOptions
// LROClient is used internally to handle long-running operations.
// It is exposed so that its CallOptions can be modified if required.
// Users should not Close this client.
LROClient *lroauto.OperationsClient
// 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.
Service for managing EntityTypes.
func NewEntityTypesClient
func NewEntityTypesClient(ctx context.Context, opts ...option.ClientOption) (*EntityTypesClient, error)
NewEntityTypesClient creates a new entity types client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service for managing EntityTypes.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewEntityTypesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func NewEntityTypesRESTClient
func NewEntityTypesRESTClient(ctx context.Context, opts ...option.ClientOption) (*EntityTypesClient, error)
NewEntityTypesRESTClient creates a new entity types rest client.
Service for managing EntityTypes.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewEntityTypesRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
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.
This method is a long-running operation (at https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned Operation type has the following method-specific fields:
metadata: An empty Struct
message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
response: An Empty
message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
Note: You should always train an agent prior to sending it queries. See the training documentation (at https://cloud.google.com/dialogflow/es/docs/training).
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewEntityTypesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.BatchCreateEntitiesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#BatchCreateEntitiesRequest.
}
op, err := c.BatchCreateEntities(ctx, req)
if err != nil {
// TODO: Handle error.
}
err = op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
}
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.
This method is a long-running operation (at https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned Operation type has the following method-specific fields:
metadata: An empty Struct
message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
response: An Empty
message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
Note: You should always train an agent prior to sending it queries. See the training documentation (at https://cloud.google.com/dialogflow/es/docs/training).
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewEntityTypesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.BatchDeleteEntitiesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#BatchDeleteEntitiesRequest.
}
op, err := c.BatchDeleteEntities(ctx, req)
if err != nil {
// TODO: Handle error.
}
err = op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
}
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.
This method is a long-running operation (at https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned Operation type has the following method-specific fields:
metadata: An empty Struct
message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
response: An Empty
message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
Note: You should always train an agent prior to sending it queries. See the training documentation (at https://cloud.google.com/dialogflow/es/docs/training).
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewEntityTypesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.BatchDeleteEntityTypesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#BatchDeleteEntityTypesRequest.
}
op, err := c.BatchDeleteEntityTypes(ctx, req)
if err != nil {
// TODO: Handle error.
}
err = op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
}
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 or creates multiple entities in the specified entity type. This method does not affect entities in the entity type that aren’t explicitly specified in the request.
This method is a long-running operation (at https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned Operation type has the following method-specific fields:
metadata: An empty Struct
message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
response: An Empty
message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
Note: You should always train an agent prior to sending it queries. See the training documentation (at https://cloud.google.com/dialogflow/es/docs/training).
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewEntityTypesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.BatchUpdateEntitiesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#BatchUpdateEntitiesRequest.
}
op, err := c.BatchUpdateEntities(ctx, req)
if err != nil {
// TODO: Handle error.
}
err = op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
}
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.
This method is a long-running operation (at https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned Operation type has the following method-specific fields:
metadata: An empty Struct
message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
response:
BatchUpdateEntityTypesResponse
Note: You should always train an agent prior to sending it queries. See the training documentation (at https://cloud.google.com/dialogflow/es/docs/training).
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewEntityTypesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.BatchUpdateEntityTypesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#BatchUpdateEntityTypesRequest.
}
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
}
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) CancelOperation
func (c *EntityTypesClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error
CancelOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewEntityTypesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.CancelOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
}
err = c.CancelOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
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 (deprecated)
func (c *EntityTypesClient) Connection() *grpc.ClientConn
Connection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not always return the same resource.
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.
Note: You should always train an agent prior to sending it queries. See the training documentation (at https://cloud.google.com/dialogflow/es/docs/training).
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewEntityTypesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.CreateEntityTypeRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#CreateEntityTypeRequest.
}
resp, err := c.CreateEntityType(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*EntityTypesClient) DeleteEntityType
func (c *EntityTypesClient) DeleteEntityType(ctx context.Context, req *dialogflowpb.DeleteEntityTypeRequest, opts ...gax.CallOption) error
DeleteEntityType deletes the specified entity type.
Note: You should always train an agent prior to sending it queries. See the training documentation (at https://cloud.google.com/dialogflow/es/docs/training).
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewEntityTypesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.DeleteEntityTypeRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#DeleteEntityTypeRequest.
}
err = c.DeleteEntityType(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
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 "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewEntityTypesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.GetEntityTypeRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#GetEntityTypeRequest.
}
resp, err := c.GetEntityType(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*EntityTypesClient) GetLocation
func (c *EntityTypesClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error)
GetLocation gets information about a location.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewEntityTypesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.GetLocationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest.
}
resp, err := c.GetLocation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*EntityTypesClient) GetOperation
func (c *EntityTypesClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
GetOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewEntityTypesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.GetOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
}
resp, err := c.GetOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
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.
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewEntityTypesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.ListEntityTypesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#ListEntityTypesRequest.
}
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
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*dialogflowpb.ListEntityTypesResponse)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewEntityTypesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.ListEntityTypesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#ListEntityTypesRequest.
}
for resp, err := range c.ListEntityTypes(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*EntityTypesClient) ListLocations
func (c *EntityTypesClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator
ListLocations lists information about the supported locations for this service.
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
"google.golang.org/api/iterator"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewEntityTypesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
it := c.ListLocations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*locationpb.ListLocationsResponse)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewEntityTypesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
for resp, err := range c.ListLocations(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*EntityTypesClient) ListOperations
func (c *EntityTypesClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewEntityTypesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
it := c.ListOperations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*longrunningpb.ListOperationsResponse)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewEntityTypesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
for resp, err := range c.ListOperations(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
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.
Note: You should always train an agent prior to sending it queries. See the training documentation (at https://cloud.google.com/dialogflow/es/docs/training).
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewEntityTypesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.UpdateEntityTypeRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#UpdateEntityTypeRequest.
}
resp, err := c.UpdateEntityType(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
EnvironmentHistory_EntryIterator
type EnvironmentHistory_EntryIterator struct {
// Response is the raw response for the current page.
// It must be cast to the RPC response type.
// Calling Next() or InternalFetch() updates this value.
Response interface{}
// 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.EnvironmentHistory_Entry, nextPageToken string, err error)
// contains filtered or unexported fields
}
EnvironmentHistory_EntryIterator manages a stream of *dialogflowpb.EnvironmentHistory_Entry.
func (*EnvironmentHistory_EntryIterator) All
func (it *EnvironmentHistory_EntryIterator) All() iter.Seq2[*dialogflowpb.EnvironmentHistory_Entry, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*EnvironmentHistory_EntryIterator) Next
func (it *EnvironmentHistory_EntryIterator) Next() (*dialogflowpb.EnvironmentHistory_Entry, 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 (*EnvironmentHistory_EntryIterator) PageInfo
func (it *EnvironmentHistory_EntryIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
EnvironmentIterator
type EnvironmentIterator struct {
// Response is the raw response for the current page.
// It must be cast to the RPC response type.
// Calling Next() or InternalFetch() updates this value.
Response interface{}
// 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.Environment, nextPageToken string, err error)
// contains filtered or unexported fields
}
EnvironmentIterator manages a stream of *dialogflowpb.Environment.
func (*EnvironmentIterator) All
func (it *EnvironmentIterator) All() iter.Seq2[*dialogflowpb.Environment, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*EnvironmentIterator) Next
func (it *EnvironmentIterator) Next() (*dialogflowpb.Environment, 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 (*EnvironmentIterator) PageInfo
func (it *EnvironmentIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
EnvironmentsCallOptions
type EnvironmentsCallOptions struct {
ListEnvironments []gax.CallOption
GetEnvironment []gax.CallOption
CreateEnvironment []gax.CallOption
UpdateEnvironment []gax.CallOption
DeleteEnvironment []gax.CallOption
GetEnvironmentHistory []gax.CallOption
GetLocation []gax.CallOption
ListLocations []gax.CallOption
CancelOperation []gax.CallOption
GetOperation []gax.CallOption
ListOperations []gax.CallOption
}
EnvironmentsCallOptions contains the retry settings for each method of EnvironmentsClient.
EnvironmentsClient
type EnvironmentsClient struct {
// The call options for this service.
CallOptions *EnvironmentsCallOptions
// contains filtered or unexported fields
}
EnvironmentsClient 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.
Service for managing Environments.
func NewEnvironmentsClient
func NewEnvironmentsClient(ctx context.Context, opts ...option.ClientOption) (*EnvironmentsClient, error)
NewEnvironmentsClient creates a new environments client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service for managing Environments.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewEnvironmentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func NewEnvironmentsRESTClient
func NewEnvironmentsRESTClient(ctx context.Context, opts ...option.ClientOption) (*EnvironmentsClient, error)
NewEnvironmentsRESTClient creates a new environments rest client.
Service for managing Environments.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewEnvironmentsRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*EnvironmentsClient) CancelOperation
func (c *EnvironmentsClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error
CancelOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewEnvironmentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.CancelOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
}
err = c.CancelOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*EnvironmentsClient) Close
func (c *EnvironmentsClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*EnvironmentsClient) Connection (deprecated)
func (c *EnvironmentsClient) Connection() *grpc.ClientConn
Connection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not always return the same resource.
func (*EnvironmentsClient) CreateEnvironment
func (c *EnvironmentsClient) CreateEnvironment(ctx context.Context, req *dialogflowpb.CreateEnvironmentRequest, opts ...gax.CallOption) (*dialogflowpb.Environment, error)
CreateEnvironment creates an agent environment.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewEnvironmentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.CreateEnvironmentRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#CreateEnvironmentRequest.
}
resp, err := c.CreateEnvironment(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*EnvironmentsClient) DeleteEnvironment
func (c *EnvironmentsClient) DeleteEnvironment(ctx context.Context, req *dialogflowpb.DeleteEnvironmentRequest, opts ...gax.CallOption) error
DeleteEnvironment deletes the specified agent environment.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewEnvironmentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.DeleteEnvironmentRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#DeleteEnvironmentRequest.
}
err = c.DeleteEnvironment(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*EnvironmentsClient) GetEnvironment
func (c *EnvironmentsClient) GetEnvironment(ctx context.Context, req *dialogflowpb.GetEnvironmentRequest, opts ...gax.CallOption) (*dialogflowpb.Environment, error)
GetEnvironment retrieves the specified agent environment.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewEnvironmentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.GetEnvironmentRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#GetEnvironmentRequest.
}
resp, err := c.GetEnvironment(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*EnvironmentsClient) GetEnvironmentHistory
func (c *EnvironmentsClient) GetEnvironmentHistory(ctx context.Context, req *dialogflowpb.GetEnvironmentHistoryRequest, opts ...gax.CallOption) *EnvironmentHistory_EntryIterator
GetEnvironmentHistory gets the history of the specified environment.
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewEnvironmentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.GetEnvironmentHistoryRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#GetEnvironmentHistoryRequest.
}
it := c.GetEnvironmentHistory(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*dialogflowpb.EnvironmentHistory)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewEnvironmentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.GetEnvironmentHistoryRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#GetEnvironmentHistoryRequest.
}
for resp, err := range c.GetEnvironmentHistory(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*EnvironmentsClient) GetLocation
func (c *EnvironmentsClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error)
GetLocation gets information about a location.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewEnvironmentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.GetLocationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest.
}
resp, err := c.GetLocation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*EnvironmentsClient) GetOperation
func (c *EnvironmentsClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
GetOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewEnvironmentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.GetOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
}
resp, err := c.GetOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*EnvironmentsClient) ListEnvironments
func (c *EnvironmentsClient) ListEnvironments(ctx context.Context, req *dialogflowpb.ListEnvironmentsRequest, opts ...gax.CallOption) *EnvironmentIterator
ListEnvironments returns the list of all non-default environments of the specified agent.
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewEnvironmentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.ListEnvironmentsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#ListEnvironmentsRequest.
}
it := c.ListEnvironments(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*dialogflowpb.ListEnvironmentsResponse)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewEnvironmentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.ListEnvironmentsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#ListEnvironmentsRequest.
}
for resp, err := range c.ListEnvironments(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*EnvironmentsClient) ListLocations
func (c *EnvironmentsClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator
ListLocations lists information about the supported locations for this service.
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
"google.golang.org/api/iterator"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewEnvironmentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
it := c.ListLocations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*locationpb.ListLocationsResponse)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewEnvironmentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
for resp, err := range c.ListLocations(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*EnvironmentsClient) ListOperations
func (c *EnvironmentsClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewEnvironmentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
it := c.ListOperations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*longrunningpb.ListOperationsResponse)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewEnvironmentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
for resp, err := range c.ListOperations(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*EnvironmentsClient) UpdateEnvironment
func (c *EnvironmentsClient) UpdateEnvironment(ctx context.Context, req *dialogflowpb.UpdateEnvironmentRequest, opts ...gax.CallOption) (*dialogflowpb.Environment, error)
UpdateEnvironment updates the specified agent environment.
This method allows you to deploy new agent versions into the environment. When an environment is pointed to a new agent version by setting environment.agent_version, the environment is temporarily set to the LOADING state. During that time, the environment continues serving the previous version of the agent. After the new agent version is done loading, the environment is set back to the RUNNING state. You can use “-” as Environment ID in environment name to update an agent version in the default environment. WARNING: this will negate all recent changes to the draft agent and can’t be undone. You may want to save the draft agent to a version before calling this method.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewEnvironmentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.UpdateEnvironmentRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#UpdateEnvironmentRequest.
}
resp, err := c.UpdateEnvironment(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
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() (*structpb.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.
ExportDocumentOperation
type ExportDocumentOperation struct {
// contains filtered or unexported fields
}
ExportDocumentOperation manages a long-running operation from ExportDocument.
func (*ExportDocumentOperation) Done
func (op *ExportDocumentOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*ExportDocumentOperation) Metadata
func (op *ExportDocumentOperation) Metadata() (*dialogflowpb.KnowledgeOperationMetadata, 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 (*ExportDocumentOperation) Name
func (op *ExportDocumentOperation) 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 (*ExportDocumentOperation) Poll
func (op *ExportDocumentOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*dialogflowpb.Document, 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 (*ExportDocumentOperation) Wait
func (op *ExportDocumentOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*dialogflowpb.Document, 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.
FulfillmentsCallOptions
type FulfillmentsCallOptions struct {
GetFulfillment []gax.CallOption
UpdateFulfillment []gax.CallOption
GetLocation []gax.CallOption
ListLocations []gax.CallOption
CancelOperation []gax.CallOption
GetOperation []gax.CallOption
ListOperations []gax.CallOption
}
FulfillmentsCallOptions contains the retry settings for each method of FulfillmentsClient.
FulfillmentsClient
type FulfillmentsClient struct {
// The call options for this service.
CallOptions *FulfillmentsCallOptions
// contains filtered or unexported fields
}
FulfillmentsClient 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.
Service for managing Fulfillments.
func NewFulfillmentsClient
func NewFulfillmentsClient(ctx context.Context, opts ...option.ClientOption) (*FulfillmentsClient, error)
NewFulfillmentsClient creates a new fulfillments client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service for managing Fulfillments.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewFulfillmentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func NewFulfillmentsRESTClient
func NewFulfillmentsRESTClient(ctx context.Context, opts ...option.ClientOption) (*FulfillmentsClient, error)
NewFulfillmentsRESTClient creates a new fulfillments rest client.
Service for managing Fulfillments.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewFulfillmentsRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*FulfillmentsClient) CancelOperation
func (c *FulfillmentsClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error
CancelOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewFulfillmentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.CancelOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
}
err = c.CancelOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*FulfillmentsClient) Close
func (c *FulfillmentsClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*FulfillmentsClient) Connection (deprecated)
func (c *FulfillmentsClient) Connection() *grpc.ClientConn
Connection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not always return the same resource.
func (*FulfillmentsClient) GetFulfillment
func (c *FulfillmentsClient) GetFulfillment(ctx context.Context, req *dialogflowpb.GetFulfillmentRequest, opts ...gax.CallOption) (*dialogflowpb.Fulfillment, error)
GetFulfillment retrieves the fulfillment.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewFulfillmentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.GetFulfillmentRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#GetFulfillmentRequest.
}
resp, err := c.GetFulfillment(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*FulfillmentsClient) GetLocation
func (c *FulfillmentsClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error)
GetLocation gets information about a location.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewFulfillmentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.GetLocationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest.
}
resp, err := c.GetLocation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*FulfillmentsClient) GetOperation
func (c *FulfillmentsClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
GetOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewFulfillmentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.GetOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
}
resp, err := c.GetOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*FulfillmentsClient) ListLocations
func (c *FulfillmentsClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator
ListLocations lists information about the supported locations for this service.
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
"google.golang.org/api/iterator"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewFulfillmentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
it := c.ListLocations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*locationpb.ListLocationsResponse)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewFulfillmentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
for resp, err := range c.ListLocations(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*FulfillmentsClient) ListOperations
func (c *FulfillmentsClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewFulfillmentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
it := c.ListOperations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*longrunningpb.ListOperationsResponse)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewFulfillmentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
for resp, err := range c.ListOperations(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*FulfillmentsClient) UpdateFulfillment
func (c *FulfillmentsClient) UpdateFulfillment(ctx context.Context, req *dialogflowpb.UpdateFulfillmentRequest, opts ...gax.CallOption) (*dialogflowpb.Fulfillment, error)
UpdateFulfillment updates the fulfillment.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewFulfillmentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.UpdateFulfillmentRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#UpdateFulfillmentRequest.
}
resp, err := c.UpdateFulfillment(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
GeneratorIterator
type GeneratorIterator struct {
// Response is the raw response for the current page.
// It must be cast to the RPC response type.
// Calling Next() or InternalFetch() updates this value.
Response interface{}
// 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.Generator, nextPageToken string, err error)
// contains filtered or unexported fields
}
GeneratorIterator manages a stream of *dialogflowpb.Generator.
func (*GeneratorIterator) All
func (it *GeneratorIterator) All() iter.Seq2[*dialogflowpb.Generator, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*GeneratorIterator) Next
func (it *GeneratorIterator) Next() (*dialogflowpb.Generator, 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 (*GeneratorIterator) PageInfo
func (it *GeneratorIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
GeneratorsCallOptions
type GeneratorsCallOptions struct {
CreateGenerator []gax.CallOption
GetGenerator []gax.CallOption
ListGenerators []gax.CallOption
DeleteGenerator []gax.CallOption
UpdateGenerator []gax.CallOption
GetLocation []gax.CallOption
ListLocations []gax.CallOption
CancelOperation []gax.CallOption
GetOperation []gax.CallOption
ListOperations []gax.CallOption
}
GeneratorsCallOptions contains the retry settings for each method of GeneratorsClient.
GeneratorsClient
type GeneratorsClient struct {
// The call options for this service.
CallOptions *GeneratorsCallOptions
// contains filtered or unexported fields
}
GeneratorsClient 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.
Generator Service for LLM powered Agent Assist. This service manages the configurations of user owned Generators, such as description, context and instruction, input/output format, etc. The generator resources will be used inside a conversation and will be triggered by TriggerEvent to query LLM for answers.
func NewGeneratorsClient
func NewGeneratorsClient(ctx context.Context, opts ...option.ClientOption) (*GeneratorsClient, error)
NewGeneratorsClient creates a new generators client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Generator Service for LLM powered Agent Assist. This service manages the configurations of user owned Generators, such as description, context and instruction, input/output format, etc. The generator resources will be used inside a conversation and will be triggered by TriggerEvent to query LLM for answers.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewGeneratorsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func NewGeneratorsRESTClient
func NewGeneratorsRESTClient(ctx context.Context, opts ...option.ClientOption) (*GeneratorsClient, error)
NewGeneratorsRESTClient creates a new generators rest client.
Generator Service for LLM powered Agent Assist. This service manages the configurations of user owned Generators, such as description, context and instruction, input/output format, etc. The generator resources will be used inside a conversation and will be triggered by TriggerEvent to query LLM for answers.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewGeneratorsRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*GeneratorsClient) CancelOperation
func (c *GeneratorsClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error
CancelOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewGeneratorsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.CancelOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
}
err = c.CancelOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*GeneratorsClient) Close
func (c *GeneratorsClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*GeneratorsClient) Connection (deprecated)
func (c *GeneratorsClient) Connection() *grpc.ClientConn
Connection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not always return the same resource.
func (*GeneratorsClient) CreateGenerator
func (c *GeneratorsClient) CreateGenerator(ctx context.Context, req *dialogflowpb.CreateGeneratorRequest, opts ...gax.CallOption) (*dialogflowpb.Generator, error)
CreateGenerator creates a generator.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewGeneratorsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.CreateGeneratorRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#CreateGeneratorRequest.
}
resp, err := c.CreateGenerator(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*GeneratorsClient) DeleteGenerator
func (c *GeneratorsClient) DeleteGenerator(ctx context.Context, req *dialogflowpb.DeleteGeneratorRequest, opts ...gax.CallOption) error
DeleteGenerator deletes a generator.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewGeneratorsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.DeleteGeneratorRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#DeleteGeneratorRequest.
}
err = c.DeleteGenerator(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*GeneratorsClient) GetGenerator
func (c *GeneratorsClient) GetGenerator(ctx context.Context, req *dialogflowpb.GetGeneratorRequest, opts ...gax.CallOption) (*dialogflowpb.Generator, error)
GetGenerator retrieves a generator.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewGeneratorsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.GetGeneratorRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#GetGeneratorRequest.
}
resp, err := c.GetGenerator(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*GeneratorsClient) GetLocation
func (c *GeneratorsClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error)
GetLocation gets information about a location.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewGeneratorsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.GetLocationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest.
}
resp, err := c.GetLocation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*GeneratorsClient) GetOperation
func (c *GeneratorsClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
GetOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewGeneratorsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.GetOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
}
resp, err := c.GetOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*GeneratorsClient) ListGenerators
func (c *GeneratorsClient) ListGenerators(ctx context.Context, req *dialogflowpb.ListGeneratorsRequest, opts ...gax.CallOption) *GeneratorIterator
ListGenerators lists generators.
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewGeneratorsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.ListGeneratorsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#ListGeneratorsRequest.
}
it := c.ListGenerators(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*dialogflowpb.ListGeneratorsResponse)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewGeneratorsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.ListGeneratorsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#ListGeneratorsRequest.
}
for resp, err := range c.ListGenerators(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*GeneratorsClient) ListLocations
func (c *GeneratorsClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator
ListLocations lists information about the supported locations for this service.
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
"google.golang.org/api/iterator"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewGeneratorsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
it := c.ListLocations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*locationpb.ListLocationsResponse)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewGeneratorsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
for resp, err := range c.ListLocations(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*GeneratorsClient) ListOperations
func (c *GeneratorsClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewGeneratorsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
it := c.ListOperations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*longrunningpb.ListOperationsResponse)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewGeneratorsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
for resp, err := range c.ListOperations(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*GeneratorsClient) UpdateGenerator
func (c *GeneratorsClient) UpdateGenerator(ctx context.Context, req *dialogflowpb.UpdateGeneratorRequest, opts ...gax.CallOption) (*dialogflowpb.Generator, error)
UpdateGenerator updates a generator.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewGeneratorsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.UpdateGeneratorRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#UpdateGeneratorRequest.
}
resp, err := c.UpdateGenerator(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
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() (*structpb.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, 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 (*ImportAgentOperation) Wait
func (op *ImportAgentOperation) Wait(ctx context.Context, opts ...gax.CallOption) 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.
ImportConversationDataOperation
type ImportConversationDataOperation struct {
// contains filtered or unexported fields
}
ImportConversationDataOperation manages a long-running operation from ImportConversationData.
func (*ImportConversationDataOperation) Done
func (op *ImportConversationDataOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*ImportConversationDataOperation) Metadata
func (op *ImportConversationDataOperation) Metadata() (*dialogflowpb.ImportConversationDataOperationMetadata, 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 (*ImportConversationDataOperation) Name
func (op *ImportConversationDataOperation) 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 (*ImportConversationDataOperation) Poll
func (op *ImportConversationDataOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*dialogflowpb.ImportConversationDataOperationResponse, 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 (*ImportConversationDataOperation) Wait
func (op *ImportConversationDataOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*dialogflowpb.ImportConversationDataOperationResponse, 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.
ImportDocumentsOperation
type ImportDocumentsOperation struct {
// contains filtered or unexported fields
}
ImportDocumentsOperation manages a long-running operation from ImportDocuments.
func (*ImportDocumentsOperation) Done
func (op *ImportDocumentsOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*ImportDocumentsOperation) Metadata
func (op *ImportDocumentsOperation) Metadata() (*dialogflowpb.KnowledgeOperationMetadata, 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 (*ImportDocumentsOperation) Name
func (op *ImportDocumentsOperation) 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 (*ImportDocumentsOperation) Poll
func (op *ImportDocumentsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*dialogflowpb.ImportDocumentsResponse, 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 (*ImportDocumentsOperation) Wait
func (op *ImportDocumentsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*dialogflowpb.ImportDocumentsResponse, 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.
InitializeEncryptionSpecOperation
type InitializeEncryptionSpecOperation struct {
// contains filtered or unexported fields
}
InitializeEncryptionSpecOperation manages a long-running operation from InitializeEncryptionSpec.
func (*InitializeEncryptionSpecOperation) Done
func (op *InitializeEncryptionSpecOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*InitializeEncryptionSpecOperation) Metadata
func (op *InitializeEncryptionSpecOperation) Metadata() (*dialogflowpb.InitializeEncryptionSpecMetadata, 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 (*InitializeEncryptionSpecOperation) Name
func (op *InitializeEncryptionSpecOperation) 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 (*InitializeEncryptionSpecOperation) Poll
func (op *InitializeEncryptionSpecOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*dialogflowpb.InitializeEncryptionSpecResponse, 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 (*InitializeEncryptionSpecOperation) Wait
func (op *InitializeEncryptionSpecOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*dialogflowpb.InitializeEncryptionSpecResponse, 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.
IntentIterator
type IntentIterator struct {
// Response is the raw response for the current page.
// It must be cast to the RPC response type.
// Calling Next() or InternalFetch() updates this value.
Response interface{}
// 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) All
func (it *IntentIterator) All() iter.Seq2[*dialogflowpb.Intent, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
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.
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
GetLocation []gax.CallOption
ListLocations []gax.CallOption
CancelOperation []gax.CallOption
GetOperation []gax.CallOption
ListOperations []gax.CallOption
}
IntentsCallOptions contains the retry settings for each method of IntentsClient.
IntentsClient
type IntentsClient struct {
// The call options for this service.
CallOptions *IntentsCallOptions
// LROClient is used internally to handle long-running operations.
// It is exposed so that its CallOptions can be modified if required.
// Users should not Close this client.
LROClient *lroauto.OperationsClient
// 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.
Service for managing Intents.
func NewIntentsClient
func NewIntentsClient(ctx context.Context, opts ...option.ClientOption) (*IntentsClient, error)
NewIntentsClient creates a new intents client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service for managing Intents.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewIntentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func NewIntentsRESTClient
func NewIntentsRESTClient(ctx context.Context, opts ...option.ClientOption) (*IntentsClient, error)
NewIntentsRESTClient creates a new intents rest client.
Service for managing Intents.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewIntentsRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
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.
This method is a long-running operation (at https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned Operation type has the following method-specific fields:
metadata: An empty Struct
message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
response: An Empty
message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
Note: You should always train an agent prior to sending it queries. See the training documentation (at https://cloud.google.com/dialogflow/es/docs/training).
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewIntentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.BatchDeleteIntentsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#BatchDeleteIntentsRequest.
}
op, err := c.BatchDeleteIntents(ctx, req)
if err != nil {
// TODO: Handle error.
}
err = op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
}
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.
This method is a long-running operation (at https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned Operation type has the following method-specific fields:
metadata: An empty Struct
message (at https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
response:
BatchUpdateIntentsResponse
Note: You should always train an agent prior to sending it queries. See the training documentation (at https://cloud.google.com/dialogflow/es/docs/training).
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewIntentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.BatchUpdateIntentsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#BatchUpdateIntentsRequest.
}
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
}
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) CancelOperation
func (c *IntentsClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error
CancelOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewIntentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.CancelOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
}
err = c.CancelOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
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 (deprecated)
func (c *IntentsClient) Connection() *grpc.ClientConn
Connection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not always return the same resource.
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.
Note: You should always train an agent prior to sending it queries. See the training documentation (at https://cloud.google.com/dialogflow/es/docs/training).
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewIntentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.CreateIntentRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#CreateIntentRequest.
}
resp, err := c.CreateIntent(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*IntentsClient) DeleteIntent
func (c *IntentsClient) DeleteIntent(ctx context.Context, req *dialogflowpb.DeleteIntentRequest, opts ...gax.CallOption) error
DeleteIntent deletes the specified intent and its direct or indirect followup intents.
Note: You should always train an agent prior to sending it queries. See the training documentation (at https://cloud.google.com/dialogflow/es/docs/training).
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewIntentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.DeleteIntentRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#DeleteIntentRequest.
}
err = c.DeleteIntent(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
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 "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewIntentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.GetIntentRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#GetIntentRequest.
}
resp, err := c.GetIntent(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*IntentsClient) GetLocation
func (c *IntentsClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error)
GetLocation gets information about a location.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewIntentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.GetLocationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest.
}
resp, err := c.GetLocation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*IntentsClient) GetOperation
func (c *IntentsClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
GetOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewIntentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.GetOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
}
resp, err := c.GetOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
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.
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewIntentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.ListIntentsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#ListIntentsRequest.
}
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
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*dialogflowpb.ListIntentsResponse)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewIntentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.ListIntentsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#ListIntentsRequest.
}
for resp, err := range c.ListIntents(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*IntentsClient) ListLocations
func (c *IntentsClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator
ListLocations lists information about the supported locations for this service.
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
"google.golang.org/api/iterator"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewIntentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
it := c.ListLocations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*locationpb.ListLocationsResponse)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewIntentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
for resp, err := range c.ListLocations(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*IntentsClient) ListOperations
func (c *IntentsClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewIntentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
it := c.ListOperations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*longrunningpb.ListOperationsResponse)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewIntentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
for resp, err := range c.ListOperations(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*IntentsClient) UpdateIntent
func (c *IntentsClient) UpdateIntent(ctx context.Context, req *dialogflowpb.UpdateIntentRequest, opts ...gax.CallOption) (*dialogflowpb.Intent, error)
UpdateIntent updates the specified intent.
Note: You should always train an agent prior to sending it queries. See the training documentation (at https://cloud.google.com/dialogflow/es/docs/training).
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewIntentsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.UpdateIntentRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#UpdateIntentRequest.
}
resp, err := c.UpdateIntent(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
KnowledgeBaseIterator
type KnowledgeBaseIterator struct {
// Response is the raw response for the current page.
// It must be cast to the RPC response type.
// Calling Next() or InternalFetch() updates this value.
Response interface{}
// 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.KnowledgeBase, nextPageToken string, err error)
// contains filtered or unexported fields
}
KnowledgeBaseIterator manages a stream of *dialogflowpb.KnowledgeBase.
func (*KnowledgeBaseIterator) All
func (it *KnowledgeBaseIterator) All() iter.Seq2[*dialogflowpb.KnowledgeBase, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*KnowledgeBaseIterator) Next
func (it *KnowledgeBaseIterator) Next() (*dialogflowpb.KnowledgeBase, 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 (*KnowledgeBaseIterator) PageInfo
func (it *KnowledgeBaseIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
KnowledgeBasesCallOptions
type KnowledgeBasesCallOptions struct {
ListKnowledgeBases []gax.CallOption
GetKnowledgeBase []gax.CallOption
CreateKnowledgeBase []gax.CallOption
DeleteKnowledgeBase []gax.CallOption
UpdateKnowledgeBase []gax.CallOption
GetLocation []gax.CallOption
ListLocations []gax.CallOption
CancelOperation []gax.CallOption
GetOperation []gax.CallOption
ListOperations []gax.CallOption
}
KnowledgeBasesCallOptions contains the retry settings for each method of KnowledgeBasesClient.
KnowledgeBasesClient
type KnowledgeBasesClient struct {
// The call options for this service.
CallOptions *KnowledgeBasesCallOptions
// contains filtered or unexported fields
}
KnowledgeBasesClient 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.
Service for managing KnowledgeBases.
func NewKnowledgeBasesClient
func NewKnowledgeBasesClient(ctx context.Context, opts ...option.ClientOption) (*KnowledgeBasesClient, error)
NewKnowledgeBasesClient creates a new knowledge bases client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service for managing KnowledgeBases.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewKnowledgeBasesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func NewKnowledgeBasesRESTClient
func NewKnowledgeBasesRESTClient(ctx context.Context, opts ...option.ClientOption) (*KnowledgeBasesClient, error)
NewKnowledgeBasesRESTClient creates a new knowledge bases rest client.
Service for managing KnowledgeBases.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewKnowledgeBasesRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*KnowledgeBasesClient) CancelOperation
func (c *KnowledgeBasesClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error
CancelOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewKnowledgeBasesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.CancelOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
}
err = c.CancelOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*KnowledgeBasesClient) Close
func (c *KnowledgeBasesClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*KnowledgeBasesClient) Connection (deprecated)
func (c *KnowledgeBasesClient) Connection() *grpc.ClientConn
Connection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not always return the same resource.
func (*KnowledgeBasesClient) CreateKnowledgeBase
func (c *KnowledgeBasesClient) CreateKnowledgeBase(ctx context.Context, req *dialogflowpb.CreateKnowledgeBaseRequest, opts ...gax.CallOption) (*dialogflowpb.KnowledgeBase, error)
CreateKnowledgeBase creates a knowledge base.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewKnowledgeBasesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.CreateKnowledgeBaseRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#CreateKnowledgeBaseRequest.
}
resp, err := c.CreateKnowledgeBase(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*KnowledgeBasesClient) DeleteKnowledgeBase
func (c *KnowledgeBasesClient) DeleteKnowledgeBase(ctx context.Context, req *dialogflowpb.DeleteKnowledgeBaseRequest, opts ...gax.CallOption) error
DeleteKnowledgeBase deletes the specified knowledge base.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewKnowledgeBasesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.DeleteKnowledgeBaseRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#DeleteKnowledgeBaseRequest.
}
err = c.DeleteKnowledgeBase(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*KnowledgeBasesClient) GetKnowledgeBase
func (c *KnowledgeBasesClient) GetKnowledgeBase(ctx context.Context, req *dialogflowpb.GetKnowledgeBaseRequest, opts ...gax.CallOption) (*dialogflowpb.KnowledgeBase, error)
GetKnowledgeBase retrieves the specified knowledge base.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewKnowledgeBasesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.GetKnowledgeBaseRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#GetKnowledgeBaseRequest.
}
resp, err := c.GetKnowledgeBase(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*KnowledgeBasesClient) GetLocation
func (c *KnowledgeBasesClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error)
GetLocation gets information about a location.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewKnowledgeBasesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.GetLocationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest.
}
resp, err := c.GetLocation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*KnowledgeBasesClient) GetOperation
func (c *KnowledgeBasesClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
GetOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewKnowledgeBasesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.GetOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
}
resp, err := c.GetOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*KnowledgeBasesClient) ListKnowledgeBases
func (c *KnowledgeBasesClient) ListKnowledgeBases(ctx context.Context, req *dialogflowpb.ListKnowledgeBasesRequest, opts ...gax.CallOption) *KnowledgeBaseIterator
ListKnowledgeBases returns the list of all knowledge bases of the specified agent.
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewKnowledgeBasesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.ListKnowledgeBasesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#ListKnowledgeBasesRequest.
}
it := c.ListKnowledgeBases(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*dialogflowpb.ListKnowledgeBasesResponse)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewKnowledgeBasesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.ListKnowledgeBasesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#ListKnowledgeBasesRequest.
}
for resp, err := range c.ListKnowledgeBases(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*KnowledgeBasesClient) ListLocations
func (c *KnowledgeBasesClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator
ListLocations lists information about the supported locations for this service.
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
"google.golang.org/api/iterator"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewKnowledgeBasesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
it := c.ListLocations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*locationpb.ListLocationsResponse)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewKnowledgeBasesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
for resp, err := range c.ListLocations(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*KnowledgeBasesClient) ListOperations
func (c *KnowledgeBasesClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewKnowledgeBasesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
it := c.ListOperations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*longrunningpb.ListOperationsResponse)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewKnowledgeBasesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
for resp, err := range c.ListOperations(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*KnowledgeBasesClient) UpdateKnowledgeBase
func (c *KnowledgeBasesClient) UpdateKnowledgeBase(ctx context.Context, req *dialogflowpb.UpdateKnowledgeBaseRequest, opts ...gax.CallOption) (*dialogflowpb.KnowledgeBase, error)
UpdateKnowledgeBase updates the specified knowledge base.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewKnowledgeBasesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.UpdateKnowledgeBaseRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#UpdateKnowledgeBaseRequest.
}
resp, err := c.UpdateKnowledgeBase(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
LocationIterator
type LocationIterator struct {
// Response is the raw response for the current page.
// It must be cast to the RPC response type.
// Calling Next() or InternalFetch() updates this value.
Response interface{}
// 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 []*locationpb.Location, nextPageToken string, err error)
// contains filtered or unexported fields
}
LocationIterator manages a stream of *locationpb.Location.
func (*LocationIterator) All
func (it *LocationIterator) All() iter.Seq2[*locationpb.Location, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*LocationIterator) Next
func (it *LocationIterator) Next() (*locationpb.Location, 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 (*LocationIterator) PageInfo
func (it *LocationIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
MessageIterator
type MessageIterator struct {
// Response is the raw response for the current page.
// It must be cast to the RPC response type.
// Calling Next() or InternalFetch() updates this value.
Response interface{}
// 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.Message, nextPageToken string, err error)
// contains filtered or unexported fields
}
MessageIterator manages a stream of *dialogflowpb.Message.
func (*MessageIterator) All
func (it *MessageIterator) All() iter.Seq2[*dialogflowpb.Message, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*MessageIterator) Next
func (it *MessageIterator) Next() (*dialogflowpb.Message, 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 (*MessageIterator) PageInfo
func (it *MessageIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
OperationIterator
type OperationIterator struct {
// Response is the raw response for the current page.
// It must be cast to the RPC response type.
// Calling Next() or InternalFetch() updates this value.
Response interface{}
// 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 []*longrunningpb.Operation, nextPageToken string, err error)
// contains filtered or unexported fields
}
OperationIterator manages a stream of *longrunningpb.Operation.
func (*OperationIterator) All
func (it *OperationIterator) All() iter.Seq2[*longrunningpb.Operation, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*OperationIterator) Next
func (it *OperationIterator) Next() (*longrunningpb.Operation, 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 (*OperationIterator) PageInfo
func (it *OperationIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
ParticipantIterator
type ParticipantIterator struct {
// Response is the raw response for the current page.
// It must be cast to the RPC response type.
// Calling Next() or InternalFetch() updates this value.
Response interface{}
// 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.Participant, nextPageToken string, err error)
// contains filtered or unexported fields
}
ParticipantIterator manages a stream of *dialogflowpb.Participant.
func (*ParticipantIterator) All
func (it *ParticipantIterator) All() iter.Seq2[*dialogflowpb.Participant, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*ParticipantIterator) Next
func (it *ParticipantIterator) Next() (*dialogflowpb.Participant, 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 (*ParticipantIterator) PageInfo
func (it *ParticipantIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
ParticipantsCallOptions
type ParticipantsCallOptions struct {
CreateParticipant []gax.CallOption
GetParticipant []gax.CallOption
ListParticipants []gax.CallOption
UpdateParticipant []gax.CallOption
AnalyzeContent []gax.CallOption
StreamingAnalyzeContent []gax.CallOption
SuggestArticles []gax.CallOption
SuggestFaqAnswers []gax.CallOption
SuggestSmartReplies []gax.CallOption
SuggestKnowledgeAssist []gax.CallOption
GetLocation []gax.CallOption
ListLocations []gax.CallOption
CancelOperation []gax.CallOption
GetOperation []gax.CallOption
ListOperations []gax.CallOption
}
ParticipantsCallOptions contains the retry settings for each method of ParticipantsClient.
ParticipantsClient
type ParticipantsClient struct {
// The call options for this service.
CallOptions *ParticipantsCallOptions
// contains filtered or unexported fields
}
ParticipantsClient 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.
Service for managing Participants.
func NewParticipantsClient
func NewParticipantsClient(ctx context.Context, opts ...option.ClientOption) (*ParticipantsClient, error)
NewParticipantsClient creates a new participants client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service for managing Participants.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewParticipantsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func NewParticipantsRESTClient
func NewParticipantsRESTClient(ctx context.Context, opts ...option.ClientOption) (*ParticipantsClient, error)
NewParticipantsRESTClient creates a new participants rest client.
Service for managing Participants.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewParticipantsRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*ParticipantsClient) AnalyzeContent
func (c *ParticipantsClient) AnalyzeContent(ctx context.Context, req *dialogflowpb.AnalyzeContentRequest, opts ...gax.CallOption) (*dialogflowpb.AnalyzeContentResponse, error)
AnalyzeContent adds a text (chat, for example), or audio (phone recording, for example) message from a participant into the conversation.
Note: Always use agent versions for production traffic sent to virtual agents. See Versions and environments (at https://cloud.google.com/dialogflow/es/docs/agents-versions).
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewParticipantsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.AnalyzeContentRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#AnalyzeContentRequest.
}
resp, err := c.AnalyzeContent(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ParticipantsClient) CancelOperation
func (c *ParticipantsClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error
CancelOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewParticipantsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.CancelOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
}
err = c.CancelOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*ParticipantsClient) Close
func (c *ParticipantsClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*ParticipantsClient) Connection (deprecated)
func (c *ParticipantsClient) Connection() *grpc.ClientConn
Connection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not always return the same resource.
func (*ParticipantsClient) CreateParticipant
func (c *ParticipantsClient) CreateParticipant(ctx context.Context, req *dialogflowpb.CreateParticipantRequest, opts ...gax.CallOption) (*dialogflowpb.Participant, error)
CreateParticipant creates a new participant in a conversation.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewParticipantsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.CreateParticipantRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#CreateParticipantRequest.
}
resp, err := c.CreateParticipant(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ParticipantsClient) GetLocation
func (c *ParticipantsClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error)
GetLocation gets information about a location.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewParticipantsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.GetLocationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest.
}
resp, err := c.GetLocation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ParticipantsClient) GetOperation
func (c *ParticipantsClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
GetOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewParticipantsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.GetOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
}
resp, err := c.GetOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ParticipantsClient) GetParticipant
func (c *ParticipantsClient) GetParticipant(ctx context.Context, req *dialogflowpb.GetParticipantRequest, opts ...gax.CallOption) (*dialogflowpb.Participant, error)
GetParticipant retrieves a conversation participant.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewParticipantsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.GetParticipantRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#GetParticipantRequest.
}
resp, err := c.GetParticipant(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ParticipantsClient) ListLocations
func (c *ParticipantsClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator
ListLocations lists information about the supported locations for this service.
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
"google.golang.org/api/iterator"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewParticipantsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
it := c.ListLocations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*locationpb.ListLocationsResponse)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewParticipantsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
for resp, err := range c.ListLocations(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*ParticipantsClient) ListOperations
func (c *ParticipantsClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewParticipantsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
it := c.ListOperations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*longrunningpb.ListOperationsResponse)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewParticipantsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
for resp, err := range c.ListOperations(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*ParticipantsClient) ListParticipants
func (c *ParticipantsClient) ListParticipants(ctx context.Context, req *dialogflowpb.ListParticipantsRequest, opts ...gax.CallOption) *ParticipantIterator
ListParticipants returns the list of all participants in the specified conversation.
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewParticipantsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.ListParticipantsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#ListParticipantsRequest.
}
it := c.ListParticipants(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*dialogflowpb.ListParticipantsResponse)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewParticipantsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.ListParticipantsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#ListParticipantsRequest.
}
for resp, err := range c.ListParticipants(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*ParticipantsClient) StreamingAnalyzeContent
func (c *ParticipantsClient) StreamingAnalyzeContent(ctx context.Context, opts ...gax.CallOption) (dialogflowpb.Participants_StreamingAnalyzeContentClient, error)
StreamingAnalyzeContent adds a text (chat, for example), or audio (phone recording, for example) message from a participant into the conversation. Note: This method is only available through the gRPC API (not REST).
The top-level message sent to the client by the server is StreamingAnalyzeContentResponse. Multiple response messages can be returned in order. The first one or more messages contain the recognition_result field. Each result represents a more complete transcript of what the user said. The next message contains the reply_text field and potentially the reply_audio field. The message can also contain the automated_agent_reply field.
Note: Always use agent versions for production traffic sent to virtual agents. See Versions and environments (at https://cloud.google.com/dialogflow/es/docs/agents-versions).
This method is not supported for the REST transport.
Example
package main
import (
"context"
"io"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewParticipantsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
stream, err := c.StreamingAnalyzeContent(ctx)
if err != nil {
// TODO: Handle error.
}
go func() {
reqs := []*dialogflowpb.StreamingAnalyzeContentRequest{
// 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
}
}
func (*ParticipantsClient) SuggestArticles
func (c *ParticipantsClient) SuggestArticles(ctx context.Context, req *dialogflowpb.SuggestArticlesRequest, opts ...gax.CallOption) (*dialogflowpb.SuggestArticlesResponse, error)
SuggestArticles gets suggested articles for a participant based on specific historical messages.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewParticipantsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.SuggestArticlesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#SuggestArticlesRequest.
}
resp, err := c.SuggestArticles(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ParticipantsClient) SuggestFaqAnswers
func (c *ParticipantsClient) SuggestFaqAnswers(ctx context.Context, req *dialogflowpb.SuggestFaqAnswersRequest, opts ...gax.CallOption) (*dialogflowpb.SuggestFaqAnswersResponse, error)
SuggestFaqAnswers gets suggested faq answers for a participant based on specific historical messages.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewParticipantsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.SuggestFaqAnswersRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#SuggestFaqAnswersRequest.
}
resp, err := c.SuggestFaqAnswers(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ParticipantsClient) SuggestKnowledgeAssist
func (c *ParticipantsClient) SuggestKnowledgeAssist(ctx context.Context, req *dialogflowpb.SuggestKnowledgeAssistRequest, opts ...gax.CallOption) (*dialogflowpb.SuggestKnowledgeAssistResponse, error)
SuggestKnowledgeAssist gets knowledge assist suggestions based on historical messages.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewParticipantsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.SuggestKnowledgeAssistRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#SuggestKnowledgeAssistRequest.
}
resp, err := c.SuggestKnowledgeAssist(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ParticipantsClient) SuggestSmartReplies
func (c *ParticipantsClient) SuggestSmartReplies(ctx context.Context, req *dialogflowpb.SuggestSmartRepliesRequest, opts ...gax.CallOption) (*dialogflowpb.SuggestSmartRepliesResponse, error)
SuggestSmartReplies gets smart replies for a participant based on specific historical messages.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewParticipantsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.SuggestSmartRepliesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#SuggestSmartRepliesRequest.
}
resp, err := c.SuggestSmartReplies(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ParticipantsClient) UpdateParticipant
func (c *ParticipantsClient) UpdateParticipant(ctx context.Context, req *dialogflowpb.UpdateParticipantRequest, opts ...gax.CallOption) (*dialogflowpb.Participant, error)
UpdateParticipant updates the specified participant.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewParticipantsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.UpdateParticipantRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#UpdateParticipantRequest.
}
resp, err := c.UpdateParticipant(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
ReloadDocumentOperation
type ReloadDocumentOperation struct {
// contains filtered or unexported fields
}
ReloadDocumentOperation manages a long-running operation from ReloadDocument.
func (*ReloadDocumentOperation) Done
func (op *ReloadDocumentOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*ReloadDocumentOperation) Metadata
func (op *ReloadDocumentOperation) Metadata() (*dialogflowpb.KnowledgeOperationMetadata, 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 (*ReloadDocumentOperation) Name
func (op *ReloadDocumentOperation) 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 (*ReloadDocumentOperation) Poll
func (op *ReloadDocumentOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*dialogflowpb.Document, 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 (*ReloadDocumentOperation) Wait
func (op *ReloadDocumentOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*dialogflowpb.Document, 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.
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() (*structpb.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, 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 (*RestoreAgentOperation) Wait
func (op *RestoreAgentOperation) Wait(ctx context.Context, opts ...gax.CallOption) 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.
SessionEntityTypeIterator
type SessionEntityTypeIterator struct {
// Response is the raw response for the current page.
// It must be cast to the RPC response type.
// Calling Next() or InternalFetch() updates this value.
Response interface{}
// 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) All
func (it *SessionEntityTypeIterator) All() iter.Seq2[*dialogflowpb.SessionEntityType, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
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.
SessionEntityTypesCallOptions
type SessionEntityTypesCallOptions struct {
ListSessionEntityTypes []gax.CallOption
GetSessionEntityType []gax.CallOption
CreateSessionEntityType []gax.CallOption
UpdateSessionEntityType []gax.CallOption
DeleteSessionEntityType []gax.CallOption
GetLocation []gax.CallOption
ListLocations []gax.CallOption
CancelOperation []gax.CallOption
GetOperation []gax.CallOption
ListOperations []gax.CallOption
}
SessionEntityTypesCallOptions contains the retry settings for each method of SessionEntityTypesClient.
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.
Service for managing SessionEntityTypes.
func NewSessionEntityTypesClient
func NewSessionEntityTypesClient(ctx context.Context, opts ...option.ClientOption) (*SessionEntityTypesClient, error)
NewSessionEntityTypesClient creates a new session entity types client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service for managing SessionEntityTypes.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewSessionEntityTypesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func NewSessionEntityTypesRESTClient
func NewSessionEntityTypesRESTClient(ctx context.Context, opts ...option.ClientOption) (*SessionEntityTypesClient, error)
NewSessionEntityTypesRESTClient creates a new session entity types rest client.
Service for managing SessionEntityTypes.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewSessionEntityTypesRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*SessionEntityTypesClient) CancelOperation
func (c *SessionEntityTypesClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error
CancelOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewSessionEntityTypesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.CancelOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
}
err = c.CancelOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
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 (deprecated)
func (c *SessionEntityTypesClient) Connection() *grpc.ClientConn
Connection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not always return the same resource.
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.
If the specified session entity type already exists, overrides the session entity type.
This method doesn’t work with Google Assistant integration. Contact Dialogflow support if you need to use session entities with Google Assistant integration.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewSessionEntityTypesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.CreateSessionEntityTypeRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#CreateSessionEntityTypeRequest.
}
resp, err := c.CreateSessionEntityType(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*SessionEntityTypesClient) DeleteSessionEntityType
func (c *SessionEntityTypesClient) DeleteSessionEntityType(ctx context.Context, req *dialogflowpb.DeleteSessionEntityTypeRequest, opts ...gax.CallOption) error
DeleteSessionEntityType deletes the specified session entity type.
This method doesn’t work with Google Assistant integration. Contact Dialogflow support if you need to use session entities with Google Assistant integration.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewSessionEntityTypesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.DeleteSessionEntityTypeRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#DeleteSessionEntityTypeRequest.
}
err = c.DeleteSessionEntityType(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*SessionEntityTypesClient) GetLocation
func (c *SessionEntityTypesClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error)
GetLocation gets information about a location.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewSessionEntityTypesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.GetLocationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest.
}
resp, err := c.GetLocation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*SessionEntityTypesClient) GetOperation
func (c *SessionEntityTypesClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
GetOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewSessionEntityTypesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.GetOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
}
resp, err := c.GetOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
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.
This method doesn’t work with Google Assistant integration. Contact Dialogflow support if you need to use session entities with Google Assistant integration.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewSessionEntityTypesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.GetSessionEntityTypeRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#GetSessionEntityTypeRequest.
}
resp, err := c.GetSessionEntityType(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*SessionEntityTypesClient) ListLocations
func (c *SessionEntityTypesClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator
ListLocations lists information about the supported locations for this service.
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
"google.golang.org/api/iterator"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewSessionEntityTypesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
it := c.ListLocations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*locationpb.ListLocationsResponse)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewSessionEntityTypesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
for resp, err := range c.ListLocations(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*SessionEntityTypesClient) ListOperations
func (c *SessionEntityTypesClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewSessionEntityTypesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
it := c.ListOperations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*longrunningpb.ListOperationsResponse)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewSessionEntityTypesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
for resp, err := range c.ListOperations(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
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.
This method doesn’t work with Google Assistant integration. Contact Dialogflow support if you need to use session entities with Google Assistant integration.
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewSessionEntityTypesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.ListSessionEntityTypesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#ListSessionEntityTypesRequest.
}
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
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*dialogflowpb.ListSessionEntityTypesResponse)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewSessionEntityTypesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.ListSessionEntityTypesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#ListSessionEntityTypesRequest.
}
for resp, err := range c.ListSessionEntityTypes(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
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.
This method doesn’t work with Google Assistant integration. Contact Dialogflow support if you need to use session entities with Google Assistant integration.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewSessionEntityTypesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.UpdateSessionEntityTypeRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#UpdateSessionEntityTypeRequest.
}
resp, err := c.UpdateSessionEntityType(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
SessionsCallOptions
type SessionsCallOptions struct {
DetectIntent []gax.CallOption
StreamingDetectIntent []gax.CallOption
GetLocation []gax.CallOption
ListLocations []gax.CallOption
CancelOperation []gax.CallOption
GetOperation []gax.CallOption
ListOperations []gax.CallOption
}
SessionsCallOptions contains the retry settings for each method of SessionsClient.
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.
A service used for session interactions.
For more information, see the API interactions guide (at https://cloud.google.com/dialogflow/docs/api-overview).
func NewSessionsClient
func NewSessionsClient(ctx context.Context, opts ...option.ClientOption) (*SessionsClient, error)
NewSessionsClient creates a new sessions client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
A service used for session interactions.
For more information, see the API interactions guide (at https://cloud.google.com/dialogflow/docs/api-overview).
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewSessionsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func NewSessionsRESTClient
func NewSessionsRESTClient(ctx context.Context, opts ...option.ClientOption) (*SessionsClient, error)
NewSessionsRESTClient creates a new sessions rest client.
A service used for session interactions.
For more information, see the API interactions guide (at https://cloud.google.com/dialogflow/docs/api-overview).
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewSessionsRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*SessionsClient) CancelOperation
func (c *SessionsClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error
CancelOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewSessionsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.CancelOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
}
err = c.CancelOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
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 (deprecated)
func (c *SessionsClient) Connection() *grpc.ClientConn
Connection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not always return the same resource.
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.
If you might use Agent Assist (at https://cloud.google.com/dialogflow/docs/#aa) or other CCAI products now or in the future, consider using AnalyzeContent instead of DetectIntent. AnalyzeContent has additional functionality for Agent Assist and other CCAI products.
Note: Always use agent versions for production traffic. See Versions and environments (at https://cloud.google.com/dialogflow/es/docs/agents-versions).
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewSessionsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.DetectIntentRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#DetectIntentRequest.
}
resp, err := c.DetectIntent(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*SessionsClient) GetLocation
func (c *SessionsClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error)
GetLocation gets information about a location.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewSessionsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.GetLocationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest.
}
resp, err := c.GetLocation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*SessionsClient) GetOperation
func (c *SessionsClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
GetOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewSessionsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.GetOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
}
resp, err := c.GetOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*SessionsClient) ListLocations
func (c *SessionsClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator
ListLocations lists information about the supported locations for this service.
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
"google.golang.org/api/iterator"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewSessionsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
it := c.ListLocations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*locationpb.ListLocationsResponse)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewSessionsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
for resp, err := range c.ListLocations(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*SessionsClient) ListOperations
func (c *SessionsClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewSessionsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
it := c.ListOperations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*longrunningpb.ListOperationsResponse)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewSessionsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
for resp, err := range c.ListOperations(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
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).
If you might use Agent Assist (at https://cloud.google.com/dialogflow/docs/#aa) or other CCAI products now or in the future, consider using StreamingAnalyzeContent instead of StreamingDetectIntent. StreamingAnalyzeContent has additional functionality for Agent Assist and other CCAI products.
Note: Always use agent versions for production traffic. See Versions and environments (at https://cloud.google.com/dialogflow/es/docs/agents-versions).
This method is not supported for the REST transport.
Example
package main
import (
"context"
"io"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewSessionsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
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
}
}
SetSuggestionFeatureConfigOperation
type SetSuggestionFeatureConfigOperation struct {
// contains filtered or unexported fields
}
SetSuggestionFeatureConfigOperation manages a long-running operation from SetSuggestionFeatureConfig.
func (*SetSuggestionFeatureConfigOperation) Done
func (op *SetSuggestionFeatureConfigOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*SetSuggestionFeatureConfigOperation) Metadata
func (op *SetSuggestionFeatureConfigOperation) Metadata() (*dialogflowpb.SetSuggestionFeatureConfigOperationMetadata, 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 (*SetSuggestionFeatureConfigOperation) Name
func (op *SetSuggestionFeatureConfigOperation) 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 (*SetSuggestionFeatureConfigOperation) Poll
func (op *SetSuggestionFeatureConfigOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*dialogflowpb.ConversationProfile, 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 (*SetSuggestionFeatureConfigOperation) Wait
func (op *SetSuggestionFeatureConfigOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*dialogflowpb.ConversationProfile, 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.
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() (*structpb.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, 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 (*TrainAgentOperation) Wait
func (op *TrainAgentOperation) Wait(ctx context.Context, opts ...gax.CallOption) 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.
UndeployConversationModelOperation
type UndeployConversationModelOperation struct {
// contains filtered or unexported fields
}
UndeployConversationModelOperation manages a long-running operation from UndeployConversationModel.
func (*UndeployConversationModelOperation) Done
func (op *UndeployConversationModelOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*UndeployConversationModelOperation) Metadata
func (op *UndeployConversationModelOperation) Metadata() (*dialogflowpb.UndeployConversationModelOperationMetadata, 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 (*UndeployConversationModelOperation) Name
func (op *UndeployConversationModelOperation) 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 (*UndeployConversationModelOperation) Poll
func (op *UndeployConversationModelOperation) 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, 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 (*UndeployConversationModelOperation) Wait
func (op *UndeployConversationModelOperation) Wait(ctx context.Context, opts ...gax.CallOption) 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.
UpdateDocumentOperation
type UpdateDocumentOperation struct {
// contains filtered or unexported fields
}
UpdateDocumentOperation manages a long-running operation from UpdateDocument.
func (*UpdateDocumentOperation) Done
func (op *UpdateDocumentOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*UpdateDocumentOperation) Metadata
func (op *UpdateDocumentOperation) Metadata() (*dialogflowpb.KnowledgeOperationMetadata, 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 (*UpdateDocumentOperation) Name
func (op *UpdateDocumentOperation) 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 (*UpdateDocumentOperation) Poll
func (op *UpdateDocumentOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*dialogflowpb.Document, 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 (*UpdateDocumentOperation) Wait
func (op *UpdateDocumentOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*dialogflowpb.Document, 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.
VersionIterator
type VersionIterator struct {
// Response is the raw response for the current page.
// It must be cast to the RPC response type.
// Calling Next() or InternalFetch() updates this value.
Response interface{}
// 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.Version, nextPageToken string, err error)
// contains filtered or unexported fields
}
VersionIterator manages a stream of *dialogflowpb.Version.
func (*VersionIterator) All
func (it *VersionIterator) All() iter.Seq2[*dialogflowpb.Version, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*VersionIterator) Next
func (it *VersionIterator) Next() (*dialogflowpb.Version, 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 (*VersionIterator) PageInfo
func (it *VersionIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
VersionsCallOptions
type VersionsCallOptions struct {
ListVersions []gax.CallOption
GetVersion []gax.CallOption
CreateVersion []gax.CallOption
UpdateVersion []gax.CallOption
DeleteVersion []gax.CallOption
GetLocation []gax.CallOption
ListLocations []gax.CallOption
CancelOperation []gax.CallOption
GetOperation []gax.CallOption
ListOperations []gax.CallOption
}
VersionsCallOptions contains the retry settings for each method of VersionsClient.
VersionsClient
type VersionsClient struct {
// The call options for this service.
CallOptions *VersionsCallOptions
// contains filtered or unexported fields
}
VersionsClient 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.
Service for managing Versions.
func NewVersionsClient
func NewVersionsClient(ctx context.Context, opts ...option.ClientOption) (*VersionsClient, error)
NewVersionsClient creates a new versions client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service for managing Versions.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewVersionsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func NewVersionsRESTClient
func NewVersionsRESTClient(ctx context.Context, opts ...option.ClientOption) (*VersionsClient, error)
NewVersionsRESTClient creates a new versions rest client.
Service for managing Versions.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewVersionsRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*VersionsClient) CancelOperation
func (c *VersionsClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error
CancelOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewVersionsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.CancelOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
}
err = c.CancelOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*VersionsClient) Close
func (c *VersionsClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*VersionsClient) Connection (deprecated)
func (c *VersionsClient) Connection() *grpc.ClientConn
Connection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not always return the same resource.
func (*VersionsClient) CreateVersion
func (c *VersionsClient) CreateVersion(ctx context.Context, req *dialogflowpb.CreateVersionRequest, opts ...gax.CallOption) (*dialogflowpb.Version, error)
CreateVersion creates an agent version.
The new version points to the agent instance in the “default” environment.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewVersionsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.CreateVersionRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#CreateVersionRequest.
}
resp, err := c.CreateVersion(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*VersionsClient) DeleteVersion
func (c *VersionsClient) DeleteVersion(ctx context.Context, req *dialogflowpb.DeleteVersionRequest, opts ...gax.CallOption) error
DeleteVersion delete the specified agent version.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewVersionsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.DeleteVersionRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#DeleteVersionRequest.
}
err = c.DeleteVersion(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*VersionsClient) GetLocation
func (c *VersionsClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error)
GetLocation gets information about a location.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewVersionsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.GetLocationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest.
}
resp, err := c.GetLocation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*VersionsClient) GetOperation
func (c *VersionsClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
GetOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewVersionsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.GetOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
}
resp, err := c.GetOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*VersionsClient) GetVersion
func (c *VersionsClient) GetVersion(ctx context.Context, req *dialogflowpb.GetVersionRequest, opts ...gax.CallOption) (*dialogflowpb.Version, error)
GetVersion retrieves the specified agent version.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewVersionsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.GetVersionRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#GetVersionRequest.
}
resp, err := c.GetVersion(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*VersionsClient) ListLocations
func (c *VersionsClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator
ListLocations lists information about the supported locations for this service.
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
"google.golang.org/api/iterator"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewVersionsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
it := c.ListLocations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*locationpb.ListLocationsResponse)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewVersionsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
for resp, err := range c.ListLocations(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*VersionsClient) ListOperations
func (c *VersionsClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewVersionsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
it := c.ListOperations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*longrunningpb.ListOperationsResponse)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewVersionsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
for resp, err := range c.ListOperations(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*VersionsClient) ListVersions
func (c *VersionsClient) ListVersions(ctx context.Context, req *dialogflowpb.ListVersionsRequest, opts ...gax.CallOption) *VersionIterator
ListVersions returns the list of all versions of the specified agent.
Examples
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewVersionsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.ListVersionsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#ListVersionsRequest.
}
it := c.ListVersions(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*dialogflowpb.ListVersionsResponse)
}
}
all
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewVersionsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.ListVersionsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#ListVersionsRequest.
}
for resp, err := range c.ListVersions(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*VersionsClient) UpdateVersion
func (c *VersionsClient) UpdateVersion(ctx context.Context, req *dialogflowpb.UpdateVersionRequest, opts ...gax.CallOption) (*dialogflowpb.Version, error)
UpdateVersion updates the specified agent version.
Note that this method does not allow you to update the state of the agent the given version points to. It allows you to update only mutable properties of the version resource.
Example
package main
import (
"context"
dialogflow "cloud.google.com/go/dialogflow/apiv2"
dialogflowpb "cloud.google.com/go/dialogflow/apiv2/dialogflowpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := dialogflow.NewVersionsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &dialogflowpb.UpdateVersionRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/dialogflow/apiv2/dialogflowpb#UpdateVersionRequest.
}
resp, err := c.UpdateVersion(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}