Debian Codegraph @

retail/apiv2alpha/merchant_center_account_link_client_example_test.go

raw symbols SCIP
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 package retail_test
18
19 import (
20 "context"
21
22 longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
23 retail "cloud.google.com/go/retail/apiv2alpha"
24 retailpb "cloud.google.com/go/retail/apiv2alpha/retailpb"
25 "google.golang.org/api/iterator"
26 )
27
28 func ExampleNewMerchantCenterAccountLinkClient() {
29 ctx := context.Background()
30 // This snippet has been automatically generated and should be regarded as a code template only.
31 // It will require modifications to work:
32 // - It may require correct/in-range values for request initialization.
33 // - It may require specifying regional endpoints when creating the service client as shown in:
34 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
35 c, err := retail.NewMerchantCenterAccountLinkClient(ctx)
36 if err != nil {
37 // TODO: Handle error.
38 }
39 defer c.Close()
40
41 // TODO: Use client.
42 _ = c
43 }
44
45 func ExampleNewMerchantCenterAccountLinkRESTClient() {
46 ctx := context.Background()
47 // This snippet has been automatically generated and should be regarded as a code template only.
48 // It will require modifications to work:
49 // - It may require correct/in-range values for request initialization.
50 // - It may require specifying regional endpoints when creating the service client as shown in:
51 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
52 c, err := retail.NewMerchantCenterAccountLinkRESTClient(ctx)
53 if err != nil {
54 // TODO: Handle error.
55 }
56 defer c.Close()
57
58 // TODO: Use client.
59 _ = c
60 }
61
62 func ExampleMerchantCenterAccountLinkClient_CreateMerchantCenterAccountLink() {
63 ctx := context.Background()
64 // This snippet has been automatically generated and should be regarded as a code template only.
65 // It will require modifications to work:
66 // - It may require correct/in-range values for request initialization.
67 // - It may require specifying regional endpoints when creating the service client as shown in:
68 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
69 c, err := retail.NewMerchantCenterAccountLinkClient(ctx)
70 if err != nil {
71 // TODO: Handle error.
72 }
73 defer c.Close()
74
75 req := &retailpb.CreateMerchantCenterAccountLinkRequest{
76 // TODO: Fill request struct fields.
77 // See https://pkg.go.dev/cloud.google.com/go/retail/apiv2alpha/retailpb#CreateMerchantCenterAccountLinkRequest.
78 }
79 op, err := c.CreateMerchantCenterAccountLink(ctx, req)
80 if err != nil {
81 // TODO: Handle error.
82 }
83
84 resp, err := op.Wait(ctx)
85 if err != nil {
86 // TODO: Handle error.
87 }
88 // TODO: Use resp.
89 _ = resp
90 }
91
92 func ExampleMerchantCenterAccountLinkClient_DeleteMerchantCenterAccountLink() {
93 ctx := context.Background()
94 // This snippet has been automatically generated and should be regarded as a code template only.
95 // It will require modifications to work:
96 // - It may require correct/in-range values for request initialization.
97 // - It may require specifying regional endpoints when creating the service client as shown in:
98 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
99 c, err := retail.NewMerchantCenterAccountLinkClient(ctx)
100 if err != nil {
101 // TODO: Handle error.
102 }
103 defer c.Close()
104
105 req := &retailpb.DeleteMerchantCenterAccountLinkRequest{
106 // TODO: Fill request struct fields.
107 // See https://pkg.go.dev/cloud.google.com/go/retail/apiv2alpha/retailpb#DeleteMerchantCenterAccountLinkRequest.
108 }
109 err = c.DeleteMerchantCenterAccountLink(ctx, req)
110 if err != nil {
111 // TODO: Handle error.
112 }
113 }
114
115 func ExampleMerchantCenterAccountLinkClient_ListMerchantCenterAccountLinks() {
116 ctx := context.Background()
117 // This snippet has been automatically generated and should be regarded as a code template only.
118 // It will require modifications to work:
119 // - It may require correct/in-range values for request initialization.
120 // - It may require specifying regional endpoints when creating the service client as shown in:
121 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
122 c, err := retail.NewMerchantCenterAccountLinkClient(ctx)
123 if err != nil {
124 // TODO: Handle error.
125 }
126 defer c.Close()
127
128 req := &retailpb.ListMerchantCenterAccountLinksRequest{
129 // TODO: Fill request struct fields.
130 // See https://pkg.go.dev/cloud.google.com/go/retail/apiv2alpha/retailpb#ListMerchantCenterAccountLinksRequest.
131 }
132 resp, err := c.ListMerchantCenterAccountLinks(ctx, req)
133 if err != nil {
134 // TODO: Handle error.
135 }
136 // TODO: Use resp.
137 _ = resp
138 }
139
140 func ExampleMerchantCenterAccountLinkClient_GetOperation() {
141 ctx := context.Background()
142 // This snippet has been automatically generated and should be regarded as a code template only.
143 // It will require modifications to work:
144 // - It may require correct/in-range values for request initialization.
145 // - It may require specifying regional endpoints when creating the service client as shown in:
146 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
147 c, err := retail.NewMerchantCenterAccountLinkClient(ctx)
148 if err != nil {
149 // TODO: Handle error.
150 }
151 defer c.Close()
152
153 req := &longrunningpb.GetOperationRequest{
154 // TODO: Fill request struct fields.
155 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
156 }
157 resp, err := c.GetOperation(ctx, req)
158 if err != nil {
159 // TODO: Handle error.
160 }
161 // TODO: Use resp.
162 _ = resp
163 }
164
165 func ExampleMerchantCenterAccountLinkClient_ListOperations() {
166 ctx := context.Background()
167 // This snippet has been automatically generated and should be regarded as a code template only.
168 // It will require modifications to work:
169 // - It may require correct/in-range values for request initialization.
170 // - It may require specifying regional endpoints when creating the service client as shown in:
171 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
172 c, err := retail.NewMerchantCenterAccountLinkClient(ctx)
173 if err != nil {
174 // TODO: Handle error.
175 }
176 defer c.Close()
177
178 req := &longrunningpb.ListOperationsRequest{
179 // TODO: Fill request struct fields.
180 // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
181 }
182 it := c.ListOperations(ctx, req)
183 for {
184 resp, err := it.Next()
185 if err == iterator.Done {
186 break
187 }
188 if err != nil {
189 // TODO: Handle error.
190 }
191 // TODO: Use resp.
192 _ = resp
193
194 // If you need to access the underlying RPC response,
195 // you can do so by casting the `Response` as below.
196 // Otherwise, remove this line. Only populated after
197 // first call to Next(). Not safe for concurrent access.
198 _ = it.Response.(*longrunningpb.ListOperationsResponse)
199 }
200 }