Documentation ¶
Overview ¶
Package discoveryengine is an auto-generated package for the Discovery Engine API.
Discovery Engine API.
NOTE: This package is in beta. It is not stable, and may be subject to changes.
General documentation ¶
For information that is relevant for all client libraries please reference https://pkg.go.dev/cloud.google.com/go#pkg-overview. Some information on this page includes:
- Authentication and Authorization
- Timeouts and Cancellation
- Testing against Client Libraries
- Debugging Client Libraries
- Inspecting errors
Example usage ¶
To get started with this package, create a client.
ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := discoveryengine.NewCompletionClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close()
The client will use your default application credentials. Clients should be reused instead of created as needed. The methods of Client are safe for concurrent use by multiple goroutines. The returned client must be Closed when it is done being used.
Using the Client ¶
The following is an example of making an API call with the newly created client.
ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := discoveryengine.NewCompletionClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.CompleteQueryRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb#CompleteQueryRequest. } resp, err := c.CompleteQuery(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp
Use of Context ¶
The ctx passed to NewCompletionClient 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.
Index ¶
- func DefaultAuthScopes() []string
- type CompletionCallOptions
- type CompletionClient
- func (c *CompletionClient) Close() error
- func (c *CompletionClient) CompleteQuery(ctx context.Context, req *discoveryenginepb.CompleteQueryRequest, ...) (*discoveryenginepb.CompleteQueryResponse, error)
- func (c *CompletionClient) Connection() *grpc.ClientConndeprecated
- func (c *CompletionClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, ...) (*longrunningpb.Operation, error)
- func (c *CompletionClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, ...) *OperationIterator
- type ConversationIterator
- type ConversationalSearchCallOptions
- type ConversationalSearchClient
- func (c *ConversationalSearchClient) Close() error
- func (c *ConversationalSearchClient) Connection() *grpc.ClientConndeprecated
- func (c *ConversationalSearchClient) ConverseConversation(ctx context.Context, req *discoveryenginepb.ConverseConversationRequest, ...) (*discoveryenginepb.ConverseConversationResponse, error)
- func (c *ConversationalSearchClient) CreateConversation(ctx context.Context, req *discoveryenginepb.CreateConversationRequest, ...) (*discoveryenginepb.Conversation, error)
- func (c *ConversationalSearchClient) DeleteConversation(ctx context.Context, req *discoveryenginepb.DeleteConversationRequest, ...) error
- func (c *ConversationalSearchClient) GetConversation(ctx context.Context, req *discoveryenginepb.GetConversationRequest, ...) (*discoveryenginepb.Conversation, error)
- func (c *ConversationalSearchClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, ...) (*longrunningpb.Operation, error)
- func (c *ConversationalSearchClient) ListConversations(ctx context.Context, req *discoveryenginepb.ListConversationsRequest, ...) *ConversationIterator
- func (c *ConversationalSearchClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, ...) *OperationIterator
- func (c *ConversationalSearchClient) UpdateConversation(ctx context.Context, req *discoveryenginepb.UpdateConversationRequest, ...) (*discoveryenginepb.Conversation, error)
- type CreateSchemaOperation
- func (op *CreateSchemaOperation) Done() bool
- func (op *CreateSchemaOperation) Metadata() (*discoveryenginepb.CreateSchemaMetadata, error)
- func (op *CreateSchemaOperation) Name() string
- func (op *CreateSchemaOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.Schema, error)
- func (op *CreateSchemaOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.Schema, error)
- type DeleteSchemaOperation
- func (op *DeleteSchemaOperation) Done() bool
- func (op *DeleteSchemaOperation) Metadata() (*discoveryenginepb.DeleteSchemaMetadata, error)
- func (op *DeleteSchemaOperation) Name() string
- func (op *DeleteSchemaOperation) Poll(ctx context.Context, opts ...gax.CallOption) error
- func (op *DeleteSchemaOperation) Wait(ctx context.Context, opts ...gax.CallOption) error
- type DocumentCallOptions
- type DocumentClient
- func (c *DocumentClient) Close() error
- func (c *DocumentClient) Connection() *grpc.ClientConndeprecated
- func (c *DocumentClient) CreateDocument(ctx context.Context, req *discoveryenginepb.CreateDocumentRequest, ...) (*discoveryenginepb.Document, error)
- func (c *DocumentClient) DeleteDocument(ctx context.Context, req *discoveryenginepb.DeleteDocumentRequest, ...) error
- func (c *DocumentClient) GetDocument(ctx context.Context, req *discoveryenginepb.GetDocumentRequest, ...) (*discoveryenginepb.Document, error)
- func (c *DocumentClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, ...) (*longrunningpb.Operation, error)
- func (c *DocumentClient) ImportDocuments(ctx context.Context, req *discoveryenginepb.ImportDocumentsRequest, ...) (*ImportDocumentsOperation, error)
- func (c *DocumentClient) ImportDocumentsOperation(name string) *ImportDocumentsOperation
- func (c *DocumentClient) ListDocuments(ctx context.Context, req *discoveryenginepb.ListDocumentsRequest, ...) *DocumentIterator
- func (c *DocumentClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, ...) *OperationIterator
- func (c *DocumentClient) PurgeDocuments(ctx context.Context, req *discoveryenginepb.PurgeDocumentsRequest, ...) (*PurgeDocumentsOperation, error)
- func (c *DocumentClient) PurgeDocumentsOperation(name string) *PurgeDocumentsOperation
- func (c *DocumentClient) UpdateDocument(ctx context.Context, req *discoveryenginepb.UpdateDocumentRequest, ...) (*discoveryenginepb.Document, error)
- type DocumentIterator
- type ImportDocumentsOperation
- func (op *ImportDocumentsOperation) Done() bool
- func (op *ImportDocumentsOperation) Metadata() (*discoveryenginepb.ImportDocumentsMetadata, error)
- func (op *ImportDocumentsOperation) Name() string
- func (op *ImportDocumentsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.ImportDocumentsResponse, error)
- func (op *ImportDocumentsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.ImportDocumentsResponse, error)
- type ImportUserEventsOperation
- func (op *ImportUserEventsOperation) Done() bool
- func (op *ImportUserEventsOperation) Metadata() (*discoveryenginepb.ImportUserEventsMetadata, error)
- func (op *ImportUserEventsOperation) Name() string
- func (op *ImportUserEventsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.ImportUserEventsResponse, error)
- func (op *ImportUserEventsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.ImportUserEventsResponse, error)
- type OperationIterator
- type PurgeDocumentsOperation
- func (op *PurgeDocumentsOperation) Done() bool
- func (op *PurgeDocumentsOperation) Metadata() (*discoveryenginepb.PurgeDocumentsMetadata, error)
- func (op *PurgeDocumentsOperation) Name() string
- func (op *PurgeDocumentsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.PurgeDocumentsResponse, error)
- func (op *PurgeDocumentsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.PurgeDocumentsResponse, error)
- type RecommendationCallOptions
- type RecommendationClient
- func (c *RecommendationClient) Close() error
- func (c *RecommendationClient) Connection() *grpc.ClientConndeprecated
- func (c *RecommendationClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, ...) (*longrunningpb.Operation, error)
- func (c *RecommendationClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, ...) *OperationIterator
- func (c *RecommendationClient) Recommend(ctx context.Context, req *discoveryenginepb.RecommendRequest, ...) (*discoveryenginepb.RecommendResponse, error)
- type SchemaCallOptions
- type SchemaClient
- func (c *SchemaClient) Close() error
- func (c *SchemaClient) Connection() *grpc.ClientConndeprecated
- func (c *SchemaClient) CreateSchema(ctx context.Context, req *discoveryenginepb.CreateSchemaRequest, ...) (*CreateSchemaOperation, error)
- func (c *SchemaClient) CreateSchemaOperation(name string) *CreateSchemaOperation
- func (c *SchemaClient) DeleteSchema(ctx context.Context, req *discoveryenginepb.DeleteSchemaRequest, ...) (*DeleteSchemaOperation, error)
- func (c *SchemaClient) DeleteSchemaOperation(name string) *DeleteSchemaOperation
- func (c *SchemaClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, ...) (*longrunningpb.Operation, error)
- func (c *SchemaClient) GetSchema(ctx context.Context, req *discoveryenginepb.GetSchemaRequest, ...) (*discoveryenginepb.Schema, error)
- func (c *SchemaClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, ...) *OperationIterator
- func (c *SchemaClient) ListSchemas(ctx context.Context, req *discoveryenginepb.ListSchemasRequest, ...) *SchemaIterator
- func (c *SchemaClient) UpdateSchema(ctx context.Context, req *discoveryenginepb.UpdateSchemaRequest, ...) (*UpdateSchemaOperation, error)
- func (c *SchemaClient) UpdateSchemaOperation(name string) *UpdateSchemaOperation
- type SchemaIterator
- type SearchCallOptions
- type SearchClient
- func (c *SearchClient) Close() error
- func (c *SearchClient) Connection() *grpc.ClientConndeprecated
- func (c *SearchClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, ...) (*longrunningpb.Operation, error)
- func (c *SearchClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, ...) *OperationIterator
- func (c *SearchClient) Search(ctx context.Context, req *discoveryenginepb.SearchRequest, ...) *SearchResponse_SearchResultIterator
- type SearchResponse_SearchResultIterator
- type UpdateSchemaOperation
- func (op *UpdateSchemaOperation) Done() bool
- func (op *UpdateSchemaOperation) Metadata() (*discoveryenginepb.UpdateSchemaMetadata, error)
- func (op *UpdateSchemaOperation) Name() string
- func (op *UpdateSchemaOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.Schema, error)
- func (op *UpdateSchemaOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.Schema, error)
- type UserEventCallOptions
- type UserEventClient
- func (c *UserEventClient) Close() error
- func (c *UserEventClient) CollectUserEvent(ctx context.Context, req *discoveryenginepb.CollectUserEventRequest, ...) (*httpbodypb.HttpBody, error)
- func (c *UserEventClient) Connection() *grpc.ClientConndeprecated
- func (c *UserEventClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, ...) (*longrunningpb.Operation, error)
- func (c *UserEventClient) ImportUserEvents(ctx context.Context, req *discoveryenginepb.ImportUserEventsRequest, ...) (*ImportUserEventsOperation, error)
- func (c *UserEventClient) ImportUserEventsOperation(name string) *ImportUserEventsOperation
- func (c *UserEventClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, ...) *OperationIterator
- func (c *UserEventClient) WriteUserEvent(ctx context.Context, req *discoveryenginepb.WriteUserEventRequest, ...) (*discoveryenginepb.UserEvent, error)
Examples ¶
- CompletionClient.CompleteQuery
- CompletionClient.GetOperation
- CompletionClient.ListOperations
- ConversationalSearchClient.ConverseConversation
- ConversationalSearchClient.CreateConversation
- ConversationalSearchClient.DeleteConversation
- ConversationalSearchClient.GetConversation
- ConversationalSearchClient.GetOperation
- ConversationalSearchClient.ListConversations
- ConversationalSearchClient.ListOperations
- ConversationalSearchClient.UpdateConversation
- DocumentClient.CreateDocument
- DocumentClient.DeleteDocument
- DocumentClient.GetDocument
- DocumentClient.GetOperation
- DocumentClient.ImportDocuments
- DocumentClient.ListDocuments
- DocumentClient.ListOperations
- DocumentClient.PurgeDocuments
- DocumentClient.UpdateDocument
- NewCompletionClient
- NewCompletionRESTClient
- NewConversationalSearchClient
- NewConversationalSearchRESTClient
- NewDocumentClient
- NewDocumentRESTClient
- NewRecommendationClient
- NewRecommendationRESTClient
- NewSchemaClient
- NewSchemaRESTClient
- NewSearchClient
- NewSearchRESTClient
- NewUserEventClient
- NewUserEventRESTClient
- RecommendationClient.GetOperation
- RecommendationClient.ListOperations
- RecommendationClient.Recommend
- SchemaClient.CreateSchema
- SchemaClient.DeleteSchema
- SchemaClient.GetOperation
- SchemaClient.GetSchema
- SchemaClient.ListOperations
- SchemaClient.ListSchemas
- SchemaClient.UpdateSchema
- SearchClient.GetOperation
- SearchClient.ListOperations
- SearchClient.Search
- UserEventClient.CollectUserEvent
- UserEventClient.GetOperation
- UserEventClient.ImportUserEvents
- UserEventClient.ListOperations
- UserEventClient.WriteUserEvent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultAuthScopes ¶
func DefaultAuthScopes() []string
DefaultAuthScopes reports the default set of authentication scopes to use with this package.
Types ¶
type CompletionCallOptions ¶ added in v0.3.0
type CompletionCallOptions struct { CompleteQuery []gax.CallOption GetOperation []gax.CallOption ListOperations []gax.CallOption }
CompletionCallOptions contains the retry settings for each method of CompletionClient.
type CompletionClient ¶ added in v0.3.0
type CompletionClient struct { // The call options for this service. CallOptions *CompletionCallOptions // contains filtered or unexported fields }
CompletionClient is a client for interacting with Discovery Engine API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Service for Auto-Completion.
func NewCompletionClient ¶ added in v0.3.0
func NewCompletionClient(ctx context.Context, opts ...option.ClientOption) (*CompletionClient, error)
NewCompletionClient creates a new completion service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service for Auto-Completion.
Example ¶
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1beta" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := discoveryengine.NewCompletionClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c }
Output:
func NewCompletionRESTClient ¶ added in v0.3.0
func NewCompletionRESTClient(ctx context.Context, opts ...option.ClientOption) (*CompletionClient, error)
NewCompletionRESTClient creates a new completion service rest client.
Service for Auto-Completion.
Example ¶
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1beta" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := discoveryengine.NewCompletionRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c }
Output:
func (*CompletionClient) Close ¶ added in v0.3.0
func (c *CompletionClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*CompletionClient) CompleteQuery ¶ added in v0.3.0
func (c *CompletionClient) CompleteQuery(ctx context.Context, req *discoveryenginepb.CompleteQueryRequest, opts ...gax.CallOption) (*discoveryenginepb.CompleteQueryResponse, error)
CompleteQuery completes the specified user input with keyword suggestions.
Example ¶
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1beta" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := discoveryengine.NewCompletionClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.CompleteQueryRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb#CompleteQueryRequest. } resp, err := c.CompleteQuery(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*CompletionClient) Connection
deprecated
added in
v0.3.0
func (c *CompletionClient) 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 (*CompletionClient) GetOperation ¶ added in v0.3.0
func (c *CompletionClient) 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" discoveryengine "cloud.google.com/go/discoveryengine/apiv1beta" 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 := discoveryengine.NewCompletionClient(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 }
Output:
func (*CompletionClient) ListOperations ¶ added in v0.3.0
func (c *CompletionClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
Example ¶
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1beta" 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 := discoveryengine.NewCompletionClient(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 } }
Output:
type ConversationIterator ¶ added in v1.1.0
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 []*discoveryenginepb.Conversation, nextPageToken string, err error) // contains filtered or unexported fields }
ConversationIterator manages a stream of *discoveryenginepb.Conversation.
func (*ConversationIterator) Next ¶ added in v1.1.0
func (it *ConversationIterator) Next() (*discoveryenginepb.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 ¶ added in v1.1.0
func (it *ConversationIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type ConversationalSearchCallOptions ¶ added in v1.1.0
type ConversationalSearchCallOptions struct { ConverseConversation []gax.CallOption CreateConversation []gax.CallOption DeleteConversation []gax.CallOption UpdateConversation []gax.CallOption GetConversation []gax.CallOption ListConversations []gax.CallOption GetOperation []gax.CallOption ListOperations []gax.CallOption }
ConversationalSearchCallOptions contains the retry settings for each method of ConversationalSearchClient.
type ConversationalSearchClient ¶ added in v1.1.0
type ConversationalSearchClient struct { // The call options for this service. CallOptions *ConversationalSearchCallOptions // contains filtered or unexported fields }
ConversationalSearchClient is a client for interacting with Discovery Engine API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Service for conversational search.
func NewConversationalSearchClient ¶ added in v1.1.0
func NewConversationalSearchClient(ctx context.Context, opts ...option.ClientOption) (*ConversationalSearchClient, error)
NewConversationalSearchClient creates a new conversational search service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service for conversational search.
Example ¶
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1beta" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := discoveryengine.NewConversationalSearchClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c }
Output:
func NewConversationalSearchRESTClient ¶ added in v1.1.0
func NewConversationalSearchRESTClient(ctx context.Context, opts ...option.ClientOption) (*ConversationalSearchClient, error)
NewConversationalSearchRESTClient creates a new conversational search service rest client.
Service for conversational search.
Example ¶
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1beta" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := discoveryengine.NewConversationalSearchRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c }
Output:
func (*ConversationalSearchClient) Close ¶ added in v1.1.0
func (c *ConversationalSearchClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*ConversationalSearchClient) Connection
deprecated
added in
v1.1.0
func (c *ConversationalSearchClient) 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 (*ConversationalSearchClient) ConverseConversation ¶ added in v1.1.0
func (c *ConversationalSearchClient) ConverseConversation(ctx context.Context, req *discoveryenginepb.ConverseConversationRequest, opts ...gax.CallOption) (*discoveryenginepb.ConverseConversationResponse, error)
ConverseConversation converses a conversation.
Example ¶
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1beta" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := discoveryengine.NewConversationalSearchClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.ConverseConversationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb#ConverseConversationRequest. } resp, err := c.ConverseConversation(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*ConversationalSearchClient) CreateConversation ¶ added in v1.1.0
func (c *ConversationalSearchClient) CreateConversation(ctx context.Context, req *discoveryenginepb.CreateConversationRequest, opts ...gax.CallOption) (*discoveryenginepb.Conversation, error)
CreateConversation creates a Conversation.
If the Conversation to create already exists, an ALREADY_EXISTS error is returned.
Example ¶
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1beta" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := discoveryengine.NewConversationalSearchClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.CreateConversationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb#CreateConversationRequest. } resp, err := c.CreateConversation(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*ConversationalSearchClient) DeleteConversation ¶ added in v1.1.0
func (c *ConversationalSearchClient) DeleteConversation(ctx context.Context, req *discoveryenginepb.DeleteConversationRequest, opts ...gax.CallOption) error
DeleteConversation deletes a Conversation.
If the Conversation to delete does not exist, a NOT_FOUND error is returned.
Example ¶
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1beta" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := discoveryengine.NewConversationalSearchClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.DeleteConversationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb#DeleteConversationRequest. } err = c.DeleteConversation(ctx, req) if err != nil { // TODO: Handle error. } }
Output:
func (*ConversationalSearchClient) GetConversation ¶ added in v1.1.0
func (c *ConversationalSearchClient) GetConversation(ctx context.Context, req *discoveryenginepb.GetConversationRequest, opts ...gax.CallOption) (*discoveryenginepb.Conversation, error)
GetConversation gets a Conversation.
Example ¶
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1beta" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := discoveryengine.NewConversationalSearchClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.GetConversationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb#GetConversationRequest. } resp, err := c.GetConversation(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*ConversationalSearchClient) GetOperation ¶ added in v1.1.0
func (c *ConversationalSearchClient) 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" discoveryengine "cloud.google.com/go/discoveryengine/apiv1beta" 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 := discoveryengine.NewConversationalSearchClient(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 }
Output:
func (*ConversationalSearchClient) ListConversations ¶ added in v1.1.0
func (c *ConversationalSearchClient) ListConversations(ctx context.Context, req *discoveryenginepb.ListConversationsRequest, opts ...gax.CallOption) *ConversationIterator
ListConversations lists all Conversations by their parent DataStore.
Example ¶
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1beta" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb" "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 := discoveryengine.NewConversationalSearchClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.ListConversationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb#ListConversationsRequest. } it := c.ListConversations(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } }
Output:
func (*ConversationalSearchClient) ListOperations ¶ added in v1.1.0
func (c *ConversationalSearchClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
Example ¶
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1beta" 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 := discoveryengine.NewConversationalSearchClient(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 } }
Output:
func (*ConversationalSearchClient) UpdateConversation ¶ added in v1.1.0
func (c *ConversationalSearchClient) UpdateConversation(ctx context.Context, req *discoveryenginepb.UpdateConversationRequest, opts ...gax.CallOption) (*discoveryenginepb.Conversation, error)
UpdateConversation updates a Conversation.
Conversation action type cannot be changed. If the Conversation to update does not exist, a NOT_FOUND error is returned.
Example ¶
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1beta" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := discoveryengine.NewConversationalSearchClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.UpdateConversationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb#UpdateConversationRequest. } resp, err := c.UpdateConversation(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
type CreateSchemaOperation ¶ added in v0.3.0
type CreateSchemaOperation struct {
// contains filtered or unexported fields
}
CreateSchemaOperation manages a long-running operation from CreateSchema.
func (*CreateSchemaOperation) Done ¶ added in v0.3.0
func (op *CreateSchemaOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*CreateSchemaOperation) Metadata ¶ added in v0.3.0
func (op *CreateSchemaOperation) Metadata() (*discoveryenginepb.CreateSchemaMetadata, 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 (*CreateSchemaOperation) Name ¶ added in v0.3.0
func (op *CreateSchemaOperation) 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 (*CreateSchemaOperation) Poll ¶ added in v0.3.0
func (op *CreateSchemaOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.Schema, 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 (*CreateSchemaOperation) Wait ¶ added in v0.3.0
func (op *CreateSchemaOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.Schema, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
type DeleteSchemaOperation ¶ added in v0.3.0
type DeleteSchemaOperation struct {
// contains filtered or unexported fields
}
DeleteSchemaOperation manages a long-running operation from DeleteSchema.
func (*DeleteSchemaOperation) Done ¶ added in v0.3.0
func (op *DeleteSchemaOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*DeleteSchemaOperation) Metadata ¶ added in v0.3.0
func (op *DeleteSchemaOperation) Metadata() (*discoveryenginepb.DeleteSchemaMetadata, 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 (*DeleteSchemaOperation) Name ¶ added in v0.3.0
func (op *DeleteSchemaOperation) 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 (*DeleteSchemaOperation) Poll ¶ added in v0.3.0
func (op *DeleteSchemaOperation) 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 (*DeleteSchemaOperation) Wait ¶ added in v0.3.0
func (op *DeleteSchemaOperation) 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.
type DocumentCallOptions ¶
type DocumentCallOptions struct { GetDocument []gax.CallOption ListDocuments []gax.CallOption CreateDocument []gax.CallOption UpdateDocument []gax.CallOption DeleteDocument []gax.CallOption ImportDocuments []gax.CallOption PurgeDocuments []gax.CallOption GetOperation []gax.CallOption ListOperations []gax.CallOption }
DocumentCallOptions contains the retry settings for each method of DocumentClient.
type DocumentClient ¶
type DocumentClient struct { // The call options for this service. CallOptions *DocumentCallOptions // 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 }
DocumentClient is a client for interacting with Discovery Engine API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Service for ingesting Document information of the customer’s website.
func NewDocumentClient ¶
func NewDocumentClient(ctx context.Context, opts ...option.ClientOption) (*DocumentClient, error)
NewDocumentClient creates a new document service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service for ingesting Document information of the customer’s website.
Example ¶
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1beta" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := discoveryengine.NewDocumentClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c }
Output:
func NewDocumentRESTClient ¶
func NewDocumentRESTClient(ctx context.Context, opts ...option.ClientOption) (*DocumentClient, error)
NewDocumentRESTClient creates a new document service rest client.
Service for ingesting Document information of the customer’s website.
Example ¶
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1beta" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := discoveryengine.NewDocumentRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c }
Output:
func (*DocumentClient) Close ¶
func (c *DocumentClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*DocumentClient) Connection
deprecated
func (c *DocumentClient) 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 (*DocumentClient) CreateDocument ¶
func (c *DocumentClient) CreateDocument(ctx context.Context, req *discoveryenginepb.CreateDocumentRequest, opts ...gax.CallOption) (*discoveryenginepb.Document, error)
CreateDocument creates a Document.
Example ¶
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1beta" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := discoveryengine.NewDocumentClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.CreateDocumentRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb#CreateDocumentRequest. } resp, err := c.CreateDocument(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*DocumentClient) DeleteDocument ¶
func (c *DocumentClient) DeleteDocument(ctx context.Context, req *discoveryenginepb.DeleteDocumentRequest, opts ...gax.CallOption) error
DeleteDocument deletes a Document.
Example ¶
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1beta" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := discoveryengine.NewDocumentClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.DeleteDocumentRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb#DeleteDocumentRequest. } err = c.DeleteDocument(ctx, req) if err != nil { // TODO: Handle error. } }
Output:
func (*DocumentClient) GetDocument ¶
func (c *DocumentClient) GetDocument(ctx context.Context, req *discoveryenginepb.GetDocumentRequest, opts ...gax.CallOption) (*discoveryenginepb.Document, error)
GetDocument gets a Document.
Example ¶
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1beta" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := discoveryengine.NewDocumentClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.GetDocumentRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb#GetDocumentRequest. } resp, err := c.GetDocument(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*DocumentClient) GetOperation ¶
func (c *DocumentClient) 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" discoveryengine "cloud.google.com/go/discoveryengine/apiv1beta" 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 := discoveryengine.NewDocumentClient(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 }
Output:
func (*DocumentClient) ImportDocuments ¶
func (c *DocumentClient) ImportDocuments(ctx context.Context, req *discoveryenginepb.ImportDocumentsRequest, opts ...gax.CallOption) (*ImportDocumentsOperation, error)
ImportDocuments bulk import of multiple Documents. Request processing may be synchronous. Non-existing items will be created.
Note: It is possible for a subset of the Documents to be successfully updated.
Example ¶
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1beta" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := discoveryengine.NewDocumentClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.ImportDocumentsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb#ImportDocumentsRequest. } op, err := c.ImportDocuments(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*DocumentClient) ImportDocumentsOperation ¶
func (c *DocumentClient) ImportDocumentsOperation(name string) *ImportDocumentsOperation
ImportDocumentsOperation returns a new ImportDocumentsOperation from a given name. The name must be that of a previously created ImportDocumentsOperation, possibly from a different process.
func (*DocumentClient) ListDocuments ¶
func (c *DocumentClient) ListDocuments(ctx context.Context, req *discoveryenginepb.ListDocumentsRequest, opts ...gax.CallOption) *DocumentIterator
ListDocuments gets a list of Documents.
Example ¶
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1beta" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb" "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 := discoveryengine.NewDocumentClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.ListDocumentsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb#ListDocumentsRequest. } it := c.ListDocuments(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } }
Output:
func (*DocumentClient) ListOperations ¶
func (c *DocumentClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
Example ¶
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1beta" 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 := discoveryengine.NewDocumentClient(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 } }
Output:
func (*DocumentClient) PurgeDocuments ¶ added in v0.3.1
func (c *DocumentClient) PurgeDocuments(ctx context.Context, req *discoveryenginepb.PurgeDocumentsRequest, opts ...gax.CallOption) (*PurgeDocumentsOperation, error)
PurgeDocuments permanently deletes all selected Documents in a branch.
This process is asynchronous. Depending on the number of Documents to be deleted, this operation can take hours to complete. Before the delete operation completes, some Documents might still be returned by DocumentService.GetDocument or DocumentService.ListDocuments.
To get a list of the Documents to be deleted, set PurgeDocumentsRequest.force to false.
Example ¶
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1beta" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := discoveryengine.NewDocumentClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.PurgeDocumentsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb#PurgeDocumentsRequest. } op, err := c.PurgeDocuments(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*DocumentClient) PurgeDocumentsOperation ¶ added in v0.3.1
func (c *DocumentClient) PurgeDocumentsOperation(name string) *PurgeDocumentsOperation
PurgeDocumentsOperation returns a new PurgeDocumentsOperation from a given name. The name must be that of a previously created PurgeDocumentsOperation, possibly from a different process.
func (*DocumentClient) UpdateDocument ¶
func (c *DocumentClient) UpdateDocument(ctx context.Context, req *discoveryenginepb.UpdateDocumentRequest, opts ...gax.CallOption) (*discoveryenginepb.Document, error)
UpdateDocument updates a Document.
Example ¶
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1beta" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := discoveryengine.NewDocumentClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.UpdateDocumentRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb#UpdateDocumentRequest. } resp, err := c.UpdateDocument(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
type DocumentIterator ¶
type DocumentIterator struct { // Response is the raw response for the current page. // It must be cast to the RPC response type. // Calling Next() or InternalFetch() updates this value. Response interface{} // InternalFetch is for use by the Google Cloud Libraries only. // It is not part of the stable interface of this package. // // InternalFetch returns results from a single call to the underlying RPC. // The number of results is no greater than pageSize. // If there are no more results, nextPageToken is empty and err is nil. InternalFetch func(pageSize int, pageToken string) (results []*discoveryenginepb.Document, nextPageToken string, err error) // contains filtered or unexported fields }
DocumentIterator manages a stream of *discoveryenginepb.Document.
func (*DocumentIterator) Next ¶
func (it *DocumentIterator) Next() (*discoveryenginepb.Document, error)
Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*DocumentIterator) PageInfo ¶
func (it *DocumentIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type ImportDocumentsOperation ¶
type ImportDocumentsOperation struct {
// contains filtered or unexported fields
}
ImportDocumentsOperation manages a long-running operation from ImportDocuments.
func (*ImportDocumentsOperation) Done ¶
func (op *ImportDocumentsOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*ImportDocumentsOperation) Metadata ¶
func (op *ImportDocumentsOperation) Metadata() (*discoveryenginepb.ImportDocumentsMetadata, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*ImportDocumentsOperation) Name ¶
func (op *ImportDocumentsOperation) Name() string
Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*ImportDocumentsOperation) Poll ¶
func (op *ImportDocumentsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.ImportDocumentsResponse, error)
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*ImportDocumentsOperation) Wait ¶
func (op *ImportDocumentsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.ImportDocumentsResponse, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
type ImportUserEventsOperation ¶
type ImportUserEventsOperation struct {
// contains filtered or unexported fields
}
ImportUserEventsOperation manages a long-running operation from ImportUserEvents.
func (*ImportUserEventsOperation) Done ¶
func (op *ImportUserEventsOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*ImportUserEventsOperation) Metadata ¶
func (op *ImportUserEventsOperation) Metadata() (*discoveryenginepb.ImportUserEventsMetadata, 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 (*ImportUserEventsOperation) Name ¶
func (op *ImportUserEventsOperation) 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 (*ImportUserEventsOperation) Poll ¶
func (op *ImportUserEventsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.ImportUserEventsResponse, 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 (*ImportUserEventsOperation) Wait ¶
func (op *ImportUserEventsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.ImportUserEventsResponse, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
type OperationIterator ¶
type OperationIterator struct { // Response is the raw response for the current page. // It must be cast to the RPC response type. // Calling Next() or InternalFetch() updates this value. Response interface{} // InternalFetch is for use by the Google Cloud Libraries only. // It is not part of the stable interface of this package. // // InternalFetch returns results from a single call to the underlying RPC. // The number of results is no greater than pageSize. // If there are no more results, nextPageToken is empty and err is nil. InternalFetch func(pageSize int, pageToken string) (results []*longrunningpb.Operation, nextPageToken string, err error) // contains filtered or unexported fields }
OperationIterator manages a stream of *longrunningpb.Operation.
func (*OperationIterator) Next ¶
func (it *OperationIterator) Next() (*longrunningpb.Operation, error)
Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*OperationIterator) PageInfo ¶
func (it *OperationIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type PurgeDocumentsOperation ¶ added in v0.3.1
type PurgeDocumentsOperation struct {
// contains filtered or unexported fields
}
PurgeDocumentsOperation manages a long-running operation from PurgeDocuments.
func (*PurgeDocumentsOperation) Done ¶ added in v0.3.1
func (op *PurgeDocumentsOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*PurgeDocumentsOperation) Metadata ¶ added in v0.3.1
func (op *PurgeDocumentsOperation) Metadata() (*discoveryenginepb.PurgeDocumentsMetadata, 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 (*PurgeDocumentsOperation) Name ¶ added in v0.3.1
func (op *PurgeDocumentsOperation) 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 (*PurgeDocumentsOperation) Poll ¶ added in v0.3.1
func (op *PurgeDocumentsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.PurgeDocumentsResponse, 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 (*PurgeDocumentsOperation) Wait ¶ added in v0.3.1
func (op *PurgeDocumentsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.PurgeDocumentsResponse, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
type RecommendationCallOptions ¶
type RecommendationCallOptions struct { Recommend []gax.CallOption GetOperation []gax.CallOption ListOperations []gax.CallOption }
RecommendationCallOptions contains the retry settings for each method of RecommendationClient.
type RecommendationClient ¶
type RecommendationClient struct { // The call options for this service. CallOptions *RecommendationCallOptions // contains filtered or unexported fields }
RecommendationClient is a client for interacting with Discovery Engine API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Service for making recommendations.
func NewRecommendationClient ¶
func NewRecommendationClient(ctx context.Context, opts ...option.ClientOption) (*RecommendationClient, error)
NewRecommendationClient creates a new recommendation service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service for making recommendations.
Example ¶
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1beta" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := discoveryengine.NewRecommendationClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c }
Output:
func NewRecommendationRESTClient ¶
func NewRecommendationRESTClient(ctx context.Context, opts ...option.ClientOption) (*RecommendationClient, error)
NewRecommendationRESTClient creates a new recommendation service rest client.
Service for making recommendations.
Example ¶
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1beta" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := discoveryengine.NewRecommendationRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c }
Output:
func (*RecommendationClient) Close ¶
func (c *RecommendationClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*RecommendationClient) Connection
deprecated
func (c *RecommendationClient) 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 (*RecommendationClient) GetOperation ¶
func (c *RecommendationClient) 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" discoveryengine "cloud.google.com/go/discoveryengine/apiv1beta" 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 := discoveryengine.NewRecommendationClient(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 }
Output:
func (*RecommendationClient) ListOperations ¶
func (c *RecommendationClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
Example ¶
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1beta" 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 := discoveryengine.NewRecommendationClient(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 } }
Output:
func (*RecommendationClient) Recommend ¶
func (c *RecommendationClient) Recommend(ctx context.Context, req *discoveryenginepb.RecommendRequest, opts ...gax.CallOption) (*discoveryenginepb.RecommendResponse, error)
Recommend makes a recommendation, which requires a contextual user event.
Example ¶
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1beta" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := discoveryengine.NewRecommendationClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.RecommendRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb#RecommendRequest. } resp, err := c.Recommend(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
type SchemaCallOptions ¶ added in v0.3.0
type SchemaCallOptions struct { GetSchema []gax.CallOption ListSchemas []gax.CallOption CreateSchema []gax.CallOption UpdateSchema []gax.CallOption DeleteSchema []gax.CallOption GetOperation []gax.CallOption ListOperations []gax.CallOption }
SchemaCallOptions contains the retry settings for each method of SchemaClient.
type SchemaClient ¶ added in v0.3.0
type SchemaClient struct { // The call options for this service. CallOptions *SchemaCallOptions // 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 }
SchemaClient is a client for interacting with Discovery Engine API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Service for managing Schemas.
func NewSchemaClient ¶ added in v0.3.0
func NewSchemaClient(ctx context.Context, opts ...option.ClientOption) (*SchemaClient, error)
NewSchemaClient creates a new schema service 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 Schemas.
Example ¶
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1beta" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := discoveryengine.NewSchemaClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c }
Output:
func NewSchemaRESTClient ¶ added in v0.3.0
func NewSchemaRESTClient(ctx context.Context, opts ...option.ClientOption) (*SchemaClient, error)
NewSchemaRESTClient creates a new schema service rest client.
Service for managing Schemas.
Example ¶
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1beta" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := discoveryengine.NewSchemaRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c }
Output:
func (*SchemaClient) Close ¶ added in v0.3.0
func (c *SchemaClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*SchemaClient) Connection
deprecated
added in
v0.3.0
func (c *SchemaClient) 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 (*SchemaClient) CreateSchema ¶ added in v0.3.0
func (c *SchemaClient) CreateSchema(ctx context.Context, req *discoveryenginepb.CreateSchemaRequest, opts ...gax.CallOption) (*CreateSchemaOperation, error)
CreateSchema creates a Schema.
Example ¶
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1beta" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := discoveryengine.NewSchemaClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.CreateSchemaRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb#CreateSchemaRequest. } op, err := c.CreateSchema(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*SchemaClient) CreateSchemaOperation ¶ added in v0.3.0
func (c *SchemaClient) CreateSchemaOperation(name string) *CreateSchemaOperation
CreateSchemaOperation returns a new CreateSchemaOperation from a given name. The name must be that of a previously created CreateSchemaOperation, possibly from a different process.
func (*SchemaClient) DeleteSchema ¶ added in v0.3.0
func (c *SchemaClient) DeleteSchema(ctx context.Context, req *discoveryenginepb.DeleteSchemaRequest, opts ...gax.CallOption) (*DeleteSchemaOperation, error)
DeleteSchema deletes a Schema.
Example ¶
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1beta" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := discoveryengine.NewSchemaClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.DeleteSchemaRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb#DeleteSchemaRequest. } op, err := c.DeleteSchema(ctx, req) if err != nil { // TODO: Handle error. } err = op.Wait(ctx) if err != nil { // TODO: Handle error. } }
Output:
func (*SchemaClient) DeleteSchemaOperation ¶ added in v0.3.0
func (c *SchemaClient) DeleteSchemaOperation(name string) *DeleteSchemaOperation
DeleteSchemaOperation returns a new DeleteSchemaOperation from a given name. The name must be that of a previously created DeleteSchemaOperation, possibly from a different process.
func (*SchemaClient) GetOperation ¶ added in v0.3.0
func (c *SchemaClient) 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" discoveryengine "cloud.google.com/go/discoveryengine/apiv1beta" 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 := discoveryengine.NewSchemaClient(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 }
Output:
func (*SchemaClient) GetSchema ¶ added in v0.3.0
func (c *SchemaClient) GetSchema(ctx context.Context, req *discoveryenginepb.GetSchemaRequest, opts ...gax.CallOption) (*discoveryenginepb.Schema, error)
GetSchema gets a Schema.
Example ¶
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1beta" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := discoveryengine.NewSchemaClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.GetSchemaRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb#GetSchemaRequest. } resp, err := c.GetSchema(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*SchemaClient) ListOperations ¶ added in v0.3.0
func (c *SchemaClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
Example ¶
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1beta" 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 := discoveryengine.NewSchemaClient(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 } }
Output:
func (*SchemaClient) ListSchemas ¶ added in v0.3.0
func (c *SchemaClient) ListSchemas(ctx context.Context, req *discoveryenginepb.ListSchemasRequest, opts ...gax.CallOption) *SchemaIterator
ListSchemas gets a list of Schemas.
Example ¶
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1beta" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb" "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 := discoveryengine.NewSchemaClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.ListSchemasRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb#ListSchemasRequest. } it := c.ListSchemas(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } }
Output:
func (*SchemaClient) UpdateSchema ¶ added in v0.3.0
func (c *SchemaClient) UpdateSchema(ctx context.Context, req *discoveryenginepb.UpdateSchemaRequest, opts ...gax.CallOption) (*UpdateSchemaOperation, error)
UpdateSchema updates a Schema.
Example ¶
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1beta" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := discoveryengine.NewSchemaClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.UpdateSchemaRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb#UpdateSchemaRequest. } op, err := c.UpdateSchema(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*SchemaClient) UpdateSchemaOperation ¶ added in v0.3.0
func (c *SchemaClient) UpdateSchemaOperation(name string) *UpdateSchemaOperation
UpdateSchemaOperation returns a new UpdateSchemaOperation from a given name. The name must be that of a previously created UpdateSchemaOperation, possibly from a different process.
type SchemaIterator ¶ added in v0.3.0
type SchemaIterator 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 []*discoveryenginepb.Schema, nextPageToken string, err error) // contains filtered or unexported fields }
SchemaIterator manages a stream of *discoveryenginepb.Schema.
func (*SchemaIterator) Next ¶ added in v0.3.0
func (it *SchemaIterator) Next() (*discoveryenginepb.Schema, 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 (*SchemaIterator) PageInfo ¶ added in v0.3.0
func (it *SchemaIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type SearchCallOptions ¶ added in v0.3.0
type SearchCallOptions struct { Search []gax.CallOption GetOperation []gax.CallOption ListOperations []gax.CallOption }
SearchCallOptions contains the retry settings for each method of SearchClient.
type SearchClient ¶ added in v0.3.0
type SearchClient struct { // The call options for this service. CallOptions *SearchCallOptions // contains filtered or unexported fields }
SearchClient is a client for interacting with Discovery Engine API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Service for search.
func NewSearchClient ¶ added in v0.3.0
func NewSearchClient(ctx context.Context, opts ...option.ClientOption) (*SearchClient, error)
NewSearchClient creates a new search service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service for search.
Example ¶
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1beta" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := discoveryengine.NewSearchClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c }
Output:
func NewSearchRESTClient ¶ added in v0.3.0
func NewSearchRESTClient(ctx context.Context, opts ...option.ClientOption) (*SearchClient, error)
NewSearchRESTClient creates a new search service rest client.
Service for search.
Example ¶
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1beta" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := discoveryengine.NewSearchRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c }
Output:
func (*SearchClient) Close ¶ added in v0.3.0
func (c *SearchClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*SearchClient) Connection
deprecated
added in
v0.3.0
func (c *SearchClient) 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 (*SearchClient) GetOperation ¶ added in v0.3.0
func (c *SearchClient) 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" discoveryengine "cloud.google.com/go/discoveryengine/apiv1beta" 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 := discoveryengine.NewSearchClient(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 }
Output:
func (*SearchClient) ListOperations ¶ added in v0.3.0
func (c *SearchClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
Example ¶
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1beta" 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 := discoveryengine.NewSearchClient(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 } }
Output:
func (*SearchClient) Search ¶ added in v0.3.0
func (c *SearchClient) Search(ctx context.Context, req *discoveryenginepb.SearchRequest, opts ...gax.CallOption) *SearchResponse_SearchResultIterator
Search performs a search.
Example ¶
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1beta" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb" "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 := discoveryengine.NewSearchClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.SearchRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb#SearchRequest. } it := c.Search(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } }
Output:
type SearchResponse_SearchResultIterator ¶ added in v0.3.0
type SearchResponse_SearchResultIterator 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 []*discoveryenginepb.SearchResponse_SearchResult, nextPageToken string, err error) // contains filtered or unexported fields }
SearchResponse_SearchResultIterator manages a stream of *discoveryenginepb.SearchResponse_SearchResult.
func (*SearchResponse_SearchResultIterator) Next ¶ added in v0.3.0
func (it *SearchResponse_SearchResultIterator) Next() (*discoveryenginepb.SearchResponse_SearchResult, 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 (*SearchResponse_SearchResultIterator) PageInfo ¶ added in v0.3.0
func (it *SearchResponse_SearchResultIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type UpdateSchemaOperation ¶ added in v0.3.0
type UpdateSchemaOperation struct {
// contains filtered or unexported fields
}
UpdateSchemaOperation manages a long-running operation from UpdateSchema.
func (*UpdateSchemaOperation) Done ¶ added in v0.3.0
func (op *UpdateSchemaOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*UpdateSchemaOperation) Metadata ¶ added in v0.3.0
func (op *UpdateSchemaOperation) Metadata() (*discoveryenginepb.UpdateSchemaMetadata, 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 (*UpdateSchemaOperation) Name ¶ added in v0.3.0
func (op *UpdateSchemaOperation) 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 (*UpdateSchemaOperation) Poll ¶ added in v0.3.0
func (op *UpdateSchemaOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.Schema, 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 (*UpdateSchemaOperation) Wait ¶ added in v0.3.0
func (op *UpdateSchemaOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.Schema, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
type UserEventCallOptions ¶
type UserEventCallOptions struct { WriteUserEvent []gax.CallOption CollectUserEvent []gax.CallOption ImportUserEvents []gax.CallOption GetOperation []gax.CallOption ListOperations []gax.CallOption }
UserEventCallOptions contains the retry settings for each method of UserEventClient.
type UserEventClient ¶
type UserEventClient struct { // The call options for this service. CallOptions *UserEventCallOptions // 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 }
UserEventClient is a client for interacting with Discovery Engine API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Service for ingesting end user actions on a website to Discovery Engine API.
func NewUserEventClient ¶
func NewUserEventClient(ctx context.Context, opts ...option.ClientOption) (*UserEventClient, error)
NewUserEventClient creates a new user event service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service for ingesting end user actions on a website to Discovery Engine API.
Example ¶
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1beta" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := discoveryengine.NewUserEventClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c }
Output:
func NewUserEventRESTClient ¶
func NewUserEventRESTClient(ctx context.Context, opts ...option.ClientOption) (*UserEventClient, error)
NewUserEventRESTClient creates a new user event service rest client.
Service for ingesting end user actions on a website to Discovery Engine API.
Example ¶
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1beta" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := discoveryengine.NewUserEventRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c }
Output:
func (*UserEventClient) Close ¶
func (c *UserEventClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*UserEventClient) CollectUserEvent ¶
func (c *UserEventClient) CollectUserEvent(ctx context.Context, req *discoveryenginepb.CollectUserEventRequest, opts ...gax.CallOption) (*httpbodypb.HttpBody, error)
CollectUserEvent writes a single user event from the browser. This uses a GET request to due to browser restriction of POST-ing to a third-party domain.
This method is used only by the Discovery Engine API JavaScript pixel and Google Tag Manager. Users should not call this method directly.
Example ¶
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1beta" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := discoveryengine.NewUserEventClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.CollectUserEventRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb#CollectUserEventRequest. } resp, err := c.CollectUserEvent(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*UserEventClient) Connection
deprecated
func (c *UserEventClient) 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 (*UserEventClient) GetOperation ¶
func (c *UserEventClient) 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" discoveryengine "cloud.google.com/go/discoveryengine/apiv1beta" 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 := discoveryengine.NewUserEventClient(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 }
Output:
func (*UserEventClient) ImportUserEvents ¶
func (c *UserEventClient) ImportUserEvents(ctx context.Context, req *discoveryenginepb.ImportUserEventsRequest, opts ...gax.CallOption) (*ImportUserEventsOperation, error)
ImportUserEvents bulk import of User events. Request processing might be synchronous. Events that already exist are skipped. Use this method for backfilling historical user events.
Operation.response is of type ImportResponse. Note that it is possible for a subset of the items to be successfully inserted. Operation.metadata is of type ImportMetadata.
Example ¶
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1beta" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := discoveryengine.NewUserEventClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.ImportUserEventsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb#ImportUserEventsRequest. } op, err := c.ImportUserEvents(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*UserEventClient) ImportUserEventsOperation ¶
func (c *UserEventClient) ImportUserEventsOperation(name string) *ImportUserEventsOperation
ImportUserEventsOperation returns a new ImportUserEventsOperation from a given name. The name must be that of a previously created ImportUserEventsOperation, possibly from a different process.
func (*UserEventClient) ListOperations ¶
func (c *UserEventClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
Example ¶
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1beta" 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 := discoveryengine.NewUserEventClient(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 } }
Output:
func (*UserEventClient) WriteUserEvent ¶
func (c *UserEventClient) WriteUserEvent(ctx context.Context, req *discoveryenginepb.WriteUserEventRequest, opts ...gax.CallOption) (*discoveryenginepb.UserEvent, error)
WriteUserEvent writes a single user event.
Example ¶
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1beta" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := discoveryengine.NewUserEventClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.WriteUserEventRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb#WriteUserEventRequest. } resp, err := c.WriteUserEvent(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output: