Debian Codegraph @

visionai/apiv1/warehouse_client_example_go123_test.go

raw
1 // Copyright 2025 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
17 //go:build go1.23
18
19 package visionai_test
20
21 import (
22 "context"
23
24 longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
25 visionai "cloud.google.com/go/visionai/apiv1"
26 visionaipb "cloud.google.com/go/visionai/apiv1/visionaipb"
27 )
28
29 func ExampleWarehouseClient_ListAnnotations_all() {
30 ctx := context.Background()
31 // This snippet has been automatically generated and should be regarded as a code template only.
32 // It will require modifications to work:
33 // - It may require correct/in-range values for request initialization.
34 // - It may require specifying regional endpoints when creating the service client as shown in:
35 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
36 c, err := visionai.NewWarehouseClient(ctx)
37 if err != nil {
38 // TODO: Handle error.
39 }
40 defer c.Close()
41
42 req := &visionaipb.ListAnnotationsRequest{
43 // TODO: Fill request struct fields.
44 // See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#ListAnnotationsRequest.
45 }
46 for resp, err := range c.ListAnnotations(ctx, req).All() {
47 if err != nil {
48 // TODO: Handle error and break/return/continue. Iteration will stop after any error.
49 }
50 // TODO: Use resp.
51 _ = resp
52 }
53 }
54
55 func ExampleWarehouseClient_ListAssets_all() {
56 ctx := context.Background()
57 // This snippet has been automatically generated and should be regarded as a code template only.
58 // It will require modifications to work:
59 // - It may require correct/in-range values for request initialization.
60 // - It may require specifying regional endpoints when creating the service client as shown in:
61 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
62 c, err := visionai.NewWarehouseClient(ctx)
63 if err != nil {
64 // TODO: Handle error.
65 }
66 defer c.Close()
67
68 req := &visionaipb.ListAssetsRequest{
69 // TODO: Fill request struct fields.
70 // See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#ListAssetsRequest.
71 }
72 for resp, err := range c.ListAssets(ctx, req).All() {
73 if err != nil {
74 // TODO: Handle error and break/return/continue. Iteration will stop after any error.
75 }
76 // TODO: Use resp.
77 _ = resp
78 }
79 }
80
81 func ExampleWarehouseClient_ListCollections_all() {
82 ctx := context.Background()
83 // This snippet has been automatically generated and should be regarded as a code template only.
84 // It will require modifications to work:
85 // - It may require correct/in-range values for request initialization.
86 // - It may require specifying regional endpoints when creating the service client as shown in:
87 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
88 c, err := visionai.NewWarehouseClient(ctx)
89 if err != nil {
90 // TODO: Handle error.
91 }
92 defer c.Close()
93
94 req := &visionaipb.ListCollectionsRequest{
95 // TODO: Fill request struct fields.
96 // See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#ListCollectionsRequest.
97 }
98 for resp, err := range c.ListCollections(ctx, req).All() {
99 if err != nil {
100 // TODO: Handle error and break/return/continue. Iteration will stop after any error.
101 }
102 // TODO: Use resp.
103 _ = resp
104 }
105 }
106
107 func ExampleWarehouseClient_ListCorpora_all() {
108 ctx := context.Background()
109 // This snippet has been automatically generated and should be regarded as a code template only.
110 // It will require modifications to work:
111 // - It may require correct/in-range values for request initialization.
112 // - It may require specifying regional endpoints when creating the service client as shown in:
113 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
114 c, err := visionai.NewWarehouseClient(ctx)
115 if err != nil {
116 // TODO: Handle error.
117 }
118 defer c.Close()
119
120 req := &visionaipb.ListCorporaRequest{
121 // TODO: Fill request struct fields.
122 // See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#ListCorporaRequest.
123 }
124 for resp, err := range c.ListCorpora(ctx, req).All() {
125 if err != nil {
126 // TODO: Handle error and break/return/continue. Iteration will stop after any error.
127 }
128 // TODO: Use resp.
129 _ = resp
130 }
131 }
132
133 func ExampleWarehouseClient_ListDataSchemas_all() {
134 ctx := context.Background()
135 // This snippet has been automatically generated and should be regarded as a code template only.
136 // It will require modifications to work:
137 // - It may require correct/in-range values for request initialization.
138 // - It may require specifying regional endpoints when creating the service client as shown in:
139 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
140 c, err := visionai.NewWarehouseClient(ctx)
141 if err != nil {
142 // TODO: Handle error.
143 }
144 defer c.Close()
145
146 req := &visionaipb.ListDataSchemasRequest{
147 // TODO: Fill request struct fields.
148 // See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#ListDataSchemasRequest.
149 }
150 for resp, err := range c.ListDataSchemas(ctx, req).All() {
151 if err != nil {
152 // TODO: Handle error and break/return/continue. Iteration will stop after any error.
153 }
154 // TODO: Use resp.
155 _ = resp
156 }
157 }
158
159 func ExampleWarehouseClient_ListIndexEndpoints_all() {
160 ctx := context.Background()
161 // This snippet has been automatically generated and should be regarded as a code template only.
162 // It will require modifications to work:
163 // - It may require correct/in-range values for request initialization.
164 // - It may require specifying regional endpoints when creating the service client as shown in:
165 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
166 c, err := visionai.NewWarehouseClient(ctx)
167 if err != nil {
168 // TODO: Handle error.
169 }
170 defer c.Close()
171
172 req := &visionaipb.ListIndexEndpointsRequest{
173 // TODO: Fill request struct fields.
174 // See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#ListIndexEndpointsRequest.
175 }
176 for resp, err := range c.ListIndexEndpoints(ctx, req).All() {
177 if err != nil {
178 // TODO: Handle error and break/return/continue. Iteration will stop after any error.
179 }
180 // TODO: Use resp.
181 _ = resp
182 }
183 }
184
185 func ExampleWarehouseClient_ListIndexes_all() {
186 ctx := context.Background()
187 // This snippet has been automatically generated and should be regarded as a code template only.
188 // It will require modifications to work:
189 // - It may require correct/in-range values for request initialization.
190 // - It may require specifying regional endpoints when creating the service client as shown in:
191 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
192 c, err := visionai.NewWarehouseClient(ctx)
193 if err != nil {
194 // TODO: Handle error.
195 }
196 defer c.Close()
197
198 req := &visionaipb.ListIndexesRequest{
199 // TODO: Fill request struct fields.
200 // See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#ListIndexesRequest.
201 }
202 for resp, err := range c.ListIndexes(ctx, req).All() {
203 if err != nil {
204 // TODO: Handle error and break/return/continue. Iteration will stop after any error.
205 }
206 // TODO: Use resp.
207 _ = resp
208 }
209 }
210
211 func ExampleWarehouseClient_ListSearchConfigs_all() {
212 ctx := context.Background()
213 // This snippet has been automatically generated and should be regarded as a code template only.
214 // It will require modifications to work:
215 // - It may require correct/in-range values for request initialization.
216 // - It may require specifying regional endpoints when creating the service client as shown in:
217 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
218 c, err := visionai.NewWarehouseClient(ctx)
219 if err != nil {
220 // TODO: Handle error.
221 }
222 defer c.Close()
223
224 req := &visionaipb.ListSearchConfigsRequest{
225 // TODO: Fill request struct fields.
226 // See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#ListSearchConfigsRequest.
227 }
228 for resp, err := range c.ListSearchConfigs(ctx, req).All() {
229 if err != nil {
230 // TODO: Handle error and break/return/continue. Iteration will stop after any error.
231 }
232 // TODO: Use resp.
233 _ = resp
234 }
235 }
236
237 func ExampleWarehouseClient_ListSearchHypernyms_all() {
238 ctx := context.Background()
239 // This snippet has been automatically generated and should be regarded as a code template only.
240 // It will require modifications to work:
241 // - It may require correct/in-range values for request initialization.
242 // - It may require specifying regional endpoints when creating the service client as shown in:
243 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
244 c, err := visionai.NewWarehouseClient(ctx)
245 if err != nil {
246 // TODO: Handle error.
247 }
248 defer c.Close()
249
250 req := &visionaipb.ListSearchHypernymsRequest{
251 // TODO: Fill request struct fields.
252 // See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#ListSearchHypernymsRequest.
253 }
254 for resp, err := range c.ListSearchHypernyms(ctx, req).All() {
255 if err != nil {
256 // TODO: Handle error and break/return/continue. Iteration will stop after any error.
257 }
258 // TODO: Use resp.
259 _ = resp
260 }
261 }
262
263 func ExampleWarehouseClient_SearchAssets_all() {
264 ctx := context.Background()
265 // This snippet has been automatically generated and should be regarded as a code template only.
266 // It will require modifications to work:
267 // - It may require correct/in-range values for request initialization.
268 // - It may require specifying regional endpoints when creating the service client as shown in:
269 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
270 c, err := visionai.NewWarehouseClient(ctx)
271 if err != nil {
272 // TODO: Handle error.
273 }
274 defer c.Close()
275
276 req := &visionaipb.SearchAssetsRequest{
277 // TODO: Fill request struct fields.
278 // See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#SearchAssetsRequest.
279 }
280 for resp, err := range c.SearchAssets(ctx, req).All() {
281 if err != nil {
282 // TODO: Handle error and break/return/continue. Iteration will stop after any error.
283 }
284 // TODO: Use resp.
285 _ = resp
286 }
287 }
288
289 func ExampleWarehouseClient_SearchIndexEndpoint_all() {
290 ctx := context.Background()
291 // This snippet has been automatically generated and should be regarded as a code template only.
292 // It will require modifications to work:
293 // - It may require correct/in-range values for request initialization.
294 // - It may require specifying regional endpoints when creating the service client as shown in:
295 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
296 c, err := visionai.NewWarehouseClient(ctx)
297 if err != nil {
298 // TODO: Handle error.
299 }
300 defer c.Close()
301
302 req := &visionaipb.SearchIndexEndpointRequest{
303 // TODO: Fill request struct fields.
304 // See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#SearchIndexEndpointRequest.
305 }
306 for resp, err := range c.SearchIndexEndpoint(ctx, req).All() {
307 if err != nil {
308 // TODO: Handle error and break/return/continue. Iteration will stop after any error.
309 }
310 // TODO: Use resp.
311 _ = resp
312 }
313 }
314
315 func ExampleWarehouseClient_ViewCollectionItems_all() {
316 ctx := context.Background()
317 // This snippet has been automatically generated and should be regarded as a code template only.
318 // It will require modifications to work:
319 // - It may require correct/in-range values for request initialization.
320 // - It may require specifying regional endpoints when creating the service client as shown in:
321 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
322 c, err := visionai.NewWarehouseClient(ctx)
323 if err != nil {
324 // TODO: Handle error.
325 }
326 defer c.Close()
327
328 req := &visionaipb.ViewCollectionItemsRequest{
329 // TODO: Fill request struct fields.
330 // See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#ViewCollectionItemsRequest.
331 }
332 for resp, err := range c.ViewCollectionItems(ctx, req).All() {
333 if err != nil {
334 // TODO: Handle error and break/return/continue. Iteration will stop after any error.
335 }
336 // TODO: Use resp.
337 _ = resp
338 }
339 }
340
341 func ExampleWarehouseClient_ViewIndexedAssets_all() {
342 ctx := context.Background()
343 // This snippet has been automatically generated and should be regarded as a code template only.
344 // It will require modifications to work:
345 // - It may require correct/in-range values for request initialization.
346 // - It may require specifying regional endpoints when creating the service client as shown in:
347 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
348 c, err := visionai.NewWarehouseClient(ctx)
349 if err != nil {
350 // TODO: Handle error.
351 }
352 defer c.Close()
353
354 req := &visionaipb.ViewIndexedAssetsRequest{
355 // TODO: Fill request struct fields.
356 // See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#ViewIndexedAssetsRequest.
357 }
358 for resp, err := range c.ViewIndexedAssets(ctx, req).All() {
359 if err != nil {
360 // TODO: Handle error and break/return/continue. Iteration will stop after any error.
361 }
362 // TODO: Use resp.
363 _ = resp
364 }
365 }
366
367 func ExampleWarehouseClient_ListOperations_all() {
368 ctx := context.Background()
369 // This snippet has been automatically generated and should be regarded as a code template only.
370 // It will require modifications to work:
371 // - It may require correct/in-range values for request initialization.
372 // - It may require specifying regional endpoints when creating the service client as shown in:
373 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
374 c, err := visionai.NewWarehouseClient(ctx)
375 if err != nil {
376 // TODO: Handle error.
377 }
378 defer c.Close()
379
380 req := &longrunningpb.ListOperationsRequest{
381 // TODO: Fill request struct fields.
382 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
383 }
384 for resp, err := range c.ListOperations(ctx, req).All() {
385 if err != nil {
386 // TODO: Handle error and break/return/continue. Iteration will stop after any error.
387 }
388 // TODO: Use resp.
389 _ = resp
390 }
391 }