1// Copyright 2019 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 gapic-generator. 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 ExampleNewIntentsClient() {
28	ctx := context.Background()
29	c, err := dialogflow.NewIntentsClient(ctx)
30	if err != nil {
31		// TODO: Handle error.
32	}
33	// TODO: Use client.
34	_ = c
35}
36
37func ExampleIntentsClient_ListIntents() {
38	ctx := context.Background()
39	c, err := dialogflow.NewIntentsClient(ctx)
40	if err != nil {
41		// TODO: Handle error.
42	}
43
44	req := &dialogflowpb.ListIntentsRequest{
45		// TODO: Fill request struct fields.
46	}
47	it := c.ListIntents(ctx, req)
48	for {
49		resp, err := it.Next()
50		if err == iterator.Done {
51			break
52		}
53		if err != nil {
54			// TODO: Handle error.
55		}
56		// TODO: Use resp.
57		_ = resp
58	}
59}
60
61func ExampleIntentsClient_GetIntent() {
62	ctx := context.Background()
63	c, err := dialogflow.NewIntentsClient(ctx)
64	if err != nil {
65		// TODO: Handle error.
66	}
67
68	req := &dialogflowpb.GetIntentRequest{
69		// TODO: Fill request struct fields.
70	}
71	resp, err := c.GetIntent(ctx, req)
72	if err != nil {
73		// TODO: Handle error.
74	}
75	// TODO: Use resp.
76	_ = resp
77}
78
79func ExampleIntentsClient_CreateIntent() {
80	ctx := context.Background()
81	c, err := dialogflow.NewIntentsClient(ctx)
82	if err != nil {
83		// TODO: Handle error.
84	}
85
86	req := &dialogflowpb.CreateIntentRequest{
87		// TODO: Fill request struct fields.
88	}
89	resp, err := c.CreateIntent(ctx, req)
90	if err != nil {
91		// TODO: Handle error.
92	}
93	// TODO: Use resp.
94	_ = resp
95}
96
97func ExampleIntentsClient_UpdateIntent() {
98	ctx := context.Background()
99	c, err := dialogflow.NewIntentsClient(ctx)
100	if err != nil {
101		// TODO: Handle error.
102	}
103
104	req := &dialogflowpb.UpdateIntentRequest{
105		// TODO: Fill request struct fields.
106	}
107	resp, err := c.UpdateIntent(ctx, req)
108	if err != nil {
109		// TODO: Handle error.
110	}
111	// TODO: Use resp.
112	_ = resp
113}
114
115func ExampleIntentsClient_DeleteIntent() {
116	ctx := context.Background()
117	c, err := dialogflow.NewIntentsClient(ctx)
118	if err != nil {
119		// TODO: Handle error.
120	}
121
122	req := &dialogflowpb.DeleteIntentRequest{
123		// TODO: Fill request struct fields.
124	}
125	err = c.DeleteIntent(ctx, req)
126	if err != nil {
127		// TODO: Handle error.
128	}
129}
130
131func ExampleIntentsClient_BatchUpdateIntents() {
132	ctx := context.Background()
133	c, err := dialogflow.NewIntentsClient(ctx)
134	if err != nil {
135		// TODO: Handle error.
136	}
137
138	req := &dialogflowpb.BatchUpdateIntentsRequest{
139		// TODO: Fill request struct fields.
140	}
141	op, err := c.BatchUpdateIntents(ctx, req)
142	if err != nil {
143		// TODO: Handle error.
144	}
145
146	resp, err := op.Wait(ctx)
147	if err != nil {
148		// TODO: Handle error.
149	}
150	// TODO: Use resp.
151	_ = resp
152}
153
154func ExampleIntentsClient_BatchDeleteIntents() {
155	ctx := context.Background()
156	c, err := dialogflow.NewIntentsClient(ctx)
157	if err != nil {
158		// TODO: Handle error.
159	}
160
161	req := &dialogflowpb.BatchDeleteIntentsRequest{
162		// TODO: Fill request struct fields.
163	}
164	op, err := c.BatchDeleteIntents(ctx, req)
165	if err != nil {
166		// TODO: Handle error.
167	}
168
169	err = op.Wait(ctx)
170	// TODO: Handle error.
171}
172