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 ExampleNewEnvironmentsClient() {
28	ctx := context.Background()
29	c, err := cx.NewEnvironmentsClient(ctx)
30	if err != nil {
31		// TODO: Handle error.
32	}
33	// TODO: Use client.
34	_ = c
35}
36
37func ExampleEnvironmentsClient_ListEnvironments() {
38	// import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
39	// import "google.golang.org/api/iterator"
40
41	ctx := context.Background()
42	c, err := cx.NewEnvironmentsClient(ctx)
43	if err != nil {
44		// TODO: Handle error.
45	}
46
47	req := &cxpb.ListEnvironmentsRequest{
48		// TODO: Fill request struct fields.
49	}
50	it := c.ListEnvironments(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 ExampleEnvironmentsClient_GetEnvironment() {
65	// import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
66
67	ctx := context.Background()
68	c, err := cx.NewEnvironmentsClient(ctx)
69	if err != nil {
70		// TODO: Handle error.
71	}
72
73	req := &cxpb.GetEnvironmentRequest{
74		// TODO: Fill request struct fields.
75	}
76	resp, err := c.GetEnvironment(ctx, req)
77	if err != nil {
78		// TODO: Handle error.
79	}
80	// TODO: Use resp.
81	_ = resp
82}
83
84func ExampleEnvironmentsClient_CreateEnvironment() {
85	// import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
86
87	ctx := context.Background()
88	c, err := cx.NewEnvironmentsClient(ctx)
89	if err != nil {
90		// TODO: Handle error.
91	}
92
93	req := &cxpb.CreateEnvironmentRequest{
94		// TODO: Fill request struct fields.
95	}
96	op, err := c.CreateEnvironment(ctx, req)
97	if err != nil {
98		// TODO: Handle error.
99	}
100
101	resp, err := op.Wait(ctx)
102	if err != nil {
103		// TODO: Handle error.
104	}
105	// TODO: Use resp.
106	_ = resp
107}
108
109func ExampleEnvironmentsClient_UpdateEnvironment() {
110	// import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
111
112	ctx := context.Background()
113	c, err := cx.NewEnvironmentsClient(ctx)
114	if err != nil {
115		// TODO: Handle error.
116	}
117
118	req := &cxpb.UpdateEnvironmentRequest{
119		// TODO: Fill request struct fields.
120	}
121	op, err := c.UpdateEnvironment(ctx, req)
122	if err != nil {
123		// TODO: Handle error.
124	}
125
126	resp, err := op.Wait(ctx)
127	if err != nil {
128		// TODO: Handle error.
129	}
130	// TODO: Use resp.
131	_ = resp
132}
133
134func ExampleEnvironmentsClient_DeleteEnvironment() {
135	ctx := context.Background()
136	c, err := cx.NewEnvironmentsClient(ctx)
137	if err != nil {
138		// TODO: Handle error.
139	}
140
141	req := &cxpb.DeleteEnvironmentRequest{
142		// TODO: Fill request struct fields.
143	}
144	err = c.DeleteEnvironment(ctx, req)
145	if err != nil {
146		// TODO: Handle error.
147	}
148}
149
150func ExampleEnvironmentsClient_LookupEnvironmentHistory() {
151	// import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3"
152	// import "google.golang.org/api/iterator"
153
154	ctx := context.Background()
155	c, err := cx.NewEnvironmentsClient(ctx)
156	if err != nil {
157		// TODO: Handle error.
158	}
159
160	req := &cxpb.LookupEnvironmentHistoryRequest{
161		// TODO: Fill request struct fields.
162	}
163	it := c.LookupEnvironmentHistory(ctx, req)
164	for {
165		resp, err := it.Next()
166		if err == iterator.Done {
167			break
168		}
169		if err != nil {
170			// TODO: Handle error.
171		}
172		// TODO: Use resp.
173		_ = resp
174	}
175}
176