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
18
19import (
20	"context"
21	"fmt"
22	"math"
23	"net/url"
24	"time"
25
26	"cloud.google.com/go/longrunning"
27	lroauto "cloud.google.com/go/longrunning/autogen"
28	structpb "github.com/golang/protobuf/ptypes/struct"
29	gax "github.com/googleapis/gax-go/v2"
30	"google.golang.org/api/iterator"
31	"google.golang.org/api/option"
32	"google.golang.org/api/option/internaloption"
33	gtransport "google.golang.org/api/transport/grpc"
34	dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2"
35	longrunningpb "google.golang.org/genproto/googleapis/longrunning"
36	"google.golang.org/grpc"
37	"google.golang.org/grpc/codes"
38	"google.golang.org/grpc/metadata"
39	"google.golang.org/protobuf/proto"
40)
41
42var newEntityTypesClientHook clientHook
43
44// EntityTypesCallOptions contains the retry settings for each method of EntityTypesClient.
45type EntityTypesCallOptions struct {
46	ListEntityTypes        []gax.CallOption
47	GetEntityType          []gax.CallOption
48	CreateEntityType       []gax.CallOption
49	UpdateEntityType       []gax.CallOption
50	DeleteEntityType       []gax.CallOption
51	BatchUpdateEntityTypes []gax.CallOption
52	BatchDeleteEntityTypes []gax.CallOption
53	BatchCreateEntities    []gax.CallOption
54	BatchUpdateEntities    []gax.CallOption
55	BatchDeleteEntities    []gax.CallOption
56}
57
58func defaultEntityTypesGRPCClientOptions() []option.ClientOption {
59	return []option.ClientOption{
60		internaloption.WithDefaultEndpoint("dialogflow.googleapis.com:443"),
61		internaloption.WithDefaultMTLSEndpoint("dialogflow.mtls.googleapis.com:443"),
62		internaloption.WithDefaultAudience("https://dialogflow.googleapis.com/"),
63		internaloption.WithDefaultScopes(DefaultAuthScopes()...),
64		internaloption.EnableJwtWithScope(),
65		option.WithGRPCDialOption(grpc.WithDisableServiceConfig()),
66		option.WithGRPCDialOption(grpc.WithDefaultCallOptions(
67			grpc.MaxCallRecvMsgSize(math.MaxInt32))),
68	}
69}
70
71func defaultEntityTypesCallOptions() *EntityTypesCallOptions {
72	return &EntityTypesCallOptions{
73		ListEntityTypes: []gax.CallOption{
74			gax.WithRetry(func() gax.Retryer {
75				return gax.OnCodes([]codes.Code{
76					codes.Unavailable,
77				}, gax.Backoff{
78					Initial:    100 * time.Millisecond,
79					Max:        60000 * time.Millisecond,
80					Multiplier: 1.30,
81				})
82			}),
83		},
84		GetEntityType: []gax.CallOption{
85			gax.WithRetry(func() gax.Retryer {
86				return gax.OnCodes([]codes.Code{
87					codes.Unavailable,
88				}, gax.Backoff{
89					Initial:    100 * time.Millisecond,
90					Max:        60000 * time.Millisecond,
91					Multiplier: 1.30,
92				})
93			}),
94		},
95		CreateEntityType: []gax.CallOption{
96			gax.WithRetry(func() gax.Retryer {
97				return gax.OnCodes([]codes.Code{
98					codes.Unavailable,
99				}, gax.Backoff{
100					Initial:    100 * time.Millisecond,
101					Max:        60000 * time.Millisecond,
102					Multiplier: 1.30,
103				})
104			}),
105		},
106		UpdateEntityType: []gax.CallOption{
107			gax.WithRetry(func() gax.Retryer {
108				return gax.OnCodes([]codes.Code{
109					codes.Unavailable,
110				}, gax.Backoff{
111					Initial:    100 * time.Millisecond,
112					Max:        60000 * time.Millisecond,
113					Multiplier: 1.30,
114				})
115			}),
116		},
117		DeleteEntityType: []gax.CallOption{
118			gax.WithRetry(func() gax.Retryer {
119				return gax.OnCodes([]codes.Code{
120					codes.Unavailable,
121				}, gax.Backoff{
122					Initial:    100 * time.Millisecond,
123					Max:        60000 * time.Millisecond,
124					Multiplier: 1.30,
125				})
126			}),
127		},
128		BatchUpdateEntityTypes: []gax.CallOption{
129			gax.WithRetry(func() gax.Retryer {
130				return gax.OnCodes([]codes.Code{
131					codes.Unavailable,
132				}, gax.Backoff{
133					Initial:    100 * time.Millisecond,
134					Max:        60000 * time.Millisecond,
135					Multiplier: 1.30,
136				})
137			}),
138		},
139		BatchDeleteEntityTypes: []gax.CallOption{
140			gax.WithRetry(func() gax.Retryer {
141				return gax.OnCodes([]codes.Code{
142					codes.Unavailable,
143				}, gax.Backoff{
144					Initial:    100 * time.Millisecond,
145					Max:        60000 * time.Millisecond,
146					Multiplier: 1.30,
147				})
148			}),
149		},
150		BatchCreateEntities: []gax.CallOption{
151			gax.WithRetry(func() gax.Retryer {
152				return gax.OnCodes([]codes.Code{
153					codes.Unavailable,
154				}, gax.Backoff{
155					Initial:    100 * time.Millisecond,
156					Max:        60000 * time.Millisecond,
157					Multiplier: 1.30,
158				})
159			}),
160		},
161		BatchUpdateEntities: []gax.CallOption{
162			gax.WithRetry(func() gax.Retryer {
163				return gax.OnCodes([]codes.Code{
164					codes.Unavailable,
165				}, gax.Backoff{
166					Initial:    100 * time.Millisecond,
167					Max:        60000 * time.Millisecond,
168					Multiplier: 1.30,
169				})
170			}),
171		},
172		BatchDeleteEntities: []gax.CallOption{
173			gax.WithRetry(func() gax.Retryer {
174				return gax.OnCodes([]codes.Code{
175					codes.Unavailable,
176				}, gax.Backoff{
177					Initial:    100 * time.Millisecond,
178					Max:        60000 * time.Millisecond,
179					Multiplier: 1.30,
180				})
181			}),
182		},
183	}
184}
185
186// internalEntityTypesClient is an interface that defines the methods availaible from Dialogflow API.
187type internalEntityTypesClient interface {
188	Close() error
189	setGoogleClientInfo(...string)
190	Connection() *grpc.ClientConn
191	ListEntityTypes(context.Context, *dialogflowpb.ListEntityTypesRequest, ...gax.CallOption) *EntityTypeIterator
192	GetEntityType(context.Context, *dialogflowpb.GetEntityTypeRequest, ...gax.CallOption) (*dialogflowpb.EntityType, error)
193	CreateEntityType(context.Context, *dialogflowpb.CreateEntityTypeRequest, ...gax.CallOption) (*dialogflowpb.EntityType, error)
194	UpdateEntityType(context.Context, *dialogflowpb.UpdateEntityTypeRequest, ...gax.CallOption) (*dialogflowpb.EntityType, error)
195	DeleteEntityType(context.Context, *dialogflowpb.DeleteEntityTypeRequest, ...gax.CallOption) error
196	BatchUpdateEntityTypes(context.Context, *dialogflowpb.BatchUpdateEntityTypesRequest, ...gax.CallOption) (*BatchUpdateEntityTypesOperation, error)
197	BatchUpdateEntityTypesOperation(name string) *BatchUpdateEntityTypesOperation
198	BatchDeleteEntityTypes(context.Context, *dialogflowpb.BatchDeleteEntityTypesRequest, ...gax.CallOption) (*BatchDeleteEntityTypesOperation, error)
199	BatchDeleteEntityTypesOperation(name string) *BatchDeleteEntityTypesOperation
200	BatchCreateEntities(context.Context, *dialogflowpb.BatchCreateEntitiesRequest, ...gax.CallOption) (*BatchCreateEntitiesOperation, error)
201	BatchCreateEntitiesOperation(name string) *BatchCreateEntitiesOperation
202	BatchUpdateEntities(context.Context, *dialogflowpb.BatchUpdateEntitiesRequest, ...gax.CallOption) (*BatchUpdateEntitiesOperation, error)
203	BatchUpdateEntitiesOperation(name string) *BatchUpdateEntitiesOperation
204	BatchDeleteEntities(context.Context, *dialogflowpb.BatchDeleteEntitiesRequest, ...gax.CallOption) (*BatchDeleteEntitiesOperation, error)
205	BatchDeleteEntitiesOperation(name string) *BatchDeleteEntitiesOperation
206}
207
208// EntityTypesClient is a client for interacting with Dialogflow API.
209// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
210//
211// Service for managing EntityTypes.
212type EntityTypesClient struct {
213	// The internal transport-dependent client.
214	internalClient internalEntityTypesClient
215
216	// The call options for this service.
217	CallOptions *EntityTypesCallOptions
218
219	// LROClient is used internally to handle long-running operations.
220	// It is exposed so that its CallOptions can be modified if required.
221	// Users should not Close this client.
222	LROClient *lroauto.OperationsClient
223}
224
225// Wrapper methods routed to the internal client.
226
227// Close closes the connection to the API service. The user should invoke this when
228// the client is no longer required.
229func (c *EntityTypesClient) Close() error {
230	return c.internalClient.Close()
231}
232
233// setGoogleClientInfo sets the name and version of the application in
234// the `x-goog-api-client` header passed on each request. Intended for
235// use by Google-written clients.
236func (c *EntityTypesClient) setGoogleClientInfo(keyval ...string) {
237	c.internalClient.setGoogleClientInfo(keyval...)
238}
239
240// Connection returns a connection to the API service.
241//
242// Deprecated.
243func (c *EntityTypesClient) Connection() *grpc.ClientConn {
244	return c.internalClient.Connection()
245}
246
247// ListEntityTypes returns the list of all entity types in the specified agent.
248func (c *EntityTypesClient) ListEntityTypes(ctx context.Context, req *dialogflowpb.ListEntityTypesRequest, opts ...gax.CallOption) *EntityTypeIterator {
249	return c.internalClient.ListEntityTypes(ctx, req, opts...)
250}
251
252// GetEntityType retrieves the specified entity type.
253func (c *EntityTypesClient) GetEntityType(ctx context.Context, req *dialogflowpb.GetEntityTypeRequest, opts ...gax.CallOption) (*dialogflowpb.EntityType, error) {
254	return c.internalClient.GetEntityType(ctx, req, opts...)
255}
256
257// CreateEntityType creates an entity type in the specified agent.
258//
259// Note: You should always train an agent prior to sending it queries. See the
260// training
261// documentation (at https://cloud.google.com/dialogflow/es/docs/training).
262func (c *EntityTypesClient) CreateEntityType(ctx context.Context, req *dialogflowpb.CreateEntityTypeRequest, opts ...gax.CallOption) (*dialogflowpb.EntityType, error) {
263	return c.internalClient.CreateEntityType(ctx, req, opts...)
264}
265
266// UpdateEntityType updates the specified entity type.
267//
268// Note: You should always train an agent prior to sending it queries. See the
269// training
270// documentation (at https://cloud.google.com/dialogflow/es/docs/training).
271func (c *EntityTypesClient) UpdateEntityType(ctx context.Context, req *dialogflowpb.UpdateEntityTypeRequest, opts ...gax.CallOption) (*dialogflowpb.EntityType, error) {
272	return c.internalClient.UpdateEntityType(ctx, req, opts...)
273}
274
275// DeleteEntityType deletes the specified entity type.
276//
277// Note: You should always train an agent prior to sending it queries. See the
278// training
279// documentation (at https://cloud.google.com/dialogflow/es/docs/training).
280func (c *EntityTypesClient) DeleteEntityType(ctx context.Context, req *dialogflowpb.DeleteEntityTypeRequest, opts ...gax.CallOption) error {
281	return c.internalClient.DeleteEntityType(ctx, req, opts...)
282}
283
284// BatchUpdateEntityTypes updates/Creates multiple entity types in the specified agent.
285//
286// Note: You should always train an agent prior to sending it queries. See the
287// training
288// documentation (at https://cloud.google.com/dialogflow/es/docs/training).
289func (c *EntityTypesClient) BatchUpdateEntityTypes(ctx context.Context, req *dialogflowpb.BatchUpdateEntityTypesRequest, opts ...gax.CallOption) (*BatchUpdateEntityTypesOperation, error) {
290	return c.internalClient.BatchUpdateEntityTypes(ctx, req, opts...)
291}
292
293// BatchUpdateEntityTypesOperation returns a new BatchUpdateEntityTypesOperation from a given name.
294// The name must be that of a previously created BatchUpdateEntityTypesOperation, possibly from a different process.
295func (c *EntityTypesClient) BatchUpdateEntityTypesOperation(name string) *BatchUpdateEntityTypesOperation {
296	return c.internalClient.BatchUpdateEntityTypesOperation(name)
297}
298
299// BatchDeleteEntityTypes deletes entity types in the specified agent.
300//
301// Note: You should always train an agent prior to sending it queries. See the
302// training
303// documentation (at https://cloud.google.com/dialogflow/es/docs/training).
304func (c *EntityTypesClient) BatchDeleteEntityTypes(ctx context.Context, req *dialogflowpb.BatchDeleteEntityTypesRequest, opts ...gax.CallOption) (*BatchDeleteEntityTypesOperation, error) {
305	return c.internalClient.BatchDeleteEntityTypes(ctx, req, opts...)
306}
307
308// BatchDeleteEntityTypesOperation returns a new BatchDeleteEntityTypesOperation from a given name.
309// The name must be that of a previously created BatchDeleteEntityTypesOperation, possibly from a different process.
310func (c *EntityTypesClient) BatchDeleteEntityTypesOperation(name string) *BatchDeleteEntityTypesOperation {
311	return c.internalClient.BatchDeleteEntityTypesOperation(name)
312}
313
314// BatchCreateEntities creates multiple new entities in the specified entity type.
315//
316// Note: You should always train an agent prior to sending it queries. See the
317// training
318// documentation (at https://cloud.google.com/dialogflow/es/docs/training).
319func (c *EntityTypesClient) BatchCreateEntities(ctx context.Context, req *dialogflowpb.BatchCreateEntitiesRequest, opts ...gax.CallOption) (*BatchCreateEntitiesOperation, error) {
320	return c.internalClient.BatchCreateEntities(ctx, req, opts...)
321}
322
323// BatchCreateEntitiesOperation returns a new BatchCreateEntitiesOperation from a given name.
324// The name must be that of a previously created BatchCreateEntitiesOperation, possibly from a different process.
325func (c *EntityTypesClient) BatchCreateEntitiesOperation(name string) *BatchCreateEntitiesOperation {
326	return c.internalClient.BatchCreateEntitiesOperation(name)
327}
328
329// BatchUpdateEntities updates or creates multiple entities in the specified entity type. This
330// method does not affect entities in the entity type that aren’t explicitly
331// specified in the request.
332//
333// Note: You should always train an agent prior to sending it queries. See the
334// training
335// documentation (at https://cloud.google.com/dialogflow/es/docs/training).
336func (c *EntityTypesClient) BatchUpdateEntities(ctx context.Context, req *dialogflowpb.BatchUpdateEntitiesRequest, opts ...gax.CallOption) (*BatchUpdateEntitiesOperation, error) {
337	return c.internalClient.BatchUpdateEntities(ctx, req, opts...)
338}
339
340// BatchUpdateEntitiesOperation returns a new BatchUpdateEntitiesOperation from a given name.
341// The name must be that of a previously created BatchUpdateEntitiesOperation, possibly from a different process.
342func (c *EntityTypesClient) BatchUpdateEntitiesOperation(name string) *BatchUpdateEntitiesOperation {
343	return c.internalClient.BatchUpdateEntitiesOperation(name)
344}
345
346// BatchDeleteEntities deletes entities in the specified entity type.
347//
348// Note: You should always train an agent prior to sending it queries. See the
349// training
350// documentation (at https://cloud.google.com/dialogflow/es/docs/training).
351func (c *EntityTypesClient) BatchDeleteEntities(ctx context.Context, req *dialogflowpb.BatchDeleteEntitiesRequest, opts ...gax.CallOption) (*BatchDeleteEntitiesOperation, error) {
352	return c.internalClient.BatchDeleteEntities(ctx, req, opts...)
353}
354
355// BatchDeleteEntitiesOperation returns a new BatchDeleteEntitiesOperation from a given name.
356// The name must be that of a previously created BatchDeleteEntitiesOperation, possibly from a different process.
357func (c *EntityTypesClient) BatchDeleteEntitiesOperation(name string) *BatchDeleteEntitiesOperation {
358	return c.internalClient.BatchDeleteEntitiesOperation(name)
359}
360
361// entityTypesGRPCClient is a client for interacting with Dialogflow API over gRPC transport.
362//
363// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
364type entityTypesGRPCClient struct {
365	// Connection pool of gRPC connections to the service.
366	connPool gtransport.ConnPool
367
368	// flag to opt out of default deadlines via GOOGLE_API_GO_EXPERIMENTAL_DISABLE_DEFAULT_DEADLINE
369	disableDeadlines bool
370
371	// Points back to the CallOptions field of the containing EntityTypesClient
372	CallOptions **EntityTypesCallOptions
373
374	// The gRPC API client.
375	entityTypesClient dialogflowpb.EntityTypesClient
376
377	// LROClient is used internally to handle long-running operations.
378	// It is exposed so that its CallOptions can be modified if required.
379	// Users should not Close this client.
380	LROClient **lroauto.OperationsClient
381
382	// The x-goog-* metadata to be sent with each request.
383	xGoogMetadata metadata.MD
384}
385
386// NewEntityTypesClient creates a new entity types client based on gRPC.
387// The returned client must be Closed when it is done being used to clean up its underlying connections.
388//
389// Service for managing EntityTypes.
390func NewEntityTypesClient(ctx context.Context, opts ...option.ClientOption) (*EntityTypesClient, error) {
391	clientOpts := defaultEntityTypesGRPCClientOptions()
392	if newEntityTypesClientHook != nil {
393		hookOpts, err := newEntityTypesClientHook(ctx, clientHookParams{})
394		if err != nil {
395			return nil, err
396		}
397		clientOpts = append(clientOpts, hookOpts...)
398	}
399
400	disableDeadlines, err := checkDisableDeadlines()
401	if err != nil {
402		return nil, err
403	}
404
405	connPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...)
406	if err != nil {
407		return nil, err
408	}
409	client := EntityTypesClient{CallOptions: defaultEntityTypesCallOptions()}
410
411	c := &entityTypesGRPCClient{
412		connPool:          connPool,
413		disableDeadlines:  disableDeadlines,
414		entityTypesClient: dialogflowpb.NewEntityTypesClient(connPool),
415		CallOptions:       &client.CallOptions,
416	}
417	c.setGoogleClientInfo()
418
419	client.internalClient = c
420
421	client.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool))
422	if err != nil {
423		// This error "should not happen", since we are just reusing old connection pool
424		// and never actually need to dial.
425		// If this does happen, we could leak connp. However, we cannot close conn:
426		// If the user invoked the constructor with option.WithGRPCConn,
427		// we would close a connection that's still in use.
428		// TODO: investigate error conditions.
429		return nil, err
430	}
431	c.LROClient = &client.LROClient
432	return &client, nil
433}
434
435// Connection returns a connection to the API service.
436//
437// Deprecated.
438func (c *entityTypesGRPCClient) Connection() *grpc.ClientConn {
439	return c.connPool.Conn()
440}
441
442// setGoogleClientInfo sets the name and version of the application in
443// the `x-goog-api-client` header passed on each request. Intended for
444// use by Google-written clients.
445func (c *entityTypesGRPCClient) setGoogleClientInfo(keyval ...string) {
446	kv := append([]string{"gl-go", versionGo()}, keyval...)
447	kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version)
448	c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...))
449}
450
451// Close closes the connection to the API service. The user should invoke this when
452// the client is no longer required.
453func (c *entityTypesGRPCClient) Close() error {
454	return c.connPool.Close()
455}
456
457func (c *entityTypesGRPCClient) ListEntityTypes(ctx context.Context, req *dialogflowpb.ListEntityTypesRequest, opts ...gax.CallOption) *EntityTypeIterator {
458	md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent())))
459	ctx = insertMetadata(ctx, c.xGoogMetadata, md)
460	opts = append((*c.CallOptions).ListEntityTypes[0:len((*c.CallOptions).ListEntityTypes):len((*c.CallOptions).ListEntityTypes)], opts...)
461	it := &EntityTypeIterator{}
462	req = proto.Clone(req).(*dialogflowpb.ListEntityTypesRequest)
463	it.InternalFetch = func(pageSize int, pageToken string) ([]*dialogflowpb.EntityType, string, error) {
464		resp := &dialogflowpb.ListEntityTypesResponse{}
465		if pageToken != "" {
466			req.PageToken = pageToken
467		}
468		if pageSize > math.MaxInt32 {
469			req.PageSize = math.MaxInt32
470		} else if pageSize != 0 {
471			req.PageSize = int32(pageSize)
472		}
473		err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
474			var err error
475			resp, err = c.entityTypesClient.ListEntityTypes(ctx, req, settings.GRPC...)
476			return err
477		}, opts...)
478		if err != nil {
479			return nil, "", err
480		}
481
482		it.Response = resp
483		return resp.GetEntityTypes(), resp.GetNextPageToken(), nil
484	}
485	fetch := func(pageSize int, pageToken string) (string, error) {
486		items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
487		if err != nil {
488			return "", err
489		}
490		it.items = append(it.items, items...)
491		return nextPageToken, nil
492	}
493
494	it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
495	it.pageInfo.MaxSize = int(req.GetPageSize())
496	it.pageInfo.Token = req.GetPageToken()
497
498	return it
499}
500
501func (c *entityTypesGRPCClient) GetEntityType(ctx context.Context, req *dialogflowpb.GetEntityTypeRequest, opts ...gax.CallOption) (*dialogflowpb.EntityType, error) {
502	if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines {
503		cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond)
504		defer cancel()
505		ctx = cctx
506	}
507	md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName())))
508	ctx = insertMetadata(ctx, c.xGoogMetadata, md)
509	opts = append((*c.CallOptions).GetEntityType[0:len((*c.CallOptions).GetEntityType):len((*c.CallOptions).GetEntityType)], opts...)
510	var resp *dialogflowpb.EntityType
511	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
512		var err error
513		resp, err = c.entityTypesClient.GetEntityType(ctx, req, settings.GRPC...)
514		return err
515	}, opts...)
516	if err != nil {
517		return nil, err
518	}
519	return resp, nil
520}
521
522func (c *entityTypesGRPCClient) CreateEntityType(ctx context.Context, req *dialogflowpb.CreateEntityTypeRequest, opts ...gax.CallOption) (*dialogflowpb.EntityType, error) {
523	if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines {
524		cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond)
525		defer cancel()
526		ctx = cctx
527	}
528	md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent())))
529	ctx = insertMetadata(ctx, c.xGoogMetadata, md)
530	opts = append((*c.CallOptions).CreateEntityType[0:len((*c.CallOptions).CreateEntityType):len((*c.CallOptions).CreateEntityType)], opts...)
531	var resp *dialogflowpb.EntityType
532	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
533		var err error
534		resp, err = c.entityTypesClient.CreateEntityType(ctx, req, settings.GRPC...)
535		return err
536	}, opts...)
537	if err != nil {
538		return nil, err
539	}
540	return resp, nil
541}
542
543func (c *entityTypesGRPCClient) UpdateEntityType(ctx context.Context, req *dialogflowpb.UpdateEntityTypeRequest, opts ...gax.CallOption) (*dialogflowpb.EntityType, error) {
544	if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines {
545		cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond)
546		defer cancel()
547		ctx = cctx
548	}
549	md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "entity_type.name", url.QueryEscape(req.GetEntityType().GetName())))
550	ctx = insertMetadata(ctx, c.xGoogMetadata, md)
551	opts = append((*c.CallOptions).UpdateEntityType[0:len((*c.CallOptions).UpdateEntityType):len((*c.CallOptions).UpdateEntityType)], opts...)
552	var resp *dialogflowpb.EntityType
553	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
554		var err error
555		resp, err = c.entityTypesClient.UpdateEntityType(ctx, req, settings.GRPC...)
556		return err
557	}, opts...)
558	if err != nil {
559		return nil, err
560	}
561	return resp, nil
562}
563
564func (c *entityTypesGRPCClient) DeleteEntityType(ctx context.Context, req *dialogflowpb.DeleteEntityTypeRequest, opts ...gax.CallOption) error {
565	if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines {
566		cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond)
567		defer cancel()
568		ctx = cctx
569	}
570	md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName())))
571	ctx = insertMetadata(ctx, c.xGoogMetadata, md)
572	opts = append((*c.CallOptions).DeleteEntityType[0:len((*c.CallOptions).DeleteEntityType):len((*c.CallOptions).DeleteEntityType)], opts...)
573	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
574		var err error
575		_, err = c.entityTypesClient.DeleteEntityType(ctx, req, settings.GRPC...)
576		return err
577	}, opts...)
578	return err
579}
580
581func (c *entityTypesGRPCClient) BatchUpdateEntityTypes(ctx context.Context, req *dialogflowpb.BatchUpdateEntityTypesRequest, opts ...gax.CallOption) (*BatchUpdateEntityTypesOperation, error) {
582	if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines {
583		cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond)
584		defer cancel()
585		ctx = cctx
586	}
587	md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent())))
588	ctx = insertMetadata(ctx, c.xGoogMetadata, md)
589	opts = append((*c.CallOptions).BatchUpdateEntityTypes[0:len((*c.CallOptions).BatchUpdateEntityTypes):len((*c.CallOptions).BatchUpdateEntityTypes)], opts...)
590	var resp *longrunningpb.Operation
591	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
592		var err error
593		resp, err = c.entityTypesClient.BatchUpdateEntityTypes(ctx, req, settings.GRPC...)
594		return err
595	}, opts...)
596	if err != nil {
597		return nil, err
598	}
599	return &BatchUpdateEntityTypesOperation{
600		lro: longrunning.InternalNewOperation(*c.LROClient, resp),
601	}, nil
602}
603
604func (c *entityTypesGRPCClient) BatchDeleteEntityTypes(ctx context.Context, req *dialogflowpb.BatchDeleteEntityTypesRequest, opts ...gax.CallOption) (*BatchDeleteEntityTypesOperation, error) {
605	if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines {
606		cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond)
607		defer cancel()
608		ctx = cctx
609	}
610	md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent())))
611	ctx = insertMetadata(ctx, c.xGoogMetadata, md)
612	opts = append((*c.CallOptions).BatchDeleteEntityTypes[0:len((*c.CallOptions).BatchDeleteEntityTypes):len((*c.CallOptions).BatchDeleteEntityTypes)], opts...)
613	var resp *longrunningpb.Operation
614	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
615		var err error
616		resp, err = c.entityTypesClient.BatchDeleteEntityTypes(ctx, req, settings.GRPC...)
617		return err
618	}, opts...)
619	if err != nil {
620		return nil, err
621	}
622	return &BatchDeleteEntityTypesOperation{
623		lro: longrunning.InternalNewOperation(*c.LROClient, resp),
624	}, nil
625}
626
627func (c *entityTypesGRPCClient) BatchCreateEntities(ctx context.Context, req *dialogflowpb.BatchCreateEntitiesRequest, opts ...gax.CallOption) (*BatchCreateEntitiesOperation, error) {
628	if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines {
629		cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond)
630		defer cancel()
631		ctx = cctx
632	}
633	md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent())))
634	ctx = insertMetadata(ctx, c.xGoogMetadata, md)
635	opts = append((*c.CallOptions).BatchCreateEntities[0:len((*c.CallOptions).BatchCreateEntities):len((*c.CallOptions).BatchCreateEntities)], opts...)
636	var resp *longrunningpb.Operation
637	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
638		var err error
639		resp, err = c.entityTypesClient.BatchCreateEntities(ctx, req, settings.GRPC...)
640		return err
641	}, opts...)
642	if err != nil {
643		return nil, err
644	}
645	return &BatchCreateEntitiesOperation{
646		lro: longrunning.InternalNewOperation(*c.LROClient, resp),
647	}, nil
648}
649
650func (c *entityTypesGRPCClient) BatchUpdateEntities(ctx context.Context, req *dialogflowpb.BatchUpdateEntitiesRequest, opts ...gax.CallOption) (*BatchUpdateEntitiesOperation, error) {
651	if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines {
652		cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond)
653		defer cancel()
654		ctx = cctx
655	}
656	md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent())))
657	ctx = insertMetadata(ctx, c.xGoogMetadata, md)
658	opts = append((*c.CallOptions).BatchUpdateEntities[0:len((*c.CallOptions).BatchUpdateEntities):len((*c.CallOptions).BatchUpdateEntities)], opts...)
659	var resp *longrunningpb.Operation
660	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
661		var err error
662		resp, err = c.entityTypesClient.BatchUpdateEntities(ctx, req, settings.GRPC...)
663		return err
664	}, opts...)
665	if err != nil {
666		return nil, err
667	}
668	return &BatchUpdateEntitiesOperation{
669		lro: longrunning.InternalNewOperation(*c.LROClient, resp),
670	}, nil
671}
672
673func (c *entityTypesGRPCClient) BatchDeleteEntities(ctx context.Context, req *dialogflowpb.BatchDeleteEntitiesRequest, opts ...gax.CallOption) (*BatchDeleteEntitiesOperation, error) {
674	if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines {
675		cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond)
676		defer cancel()
677		ctx = cctx
678	}
679	md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent())))
680	ctx = insertMetadata(ctx, c.xGoogMetadata, md)
681	opts = append((*c.CallOptions).BatchDeleteEntities[0:len((*c.CallOptions).BatchDeleteEntities):len((*c.CallOptions).BatchDeleteEntities)], opts...)
682	var resp *longrunningpb.Operation
683	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
684		var err error
685		resp, err = c.entityTypesClient.BatchDeleteEntities(ctx, req, settings.GRPC...)
686		return err
687	}, opts...)
688	if err != nil {
689		return nil, err
690	}
691	return &BatchDeleteEntitiesOperation{
692		lro: longrunning.InternalNewOperation(*c.LROClient, resp),
693	}, nil
694}
695
696// BatchCreateEntitiesOperation manages a long-running operation from BatchCreateEntities.
697type BatchCreateEntitiesOperation struct {
698	lro *longrunning.Operation
699}
700
701// BatchCreateEntitiesOperation returns a new BatchCreateEntitiesOperation from a given name.
702// The name must be that of a previously created BatchCreateEntitiesOperation, possibly from a different process.
703func (c *entityTypesGRPCClient) BatchCreateEntitiesOperation(name string) *BatchCreateEntitiesOperation {
704	return &BatchCreateEntitiesOperation{
705		lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
706	}
707}
708
709// Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
710//
711// See documentation of Poll for error-handling information.
712func (op *BatchCreateEntitiesOperation) Wait(ctx context.Context, opts ...gax.CallOption) error {
713	return op.lro.WaitWithInterval(ctx, nil, time.Minute, opts...)
714}
715
716// Poll fetches the latest state of the long-running operation.
717//
718// Poll also fetches the latest metadata, which can be retrieved by Metadata.
719//
720// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
721// the operation has completed with failure, the error is returned and op.Done will return true.
722// If Poll succeeds and the operation has completed successfully,
723// op.Done will return true, and the response of the operation is returned.
724// If Poll succeeds and the operation has not completed, the returned response and error are both nil.
725func (op *BatchCreateEntitiesOperation) Poll(ctx context.Context, opts ...gax.CallOption) error {
726	return op.lro.Poll(ctx, nil, opts...)
727}
728
729// Metadata returns metadata associated with the long-running operation.
730// Metadata itself does not contact the server, but Poll does.
731// To get the latest metadata, call this method after a successful call to Poll.
732// If the metadata is not available, the returned metadata and error are both nil.
733func (op *BatchCreateEntitiesOperation) Metadata() (*structpb.Struct, error) {
734	var meta structpb.Struct
735	if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
736		return nil, nil
737	} else if err != nil {
738		return nil, err
739	}
740	return &meta, nil
741}
742
743// Done reports whether the long-running operation has completed.
744func (op *BatchCreateEntitiesOperation) Done() bool {
745	return op.lro.Done()
746}
747
748// Name returns the name of the long-running operation.
749// The name is assigned by the server and is unique within the service from which the operation is created.
750func (op *BatchCreateEntitiesOperation) Name() string {
751	return op.lro.Name()
752}
753
754// BatchDeleteEntitiesOperation manages a long-running operation from BatchDeleteEntities.
755type BatchDeleteEntitiesOperation struct {
756	lro *longrunning.Operation
757}
758
759// BatchDeleteEntitiesOperation returns a new BatchDeleteEntitiesOperation from a given name.
760// The name must be that of a previously created BatchDeleteEntitiesOperation, possibly from a different process.
761func (c *entityTypesGRPCClient) BatchDeleteEntitiesOperation(name string) *BatchDeleteEntitiesOperation {
762	return &BatchDeleteEntitiesOperation{
763		lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
764	}
765}
766
767// Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
768//
769// See documentation of Poll for error-handling information.
770func (op *BatchDeleteEntitiesOperation) Wait(ctx context.Context, opts ...gax.CallOption) error {
771	return op.lro.WaitWithInterval(ctx, nil, time.Minute, opts...)
772}
773
774// Poll fetches the latest state of the long-running operation.
775//
776// Poll also fetches the latest metadata, which can be retrieved by Metadata.
777//
778// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
779// the operation has completed with failure, the error is returned and op.Done will return true.
780// If Poll succeeds and the operation has completed successfully,
781// op.Done will return true, and the response of the operation is returned.
782// If Poll succeeds and the operation has not completed, the returned response and error are both nil.
783func (op *BatchDeleteEntitiesOperation) Poll(ctx context.Context, opts ...gax.CallOption) error {
784	return op.lro.Poll(ctx, nil, opts...)
785}
786
787// Metadata returns metadata associated with the long-running operation.
788// Metadata itself does not contact the server, but Poll does.
789// To get the latest metadata, call this method after a successful call to Poll.
790// If the metadata is not available, the returned metadata and error are both nil.
791func (op *BatchDeleteEntitiesOperation) Metadata() (*structpb.Struct, error) {
792	var meta structpb.Struct
793	if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
794		return nil, nil
795	} else if err != nil {
796		return nil, err
797	}
798	return &meta, nil
799}
800
801// Done reports whether the long-running operation has completed.
802func (op *BatchDeleteEntitiesOperation) Done() bool {
803	return op.lro.Done()
804}
805
806// Name returns the name of the long-running operation.
807// The name is assigned by the server and is unique within the service from which the operation is created.
808func (op *BatchDeleteEntitiesOperation) Name() string {
809	return op.lro.Name()
810}
811
812// BatchDeleteEntityTypesOperation manages a long-running operation from BatchDeleteEntityTypes.
813type BatchDeleteEntityTypesOperation struct {
814	lro *longrunning.Operation
815}
816
817// BatchDeleteEntityTypesOperation returns a new BatchDeleteEntityTypesOperation from a given name.
818// The name must be that of a previously created BatchDeleteEntityTypesOperation, possibly from a different process.
819func (c *entityTypesGRPCClient) BatchDeleteEntityTypesOperation(name string) *BatchDeleteEntityTypesOperation {
820	return &BatchDeleteEntityTypesOperation{
821		lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
822	}
823}
824
825// Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
826//
827// See documentation of Poll for error-handling information.
828func (op *BatchDeleteEntityTypesOperation) Wait(ctx context.Context, opts ...gax.CallOption) error {
829	return op.lro.WaitWithInterval(ctx, nil, time.Minute, opts...)
830}
831
832// Poll fetches the latest state of the long-running operation.
833//
834// Poll also fetches the latest metadata, which can be retrieved by Metadata.
835//
836// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
837// the operation has completed with failure, the error is returned and op.Done will return true.
838// If Poll succeeds and the operation has completed successfully,
839// op.Done will return true, and the response of the operation is returned.
840// If Poll succeeds and the operation has not completed, the returned response and error are both nil.
841func (op *BatchDeleteEntityTypesOperation) Poll(ctx context.Context, opts ...gax.CallOption) error {
842	return op.lro.Poll(ctx, nil, opts...)
843}
844
845// Metadata returns metadata associated with the long-running operation.
846// Metadata itself does not contact the server, but Poll does.
847// To get the latest metadata, call this method after a successful call to Poll.
848// If the metadata is not available, the returned metadata and error are both nil.
849func (op *BatchDeleteEntityTypesOperation) Metadata() (*structpb.Struct, error) {
850	var meta structpb.Struct
851	if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
852		return nil, nil
853	} else if err != nil {
854		return nil, err
855	}
856	return &meta, nil
857}
858
859// Done reports whether the long-running operation has completed.
860func (op *BatchDeleteEntityTypesOperation) Done() bool {
861	return op.lro.Done()
862}
863
864// Name returns the name of the long-running operation.
865// The name is assigned by the server and is unique within the service from which the operation is created.
866func (op *BatchDeleteEntityTypesOperation) Name() string {
867	return op.lro.Name()
868}
869
870// BatchUpdateEntitiesOperation manages a long-running operation from BatchUpdateEntities.
871type BatchUpdateEntitiesOperation struct {
872	lro *longrunning.Operation
873}
874
875// BatchUpdateEntitiesOperation returns a new BatchUpdateEntitiesOperation from a given name.
876// The name must be that of a previously created BatchUpdateEntitiesOperation, possibly from a different process.
877func (c *entityTypesGRPCClient) BatchUpdateEntitiesOperation(name string) *BatchUpdateEntitiesOperation {
878	return &BatchUpdateEntitiesOperation{
879		lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
880	}
881}
882
883// Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
884//
885// See documentation of Poll for error-handling information.
886func (op *BatchUpdateEntitiesOperation) Wait(ctx context.Context, opts ...gax.CallOption) error {
887	return op.lro.WaitWithInterval(ctx, nil, time.Minute, opts...)
888}
889
890// Poll fetches the latest state of the long-running operation.
891//
892// Poll also fetches the latest metadata, which can be retrieved by Metadata.
893//
894// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
895// the operation has completed with failure, the error is returned and op.Done will return true.
896// If Poll succeeds and the operation has completed successfully,
897// op.Done will return true, and the response of the operation is returned.
898// If Poll succeeds and the operation has not completed, the returned response and error are both nil.
899func (op *BatchUpdateEntitiesOperation) Poll(ctx context.Context, opts ...gax.CallOption) error {
900	return op.lro.Poll(ctx, nil, opts...)
901}
902
903// Metadata returns metadata associated with the long-running operation.
904// Metadata itself does not contact the server, but Poll does.
905// To get the latest metadata, call this method after a successful call to Poll.
906// If the metadata is not available, the returned metadata and error are both nil.
907func (op *BatchUpdateEntitiesOperation) Metadata() (*structpb.Struct, error) {
908	var meta structpb.Struct
909	if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
910		return nil, nil
911	} else if err != nil {
912		return nil, err
913	}
914	return &meta, nil
915}
916
917// Done reports whether the long-running operation has completed.
918func (op *BatchUpdateEntitiesOperation) Done() bool {
919	return op.lro.Done()
920}
921
922// Name returns the name of the long-running operation.
923// The name is assigned by the server and is unique within the service from which the operation is created.
924func (op *BatchUpdateEntitiesOperation) Name() string {
925	return op.lro.Name()
926}
927
928// BatchUpdateEntityTypesOperation manages a long-running operation from BatchUpdateEntityTypes.
929type BatchUpdateEntityTypesOperation struct {
930	lro *longrunning.Operation
931}
932
933// BatchUpdateEntityTypesOperation returns a new BatchUpdateEntityTypesOperation from a given name.
934// The name must be that of a previously created BatchUpdateEntityTypesOperation, possibly from a different process.
935func (c *entityTypesGRPCClient) BatchUpdateEntityTypesOperation(name string) *BatchUpdateEntityTypesOperation {
936	return &BatchUpdateEntityTypesOperation{
937		lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}),
938	}
939}
940
941// Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
942//
943// See documentation of Poll for error-handling information.
944func (op *BatchUpdateEntityTypesOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*dialogflowpb.BatchUpdateEntityTypesResponse, error) {
945	var resp dialogflowpb.BatchUpdateEntityTypesResponse
946	if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {
947		return nil, err
948	}
949	return &resp, nil
950}
951
952// Poll fetches the latest state of the long-running operation.
953//
954// Poll also fetches the latest metadata, which can be retrieved by Metadata.
955//
956// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
957// the operation has completed with failure, the error is returned and op.Done will return true.
958// If Poll succeeds and the operation has completed successfully,
959// op.Done will return true, and the response of the operation is returned.
960// If Poll succeeds and the operation has not completed, the returned response and error are both nil.
961func (op *BatchUpdateEntityTypesOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*dialogflowpb.BatchUpdateEntityTypesResponse, error) {
962	var resp dialogflowpb.BatchUpdateEntityTypesResponse
963	if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
964		return nil, err
965	}
966	if !op.Done() {
967		return nil, nil
968	}
969	return &resp, nil
970}
971
972// Metadata returns metadata associated with the long-running operation.
973// Metadata itself does not contact the server, but Poll does.
974// To get the latest metadata, call this method after a successful call to Poll.
975// If the metadata is not available, the returned metadata and error are both nil.
976func (op *BatchUpdateEntityTypesOperation) Metadata() (*structpb.Struct, error) {
977	var meta structpb.Struct
978	if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
979		return nil, nil
980	} else if err != nil {
981		return nil, err
982	}
983	return &meta, nil
984}
985
986// Done reports whether the long-running operation has completed.
987func (op *BatchUpdateEntityTypesOperation) Done() bool {
988	return op.lro.Done()
989}
990
991// Name returns the name of the long-running operation.
992// The name is assigned by the server and is unique within the service from which the operation is created.
993func (op *BatchUpdateEntityTypesOperation) Name() string {
994	return op.lro.Name()
995}
996
997// EntityTypeIterator manages a stream of *dialogflowpb.EntityType.
998type EntityTypeIterator struct {
999	items    []*dialogflowpb.EntityType
1000	pageInfo *iterator.PageInfo
1001	nextFunc func() error
1002
1003	// Response is the raw response for the current page.
1004	// It must be cast to the RPC response type.
1005	// Calling Next() or InternalFetch() updates this value.
1006	Response interface{}
1007
1008	// InternalFetch is for use by the Google Cloud Libraries only.
1009	// It is not part of the stable interface of this package.
1010	//
1011	// InternalFetch returns results from a single call to the underlying RPC.
1012	// The number of results is no greater than pageSize.
1013	// If there are no more results, nextPageToken is empty and err is nil.
1014	InternalFetch func(pageSize int, pageToken string) (results []*dialogflowpb.EntityType, nextPageToken string, err error)
1015}
1016
1017// PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
1018func (it *EntityTypeIterator) PageInfo() *iterator.PageInfo {
1019	return it.pageInfo
1020}
1021
1022// Next returns the next result. Its second return value is iterator.Done if there are no more
1023// results. Once Next returns Done, all subsequent calls will return Done.
1024func (it *EntityTypeIterator) Next() (*dialogflowpb.EntityType, error) {
1025	var item *dialogflowpb.EntityType
1026	if err := it.nextFunc(); err != nil {
1027		return item, err
1028	}
1029	item = it.items[0]
1030	it.items = it.items[1:]
1031	return item, nil
1032}
1033
1034func (it *EntityTypeIterator) bufLen() int {
1035	return len(it.items)
1036}
1037
1038func (it *EntityTypeIterator) takeBuf() interface{} {
1039	b := it.items
1040	it.items = nil
1041	return b
1042}
1043