blob: fec91796c214a4ed98a6f73962b01c2709143142 [file] [log] [blame]
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by protoc-gen-go_gapic. DO NOT EDIT.
package speech_test
import (
"context"
"io"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
speech "cloud.google.com/go/speech/apiv2"
speechpb "cloud.google.com/go/speech/apiv2/speechpb"
"google.golang.org/api/iterator"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func ExampleNewClient() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require 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 ExampleNewRESTClient() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require 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 ExampleClient_CreateRecognizer() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require 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 ExampleClient_ListRecognizers() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require 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
}
}
func ExampleClient_GetRecognizer() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require 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 ExampleClient_UpdateRecognizer() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require 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 ExampleClient_DeleteRecognizer() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require 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 ExampleClient_UndeleteRecognizer() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require 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 ExampleClient_Recognize() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require 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 ExampleClient_StreamingRecognize() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require 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 ExampleClient_BatchRecognize() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require 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 ExampleClient_GetConfig() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require 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 ExampleClient_UpdateConfig() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require 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 ExampleClient_CreateCustomClass() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require 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 ExampleClient_ListCustomClasses() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require 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
}
}
func ExampleClient_GetCustomClass() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require 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 ExampleClient_UpdateCustomClass() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require 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 ExampleClient_DeleteCustomClass() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require 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 ExampleClient_UndeleteCustomClass() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require 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 ExampleClient_CreatePhraseSet() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require 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 ExampleClient_ListPhraseSets() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require 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
}
}
func ExampleClient_GetPhraseSet() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require 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 ExampleClient_UpdatePhraseSet() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require 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 ExampleClient_DeletePhraseSet() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require 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 ExampleClient_UndeletePhraseSet() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require 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 ExampleClient_GetLocation() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require 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 ExampleClient_ListLocations() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require 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
}
}
func ExampleClient_CancelOperation() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require 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 ExampleClient_DeleteOperation() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require 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 ExampleClient_GetOperation() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require 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 ExampleClient_ListOperations() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require 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
}
}