66 </a>
77</div >
88
9+ <!-- Start Summary [summary] -->
10+ ## Summary
11+
12+ Bolt API Reference: A comprehensive Bolt API reference for interacting with Accounts, Payments, Orders and more.
13+ <!-- End Summary [summary] -->
14+
15+ <!-- Start Table of Contents [toc] -->
16+ ## Table of Contents
17+
18+ * [ SDK Installation] ( #sdk-installation )
19+ * [ SDK Example Usage] ( #sdk-example-usage )
20+ * [ Available Resources and Operations] ( #available-resources-and-operations )
21+ * [ Retries] ( #retries )
22+ * [ Error Handling] ( #error-handling )
23+ * [ Server Selection] ( #server-selection )
24+ * [ Custom HTTP Client] ( #custom-http-client )
25+ * [ Authentication] ( #authentication )
26+ * [ Special Types] ( #special-types )
27+ <!-- End Table of Contents [toc] -->
28+
929<!-- Start SDK Installation [installation] -->
1030## SDK Installation
1131
32+ To add the SDK as a dependency to your project:
1233``` bash
1334go get github.com/BoltApp/bolt-go
1435```
@@ -27,20 +48,18 @@ import (
2748 boltgo " github.com/BoltApp/bolt-go"
2849 " github.com/BoltApp/bolt-go/models/components"
2950 " log"
30- " os"
3151)
3252
3353func main () {
3454 s := boltgo.New (
3555 boltgo.WithSecurity (components.Security {
36- Oauth: boltgo.String (os.Getenv (" OAUTH" )),
56+ Oauth: boltgo.String (" <YOUR_OAUTH_HERE>" ),
57+ APIKey: boltgo.String (" <YOUR_API_KEY_HERE>" ),
3758 }),
3859 )
39- var xPublishableKey string = " <value>"
4060
41- var xMerchantClientID string = " <value>"
4261 ctx := context.Background ()
43- res , err := s.Account .GetDetails (ctx, xPublishableKey, xMerchantClientID )
62+ res , err := s.Account .GetDetails (ctx, " <value> " , " <value> " )
4463 if err != nil {
4564 log.Fatal (err)
4665 }
@@ -112,20 +131,18 @@ import (
112131 " github.com/BoltApp/bolt-go/models/components"
113132 " github.com/BoltApp/bolt-go/models/sdkerrors"
114133 " log"
115- " os"
116134)
117135
118136func main () {
119137 s := boltgo.New (
120138 boltgo.WithSecurity (components.Security {
121- Oauth: boltgo.String (os.Getenv (" OAUTH" )),
139+ Oauth: boltgo.String (" <YOUR_OAUTH_HERE>" ),
140+ APIKey: boltgo.String (" <YOUR_API_KEY_HERE>" ),
122141 }),
123142 )
124- var xPublishableKey string = " <value>"
125143
126- var xMerchantClientID string = " <value>"
127144 ctx := context.Background ()
128- res , err := s.Account .GetDetails (ctx, xPublishableKey, xMerchantClientID )
145+ res , err := s.Account .GetDetails (ctx, " <value> " , " <value> " )
129146 if err != nil {
130147
131148 var e *sdkerrors.AccountGetResponseBody
@@ -166,21 +183,19 @@ import (
166183 boltgo " github.com/BoltApp/bolt-go"
167184 " github.com/BoltApp/bolt-go/models/components"
168185 " log"
169- " os"
170186)
171187
172188func main () {
173189 s := boltgo.New (
174190 boltgo.WithServerIndex (0 ),
175191 boltgo.WithSecurity (components.Security {
176- Oauth: boltgo.String (os.Getenv (" OAUTH" )),
192+ Oauth: boltgo.String (" <YOUR_OAUTH_HERE>" ),
193+ APIKey: boltgo.String (" <YOUR_API_KEY_HERE>" ),
177194 }),
178195 )
179- var xPublishableKey string = " <value>"
180196
181- var xMerchantClientID string = " <value>"
182197 ctx := context.Background ()
183- res , err := s.Account .GetDetails (ctx, xPublishableKey, xMerchantClientID )
198+ res , err := s.Account .GetDetails (ctx, " <value> " , " <value> " )
184199 if err != nil {
185200 log.Fatal (err)
186201 }
@@ -207,21 +222,19 @@ import (
207222 boltgo " github.com/BoltApp/bolt-go"
208223 " github.com/BoltApp/bolt-go/models/components"
209224 " log"
210- " os"
211225)
212226
213227func main () {
214228 s := boltgo.New (
215229 boltgo.WithServerURL (" https://{environment}.bolt.com/v3" ),
216230 boltgo.WithSecurity (components.Security {
217- Oauth: boltgo.String (os.Getenv (" OAUTH" )),
231+ Oauth: boltgo.String (" <YOUR_OAUTH_HERE>" ),
232+ APIKey: boltgo.String (" <YOUR_API_KEY_HERE>" ),
218233 }),
219234 )
220- var xPublishableKey string = " <value>"
221235
222- var xMerchantClientID string = " <value>"
223236 ctx := context.Background ()
224- res , err := s.Account .GetDetails (ctx, xPublishableKey, xMerchantClientID )
237+ res , err := s.Account .GetDetails (ctx, " <value> " , " <value> " )
225238 if err != nil {
226239 log.Fatal (err)
227240 }
@@ -283,20 +296,18 @@ import (
283296 boltgo " github.com/BoltApp/bolt-go"
284297 " github.com/BoltApp/bolt-go/models/components"
285298 " log"
286- " os"
287299)
288300
289301func main () {
290302 s := boltgo.New (
291303 boltgo.WithSecurity (components.Security {
292- Oauth: boltgo.String (os.Getenv (" OAUTH" )),
304+ Oauth: boltgo.String (" <YOUR_OAUTH_HERE>" ),
305+ APIKey: boltgo.String (" <YOUR_API_KEY_HERE>" ),
293306 }),
294307 )
295- var xPublishableKey string = " <value>"
296308
297- var xMerchantClientID string = " <value>"
298309 ctx := context.Background ()
299- res , err := s.Account .GetDetails (ctx, xPublishableKey, xMerchantClientID )
310+ res , err := s.Account .GetDetails (ctx, " <value> " , " <value> " )
300311 if err != nil {
301312 log.Fatal (err)
302313 }
@@ -319,20 +330,15 @@ import (
319330 " github.com/BoltApp/bolt-go/models/components"
320331 " github.com/BoltApp/bolt-go/models/operations"
321332 " log"
322- " os"
323333)
324334
325335func main () {
326336 s := boltgo.New ()
327- security := operations.GuestPaymentsInitializeSecurity {
328- APIKey: os.Getenv (" API_KEY" ),
329- }
330-
331- var xPublishableKey string = " <value>"
332-
333- var xMerchantClientID string = " <value>"
334337
335- guestPaymentInitializeRequest := components.GuestPaymentInitializeRequest {
338+ ctx := context.Background ()
339+ res , err := s.Payments .Guest .Initialize (ctx, operations.GuestPaymentsInitializeSecurity {
340+ APIKey: " <YOUR_API_KEY_HERE>" ,
341+ }, " <value>" , " <value>" , components.GuestPaymentInitializeRequest {
336342 Profile: components.ProfileCreationData {
337343 CreateAccount: true ,
338344 FirstName: " Alice" ,
@@ -346,10 +352,20 @@ func main() {
346352 DisplayID: boltgo.String (" 215614191" ),
347353 Shipments: []components.CartShipment {
348354 components.CartShipment {
349- Address: components.CreateAddressReferenceInputAddressReferenceID (
350- components.AddressReferenceID {
351- DotTag: components.AddressReferenceIDTagID ,
352- ID: " D4g3h5tBuVYK9" ,
355+ Address: components.CreateAddressReferenceInputAddressReferenceExplicitInput (
356+ components.AddressReferenceExplicitInput {
357+ DotTag: components.AddressReferenceExplicitTagExplicit ,
358+ FirstName: " Alice" ,
359+ LastName: " Baker" ,
360+ Company: boltgo.String (" ACME Corporation" ),
361+ StreetAddress1: " 535 Mission St, Ste 1401" ,
362+ StreetAddress2: boltgo.String (" c/o Shipping Department" ),
363+ Locality: " San Francisco" ,
364+ PostalCode: " 94105" ,
365+ Region: boltgo.String (" CA" ),
366+ CountryCode: components.CountryCodeUs ,
367+ Email: boltgo.
String (
" [email protected] " ),
368+ Phone: boltgo.String (" +14155550199" ),
353369 },
354370 ),
355371 Cost: &components.Amount {
@@ -395,10 +411,20 @@ func main() {
395411 PaymentMethod: components.CreatePaymentMethodInputPaymentMethodCreditCardInput (
396412 components.PaymentMethodCreditCardInput {
397413 DotTag: components.DotTagCreditCard ,
398- BillingAddress: components.CreateAddressReferenceInputAddressReferenceID (
399- components.AddressReferenceID {
400- DotTag: components.AddressReferenceIDTagID ,
401- ID: " D4g3h5tBuVYK9" ,
414+ BillingAddress: components.CreateAddressReferenceInputAddressReferenceExplicitInput (
415+ components.AddressReferenceExplicitInput {
416+ DotTag: components.AddressReferenceExplicitTagExplicit ,
417+ FirstName: " Alice" ,
418+ LastName: " Baker" ,
419+ Company: boltgo.String (" ACME Corporation" ),
420+ StreetAddress1: " 535 Mission St, Ste 1401" ,
421+ StreetAddress2: boltgo.String (" c/o Shipping Department" ),
422+ Locality: " San Francisco" ,
423+ PostalCode: " 94105" ,
424+ Region: boltgo.String (" CA" ),
425+ CountryCode: components.CountryCodeUs ,
426+ Email: boltgo.
String (
" [email protected] " ),
427+ Phone: boltgo.String (" +14155550199" ),
402428 },
403429 ),
404430 Network: components.CreditCardNetworkVisa ,
@@ -408,9 +434,7 @@ func main() {
408434 Token: " a1B2c3D4e5F6G7H8i9J0k1L2m3N4o5P6Q7r8S9t0" ,
409435 },
410436 ),
411- }
412- ctx := context.Background ()
413- res , err := s.Payments .Guest .Initialize (ctx, security, xPublishableKey, xMerchantClientID, guestPaymentInitializeRequest)
437+ })
414438 if err != nil {
415439 log.Fatal (err)
416440 }
@@ -444,20 +468,18 @@ import (
444468 " github.com/BoltApp/bolt-go/retry"
445469 " log"
446470 " models/operations"
447- " os"
448471)
449472
450473func main () {
451474 s := boltgo.New (
452475 boltgo.WithSecurity (components.Security {
453- Oauth: boltgo.String (os.Getenv (" OAUTH" )),
476+ Oauth: boltgo.String (" <YOUR_OAUTH_HERE>" ),
477+ APIKey: boltgo.String (" <YOUR_API_KEY_HERE>" ),
454478 }),
455479 )
456- var xPublishableKey string = " <value>"
457480
458- var xMerchantClientID string = " <value>"
459481 ctx := context.Background ()
460- res , err := s.Account .GetDetails (ctx, xPublishableKey, xMerchantClientID , operations.WithRetries (
482+ res , err := s.Account .GetDetails (ctx, " <value> " , " <value> " , operations.WithRetries (
461483 retry.Config {
462484 Strategy: " backoff" ,
463485 Backoff: &retry.BackoffStrategy {
@@ -488,7 +510,6 @@ import (
488510 " github.com/BoltApp/bolt-go/models/components"
489511 " github.com/BoltApp/bolt-go/retry"
490512 " log"
491- " os"
492513)
493514
494515func main () {
@@ -505,14 +526,13 @@ func main() {
505526 RetryConnectionErrors: false ,
506527 }),
507528 boltgo.WithSecurity (components.Security {
508- Oauth: boltgo.String (os.Getenv (" OAUTH" )),
529+ Oauth: boltgo.String (" <YOUR_OAUTH_HERE>" ),
530+ APIKey: boltgo.String (" <YOUR_API_KEY_HERE>" ),
509531 }),
510532 )
511- var xPublishableKey string = " <value>"
512533
513- var xMerchantClientID string = " <value>"
514534 ctx := context.Background ()
515- res , err := s.Account .GetDetails (ctx, xPublishableKey, xMerchantClientID )
535+ res , err := s.Account .GetDetails (ctx, " <value> " , " <value> " )
516536 if err != nil {
517537 log.Fatal (err)
518538 }
0 commit comments