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 dialogflow_test 18 19import ( 20 "context" 21 22 dialogflow "cloud.google.com/go/dialogflow/apiv2" 23 "google.golang.org/api/iterator" 24 dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2" 25) 26 27func ExampleNewEntityTypesClient() { 28 ctx := context.Background() 29 c, err := dialogflow.NewEntityTypesClient(ctx) 30 if err != nil { 31 // TODO: Handle error. 32 } 33 defer c.Close() 34 35 // TODO: Use client. 36 _ = c 37} 38 39func ExampleEntityTypesClient_ListEntityTypes() { 40 ctx := context.Background() 41 c, err := dialogflow.NewEntityTypesClient(ctx) 42 if err != nil { 43 // TODO: Handle error. 44 } 45 defer c.Close() 46 47 req := &dialogflowpb.ListEntityTypesRequest{ 48 // TODO: Fill request struct fields. 49 } 50 it := c.ListEntityTypes(ctx, req) 51 for { 52 resp, err := it.Next() 53 if err == iterator.Done { 54 break 55 } 56 if err != nil { 57 // TODO: Handle error. 58 } 59 // TODO: Use resp. 60 _ = resp 61 } 62} 63 64func ExampleEntityTypesClient_GetEntityType() { 65 ctx := context.Background() 66 c, err := dialogflow.NewEntityTypesClient(ctx) 67 if err != nil { 68 // TODO: Handle error. 69 } 70 defer c.Close() 71 72 req := &dialogflowpb.GetEntityTypeRequest{ 73 // TODO: Fill request struct fields. 74 } 75 resp, err := c.GetEntityType(ctx, req) 76 if err != nil { 77 // TODO: Handle error. 78 } 79 // TODO: Use resp. 80 _ = resp 81} 82 83func ExampleEntityTypesClient_CreateEntityType() { 84 ctx := context.Background() 85 c, err := dialogflow.NewEntityTypesClient(ctx) 86 if err != nil { 87 // TODO: Handle error. 88 } 89 defer c.Close() 90 91 req := &dialogflowpb.CreateEntityTypeRequest{ 92 // TODO: Fill request struct fields. 93 } 94 resp, err := c.CreateEntityType(ctx, req) 95 if err != nil { 96 // TODO: Handle error. 97 } 98 // TODO: Use resp. 99 _ = resp 100} 101 102func ExampleEntityTypesClient_UpdateEntityType() { 103 ctx := context.Background() 104 c, err := dialogflow.NewEntityTypesClient(ctx) 105 if err != nil { 106 // TODO: Handle error. 107 } 108 defer c.Close() 109 110 req := &dialogflowpb.UpdateEntityTypeRequest{ 111 // TODO: Fill request struct fields. 112 } 113 resp, err := c.UpdateEntityType(ctx, req) 114 if err != nil { 115 // TODO: Handle error. 116 } 117 // TODO: Use resp. 118 _ = resp 119} 120 121func ExampleEntityTypesClient_DeleteEntityType() { 122 ctx := context.Background() 123 c, err := dialogflow.NewEntityTypesClient(ctx) 124 if err != nil { 125 // TODO: Handle error. 126 } 127 defer c.Close() 128 129 req := &dialogflowpb.DeleteEntityTypeRequest{ 130 // TODO: Fill request struct fields. 131 } 132 err = c.DeleteEntityType(ctx, req) 133 if err != nil { 134 // TODO: Handle error. 135 } 136} 137 138func ExampleEntityTypesClient_BatchUpdateEntityTypes() { 139 ctx := context.Background() 140 c, err := dialogflow.NewEntityTypesClient(ctx) 141 if err != nil { 142 // TODO: Handle error. 143 } 144 defer c.Close() 145 146 req := &dialogflowpb.BatchUpdateEntityTypesRequest{ 147 // TODO: Fill request struct fields. 148 } 149 op, err := c.BatchUpdateEntityTypes(ctx, req) 150 if err != nil { 151 // TODO: Handle error. 152 } 153 154 resp, err := op.Wait(ctx) 155 if err != nil { 156 // TODO: Handle error. 157 } 158 // TODO: Use resp. 159 _ = resp 160} 161 162func ExampleEntityTypesClient_BatchDeleteEntityTypes() { 163 ctx := context.Background() 164 c, err := dialogflow.NewEntityTypesClient(ctx) 165 if err != nil { 166 // TODO: Handle error. 167 } 168 defer c.Close() 169 170 req := &dialogflowpb.BatchDeleteEntityTypesRequest{ 171 // TODO: Fill request struct fields. 172 } 173 op, err := c.BatchDeleteEntityTypes(ctx, req) 174 if err != nil { 175 // TODO: Handle error. 176 } 177 178 err = op.Wait(ctx) 179 if err != nil { 180 // TODO: Handle error. 181 } 182} 183 184func ExampleEntityTypesClient_BatchCreateEntities() { 185 ctx := context.Background() 186 c, err := dialogflow.NewEntityTypesClient(ctx) 187 if err != nil { 188 // TODO: Handle error. 189 } 190 defer c.Close() 191 192 req := &dialogflowpb.BatchCreateEntitiesRequest{ 193 // TODO: Fill request struct fields. 194 } 195 op, err := c.BatchCreateEntities(ctx, req) 196 if err != nil { 197 // TODO: Handle error. 198 } 199 200 err = op.Wait(ctx) 201 if err != nil { 202 // TODO: Handle error. 203 } 204} 205 206func ExampleEntityTypesClient_BatchUpdateEntities() { 207 ctx := context.Background() 208 c, err := dialogflow.NewEntityTypesClient(ctx) 209 if err != nil { 210 // TODO: Handle error. 211 } 212 defer c.Close() 213 214 req := &dialogflowpb.BatchUpdateEntitiesRequest{ 215 // TODO: Fill request struct fields. 216 } 217 op, err := c.BatchUpdateEntities(ctx, req) 218 if err != nil { 219 // TODO: Handle error. 220 } 221 222 err = op.Wait(ctx) 223 if err != nil { 224 // TODO: Handle error. 225 } 226} 227 228func ExampleEntityTypesClient_BatchDeleteEntities() { 229 ctx := context.Background() 230 c, err := dialogflow.NewEntityTypesClient(ctx) 231 if err != nil { 232 // TODO: Handle error. 233 } 234 defer c.Close() 235 236 req := &dialogflowpb.BatchDeleteEntitiesRequest{ 237 // TODO: Fill request struct fields. 238 } 239 op, err := c.BatchDeleteEntities(ctx, req) 240 if err != nil { 241 // TODO: Handle error. 242 } 243 244 err = op.Wait(ctx) 245 if err != nil { 246 // TODO: Handle error. 247 } 248} 249