1// Copyright 2021 Google LLC 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// https://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15// Code generated by protoc-gen-go_gapic. DO NOT EDIT. 16 17package vision_test 18 19import ( 20 "context" 21 22 vision "cloud.google.com/go/vision/apiv1" 23 visionpb "google.golang.org/genproto/googleapis/cloud/vision/v1" 24) 25 26func ExampleNewImageAnnotatorClient() { 27 ctx := context.Background() 28 c, err := vision.NewImageAnnotatorClient(ctx) 29 if err != nil { 30 // TODO: Handle error. 31 } 32 defer c.Close() 33 34 // TODO: Use client. 35 _ = c 36} 37 38func ExampleImageAnnotatorClient_BatchAnnotateImages() { 39 ctx := context.Background() 40 c, err := vision.NewImageAnnotatorClient(ctx) 41 if err != nil { 42 // TODO: Handle error. 43 } 44 defer c.Close() 45 46 req := &visionpb.BatchAnnotateImagesRequest{ 47 // TODO: Fill request struct fields. 48 // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/vision/v1#BatchAnnotateImagesRequest. 49 } 50 resp, err := c.BatchAnnotateImages(ctx, req) 51 if err != nil { 52 // TODO: Handle error. 53 } 54 // TODO: Use resp. 55 _ = resp 56} 57 58func ExampleImageAnnotatorClient_BatchAnnotateFiles() { 59 ctx := context.Background() 60 c, err := vision.NewImageAnnotatorClient(ctx) 61 if err != nil { 62 // TODO: Handle error. 63 } 64 defer c.Close() 65 66 req := &visionpb.BatchAnnotateFilesRequest{ 67 // TODO: Fill request struct fields. 68 // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/vision/v1#BatchAnnotateFilesRequest. 69 } 70 resp, err := c.BatchAnnotateFiles(ctx, req) 71 if err != nil { 72 // TODO: Handle error. 73 } 74 // TODO: Use resp. 75 _ = resp 76} 77 78func ExampleImageAnnotatorClient_AsyncBatchAnnotateImages() { 79 ctx := context.Background() 80 c, err := vision.NewImageAnnotatorClient(ctx) 81 if err != nil { 82 // TODO: Handle error. 83 } 84 defer c.Close() 85 86 req := &visionpb.AsyncBatchAnnotateImagesRequest{ 87 // TODO: Fill request struct fields. 88 // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/vision/v1#AsyncBatchAnnotateImagesRequest. 89 } 90 op, err := c.AsyncBatchAnnotateImages(ctx, req) 91 if err != nil { 92 // TODO: Handle error. 93 } 94 95 resp, err := op.Wait(ctx) 96 if err != nil { 97 // TODO: Handle error. 98 } 99 // TODO: Use resp. 100 _ = resp 101} 102 103func ExampleImageAnnotatorClient_AsyncBatchAnnotateFiles() { 104 ctx := context.Background() 105 c, err := vision.NewImageAnnotatorClient(ctx) 106 if err != nil { 107 // TODO: Handle error. 108 } 109 defer c.Close() 110 111 req := &visionpb.AsyncBatchAnnotateFilesRequest{ 112 // TODO: Fill request struct fields. 113 // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/vision/v1#AsyncBatchAnnotateFilesRequest. 114 } 115 op, err := c.AsyncBatchAnnotateFiles(ctx, req) 116 if err != nil { 117 // TODO: Handle error. 118 } 119 120 resp, err := op.Wait(ctx) 121 if err != nil { 122 // TODO: Handle error. 123 } 124 // TODO: Use resp. 125 _ = resp 126} 127