Cloud Speech-to-Text API v2 - Package cloud.google.com/go/speech/apiv2 (v1.24.1)

Package speech is an auto-generated package for the Cloud Speech-to-Text API.

Converts audio to text by applying powerful neural network models.

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:

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 
  
 := 
  
 speech 
 . 
 NewClient 
 ( 
 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 
  
 := 
  
 speech 
 . 
 NewClient 
 ( 
 ctx 
 ) 
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
 } 
 defer 
  
 c 
 . 
 Close 
 () 
 req 
  
 := 
  
& speechpb 
 . 
 BatchRecognizeRequest 
 { 
  
 // TODO: Fill request struct fields. 
  
 // See https://pkg.go.dev/cloud.google.com/go/speech/apiv2/speechpb#BatchRecognizeRequest. 
 } 
 op 
 , 
  
 err 
  
 := 
  
 c 
 . 
 BatchRecognize 
 ( 
 ctx 
 , 
  
 req 
 ) 
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
 } 
 resp 
 , 
  
 err 
  
 := 
  
 op 
 . 
 Wait 
 ( 
 ctx 
 ) 
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
 } 
 // TODO: Use resp. 
 _ 
  
 = 
  
 resp 

Use of Context

The ctx passed to NewClient is used for authentication requests and for creating the underlying connection, but is not used for subsequent calls. Individual methods on the client use the ctx given to them.

To close the open connection, use the Close() method.

Functions

func DefaultAuthScopes

  func 
  
 DefaultAuthScopes 
 () 
  
 [] 
  string 
 
 

DefaultAuthScopes reports the default set of authentication scopes to use with this package.

BatchRecognizeOperation

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

BatchRecognizeOperation manages a long-running operation from BatchRecognize.

func (*BatchRecognizeOperation) Done

  func 
  
 ( 
 op 
  
 * 
  BatchRecognizeOperation 
 
 ) 
  
 Done 
 () 
  
  bool 
 
 

Done reports whether the long-running operation has completed.

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 (*BatchRecognizeOperation) Name

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 (*BatchRecognizeOperation) Poll

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 (*BatchRecognizeOperation) Wait

Wait blocks until the long-running operation is completed, returning the response and any errors encountered.

See documentation of Poll for error-handling information.

CallOptions

  type 
  
 CallOptions 
  
 struct 
  
 { 
  
 CreateRecognizer 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 ListRecognizers 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 GetRecognizer 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 UpdateRecognizer 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 DeleteRecognizer 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 UndeleteRecognizer 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 Recognize 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 StreamingRecognize 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 BatchRecognize 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 GetConfig 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 UpdateConfig 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 CreateCustomClass 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 ListCustomClasses 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 GetCustomClass 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 UpdateCustomClass 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 DeleteCustomClass 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 UndeleteCustomClass 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 CreatePhraseSet 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 ListPhraseSets 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 GetPhraseSet 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 UpdatePhraseSet 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 DeletePhraseSet 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 UndeletePhraseSet 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 GetLocation 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 ListLocations 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 CancelOperation 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 DeleteOperation 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 GetOperation 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 ListOperations 
  
 [] 
  gax 
 
 . 
  CallOption 
 
 } 
 

CallOptions contains the retry settings for each method of Client.

Client

  type 
  
 Client 
  
 struct 
  
 { 
  
 // The call options for this service. 
  
 CallOptions 
  
 * 
  CallOptions 
 
  
 // 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 
 } 
 

Client is a client for interacting with Cloud Speech-to-Text API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

Enables speech transcription and resource management.

func NewClient

  func 
  
 NewClient 
 ( 
 ctx 
  
  context 
 
 . 
  Context 
 
 , 
  
 opts 
  
 ... 
 option 
 . 
 ClientOption 
 ) 
  
 ( 
 * 
  Client 
 
 , 
  
  error 
 
 ) 
 

NewClient creates a new speech client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.

Enables speech transcription and resource management.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 speech 
  
 "cloud.google.com/go/speech/apiv2" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in: 
  
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
  
 c 
 , 
  
 err 
  
 := 
  
 speech 
 . 
  NewClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 defer 
  
 c 
 . 
  Close 
 
 () 
  
 // TODO: Use client. 
  
 _ 
  
 = 
  
 c 
 } 
 

func NewRESTClient

  func 
  
 NewRESTClient 
 ( 
 ctx 
  
  context 
 
 . 
  Context 
 
 , 
  
 opts 
  
 ... 
 option 
 . 
 ClientOption 
 ) 
  
 ( 
 * 
  Client 
 
 , 
  
  error 
 
 ) 
 

NewRESTClient creates a new speech rest client.

Enables speech transcription and resource management.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 speech 
  
 "cloud.google.com/go/speech/apiv2" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in: 
  
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
  
 c 
 , 
  
 err 
  
 := 
  
 speech 
 . 
  NewRESTClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 defer 
  
 c 
 . 
  Close 
 
 () 
  
 // TODO: Use client. 
  
 _ 
  
 = 
  
 c 
 } 
 

func (*Client) BatchRecognize

BatchRecognize performs batch asynchronous speech recognition: send a request with N audio files and receive a long running operation that can be polled to see when the transcriptions are finished.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 speech 
  
 "cloud.google.com/go/speech/apiv2" 
  
 speechpb 
  
 "cloud.google.com/go/speech/apiv2/speechpb" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in: 
  
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
  
 c 
 , 
  
 err 
  
 := 
  
 speech 
 . 
  NewClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 defer 
  
 c 
 . 
  Close 
 
 () 
  
 req 
  
 := 
  
& speechpb 
 . 
 BatchRecognizeRequest 
 { 
  
 // TODO: Fill request struct fields. 
  
 // See https://pkg.go.dev/cloud.google.com/go/speech/apiv2/speechpb#BatchRecognizeRequest. 
  
 } 
  
 op 
 , 
  
 err 
  
 := 
  
 c 
 . 
 BatchRecognize 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 resp 
 , 
  
 err 
  
 := 
  
 op 
 . 
 Wait 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
 } 
 

func (*Client) BatchRecognizeOperation

  func 
  
 ( 
 c 
  
 * 
  Client 
 
 ) 
  
 BatchRecognizeOperation 
 ( 
 name 
  
  string 
 
 ) 
  
 * 
  BatchRecognizeOperation 
 
 

BatchRecognizeOperation returns a new BatchRecognizeOperation from a given name. The name must be that of a previously created BatchRecognizeOperation, possibly from a different process.

func (*Client) CancelOperation

CancelOperation is a utility method from google.longrunning.Operations.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 longrunningpb 
  
 "cloud.google.com/go/longrunning/autogen/longrunningpb" 
  
 speech 
  
 "cloud.google.com/go/speech/apiv2" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in: 
  
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
  
 c 
 , 
  
 err 
  
 := 
  
 speech 
 . 
  NewClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 defer 
  
 c 
 . 
  Close 
 
 () 
  
 req 
  
 := 
  
& longrunningpb 
 . 
  CancelOperationRequest 
 
 { 
  
 // TODO: Fill request struct fields. 
  
 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest. 
  
 } 
  
 err 
  
 = 
  
 c 
 . 
 CancelOperation 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
 } 
 

func (*Client) Close

  func 
  
 ( 
 c 
  
 * 
  Client 
 
 ) 
  
 Close 
 () 
  
  error 
 
 

Close closes the connection to the API service. The user should invoke this when the client is no longer required.

func (*Client) Connection (deprecated)

  func 
  
 ( 
 c 
  
 * 
  Client 
 
 ) 
  
 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 (*Client) CreateCustomClass

CreateCustomClass creates a CustomClass.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 speech 
  
 "cloud.google.com/go/speech/apiv2" 
  
 speechpb 
  
 "cloud.google.com/go/speech/apiv2/speechpb" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in: 
  
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
  
 c 
 , 
  
 err 
  
 := 
  
 speech 
 . 
  NewClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 defer 
  
 c 
 . 
  Close 
 
 () 
  
 req 
  
 := 
  
& speechpb 
 . 
 CreateCustomClassRequest 
 { 
  
 // TODO: Fill request struct fields. 
  
 // See https://pkg.go.dev/cloud.google.com/go/speech/apiv2/speechpb#CreateCustomClassRequest. 
  
 } 
  
 op 
 , 
  
 err 
  
 := 
  
 c 
 . 
 CreateCustomClass 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 resp 
 , 
  
 err 
  
 := 
  
 op 
 . 
 Wait 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
 } 
 

func (*Client) CreateCustomClassOperation

  func 
  
 ( 
 c 
  
 * 
  Client 
 
 ) 
  
 CreateCustomClassOperation 
 ( 
 name 
  
  string 
 
 ) 
  
 * 
  CreateCustomClassOperation 
 
 

CreateCustomClassOperation returns a new CreateCustomClassOperation from a given name. The name must be that of a previously created CreateCustomClassOperation, possibly from a different process.

func (*Client) CreatePhraseSet

CreatePhraseSet creates a PhraseSet.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 speech 
  
 "cloud.google.com/go/speech/apiv2" 
  
 speechpb 
  
 "cloud.google.com/go/speech/apiv2/speechpb" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in: 
  
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
  
 c 
 , 
  
 err 
  
 := 
  
 speech 
 . 
  NewClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 defer 
  
 c 
 . 
  Close 
 
 () 
  
 req 
  
 := 
  
& speechpb 
 . 
 CreatePhraseSetRequest 
 { 
  
 // TODO: Fill request struct fields. 
  
 // See https://pkg.go.dev/cloud.google.com/go/speech/apiv2/speechpb#CreatePhraseSetRequest. 
  
 } 
  
 op 
 , 
  
 err 
  
 := 
  
 c 
 . 
 CreatePhraseSet 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 resp 
 , 
  
 err 
  
 := 
  
 op 
 . 
 Wait 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
 } 
 

func (*Client) CreatePhraseSetOperation

  func 
  
 ( 
 c 
  
 * 
  Client 
 
 ) 
  
 CreatePhraseSetOperation 
 ( 
 name 
  
  string 
 
 ) 
  
 * 
  CreatePhraseSetOperation 
 
 

CreatePhraseSetOperation returns a new CreatePhraseSetOperation from a given name. The name must be that of a previously created CreatePhraseSetOperation, possibly from a different process.

func (*Client) CreateRecognizer

CreateRecognizer creates a Recognizer.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 speech 
  
 "cloud.google.com/go/speech/apiv2" 
  
 speechpb 
  
 "cloud.google.com/go/speech/apiv2/speechpb" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in: 
  
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
  
 c 
 , 
  
 err 
  
 := 
  
 speech 
 . 
  NewClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 defer 
  
 c 
 . 
  Close 
 
 () 
  
 req 
  
 := 
  
& speechpb 
 . 
 CreateRecognizerRequest 
 { 
  
 // TODO: Fill request struct fields. 
  
 // See https://pkg.go.dev/cloud.google.com/go/speech/apiv2/speechpb#CreateRecognizerRequest. 
  
 } 
  
 op 
 , 
  
 err 
  
 := 
  
 c 
 . 
 CreateRecognizer 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 resp 
 , 
  
 err 
  
 := 
  
 op 
 . 
 Wait 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
 } 
 

func (*Client) CreateRecognizerOperation

  func 
  
 ( 
 c 
  
 * 
  Client 
 
 ) 
  
 CreateRecognizerOperation 
 ( 
 name 
  
  string 
 
 ) 
  
 * 
  CreateRecognizerOperation 
 
 

CreateRecognizerOperation returns a new CreateRecognizerOperation from a given name. The name must be that of a previously created CreateRecognizerOperation, possibly from a different process.

func (*Client) DeleteCustomClass

DeleteCustomClass deletes the CustomClass.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 speech 
  
 "cloud.google.com/go/speech/apiv2" 
  
 speechpb 
  
 "cloud.google.com/go/speech/apiv2/speechpb" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in: 
  
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
  
 c 
 , 
  
 err 
  
 := 
  
 speech 
 . 
  NewClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 defer 
  
 c 
 . 
  Close 
 
 () 
  
 req 
  
 := 
  
& speechpb 
 . 
 DeleteCustomClassRequest 
 { 
  
 // TODO: Fill request struct fields. 
  
 // See https://pkg.go.dev/cloud.google.com/go/speech/apiv2/speechpb#DeleteCustomClassRequest. 
  
 } 
  
 op 
 , 
  
 err 
  
 := 
  
 c 
 . 
 DeleteCustomClass 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 resp 
 , 
  
 err 
  
 := 
  
 op 
 . 
 Wait 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
 } 
 

func (*Client) DeleteCustomClassOperation

  func 
  
 ( 
 c 
  
 * 
  Client 
 
 ) 
  
 DeleteCustomClassOperation 
 ( 
 name 
  
  string 
 
 ) 
  
 * 
  DeleteCustomClassOperation 
 
 

DeleteCustomClassOperation returns a new DeleteCustomClassOperation from a given name. The name must be that of a previously created DeleteCustomClassOperation, possibly from a different process.

func (*Client) DeleteOperation

DeleteOperation is a utility method from google.longrunning.Operations.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 longrunningpb 
  
 "cloud.google.com/go/longrunning/autogen/longrunningpb" 
  
 speech 
  
 "cloud.google.com/go/speech/apiv2" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in: 
  
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
  
 c 
 , 
  
 err 
  
 := 
  
 speech 
 . 
  NewClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 defer 
  
 c 
 . 
  Close 
 
 () 
  
 req 
  
 := 
  
& longrunningpb 
 . 
  DeleteOperationRequest 
 
 { 
  
 // TODO: Fill request struct fields. 
  
 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest. 
  
 } 
  
 err 
  
 = 
  
 c 
 . 
 DeleteOperation 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
 } 
 

func (*Client) DeletePhraseSet

DeletePhraseSet deletes the PhraseSet.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 speech 
  
 "cloud.google.com/go/speech/apiv2" 
  
 speechpb 
  
 "cloud.google.com/go/speech/apiv2/speechpb" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in: 
  
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
  
 c 
 , 
  
 err 
  
 := 
  
 speech 
 . 
  NewClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 defer 
  
 c 
 . 
  Close 
 
 () 
  
 req 
  
 := 
  
& speechpb 
 . 
 DeletePhraseSetRequest 
 { 
  
 // TODO: Fill request struct fields. 
  
 // See https://pkg.go.dev/cloud.google.com/go/speech/apiv2/speechpb#DeletePhraseSetRequest. 
  
 } 
  
 op 
 , 
  
 err 
  
 := 
  
 c 
 . 
 DeletePhraseSet 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 resp 
 , 
  
 err 
  
 := 
  
 op 
 . 
 Wait 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
 } 
 

func (*Client) DeletePhraseSetOperation

  func 
  
 ( 
 c 
  
 * 
  Client 
 
 ) 
  
 DeletePhraseSetOperation 
 ( 
 name 
  
  string 
 
 ) 
  
 * 
  DeletePhraseSetOperation 
 
 

DeletePhraseSetOperation returns a new DeletePhraseSetOperation from a given name. The name must be that of a previously created DeletePhraseSetOperation, possibly from a different process.

func (*Client) DeleteRecognizer

DeleteRecognizer deletes the Recognizer.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 speech 
  
 "cloud.google.com/go/speech/apiv2" 
  
 speechpb 
  
 "cloud.google.com/go/speech/apiv2/speechpb" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in: 
  
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
  
 c 
 , 
  
 err 
  
 := 
  
 speech 
 . 
  NewClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 defer 
  
 c 
 . 
  Close 
 
 () 
  
 req 
  
 := 
  
& speechpb 
 . 
 DeleteRecognizerRequest 
 { 
  
 // TODO: Fill request struct fields. 
  
 // See https://pkg.go.dev/cloud.google.com/go/speech/apiv2/speechpb#DeleteRecognizerRequest. 
  
 } 
  
 op 
 , 
  
 err 
  
 := 
  
 c 
 . 
 DeleteRecognizer 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 resp 
 , 
  
 err 
  
 := 
  
 op 
 . 
 Wait 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
 } 
 

func (*Client) DeleteRecognizerOperation

  func 
  
 ( 
 c 
  
 * 
  Client 
 
 ) 
  
 DeleteRecognizerOperation 
 ( 
 name 
  
  string 
 
 ) 
  
 * 
  DeleteRecognizerOperation 
 
 

DeleteRecognizerOperation returns a new DeleteRecognizerOperation from a given name. The name must be that of a previously created DeleteRecognizerOperation, possibly from a different process.

func (*Client) GetConfig

GetConfig returns the requested Config.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 speech 
  
 "cloud.google.com/go/speech/apiv2" 
  
 speechpb 
  
 "cloud.google.com/go/speech/apiv2/speechpb" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in: 
  
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
  
 c 
 , 
  
 err 
  
 := 
  
 speech 
 . 
  NewClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 defer 
  
 c 
 . 
  Close 
 
 () 
  
 req 
  
 := 
  
& speechpb 
 . 
 GetConfigRequest 
 { 
  
 // TODO: Fill request struct fields. 
  
 // See https://pkg.go.dev/cloud.google.com/go/speech/apiv2/speechpb#GetConfigRequest. 
  
 } 
  
 resp 
 , 
  
 err 
  
 := 
  
 c 
 . 
 GetConfig 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
 } 
 

func (*Client) GetCustomClass

GetCustomClass returns the requested CustomClass.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 speech 
  
 "cloud.google.com/go/speech/apiv2" 
  
 speechpb 
  
 "cloud.google.com/go/speech/apiv2/speechpb" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in: 
  
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
  
 c 
 , 
  
 err 
  
 := 
  
 speech 
 . 
  NewClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 defer 
  
 c 
 . 
  Close 
 
 () 
  
 req 
  
 := 
  
& speechpb 
 . 
 GetCustomClassRequest 
 { 
  
 // TODO: Fill request struct fields. 
  
 // See https://pkg.go.dev/cloud.google.com/go/speech/apiv2/speechpb#GetCustomClassRequest. 
  
 } 
  
 resp 
 , 
  
 err 
  
 := 
  
 c 
 . 
 GetCustomClass 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
 } 
 

func (*Client) GetLocation

GetLocation gets information about a location.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 speech 
  
 "cloud.google.com/go/speech/apiv2" 
  
 locationpb 
  
 "google.golang.org/genproto/googleapis/cloud/location" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in: 
  
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
  
 c 
 , 
  
 err 
  
 := 
  
 speech 
 . 
  NewClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 defer 
  
 c 
 . 
  Close 
 
 () 
  
 req 
  
 := 
  
& locationpb 
 . 
 GetLocationRequest 
 { 
  
 // TODO: Fill request struct fields. 
  
 // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest. 
  
 } 
  
 resp 
 , 
  
 err 
  
 := 
  
 c 
 . 
  GetLocation 
 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
 } 
 

func (*Client) GetOperation

GetOperation is a utility method from google.longrunning.Operations.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 longrunningpb 
  
 "cloud.google.com/go/longrunning/autogen/longrunningpb" 
  
 speech 
  
 "cloud.google.com/go/speech/apiv2" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in: 
  
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
  
 c 
 , 
  
 err 
  
 := 
  
 speech 
 . 
  NewClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 defer 
  
 c 
 . 
  Close 
 
 () 
  
 req 
  
 := 
  
& longrunningpb 
 . 
  GetOperationRequest 
 
 { 
  
 // TODO: Fill request struct fields. 
  
 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest. 
  
 } 
  
 resp 
 , 
  
 err 
  
 := 
  
 c 
 . 
 GetOperation 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
 } 
 

func (*Client) GetPhraseSet

GetPhraseSet returns the requested PhraseSet.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 speech 
  
 "cloud.google.com/go/speech/apiv2" 
  
 speechpb 
  
 "cloud.google.com/go/speech/apiv2/speechpb" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in: 
  
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
  
 c 
 , 
  
 err 
  
 := 
  
 speech 
 . 
  NewClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 defer 
  
 c 
 . 
  Close 
 
 () 
  
 req 
  
 := 
  
& speechpb 
 . 
 GetPhraseSetRequest 
 { 
  
 // TODO: Fill request struct fields. 
  
 // See https://pkg.go.dev/cloud.google.com/go/speech/apiv2/speechpb#GetPhraseSetRequest. 
  
 } 
  
 resp 
 , 
  
 err 
  
 := 
  
 c 
 . 
 GetPhraseSet 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
 } 
 

func (*Client) GetRecognizer

GetRecognizer returns the requested Recognizer. Fails with NOT_FOUND if the requested Recognizer doesn’t exist.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 speech 
  
 "cloud.google.com/go/speech/apiv2" 
  
 speechpb 
  
 "cloud.google.com/go/speech/apiv2/speechpb" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in: 
  
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
  
 c 
 , 
  
 err 
  
 := 
  
 speech 
 . 
  NewClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 defer 
  
 c 
 . 
  Close 
 
 () 
  
 req 
  
 := 
  
& speechpb 
 . 
 GetRecognizerRequest 
 { 
  
 // TODO: Fill request struct fields. 
  
 // See https://pkg.go.dev/cloud.google.com/go/speech/apiv2/speechpb#GetRecognizerRequest. 
  
 } 
  
 resp 
 , 
  
 err 
  
 := 
  
 c 
 . 
 GetRecognizer 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
 } 
 

func (*Client) ListCustomClasses

ListCustomClasses lists CustomClasses.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 speech 
  
 "cloud.google.com/go/speech/apiv2" 
  
 speechpb 
  
 "cloud.google.com/go/speech/apiv2/speechpb" 
  
 "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 
  
 := 
  
 speech 
 . 
  NewClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 defer 
  
 c 
 . 
  Close 
 
 () 
  
 req 
  
 := 
  
& speechpb 
 . 
 ListCustomClassesRequest 
 { 
  
 // TODO: Fill request struct fields. 
  
 // See https://pkg.go.dev/cloud.google.com/go/speech/apiv2/speechpb#ListCustomClassesRequest. 
  
 } 
  
 it 
  
 := 
  
 c 
 . 
 ListCustomClasses 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 for 
  
 { 
  
 resp 
 , 
  
 err 
  
 := 
  
 it 
 . 
 Next 
 () 
  
 if 
  
 err 
  
 == 
  
 iterator 
 . 
 Done 
  
 { 
  
 break 
  
 } 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
  
 // If you need to access the underlying RPC response, 
  
 // you can do so by casting the `Response` as below. 
  
 // Otherwise, remove this line. Only populated after 
  
 // first call to Next(). Not safe for concurrent access. 
  
 _ 
  
 = 
  
 it 
 . 
 Response 
 .( 
 * 
 speechpb 
 . 
 ListCustomClassesResponse 
 ) 
  
 } 
 } 
 

func (*Client) ListLocations

ListLocations lists information about the supported locations for this service.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 speech 
  
 "cloud.google.com/go/speech/apiv2" 
  
 "google.golang.org/api/iterator" 
  
 locationpb 
  
 "google.golang.org/genproto/googleapis/cloud/location" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in: 
  
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
  
 c 
 , 
  
 err 
  
 := 
  
 speech 
 . 
  NewClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 defer 
  
 c 
 . 
  Close 
 
 () 
  
 req 
  
 := 
  
& locationpb 
 . 
 ListLocationsRequest 
 { 
  
 // TODO: Fill request struct fields. 
  
 // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest. 
  
 } 
  
 it 
  
 := 
  
 c 
 . 
  ListLocations 
 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 for 
  
 { 
  
 resp 
 , 
  
 err 
  
 := 
  
 it 
 . 
 Next 
 () 
  
 if 
  
 err 
  
 == 
  
 iterator 
 . 
 Done 
  
 { 
  
 break 
  
 } 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
  
 // If you need to access the underlying RPC response, 
  
 // you can do so by casting the `Response` as below. 
  
 // Otherwise, remove this line. Only populated after 
  
 // first call to Next(). Not safe for concurrent access. 
  
 _ 
  
 = 
  
 it 
 . 
 Response 
 .( 
 * 
 locationpb 
 . 
 ListLocationsResponse 
 ) 
  
 } 
 } 
 

func (*Client) ListOperations

ListOperations is a utility method from google.longrunning.Operations.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 longrunningpb 
  
 "cloud.google.com/go/longrunning/autogen/longrunningpb" 
  
 speech 
  
 "cloud.google.com/go/speech/apiv2" 
  
 "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 
  
 := 
  
 speech 
 . 
  NewClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 defer 
  
 c 
 . 
  Close 
 
 () 
  
 req 
  
 := 
  
& longrunningpb 
 . 
  ListOperationsRequest 
 
 { 
  
 // TODO: Fill request struct fields. 
  
 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. 
  
 } 
  
 it 
  
 := 
  
 c 
 . 
 ListOperations 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 for 
  
 { 
  
 resp 
 , 
  
 err 
  
 := 
  
 it 
 . 
 Next 
 () 
  
 if 
  
 err 
  
 == 
  
 iterator 
 . 
 Done 
  
 { 
  
 break 
  
 } 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
  
 // If you need to access the underlying RPC response, 
  
 // you can do so by casting the `Response` as below. 
  
 // Otherwise, remove this line. Only populated after 
  
 // first call to Next(). Not safe for concurrent access. 
  
 _ 
  
 = 
  
 it 
 . 
 Response 
 .( 
 * 
 longrunningpb 
 . 
  ListOperationsResponse 
 
 ) 
  
 } 
 } 
 

func (*Client) ListPhraseSets

ListPhraseSets lists PhraseSets.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 speech 
  
 "cloud.google.com/go/speech/apiv2" 
  
 speechpb 
  
 "cloud.google.com/go/speech/apiv2/speechpb" 
  
 "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 
  
 := 
  
 speech 
 . 
  NewClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 defer 
  
 c 
 . 
  Close 
 
 () 
  
 req 
  
 := 
  
& speechpb 
 . 
 ListPhraseSetsRequest 
 { 
  
 // TODO: Fill request struct fields. 
  
 // See https://pkg.go.dev/cloud.google.com/go/speech/apiv2/speechpb#ListPhraseSetsRequest. 
  
 } 
  
 it 
  
 := 
  
 c 
 . 
 ListPhraseSets 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 for 
  
 { 
  
 resp 
 , 
  
 err 
  
 := 
  
 it 
 . 
 Next 
 () 
  
 if 
  
 err 
  
 == 
  
 iterator 
 . 
 Done 
  
 { 
  
 break 
  
 } 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
  
 // If you need to access the underlying RPC response, 
  
 // you can do so by casting the `Response` as below. 
  
 // Otherwise, remove this line. Only populated after 
  
 // first call to Next(). Not safe for concurrent access. 
  
 _ 
  
 = 
  
 it 
 . 
 Response 
 .( 
 * 
 speechpb 
 . 
 ListPhraseSetsResponse 
 ) 
  
 } 
 } 
 

func (*Client) ListRecognizers

ListRecognizers lists Recognizers.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 speech 
  
 "cloud.google.com/go/speech/apiv2" 
  
 speechpb 
  
 "cloud.google.com/go/speech/apiv2/speechpb" 
  
 "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 
  
 := 
  
 speech 
 . 
  NewClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 defer 
  
 c 
 . 
  Close 
 
 () 
  
 req 
  
 := 
  
& speechpb 
 . 
 ListRecognizersRequest 
 { 
  
 // TODO: Fill request struct fields. 
  
 // See https://pkg.go.dev/cloud.google.com/go/speech/apiv2/speechpb#ListRecognizersRequest. 
  
 } 
  
 it 
  
 := 
  
 c 
 . 
 ListRecognizers 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 for 
  
 { 
  
 resp 
 , 
  
 err 
  
 := 
  
 it 
 . 
 Next 
 () 
  
 if 
  
 err 
  
 == 
  
 iterator 
 . 
 Done 
  
 { 
  
 break 
  
 } 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
  
 // If you need to access the underlying RPC response, 
  
 // you can do so by casting the `Response` as below. 
  
 // Otherwise, remove this line. Only populated after 
  
 // first call to Next(). Not safe for concurrent access. 
  
 _ 
  
 = 
  
 it 
 . 
 Response 
 .( 
 * 
 speechpb 
 . 
 ListRecognizersResponse 
 ) 
  
 } 
 } 
 

func (*Client) Recognize

Recognize performs synchronous Speech recognition: receive results after all audio has been sent and processed.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 speech 
  
 "cloud.google.com/go/speech/apiv2" 
  
 speechpb 
  
 "cloud.google.com/go/speech/apiv2/speechpb" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in: 
  
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
  
 c 
 , 
  
 err 
  
 := 
  
 speech 
 . 
  NewClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 defer 
  
 c 
 . 
  Close 
 
 () 
  
 req 
  
 := 
  
& speechpb 
 . 
 RecognizeRequest 
 { 
  
 // TODO: Fill request struct fields. 
  
 // See https://pkg.go.dev/cloud.google.com/go/speech/apiv2/speechpb#RecognizeRequest. 
  
 } 
  
 resp 
 , 
  
 err 
  
 := 
  
 c 
 . 
 Recognize 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
 } 
 

func (*Client) StreamingRecognize

StreamingRecognize performs bidirectional streaming speech recognition: receive results while sending audio. This method is only available via the gRPC API (not REST).

This method is not supported for the REST transport.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 "io" 
  
 speech 
  
 "cloud.google.com/go/speech/apiv2" 
  
 speechpb 
  
 "cloud.google.com/go/speech/apiv2/speechpb" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in: 
  
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
  
 c 
 , 
  
 err 
  
 := 
  
 speech 
 . 
  NewClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 defer 
  
 c 
 . 
  Close 
 
 () 
  
 stream 
 , 
  
 err 
  
 := 
  
 c 
 . 
 StreamingRecognize 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 go 
  
 func 
 () 
  
 { 
  
 reqs 
  
 := 
  
 [] 
 * 
 speechpb 
 . 
 StreamingRecognizeRequest 
 { 
  
 // TODO: Create requests. 
  
 } 
  
 for 
  
 _ 
 , 
  
 req 
  
 := 
  
 range 
  
 reqs 
  
 { 
  
 if 
  
 err 
  
 := 
  
 stream 
 . 
 Send 
 ( 
 req 
 ); 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 } 
  
 stream 
 . 
 CloseSend 
 () 
  
 }() 
  
 for 
  
 { 
  
 resp 
 , 
  
 err 
  
 := 
  
 stream 
 . 
 Recv 
 () 
  
 if 
  
 err 
  
 == 
  
 io 
 . 
 EOF 
  
 { 
  
 break 
  
 } 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
  
 } 
 } 
 

func (*Client) UndeleteCustomClass

UndeleteCustomClass undeletes the CustomClass.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 speech 
  
 "cloud.google.com/go/speech/apiv2" 
  
 speechpb 
  
 "cloud.google.com/go/speech/apiv2/speechpb" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in: 
  
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
  
 c 
 , 
  
 err 
  
 := 
  
 speech 
 . 
  NewClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 defer 
  
 c 
 . 
  Close 
 
 () 
  
 req 
  
 := 
  
& speechpb 
 . 
 UndeleteCustomClassRequest 
 { 
  
 // TODO: Fill request struct fields. 
  
 // See https://pkg.go.dev/cloud.google.com/go/speech/apiv2/speechpb#UndeleteCustomClassRequest. 
  
 } 
  
 op 
 , 
  
 err 
  
 := 
  
 c 
 . 
 UndeleteCustomClass 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 resp 
 , 
  
 err 
  
 := 
  
 op 
 . 
 Wait 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
 } 
 

func (*Client) UndeleteCustomClassOperation

  func 
  
 ( 
 c 
  
 * 
  Client 
 
 ) 
  
 UndeleteCustomClassOperation 
 ( 
 name 
  
  string 
 
 ) 
  
 * 
  UndeleteCustomClassOperation 
 
 

UndeleteCustomClassOperation returns a new UndeleteCustomClassOperation from a given name. The name must be that of a previously created UndeleteCustomClassOperation, possibly from a different process.

func (*Client) UndeletePhraseSet

UndeletePhraseSet undeletes the PhraseSet.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 speech 
  
 "cloud.google.com/go/speech/apiv2" 
  
 speechpb 
  
 "cloud.google.com/go/speech/apiv2/speechpb" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in: 
  
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
  
 c 
 , 
  
 err 
  
 := 
  
 speech 
 . 
  NewClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 defer 
  
 c 
 . 
  Close 
 
 () 
  
 req 
  
 := 
  
& speechpb 
 . 
 UndeletePhraseSetRequest 
 { 
  
 // TODO: Fill request struct fields. 
  
 // See https://pkg.go.dev/cloud.google.com/go/speech/apiv2/speechpb#UndeletePhraseSetRequest. 
  
 } 
  
 op 
 , 
  
 err 
  
 := 
  
 c 
 . 
 UndeletePhraseSet 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 resp 
 , 
  
 err 
  
 := 
  
 op 
 . 
 Wait 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
 } 
 

func (*Client) UndeletePhraseSetOperation

  func 
  
 ( 
 c 
  
 * 
  Client 
 
 ) 
  
 UndeletePhraseSetOperation 
 ( 
 name 
  
  string 
 
 ) 
  
 * 
  UndeletePhraseSetOperation 
 
 

UndeletePhraseSetOperation returns a new UndeletePhraseSetOperation from a given name. The name must be that of a previously created UndeletePhraseSetOperation, possibly from a different process.

func (*Client) UndeleteRecognizer

UndeleteRecognizer undeletes the Recognizer.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 speech 
  
 "cloud.google.com/go/speech/apiv2" 
  
 speechpb 
  
 "cloud.google.com/go/speech/apiv2/speechpb" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in: 
  
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
  
 c 
 , 
  
 err 
  
 := 
  
 speech 
 . 
  NewClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 defer 
  
 c 
 . 
  Close 
 
 () 
  
 req 
  
 := 
  
& speechpb 
 . 
 UndeleteRecognizerRequest 
 { 
  
 // TODO: Fill request struct fields. 
  
 // See https://pkg.go.dev/cloud.google.com/go/speech/apiv2/speechpb#UndeleteRecognizerRequest. 
  
 } 
  
 op 
 , 
  
 err 
  
 := 
  
 c 
 . 
 UndeleteRecognizer 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 resp 
 , 
  
 err 
  
 := 
  
 op 
 . 
 Wait 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
 } 
 

func (*Client) UndeleteRecognizerOperation

  func 
  
 ( 
 c 
  
 * 
  Client 
 
 ) 
  
 UndeleteRecognizerOperation 
 ( 
 name 
  
  string 
 
 ) 
  
 * 
  UndeleteRecognizerOperation 
 
 

UndeleteRecognizerOperation returns a new UndeleteRecognizerOperation from a given name. The name must be that of a previously created UndeleteRecognizerOperation, possibly from a different process.

func (*Client) UpdateConfig

UpdateConfig updates the Config.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 speech 
  
 "cloud.google.com/go/speech/apiv2" 
  
 speechpb 
  
 "cloud.google.com/go/speech/apiv2/speechpb" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in: 
  
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
  
 c 
 , 
  
 err 
  
 := 
  
 speech 
 . 
  NewClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 defer 
  
 c 
 . 
  Close 
 
 () 
  
 req 
  
 := 
  
& speechpb 
 . 
 UpdateConfigRequest 
 { 
  
 // TODO: Fill request struct fields. 
  
 // See https://pkg.go.dev/cloud.google.com/go/speech/apiv2/speechpb#UpdateConfigRequest. 
  
 } 
  
 resp 
 , 
  
 err 
  
 := 
  
 c 
 . 
 UpdateConfig 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
 } 
 

func (*Client) UpdateCustomClass

UpdateCustomClass updates the CustomClass.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 speech 
  
 "cloud.google.com/go/speech/apiv2" 
  
 speechpb 
  
 "cloud.google.com/go/speech/apiv2/speechpb" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in: 
  
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
  
 c 
 , 
  
 err 
  
 := 
  
 speech 
 . 
  NewClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 defer 
  
 c 
 . 
  Close 
 
 () 
  
 req 
  
 := 
  
& speechpb 
 . 
 UpdateCustomClassRequest 
 { 
  
 // TODO: Fill request struct fields. 
  
 // See https://pkg.go.dev/cloud.google.com/go/speech/apiv2/speechpb#UpdateCustomClassRequest. 
  
 } 
  
 op 
 , 
  
 err 
  
 := 
  
 c 
 . 
 UpdateCustomClass 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 resp 
 , 
  
 err 
  
 := 
  
 op 
 . 
 Wait 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
 } 
 

func (*Client) UpdateCustomClassOperation

  func 
  
 ( 
 c 
  
 * 
  Client 
 
 ) 
  
 UpdateCustomClassOperation 
 ( 
 name 
  
  string 
 
 ) 
  
 * 
  UpdateCustomClassOperation 
 
 

UpdateCustomClassOperation returns a new UpdateCustomClassOperation from a given name. The name must be that of a previously created UpdateCustomClassOperation, possibly from a different process.

func (*Client) UpdatePhraseSet

UpdatePhraseSet updates the PhraseSet.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 speech 
  
 "cloud.google.com/go/speech/apiv2" 
  
 speechpb 
  
 "cloud.google.com/go/speech/apiv2/speechpb" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in: 
  
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
  
 c 
 , 
  
 err 
  
 := 
  
 speech 
 . 
  NewClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 defer 
  
 c 
 . 
  Close 
 
 () 
  
 req 
  
 := 
  
& speechpb 
 . 
 UpdatePhraseSetRequest 
 { 
  
 // TODO: Fill request struct fields. 
  
 // See https://pkg.go.dev/cloud.google.com/go/speech/apiv2/speechpb#UpdatePhraseSetRequest. 
  
 } 
  
 op 
 , 
  
 err 
  
 := 
  
 c 
 . 
 UpdatePhraseSet 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 resp 
 , 
  
 err 
  
 := 
  
 op 
 . 
 Wait 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
 } 
 

func (*Client) UpdatePhraseSetOperation

  func 
  
 ( 
 c 
  
 * 
  Client 
 
 ) 
  
 UpdatePhraseSetOperation 
 ( 
 name 
  
  string 
 
 ) 
  
 * 
  UpdatePhraseSetOperation 
 
 

UpdatePhraseSetOperation returns a new UpdatePhraseSetOperation from a given name. The name must be that of a previously created UpdatePhraseSetOperation, possibly from a different process.

func (*Client) UpdateRecognizer

UpdateRecognizer updates the Recognizer.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 speech 
  
 "cloud.google.com/go/speech/apiv2" 
  
 speechpb 
  
 "cloud.google.com/go/speech/apiv2/speechpb" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in: 
  
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
  
 c 
 , 
  
 err 
  
 := 
  
 speech 
 . 
  NewClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 defer 
  
 c 
 . 
  Close 
 
 () 
  
 req 
  
 := 
  
& speechpb 
 . 
 UpdateRecognizerRequest 
 { 
  
 // TODO: Fill request struct fields. 
  
 // See https://pkg.go.dev/cloud.google.com/go/speech/apiv2/speechpb#UpdateRecognizerRequest. 
  
 } 
  
 op 
 , 
  
 err 
  
 := 
  
 c 
 . 
 UpdateRecognizer 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 resp 
 , 
  
 err 
  
 := 
  
 op 
 . 
 Wait 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
 } 
 

func (*Client) UpdateRecognizerOperation

  func 
  
 ( 
 c 
  
 * 
  Client 
 
 ) 
  
 UpdateRecognizerOperation 
 ( 
 name 
  
  string 
 
 ) 
  
 * 
  UpdateRecognizerOperation 
 
 

UpdateRecognizerOperation returns a new UpdateRecognizerOperation from a given name. The name must be that of a previously created UpdateRecognizerOperation, possibly from a different process.

CreateCustomClassOperation

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

CreateCustomClassOperation manages a long-running operation from CreateCustomClass.

func (*CreateCustomClassOperation) Done

Done reports whether the long-running operation has completed.

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 (*CreateCustomClassOperation) Name

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 (*CreateCustomClassOperation) Poll

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 (*CreateCustomClassOperation) Wait

Wait blocks until the long-running operation is completed, returning the response and any errors encountered.

See documentation of Poll for error-handling information.

CreatePhraseSetOperation

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

CreatePhraseSetOperation manages a long-running operation from CreatePhraseSet.

func (*CreatePhraseSetOperation) Done

Done reports whether the long-running operation has completed.

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 (*CreatePhraseSetOperation) Name

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 (*CreatePhraseSetOperation) Poll

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 (*CreatePhraseSetOperation) Wait

Wait blocks until the long-running operation is completed, returning the response and any errors encountered.

See documentation of Poll for error-handling information.

CreateRecognizerOperation

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

CreateRecognizerOperation manages a long-running operation from CreateRecognizer.

func (*CreateRecognizerOperation) Done

Done reports whether the long-running operation has completed.

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 (*CreateRecognizerOperation) Name

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 (*CreateRecognizerOperation) Poll

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 (*CreateRecognizerOperation) Wait

Wait blocks until the long-running operation is completed, returning the response and any errors encountered.

See documentation of Poll for error-handling information.

CustomClassIterator

  type 
  
 CustomClassIterator 
  
 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 
  
 [] 
 * 
  speechpb 
 
 . 
  CustomClass 
 
 , 
  
 nextPageToken 
  
  string 
 
 , 
  
 err 
  
  error 
 
 ) 
  
 // contains filtered or unexported fields 
 } 
 

CustomClassIterator manages a stream of *speechpb.CustomClass.

func (*CustomClassIterator) Next

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 (*CustomClassIterator) PageInfo

  func 
  
 ( 
 it 
  
 * 
  CustomClassIterator 
 
 ) 
  
 PageInfo 
 () 
  
 * 
 iterator 
 . 
 PageInfo 
 

PageInfo supports pagination. See the google.golang.org/api/iterator package for details.

DeleteCustomClassOperation

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

DeleteCustomClassOperation manages a long-running operation from DeleteCustomClass.

func (*DeleteCustomClassOperation) Done

Done reports whether the long-running operation has completed.

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 (*DeleteCustomClassOperation) Name

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 (*DeleteCustomClassOperation) Poll

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 (*DeleteCustomClassOperation) Wait

Wait blocks until the long-running operation is completed, returning the response and any errors encountered.

See documentation of Poll for error-handling information.

DeletePhraseSetOperation

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

DeletePhraseSetOperation manages a long-running operation from DeletePhraseSet.

func (*DeletePhraseSetOperation) Done

Done reports whether the long-running operation has completed.

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 (*DeletePhraseSetOperation) Name

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 (*DeletePhraseSetOperation) Poll

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 (*DeletePhraseSetOperation) Wait

Wait blocks until the long-running operation is completed, returning the response and any errors encountered.

See documentation of Poll for error-handling information.

DeleteRecognizerOperation

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

DeleteRecognizerOperation manages a long-running operation from DeleteRecognizer.

func (*DeleteRecognizerOperation) Done

Done reports whether the long-running operation has completed.

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 (*DeleteRecognizerOperation) Name

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 (*DeleteRecognizerOperation) Poll

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 (*DeleteRecognizerOperation) Wait

Wait blocks until the long-running operation is completed, returning the response and any errors encountered.

See documentation of Poll for error-handling information.

LocationIterator

  type 
  
 LocationIterator 
  
 struct 
  
 { 
  
 // Response is the raw response for the current page. 
  
 // It must be cast to the RPC response type. 
  
 // Calling Next() or InternalFetch() updates this value. 
  
 Response 
  
 interface 
 {} 
  
 // InternalFetch is for use by the Google Cloud Libraries only. 
  
 // It is not part of the stable interface of this package. 
  
 // 
  
 // InternalFetch returns results from a single call to the underlying RPC. 
  
 // The number of results is no greater than pageSize. 
  
 // If there are no more results, nextPageToken is empty and err is nil. 
  
 InternalFetch 
  
 func 
 ( 
 pageSize 
  
  int 
 
 , 
  
 pageToken 
  
  string 
 
 ) 
  
 ( 
 results 
  
 [] 
 * 
  locationpb 
 
 . 
  Location 
 
 , 
  
 nextPageToken 
  
  string 
 
 , 
  
 err 
  
  error 
 
 ) 
  
 // contains filtered or unexported fields 
 } 
 

LocationIterator manages a stream of *locationpb.Location.

func (*LocationIterator) Next

Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.

func (*LocationIterator) PageInfo

  func 
  
 ( 
 it 
  
 * 
  LocationIterator 
 
 ) 
  
 PageInfo 
 () 
  
 * 
 iterator 
 . 
 PageInfo 
 

PageInfo supports pagination. See the google.golang.org/api/iterator package for details.

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

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.

PhraseSetIterator

  type 
  
 PhraseSetIterator 
  
 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 
  
 [] 
 * 
  speechpb 
 
 . 
  PhraseSet 
 
 , 
  
 nextPageToken 
  
  string 
 
 , 
  
 err 
  
  error 
 
 ) 
  
 // contains filtered or unexported fields 
 } 
 

PhraseSetIterator manages a stream of *speechpb.PhraseSet.

func (*PhraseSetIterator) Next

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 (*PhraseSetIterator) PageInfo

  func 
  
 ( 
 it 
  
 * 
  PhraseSetIterator 
 
 ) 
  
 PageInfo 
 () 
  
 * 
 iterator 
 . 
 PageInfo 
 

PageInfo supports pagination. See the google.golang.org/api/iterator package for details.

RecognizerIterator

  type 
  
 RecognizerIterator 
  
 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 
  
 [] 
 * 
  speechpb 
 
 . 
  Recognizer 
 
 , 
  
 nextPageToken 
  
  string 
 
 , 
  
 err 
  
  error 
 
 ) 
  
 // contains filtered or unexported fields 
 } 
 

RecognizerIterator manages a stream of *speechpb.Recognizer.

func (*RecognizerIterator) Next

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 (*RecognizerIterator) PageInfo

  func 
  
 ( 
 it 
  
 * 
  RecognizerIterator 
 
 ) 
  
 PageInfo 
 () 
  
 * 
 iterator 
 . 
 PageInfo 
 

PageInfo supports pagination. See the google.golang.org/api/iterator package for details.

UndeleteCustomClassOperation

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

UndeleteCustomClassOperation manages a long-running operation from UndeleteCustomClass.

func (*UndeleteCustomClassOperation) Done

Done reports whether the long-running operation has completed.

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 (*UndeleteCustomClassOperation) Name

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 (*UndeleteCustomClassOperation) Poll

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 (*UndeleteCustomClassOperation) Wait

Wait blocks until the long-running operation is completed, returning the response and any errors encountered.

See documentation of Poll for error-handling information.

UndeletePhraseSetOperation

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

UndeletePhraseSetOperation manages a long-running operation from UndeletePhraseSet.

func (*UndeletePhraseSetOperation) Done

Done reports whether the long-running operation has completed.

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 (*UndeletePhraseSetOperation) Name

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 (*UndeletePhraseSetOperation) Poll

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 (*UndeletePhraseSetOperation) Wait

Wait blocks until the long-running operation is completed, returning the response and any errors encountered.

See documentation of Poll for error-handling information.

UndeleteRecognizerOperation

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

UndeleteRecognizerOperation manages a long-running operation from UndeleteRecognizer.

func (*UndeleteRecognizerOperation) Done

Done reports whether the long-running operation has completed.

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 (*UndeleteRecognizerOperation) Name

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 (*UndeleteRecognizerOperation) Poll

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 (*UndeleteRecognizerOperation) Wait

Wait blocks until the long-running operation is completed, returning the response and any errors encountered.

See documentation of Poll for error-handling information.

UpdateCustomClassOperation

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

UpdateCustomClassOperation manages a long-running operation from UpdateCustomClass.

func (*UpdateCustomClassOperation) Done

Done reports whether the long-running operation has completed.

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 (*UpdateCustomClassOperation) Name

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 (*UpdateCustomClassOperation) Poll

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 (*UpdateCustomClassOperation) Wait

Wait blocks until the long-running operation is completed, returning the response and any errors encountered.

See documentation of Poll for error-handling information.

UpdatePhraseSetOperation

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

UpdatePhraseSetOperation manages a long-running operation from UpdatePhraseSet.

func (*UpdatePhraseSetOperation) Done

Done reports whether the long-running operation has completed.

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 (*UpdatePhraseSetOperation) Name

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 (*UpdatePhraseSetOperation) Poll

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 (*UpdatePhraseSetOperation) Wait

Wait blocks until the long-running operation is completed, returning the response and any errors encountered.

See documentation of Poll for error-handling information.

UpdateRecognizerOperation

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

UpdateRecognizerOperation manages a long-running operation from UpdateRecognizer.

func (*UpdateRecognizerOperation) Done

Done reports whether the long-running operation has completed.

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 (*UpdateRecognizerOperation) Name

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 (*UpdateRecognizerOperation) Poll

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 (*UpdateRecognizerOperation) Wait

Wait blocks until the long-running operation is completed, returning the response and any errors encountered.

See documentation of Poll for error-handling information.

Create a Mobile Website
View Site in Mobile | Classic
Share by: