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 cx_test
18
19import (
20	"context"
21
22	cx "cloud.google.com/go/dialogflow/cx/apiv3"
23	"google.golang.org/api/iterator"
24	cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
25)
26
27func ExampleNewFlowsClient() {
28	ctx := context.Background()
29	c, err := cx.NewFlowsClient(ctx)
30	if err != nil {
31		// TODO: Handle error.
32	}
33	defer c.Close()
34
35	// TODO: Use client.
36	_ = c
37}
38
39func ExampleFlowsClient_CreateFlow() {
40	ctx := context.Background()
41	c, err := cx.NewFlowsClient(ctx)
42	if err != nil {
43		// TODO: Handle error.
44	}
45	defer c.Close()
46
47	req := &cxpb.CreateFlowRequest{
48		// TODO: Fill request struct fields.
49		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3#CreateFlowRequest.
50	}
51	resp, err := c.CreateFlow(ctx, req)
52	if err != nil {
53		// TODO: Handle error.
54	}
55	// TODO: Use resp.
56	_ = resp
57}
58
59func ExampleFlowsClient_DeleteFlow() {
60	ctx := context.Background()
61	c, err := cx.NewFlowsClient(ctx)
62	if err != nil {
63		// TODO: Handle error.
64	}
65	defer c.Close()
66
67	req := &cxpb.DeleteFlowRequest{
68		// TODO: Fill request struct fields.
69		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3#DeleteFlowRequest.
70	}
71	err = c.DeleteFlow(ctx, req)
72	if err != nil {
73		// TODO: Handle error.
74	}
75}
76
77func ExampleFlowsClient_ListFlows() {
78	ctx := context.Background()
79	c, err := cx.NewFlowsClient(ctx)
80	if err != nil {
81		// TODO: Handle error.
82	}
83	defer c.Close()
84
85	req := &cxpb.ListFlowsRequest{
86		// TODO: Fill request struct fields.
87		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3#ListFlowsRequest.
88	}
89	it := c.ListFlows(ctx, req)
90	for {
91		resp, err := it.Next()
92		if err == iterator.Done {
93			break
94		}
95		if err != nil {
96			// TODO: Handle error.
97		}
98		// TODO: Use resp.
99		_ = resp
100	}
101}
102
103func ExampleFlowsClient_GetFlow() {
104	ctx := context.Background()
105	c, err := cx.NewFlowsClient(ctx)
106	if err != nil {
107		// TODO: Handle error.
108	}
109	defer c.Close()
110
111	req := &cxpb.GetFlowRequest{
112		// TODO: Fill request struct fields.
113		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3#GetFlowRequest.
114	}
115	resp, err := c.GetFlow(ctx, req)
116	if err != nil {
117		// TODO: Handle error.
118	}
119	// TODO: Use resp.
120	_ = resp
121}
122
123func ExampleFlowsClient_UpdateFlow() {
124	ctx := context.Background()
125	c, err := cx.NewFlowsClient(ctx)
126	if err != nil {
127		// TODO: Handle error.
128	}
129	defer c.Close()
130
131	req := &cxpb.UpdateFlowRequest{
132		// TODO: Fill request struct fields.
133		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3#UpdateFlowRequest.
134	}
135	resp, err := c.UpdateFlow(ctx, req)
136	if err != nil {
137		// TODO: Handle error.
138	}
139	// TODO: Use resp.
140	_ = resp
141}
142
143func ExampleFlowsClient_TrainFlow() {
144	ctx := context.Background()
145	c, err := cx.NewFlowsClient(ctx)
146	if err != nil {
147		// TODO: Handle error.
148	}
149	defer c.Close()
150
151	req := &cxpb.TrainFlowRequest{
152		// TODO: Fill request struct fields.
153		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3#TrainFlowRequest.
154	}
155	op, err := c.TrainFlow(ctx, req)
156	if err != nil {
157		// TODO: Handle error.
158	}
159
160	err = op.Wait(ctx)
161	if err != nil {
162		// TODO: Handle error.
163	}
164}
165
166func ExampleFlowsClient_ValidateFlow() {
167	ctx := context.Background()
168	c, err := cx.NewFlowsClient(ctx)
169	if err != nil {
170		// TODO: Handle error.
171	}
172	defer c.Close()
173
174	req := &cxpb.ValidateFlowRequest{
175		// TODO: Fill request struct fields.
176		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3#ValidateFlowRequest.
177	}
178	resp, err := c.ValidateFlow(ctx, req)
179	if err != nil {
180		// TODO: Handle error.
181	}
182	// TODO: Use resp.
183	_ = resp
184}
185
186func ExampleFlowsClient_GetFlowValidationResult() {
187	ctx := context.Background()
188	c, err := cx.NewFlowsClient(ctx)
189	if err != nil {
190		// TODO: Handle error.
191	}
192	defer c.Close()
193
194	req := &cxpb.GetFlowValidationResultRequest{
195		// TODO: Fill request struct fields.
196		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3#GetFlowValidationResultRequest.
197	}
198	resp, err := c.GetFlowValidationResult(ctx, req)
199	if err != nil {
200		// TODO: Handle error.
201	}
202	// TODO: Use resp.
203	_ = resp
204}
205
206func ExampleFlowsClient_ImportFlow() {
207	ctx := context.Background()
208	c, err := cx.NewFlowsClient(ctx)
209	if err != nil {
210		// TODO: Handle error.
211	}
212	defer c.Close()
213
214	req := &cxpb.ImportFlowRequest{
215		// TODO: Fill request struct fields.
216		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3#ImportFlowRequest.
217	}
218	op, err := c.ImportFlow(ctx, req)
219	if err != nil {
220		// TODO: Handle error.
221	}
222
223	resp, err := op.Wait(ctx)
224	if err != nil {
225		// TODO: Handle error.
226	}
227	// TODO: Use resp.
228	_ = resp
229}
230
231func ExampleFlowsClient_ExportFlow() {
232	ctx := context.Background()
233	c, err := cx.NewFlowsClient(ctx)
234	if err != nil {
235		// TODO: Handle error.
236	}
237	defer c.Close()
238
239	req := &cxpb.ExportFlowRequest{
240		// TODO: Fill request struct fields.
241		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3#ExportFlowRequest.
242	}
243	op, err := c.ExportFlow(ctx, req)
244	if err != nil {
245		// TODO: Handle error.
246	}
247
248	resp, err := op.Wait(ctx)
249	if err != nil {
250		// TODO: Handle error.
251	}
252	// TODO: Use resp.
253	_ = resp
254}
255