@@ -24,21 +24,22 @@ Retrieve a shopper's account details, such as addresses and payment information.
2424package main
2525
2626import (
27+ " context"
2728 boltgo " github.com/BoltApp/bolt-go"
2829 " github.com/BoltApp/bolt-go/models/components"
29- " context"
3030 " log"
3131)
3232
3333func main () {
34+ ctx := context.Background ()
35+
3436 s := boltgo.New (
3537 boltgo.WithSecurity (components.Security {
3638 Oauth: boltgo.String (" <YOUR_OAUTH_HERE>" ),
3739 APIKey: boltgo.String (" <YOUR_API_KEY_HERE>" ),
3840 }),
3941 )
4042
41- ctx := context.Background ()
4243 res , err := s.Account .GetDetails (ctx, " <value>" , boltgo.String (" <value>" ))
4344 if err != nil {
4445 log.Fatal (err)
@@ -79,21 +80,22 @@ Add an address to the shopper's account
7980package main
8081
8182import (
83+ " context"
8284 boltgo " github.com/BoltApp/bolt-go"
8385 " github.com/BoltApp/bolt-go/models/components"
84- " context"
8586 " log"
8687)
8788
8889func main () {
90+ ctx := context.Background ()
91+
8992 s := boltgo.New (
9093 boltgo.WithSecurity (components.Security {
9194 Oauth: boltgo.String (" <YOUR_OAUTH_HERE>" ),
9295 APIKey: boltgo.String (" <YOUR_API_KEY_HERE>" ),
9396 }),
9497 )
9598
96- ctx := context.Background ()
9799 res , err := s.Account .AddAddress (ctx, " <value>" , components.AddressListingInput {
98100 FirstName: " Alice" ,
99101 LastName: " Baker" ,
@@ -147,21 +149,22 @@ Edit an existing address on the shopper's account. This does not edit addresses
147149package main
148150
149151import (
152+ " context"
150153 boltgo " github.com/BoltApp/bolt-go"
151154 " github.com/BoltApp/bolt-go/models/components"
152- " context"
153155 " log"
154156)
155157
156158func main () {
159+ ctx := context.Background ()
160+
157161 s := boltgo.New (
158162 boltgo.WithSecurity (components.Security {
159163 Oauth: boltgo.String (" <YOUR_OAUTH_HERE>" ),
160164 APIKey: boltgo.String (" <YOUR_API_KEY_HERE>" ),
161165 }),
162166 )
163167
164- ctx := context.Background ()
165168 res , err := s.Account .UpdateAddress (ctx, " D4g3h5tBuVYK9" , " <value>" , components.AddressListingInput {
166169 FirstName: " Alice" ,
167170 LastName: " Baker" ,
@@ -216,21 +219,22 @@ Delete an existing address. Deleting an address does not invalidate or remove th
216219package main
217220
218221import (
222+ " context"
219223 boltgo " github.com/BoltApp/bolt-go"
220224 " github.com/BoltApp/bolt-go/models/components"
221- " context"
222225 " log"
223226)
224227
225228func main () {
229+ ctx := context.Background ()
230+
226231 s := boltgo.New (
227232 boltgo.WithSecurity (components.Security {
228233 Oauth: boltgo.String (" <YOUR_OAUTH_HERE>" ),
229234 APIKey: boltgo.String (" <YOUR_API_KEY_HERE>" ),
230235 }),
231236 )
232237
233- ctx := context.Background ()
234238 res , err := s.Account .DeleteAddress (ctx, " D4g3h5tBuVYK9" , " <value>" , boltgo.String (" <value>" ))
235239 if err != nil {
236240 log.Fatal (err)
@@ -272,21 +276,22 @@ Add a payment method to a shopper's Bolt Account Wallet. For security purposes,
272276package main
273277
274278import (
279+ " context"
275280 boltgo " github.com/BoltApp/bolt-go"
276281 " github.com/BoltApp/bolt-go/models/components"
277- " context"
278282 " log"
279283)
280284
281285func main () {
286+ ctx := context.Background ()
287+
282288 s := boltgo.New (
283289 boltgo.WithSecurity (components.Security {
284290 Oauth: boltgo.String (" <YOUR_OAUTH_HERE>" ),
285291 APIKey: boltgo.String (" <YOUR_API_KEY_HERE>" ),
286292 }),
287293 )
288294
289- ctx := context.Background ()
290295 res , err := s.Account .AddPaymentMethod (ctx, " <value>" , components.CreatePaymentMethodInputPaymentMethodCreditCardInput (
291296 components.PaymentMethodCreditCardInput {
292297 DotTag: components.DotTagCreditCard ,
@@ -343,21 +348,22 @@ Delete an existing payment method. Deleting a payment method does not invalidate
343348package main
344349
345350import (
351+ " context"
346352 boltgo " github.com/BoltApp/bolt-go"
347353 " github.com/BoltApp/bolt-go/models/components"
348- " context"
349354 " log"
350355)
351356
352357func main () {
358+ ctx := context.Background ()
359+
353360 s := boltgo.New (
354361 boltgo.WithSecurity (components.Security {
355362 Oauth: boltgo.String (" <YOUR_OAUTH_HERE>" ),
356363 APIKey: boltgo.String (" <YOUR_API_KEY_HERE>" ),
357364 }),
358365 )
359366
360- ctx := context.Background ()
361367 res , err := s.Account .DeletePaymentMethod (ctx, " D4g3h5tBuVYK9" , " <value>" , boltgo.String (" <value>" ))
362368 if err != nil {
363369 log.Fatal (err)
0 commit comments