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 // TODO: Use client. 34 _ = c 35} 36 37func ExampleFlowsClient_CreateFlow() { 38 // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3" 39 40 ctx := context.Background() 41 c, err := cx.NewFlowsClient(ctx) 42 if err != nil { 43 // TODO: Handle error. 44 } 45 46 req := &cxpb.CreateFlowRequest{ 47 // TODO: Fill request struct fields. 48 } 49 resp, err := c.CreateFlow(ctx, req) 50 if err != nil { 51 // TODO: Handle error. 52 } 53 // TODO: Use resp. 54 _ = resp 55} 56 57func ExampleFlowsClient_DeleteFlow() { 58 ctx := context.Background() 59 c, err := cx.NewFlowsClient(ctx) 60 if err != nil { 61 // TODO: Handle error. 62 } 63 64 req := &cxpb.DeleteFlowRequest{ 65 // TODO: Fill request struct fields. 66 } 67 err = c.DeleteFlow(ctx, req) 68 if err != nil { 69 // TODO: Handle error. 70 } 71} 72 73func ExampleFlowsClient_ListFlows() { 74 // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3" 75 // import "google.golang.org/api/iterator" 76 77 ctx := context.Background() 78 c, err := cx.NewFlowsClient(ctx) 79 if err != nil { 80 // TODO: Handle error. 81 } 82 83 req := &cxpb.ListFlowsRequest{ 84 // TODO: Fill request struct fields. 85 } 86 it := c.ListFlows(ctx, req) 87 for { 88 resp, err := it.Next() 89 if err == iterator.Done { 90 break 91 } 92 if err != nil { 93 // TODO: Handle error. 94 } 95 // TODO: Use resp. 96 _ = resp 97 } 98} 99 100func ExampleFlowsClient_GetFlow() { 101 // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3" 102 103 ctx := context.Background() 104 c, err := cx.NewFlowsClient(ctx) 105 if err != nil { 106 // TODO: Handle error. 107 } 108 109 req := &cxpb.GetFlowRequest{ 110 // TODO: Fill request struct fields. 111 } 112 resp, err := c.GetFlow(ctx, req) 113 if err != nil { 114 // TODO: Handle error. 115 } 116 // TODO: Use resp. 117 _ = resp 118} 119 120func ExampleFlowsClient_UpdateFlow() { 121 // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3" 122 123 ctx := context.Background() 124 c, err := cx.NewFlowsClient(ctx) 125 if err != nil { 126 // TODO: Handle error. 127 } 128 129 req := &cxpb.UpdateFlowRequest{ 130 // TODO: Fill request struct fields. 131 } 132 resp, err := c.UpdateFlow(ctx, req) 133 if err != nil { 134 // TODO: Handle error. 135 } 136 // TODO: Use resp. 137 _ = resp 138} 139 140func ExampleFlowsClient_TrainFlow() { 141 // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3" 142 143 ctx := context.Background() 144 c, err := cx.NewFlowsClient(ctx) 145 if err != nil { 146 // TODO: Handle error. 147 } 148 149 req := &cxpb.TrainFlowRequest{ 150 // TODO: Fill request struct fields. 151 } 152 op, err := c.TrainFlow(ctx, req) 153 if err != nil { 154 // TODO: Handle error. 155 } 156 157 err = op.Wait(ctx) 158 if err != nil { 159 // TODO: Handle error. 160 } 161} 162 163func ExampleFlowsClient_ValidateFlow() { 164 // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3" 165 166 ctx := context.Background() 167 c, err := cx.NewFlowsClient(ctx) 168 if err != nil { 169 // TODO: Handle error. 170 } 171 172 req := &cxpb.ValidateFlowRequest{ 173 // TODO: Fill request struct fields. 174 } 175 resp, err := c.ValidateFlow(ctx, req) 176 if err != nil { 177 // TODO: Handle error. 178 } 179 // TODO: Use resp. 180 _ = resp 181} 182 183func ExampleFlowsClient_GetFlowValidationResult() { 184 // import cxpb "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3" 185 186 ctx := context.Background() 187 c, err := cx.NewFlowsClient(ctx) 188 if err != nil { 189 // TODO: Handle error. 190 } 191 192 req := &cxpb.GetFlowValidationResultRequest{ 193 // TODO: Fill request struct fields. 194 } 195 resp, err := c.GetFlowValidationResult(ctx, req) 196 if err != nil { 197 // TODO: Handle error. 198 } 199 // TODO: Use resp. 200 _ = resp 201} 202