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 speech_test 18 19import ( 20 "context" 21 22 speech "cloud.google.com/go/speech/apiv1p1beta1" 23 "google.golang.org/api/iterator" 24 speechpb "google.golang.org/genproto/googleapis/cloud/speech/v1p1beta1" 25) 26 27func ExampleNewAdaptationClient() { 28 ctx := context.Background() 29 c, err := speech.NewAdaptationClient(ctx) 30 if err != nil { 31 // TODO: Handle error. 32 } 33 // TODO: Use client. 34 _ = c 35} 36 37func ExampleAdaptationClient_CreatePhraseSet() { 38 // import speechpb "google.golang.org/genproto/googleapis/cloud/speech/v1p1beta1" 39 40 ctx := context.Background() 41 c, err := speech.NewAdaptationClient(ctx) 42 if err != nil { 43 // TODO: Handle error. 44 } 45 46 req := &speechpb.CreatePhraseSetRequest{ 47 // TODO: Fill request struct fields. 48 } 49 resp, err := c.CreatePhraseSet(ctx, req) 50 if err != nil { 51 // TODO: Handle error. 52 } 53 // TODO: Use resp. 54 _ = resp 55} 56 57func ExampleAdaptationClient_GetPhraseSet() { 58 // import speechpb "google.golang.org/genproto/googleapis/cloud/speech/v1p1beta1" 59 60 ctx := context.Background() 61 c, err := speech.NewAdaptationClient(ctx) 62 if err != nil { 63 // TODO: Handle error. 64 } 65 66 req := &speechpb.GetPhraseSetRequest{ 67 // TODO: Fill request struct fields. 68 } 69 resp, err := c.GetPhraseSet(ctx, req) 70 if err != nil { 71 // TODO: Handle error. 72 } 73 // TODO: Use resp. 74 _ = resp 75} 76 77func ExampleAdaptationClient_ListPhraseSet() { 78 // import speechpb "google.golang.org/genproto/googleapis/cloud/speech/v1p1beta1" 79 // import "google.golang.org/api/iterator" 80 81 ctx := context.Background() 82 c, err := speech.NewAdaptationClient(ctx) 83 if err != nil { 84 // TODO: Handle error. 85 } 86 87 req := &speechpb.ListPhraseSetRequest{ 88 // TODO: Fill request struct fields. 89 } 90 it := c.ListPhraseSet(ctx, req) 91 for { 92 resp, err := it.Next() 93 if err == iterator.Done { 94 break 95 } 96 if err != nil { 97 // TODO: Handle error. 98 } 99 // TODO: Use resp. 100 _ = resp 101 } 102} 103 104func ExampleAdaptationClient_UpdatePhraseSet() { 105 // import speechpb "google.golang.org/genproto/googleapis/cloud/speech/v1p1beta1" 106 107 ctx := context.Background() 108 c, err := speech.NewAdaptationClient(ctx) 109 if err != nil { 110 // TODO: Handle error. 111 } 112 113 req := &speechpb.UpdatePhraseSetRequest{ 114 // TODO: Fill request struct fields. 115 } 116 resp, err := c.UpdatePhraseSet(ctx, req) 117 if err != nil { 118 // TODO: Handle error. 119 } 120 // TODO: Use resp. 121 _ = resp 122} 123 124func ExampleAdaptationClient_DeletePhraseSet() { 125 ctx := context.Background() 126 c, err := speech.NewAdaptationClient(ctx) 127 if err != nil { 128 // TODO: Handle error. 129 } 130 131 req := &speechpb.DeletePhraseSetRequest{ 132 // TODO: Fill request struct fields. 133 } 134 err = c.DeletePhraseSet(ctx, req) 135 if err != nil { 136 // TODO: Handle error. 137 } 138} 139 140func ExampleAdaptationClient_CreateCustomClass() { 141 // import speechpb "google.golang.org/genproto/googleapis/cloud/speech/v1p1beta1" 142 143 ctx := context.Background() 144 c, err := speech.NewAdaptationClient(ctx) 145 if err != nil { 146 // TODO: Handle error. 147 } 148 149 req := &speechpb.CreateCustomClassRequest{ 150 // TODO: Fill request struct fields. 151 } 152 resp, err := c.CreateCustomClass(ctx, req) 153 if err != nil { 154 // TODO: Handle error. 155 } 156 // TODO: Use resp. 157 _ = resp 158} 159 160func ExampleAdaptationClient_GetCustomClass() { 161 // import speechpb "google.golang.org/genproto/googleapis/cloud/speech/v1p1beta1" 162 163 ctx := context.Background() 164 c, err := speech.NewAdaptationClient(ctx) 165 if err != nil { 166 // TODO: Handle error. 167 } 168 169 req := &speechpb.GetCustomClassRequest{ 170 // TODO: Fill request struct fields. 171 } 172 resp, err := c.GetCustomClass(ctx, req) 173 if err != nil { 174 // TODO: Handle error. 175 } 176 // TODO: Use resp. 177 _ = resp 178} 179 180func ExampleAdaptationClient_ListCustomClasses() { 181 // import speechpb "google.golang.org/genproto/googleapis/cloud/speech/v1p1beta1" 182 // import "google.golang.org/api/iterator" 183 184 ctx := context.Background() 185 c, err := speech.NewAdaptationClient(ctx) 186 if err != nil { 187 // TODO: Handle error. 188 } 189 190 req := &speechpb.ListCustomClassesRequest{ 191 // TODO: Fill request struct fields. 192 } 193 it := c.ListCustomClasses(ctx, req) 194 for { 195 resp, err := it.Next() 196 if err == iterator.Done { 197 break 198 } 199 if err != nil { 200 // TODO: Handle error. 201 } 202 // TODO: Use resp. 203 _ = resp 204 } 205} 206 207func ExampleAdaptationClient_UpdateCustomClass() { 208 // import speechpb "google.golang.org/genproto/googleapis/cloud/speech/v1p1beta1" 209 210 ctx := context.Background() 211 c, err := speech.NewAdaptationClient(ctx) 212 if err != nil { 213 // TODO: Handle error. 214 } 215 216 req := &speechpb.UpdateCustomClassRequest{ 217 // TODO: Fill request struct fields. 218 } 219 resp, err := c.UpdateCustomClass(ctx, req) 220 if err != nil { 221 // TODO: Handle error. 222 } 223 // TODO: Use resp. 224 _ = resp 225} 226 227func ExampleAdaptationClient_DeleteCustomClass() { 228 ctx := context.Background() 229 c, err := speech.NewAdaptationClient(ctx) 230 if err != nil { 231 // TODO: Handle error. 232 } 233 234 req := &speechpb.DeleteCustomClassRequest{ 235 // TODO: Fill request struct fields. 236 } 237 err = c.DeleteCustomClass(ctx, req) 238 if err != nil { 239 // TODO: Handle error. 240 } 241} 242