- 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.
// go get cloud.google.com/go/dialogflow/apiv2@latest ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying 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, mentioned above.
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.