diff --git a/go.mod b/go.mod index cce1b425..9458e727 100644 --- a/go.mod +++ b/go.mod @@ -6,4 +6,5 @@ require ( github.com/EasyPost/easypost-go/v2 v2.20.0 github.com/EasyPost/easypost-go/v3 v3.2.0 github.com/EasyPost/easypost-go/v4 v4.6.0 + github.com/EasyPost/easypost-go/v5 v5.0.0 ) diff --git a/go.sum b/go.sum index 355eff5f..4b4d1bfb 100644 --- a/go.sum +++ b/go.sum @@ -4,6 +4,8 @@ github.com/EasyPost/easypost-go/v3 v3.2.0 h1:dNWmPG1AkpgYFJxhw/zGzCz1JOVXPpNIi8+ github.com/EasyPost/easypost-go/v3 v3.2.0/go.mod h1:WDD0qkjwxedVKFXCcdJBz22rtRHpuxjGazgSVcTfdIw= github.com/EasyPost/easypost-go/v4 v4.6.0 h1:wxMK4wkGEG5vW/4Vdy3rwE9iqww1eQ1xS6oYWUZbhrc= github.com/EasyPost/easypost-go/v4 v4.6.0/go.mod h1:WGoS4tmjHquhooMNmY6RirP+KWeYV/akcf/Jg9Q6fsk= +github.com/EasyPost/easypost-go/v5 v5.0.0 h1:w6Jp4wBD0Desgk4a1kbJpbEMexBYMz9VWPPrFeTdsak= +github.com/EasyPost/easypost-go/v5 v5.0.0/go.mod h1:wUxStg92sBzWO3m2yoFAN7CbZTr25zQeFog48itvfnw= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= @@ -11,8 +13,9 @@ github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= diff --git a/official/docs/csharp/current/billing/create-stripe-bank-account.cs b/official/docs/csharp/current/billing/create-stripe-bank-account-secret.cs similarity index 100% rename from official/docs/csharp/current/billing/create-stripe-bank-account.cs rename to official/docs/csharp/current/billing/create-stripe-bank-account-secret.cs diff --git a/official/docs/csharp/current/billing/create-stripe-credit-card.cs b/official/docs/csharp/current/billing/create-stripe-credit-card-secret.cs similarity index 100% rename from official/docs/csharp/current/billing/create-stripe-credit-card.cs rename to official/docs/csharp/current/billing/create-stripe-credit-card-secret.cs diff --git a/official/docs/curl/current/billing/add-stripe-bank-account.sh b/official/docs/curl/current/billing/add-stripe-bank-account.sh new file mode 100644 index 00000000..0bbc26bb --- /dev/null +++ b/official/docs/curl/current/billing/add-stripe-bank-account.sh @@ -0,0 +1,12 @@ +curl -X POST "https://api.easypost.com/v2/bank_accounts" \ + -u "$REFERRAL_USER_API_KEY:" \ + -H "Content-Type: application/json" \ + -d '{ + "financial_connections_id": "fca_...", + "mandate_data": { + "ip_address": "127.0.0.1", + "user_agent": "Mozilla/5.0", + "accepted_at": 1722510730, + }, + "priority": "primary" + }' diff --git a/official/docs/curl/current/billing/add-stripe-credit-card.sh b/official/docs/curl/current/billing/add-stripe-credit-card.sh new file mode 100644 index 00000000..c67b53f9 --- /dev/null +++ b/official/docs/curl/current/billing/add-stripe-credit-card.sh @@ -0,0 +1,9 @@ +curl -X POST "https://api.easypost.com/v2/credit_cards" \ + -u "$REFERRAL_USER_API_KEY:" \ + -H "Content-Type: application/json" \ + -d '{ + "credit_card": { + "payment_method_id": "pm_...", + "priority": "primary" + } + }' diff --git a/official/docs/curl/current/billing/create-bank-account.sh b/official/docs/curl/current/billing/create-bank-account.sh deleted file mode 100644 index 0fe0c494..00000000 --- a/official/docs/curl/current/billing/create-bank-account.sh +++ /dev/null @@ -1,12 +0,0 @@ -curl -X POST "https://api.easypost.com/v2/bank_accounts" \ - -u "$REFERRAL_USER_API_KEY:" \ - -H "Content-Type: application/json" \ - -d '{ - "financial_connections_id": "fca_...", - "mandate_data": { - "ip_address": "127.0.0.1", - "user_agent": "Mozilla/5.0", - "accepted_at": 1722510730, - }, - "priority": "primary" -}' diff --git a/official/docs/curl/current/billing/create-financial-connections-sessions.sh b/official/docs/curl/current/billing/create-stripe-bank-account-secret.sh similarity index 100% rename from official/docs/curl/current/billing/create-financial-connections-sessions.sh rename to official/docs/curl/current/billing/create-stripe-bank-account-secret.sh diff --git a/official/docs/curl/current/billing/create-setup-intents.sh b/official/docs/curl/current/billing/create-stripe-credit-card-secret.sh similarity index 100% rename from official/docs/curl/current/billing/create-setup-intents.sh rename to official/docs/curl/current/billing/create-stripe-credit-card-secret.sh diff --git a/official/docs/golang/current/addresses/create-and-verify.go b/official/docs/golang/current/addresses/create-and-verify.go index 16d81885..9583405f 100644 --- a/official/docs/golang/current/addresses/create-and-verify.go +++ b/official/docs/golang/current/addresses/create-and-verify.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func createAndVerify() { diff --git a/official/docs/golang/current/addresses/create.go b/official/docs/golang/current/addresses/create.go index 64f50cf1..4cf09f98 100644 --- a/official/docs/golang/current/addresses/create.go +++ b/official/docs/golang/current/addresses/create.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func create() { diff --git a/official/docs/golang/current/addresses/list.go b/official/docs/golang/current/addresses/list.go index 014f28ec..01422118 100644 --- a/official/docs/golang/current/addresses/list.go +++ b/official/docs/golang/current/addresses/list.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func list() { diff --git a/official/docs/golang/current/addresses/retrieve.go b/official/docs/golang/current/addresses/retrieve.go index 2719fbad..0d48d517 100644 --- a/official/docs/golang/current/addresses/retrieve.go +++ b/official/docs/golang/current/addresses/retrieve.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func retrieve() { diff --git a/official/docs/golang/current/addresses/verify-param.go b/official/docs/golang/current/addresses/verify-param.go index 7c66f54d..1abc3a60 100644 --- a/official/docs/golang/current/addresses/verify-param.go +++ b/official/docs/golang/current/addresses/verify-param.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func verifyParam() { @@ -20,7 +20,7 @@ func verifyParam() { Phone: "5555555555", }, &easypost.CreateAddressOptions{ - Verify: []string{"true"}, + Verify: true, }, ) diff --git a/official/docs/golang/current/addresses/verify-strict-param.go b/official/docs/golang/current/addresses/verify-strict-param.go index 9f56655c..e73f712c 100644 --- a/official/docs/golang/current/addresses/verify-strict-param.go +++ b/official/docs/golang/current/addresses/verify-strict-param.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func verifyStrictParam() { @@ -20,7 +20,7 @@ func verifyStrictParam() { Phone: "5555555555", }, &easypost.CreateAddressOptions{ - VerifyStrict: []string{"true"}, + VerifyStrict: true, }, ) diff --git a/official/docs/golang/current/addresses/verify.go b/official/docs/golang/current/addresses/verify.go index dc580a41..08f131f1 100644 --- a/official/docs/golang/current/addresses/verify.go +++ b/official/docs/golang/current/addresses/verify.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func verify() { diff --git a/official/docs/golang/current/api-keys/retrieve.go b/official/docs/golang/current/api-keys/retrieve.go index 9ce4eb99..b606196d 100644 --- a/official/docs/golang/current/api-keys/retrieve.go +++ b/official/docs/golang/current/api-keys/retrieve.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func retrieve() { diff --git a/official/docs/golang/current/batches/add-shipments.go b/official/docs/golang/current/batches/add-shipments.go index 90bbd129..6e56c3d7 100644 --- a/official/docs/golang/current/batches/add-shipments.go +++ b/official/docs/golang/current/batches/add-shipments.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func addShipments() { diff --git a/official/docs/golang/current/batches/buy.go b/official/docs/golang/current/batches/buy.go index d0e9599e..0b40f2d8 100644 --- a/official/docs/golang/current/batches/buy.go +++ b/official/docs/golang/current/batches/buy.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func buy() { diff --git a/official/docs/golang/current/batches/create.go b/official/docs/golang/current/batches/create.go index fd87ac28..837f8293 100644 --- a/official/docs/golang/current/batches/create.go +++ b/official/docs/golang/current/batches/create.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func create() { diff --git a/official/docs/golang/current/batches/label.go b/official/docs/golang/current/batches/label.go index f08a4f9f..de1cdfff 100644 --- a/official/docs/golang/current/batches/label.go +++ b/official/docs/golang/current/batches/label.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func label() { diff --git a/official/docs/golang/current/batches/list.go b/official/docs/golang/current/batches/list.go index 59f3dfa2..babc5d36 100644 --- a/official/docs/golang/current/batches/list.go +++ b/official/docs/golang/current/batches/list.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func list() { diff --git a/official/docs/golang/current/batches/remove-shipments.go b/official/docs/golang/current/batches/remove-shipments.go index 952f50c3..ab02940a 100644 --- a/official/docs/golang/current/batches/remove-shipments.go +++ b/official/docs/golang/current/batches/remove-shipments.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func removeShipments() { diff --git a/official/docs/golang/current/batches/retrieve.go b/official/docs/golang/current/batches/retrieve.go index 6c36de19..2a03f4c5 100644 --- a/official/docs/golang/current/batches/retrieve.go +++ b/official/docs/golang/current/batches/retrieve.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func retrieve() { diff --git a/official/docs/golang/current/batches/scan-forms.go b/official/docs/golang/current/batches/scan-forms.go index eb41a9d6..b1e63638 100644 --- a/official/docs/golang/current/batches/scan-forms.go +++ b/official/docs/golang/current/batches/scan-forms.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func scanForms() { diff --git a/official/docs/golang/current/billing/add-stripe-bank-account.go b/official/docs/golang/current/billing/add-stripe-bank-account.go new file mode 100644 index 00000000..8fbc6fb5 --- /dev/null +++ b/official/docs/golang/current/billing/add-stripe-bank-account.go @@ -0,0 +1,24 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v5" +) + +func addStripeBankAccount() { + client := easypost.New("EASYPOST_API_KEY") + + bankAccount, _ := client.AddReferralCustomerBankAccountFromStripe( + "REFERRAL_USER_API_KEY", + "fca_...", + &easypost.MandateData{ + IpAddress: "127.0.0.1", + UserAgent: "Mozilla/5.0", + AcceptedAt: 1722510730, + }, + easypost.PrimaryPaymentMethodPriority, + ) + + fmt.Println(bankAccount) +} diff --git a/official/docs/golang/current/billing/add-stripe-credit-card.go b/official/docs/golang/current/billing/add-stripe-credit-card.go new file mode 100644 index 00000000..72b8c9fc --- /dev/null +++ b/official/docs/golang/current/billing/add-stripe-credit-card.go @@ -0,0 +1,19 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v5" +) + +func addStripeCreditCard() { + client := easypost.New("EASYPOST_API_KEY") + + creditCard, _ := client.AddReferralCustomerCreditCardFromStripe( + "REFERRAL_USER_API_KEY", + "seti_123", + easypost.PrimaryPaymentMethodPriority, + ) + + fmt.Println(creditCard) +} diff --git a/official/docs/golang/current/billing/create-ep-credit-card.go b/official/docs/golang/current/billing/create-ep-credit-card.go index 1cd27787..1d12c7e6 100644 --- a/official/docs/golang/current/billing/create-ep-credit-card.go +++ b/official/docs/golang/current/billing/create-ep-credit-card.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func createEpCreditCard() { diff --git a/official/docs/golang/current/billing/create-stripe-bank-account-secret.go b/official/docs/golang/current/billing/create-stripe-bank-account-secret.go new file mode 100644 index 00000000..cd255bff --- /dev/null +++ b/official/docs/golang/current/billing/create-stripe-bank-account-secret.go @@ -0,0 +1,15 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v5" +) + +func createStripeBankAccountSecret() { + client := easypost.New("EASYPOST_API_KEY") + + response, _ := client.BetaCreateBankAccountClientSecret() + + fmt.Println(response) +} diff --git a/official/docs/golang/current/billing/create-stripe-credit-card-secret.go b/official/docs/golang/current/billing/create-stripe-credit-card-secret.go new file mode 100644 index 00000000..eb5c7576 --- /dev/null +++ b/official/docs/golang/current/billing/create-stripe-credit-card-secret.go @@ -0,0 +1,15 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v5" +) + +func createStripeCreditCardSecret() { + client := easypost.New("EASYPOST_API_KEY") + + response, _ := client.BetaCreateCreditCardClientSecret() + + fmt.Println(response) +} diff --git a/official/docs/golang/current/billing/delete.go b/official/docs/golang/current/billing/delete.go index 57d9bec0..6e41cdae 100644 --- a/official/docs/golang/current/billing/delete.go +++ b/official/docs/golang/current/billing/delete.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func delete() { diff --git a/official/docs/golang/current/billing/fund.go b/official/docs/golang/current/billing/fund.go index 2434fe1f..8c0b69ba 100644 --- a/official/docs/golang/current/billing/fund.go +++ b/official/docs/golang/current/billing/fund.go @@ -1,7 +1,7 @@ package example import ( - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func fund() { diff --git a/official/docs/golang/current/billing/list.go b/official/docs/golang/current/billing/list.go index b363f016..360515a4 100644 --- a/official/docs/golang/current/billing/list.go +++ b/official/docs/golang/current/billing/list.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func list() { diff --git a/official/docs/golang/current/brand/update.go b/official/docs/golang/current/brand/update.go index 352ebabe..0f2d4ba4 100644 --- a/official/docs/golang/current/brand/update.go +++ b/official/docs/golang/current/brand/update.go @@ -3,17 +3,17 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func brand() { client := easypost.New("EASYPOST_API_KEY") brand, _ := client.UpdateBrand( + "user_...", map[string]interface{}{ "color": "#303F9F", }, - "user_...", ) fmt.Println(brand) diff --git a/official/docs/golang/current/carrier-accounts/create.go b/official/docs/golang/current/carrier-accounts/create.go index e93ac5c9..1e700a7c 100644 --- a/official/docs/golang/current/carrier-accounts/create.go +++ b/official/docs/golang/current/carrier-accounts/create.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func create() { diff --git a/official/docs/golang/current/carrier-accounts/delete.go b/official/docs/golang/current/carrier-accounts/delete.go index 4e375cd9..574ea942 100644 --- a/official/docs/golang/current/carrier-accounts/delete.go +++ b/official/docs/golang/current/carrier-accounts/delete.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func delete() { diff --git a/official/docs/golang/current/carrier-accounts/list.go b/official/docs/golang/current/carrier-accounts/list.go index bb9ca894..ba8d03be 100644 --- a/official/docs/golang/current/carrier-accounts/list.go +++ b/official/docs/golang/current/carrier-accounts/list.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func list() { diff --git a/official/docs/golang/current/carrier-accounts/retrieve.go b/official/docs/golang/current/carrier-accounts/retrieve.go index bafc15a4..87fa083e 100644 --- a/official/docs/golang/current/carrier-accounts/retrieve.go +++ b/official/docs/golang/current/carrier-accounts/retrieve.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func retrieve() { diff --git a/official/docs/golang/current/carrier-accounts/update.go b/official/docs/golang/current/carrier-accounts/update.go index 60e82c1e..3551ed52 100644 --- a/official/docs/golang/current/carrier-accounts/update.go +++ b/official/docs/golang/current/carrier-accounts/update.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func update() { diff --git a/official/docs/golang/current/carrier-metadata/retrieve.go b/official/docs/golang/current/carrier-metadata/retrieve.go index 680ed3c7..87b065d4 100644 --- a/official/docs/golang/current/carrier-metadata/retrieve.go +++ b/official/docs/golang/current/carrier-metadata/retrieve.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func retrieve() { diff --git a/official/docs/golang/current/carrier-types/list.go b/official/docs/golang/current/carrier-types/list.go index 3c8d3502..62c07336 100644 --- a/official/docs/golang/current/carrier-types/list.go +++ b/official/docs/golang/current/carrier-types/list.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func list() { diff --git a/official/docs/golang/current/child-users/create.go b/official/docs/golang/current/child-users/create.go index 1b89c128..6802e446 100644 --- a/official/docs/golang/current/child-users/create.go +++ b/official/docs/golang/current/child-users/create.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func create() { diff --git a/official/docs/golang/current/child-users/delete.go b/official/docs/golang/current/child-users/delete.go index 097b2693..09f9bc16 100644 --- a/official/docs/golang/current/child-users/delete.go +++ b/official/docs/golang/current/child-users/delete.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func delete() { diff --git a/official/docs/golang/current/child-users/list.go b/official/docs/golang/current/child-users/list.go index 4c2cc165..3d10c487 100644 --- a/official/docs/golang/current/child-users/list.go +++ b/official/docs/golang/current/child-users/list.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func list() { diff --git a/official/docs/golang/current/claims/cancel.go b/official/docs/golang/current/claims/cancel.go index 2533f16a..fbb166f5 100644 --- a/official/docs/golang/current/claims/cancel.go +++ b/official/docs/golang/current/claims/cancel.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func cancel() { diff --git a/official/docs/golang/current/claims/create.go b/official/docs/golang/current/claims/create.go index 17419ce7..839ccfc3 100644 --- a/official/docs/golang/current/claims/create.go +++ b/official/docs/golang/current/claims/create.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func create() { diff --git a/official/docs/golang/current/claims/list.go b/official/docs/golang/current/claims/list.go index 794da003..ca62d9f6 100644 --- a/official/docs/golang/current/claims/list.go +++ b/official/docs/golang/current/claims/list.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func list() { diff --git a/official/docs/golang/current/claims/retrieve.go b/official/docs/golang/current/claims/retrieve.go index 2e21dbdd..5857d505 100644 --- a/official/docs/golang/current/claims/retrieve.go +++ b/official/docs/golang/current/claims/retrieve.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func retrieve() { diff --git a/official/docs/golang/current/customs-infos/create.go b/official/docs/golang/current/customs-infos/create.go index d3b7218d..88425245 100644 --- a/official/docs/golang/current/customs-infos/create.go +++ b/official/docs/golang/current/customs-infos/create.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func create() { diff --git a/official/docs/golang/current/customs-infos/retrieve.go b/official/docs/golang/current/customs-infos/retrieve.go index 36375fa6..7999f1fb 100644 --- a/official/docs/golang/current/customs-infos/retrieve.go +++ b/official/docs/golang/current/customs-infos/retrieve.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func retrieve() { diff --git a/official/docs/golang/current/customs-items/create.go b/official/docs/golang/current/customs-items/create.go index fed3b8a7..c453fbee 100644 --- a/official/docs/golang/current/customs-items/create.go +++ b/official/docs/golang/current/customs-items/create.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func create() { diff --git a/official/docs/golang/current/customs-items/retrieve.go b/official/docs/golang/current/customs-items/retrieve.go index b26b56ac..b602d2dc 100644 --- a/official/docs/golang/current/customs-items/retrieve.go +++ b/official/docs/golang/current/customs-items/retrieve.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func retrieve() { diff --git a/official/docs/golang/current/endshipper/buy.go b/official/docs/golang/current/endshipper/buy.go index f9ac6ff2..0a50db9d 100644 --- a/official/docs/golang/current/endshipper/buy.go +++ b/official/docs/golang/current/endshipper/buy.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func buy() { diff --git a/official/docs/golang/current/endshipper/create.go b/official/docs/golang/current/endshipper/create.go index b44e47fa..b425f580 100644 --- a/official/docs/golang/current/endshipper/create.go +++ b/official/docs/golang/current/endshipper/create.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func create() { diff --git a/official/docs/golang/current/endshipper/list.go b/official/docs/golang/current/endshipper/list.go index 6f3ca78a..4b55b031 100644 --- a/official/docs/golang/current/endshipper/list.go +++ b/official/docs/golang/current/endshipper/list.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func list() { diff --git a/official/docs/golang/current/endshipper/retrieve.go b/official/docs/golang/current/endshipper/retrieve.go index c3b1c57a..e1e6c039 100644 --- a/official/docs/golang/current/endshipper/retrieve.go +++ b/official/docs/golang/current/endshipper/retrieve.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func retrieve() { diff --git a/official/docs/golang/current/endshipper/update.go b/official/docs/golang/current/endshipper/update.go index b28a6d29..6ed8f49e 100644 --- a/official/docs/golang/current/endshipper/update.go +++ b/official/docs/golang/current/endshipper/update.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func update() { diff --git a/official/docs/golang/current/events/list.go b/official/docs/golang/current/events/list.go index 13ff840f..11a2b080 100644 --- a/official/docs/golang/current/events/list.go +++ b/official/docs/golang/current/events/list.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func list() { diff --git a/official/docs/golang/current/events/retrieve.go b/official/docs/golang/current/events/retrieve.go index 4e39fc91..a72c3389 100644 --- a/official/docs/golang/current/events/retrieve.go +++ b/official/docs/golang/current/events/retrieve.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func retrieve() { diff --git a/official/docs/golang/current/forms/create.go b/official/docs/golang/current/forms/create.go index 10a29032..11d0bfc7 100644 --- a/official/docs/golang/current/forms/create.go +++ b/official/docs/golang/current/forms/create.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func create() { diff --git a/official/docs/golang/current/insurance/create.go b/official/docs/golang/current/insurance/create.go index 54dec3e6..193c59ab 100644 --- a/official/docs/golang/current/insurance/create.go +++ b/official/docs/golang/current/insurance/create.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func create() { diff --git a/official/docs/golang/current/insurance/list.go b/official/docs/golang/current/insurance/list.go index f89668d5..9f03c51e 100644 --- a/official/docs/golang/current/insurance/list.go +++ b/official/docs/golang/current/insurance/list.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func list() { diff --git a/official/docs/golang/current/insurance/refund.go b/official/docs/golang/current/insurance/refund.go index 0dd9ab02..580260f9 100644 --- a/official/docs/golang/current/insurance/refund.go +++ b/official/docs/golang/current/insurance/refund.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func refund() { diff --git a/official/docs/golang/current/insurance/retrieve.go b/official/docs/golang/current/insurance/retrieve.go index 4c94509d..d3e2fa89 100644 --- a/official/docs/golang/current/insurance/retrieve.go +++ b/official/docs/golang/current/insurance/retrieve.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func retrieve() { diff --git a/official/docs/golang/current/options/create-with-options.go b/official/docs/golang/current/options/create-with-options.go index 4e465249..f4fb736c 100644 --- a/official/docs/golang/current/options/create-with-options.go +++ b/official/docs/golang/current/options/create-with-options.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func createWithOptions() { diff --git a/official/docs/golang/current/orders/buy.go b/official/docs/golang/current/orders/buy.go index f2ccc724..91c87e7b 100644 --- a/official/docs/golang/current/orders/buy.go +++ b/official/docs/golang/current/orders/buy.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func buy() { diff --git a/official/docs/golang/current/orders/create.go b/official/docs/golang/current/orders/create.go index 4309ec7b..06bf57de 100644 --- a/official/docs/golang/current/orders/create.go +++ b/official/docs/golang/current/orders/create.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func create() { diff --git a/official/docs/golang/current/orders/one-call-buy.go b/official/docs/golang/current/orders/one-call-buy.go index b4f2ac60..39487231 100644 --- a/official/docs/golang/current/orders/one-call-buy.go +++ b/official/docs/golang/current/orders/one-call-buy.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func oneCallBuy() { diff --git a/official/docs/golang/current/orders/retrieve.go b/official/docs/golang/current/orders/retrieve.go index 8a3ee172..4272af9a 100644 --- a/official/docs/golang/current/orders/retrieve.go +++ b/official/docs/golang/current/orders/retrieve.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func retrieve() { diff --git a/official/docs/golang/current/pagination/get-next-page.go b/official/docs/golang/current/pagination/get-next-page.go index 08171bce..a70d3d6e 100644 --- a/official/docs/golang/current/pagination/get-next-page.go +++ b/official/docs/golang/current/pagination/get-next-page.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func getNextPage() { diff --git a/official/docs/golang/current/parcels/create.go b/official/docs/golang/current/parcels/create.go index 3b8a79b1..6eb31d04 100644 --- a/official/docs/golang/current/parcels/create.go +++ b/official/docs/golang/current/parcels/create.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func create() { diff --git a/official/docs/golang/current/parcels/retrieve.go b/official/docs/golang/current/parcels/retrieve.go index 142f7596..6aba21d0 100644 --- a/official/docs/golang/current/parcels/retrieve.go +++ b/official/docs/golang/current/parcels/retrieve.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func retrieve() { diff --git a/official/docs/golang/current/payloads/list.go b/official/docs/golang/current/payloads/list.go index 0ff1ad4c..ee51bae5 100644 --- a/official/docs/golang/current/payloads/list.go +++ b/official/docs/golang/current/payloads/list.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func list() { diff --git a/official/docs/golang/current/payloads/retrieve.go b/official/docs/golang/current/payloads/retrieve.go index 6511c26d..fe5ec08b 100644 --- a/official/docs/golang/current/payloads/retrieve.go +++ b/official/docs/golang/current/payloads/retrieve.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func retrieve() { diff --git a/official/docs/golang/current/pickups/buy.go b/official/docs/golang/current/pickups/buy.go index 8b34873e..a81bab59 100644 --- a/official/docs/golang/current/pickups/buy.go +++ b/official/docs/golang/current/pickups/buy.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func buy() { diff --git a/official/docs/golang/current/pickups/cancel.go b/official/docs/golang/current/pickups/cancel.go index b1b18b04..2fc648e6 100644 --- a/official/docs/golang/current/pickups/cancel.go +++ b/official/docs/golang/current/pickups/cancel.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func cancel() { diff --git a/official/docs/golang/current/pickups/create.go b/official/docs/golang/current/pickups/create.go index 6d68630a..8057a561 100644 --- a/official/docs/golang/current/pickups/create.go +++ b/official/docs/golang/current/pickups/create.go @@ -4,7 +4,7 @@ import ( "fmt" "time" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func create() { diff --git a/official/docs/golang/current/pickups/list.go b/official/docs/golang/current/pickups/list.go index fe10aae3..b36a07b6 100644 --- a/official/docs/golang/current/pickups/list.go +++ b/official/docs/golang/current/pickups/list.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func list() { diff --git a/official/docs/golang/current/pickups/retrieve.go b/official/docs/golang/current/pickups/retrieve.go index a00426f7..92152e16 100644 --- a/official/docs/golang/current/pickups/retrieve.go +++ b/official/docs/golang/current/pickups/retrieve.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func retrieve() { diff --git a/official/docs/golang/current/rates/regenerate.go b/official/docs/golang/current/rates/regenerate.go index 7810d1b0..9983efcc 100644 --- a/official/docs/golang/current/rates/regenerate.go +++ b/official/docs/golang/current/rates/regenerate.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func regenerate() { diff --git a/official/docs/golang/current/rates/retrieve-stateless.go b/official/docs/golang/current/rates/retrieve-stateless.go index a25ff541..13b538f3 100644 --- a/official/docs/golang/current/rates/retrieve-stateless.go +++ b/official/docs/golang/current/rates/retrieve-stateless.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func retrieveStateless() { diff --git a/official/docs/golang/current/rates/retrieve.go b/official/docs/golang/current/rates/retrieve.go index e5a0aec3..da64d645 100644 --- a/official/docs/golang/current/rates/retrieve.go +++ b/official/docs/golang/current/rates/retrieve.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func retrieve() { diff --git a/official/docs/golang/current/referral-customers/add-payment-method-with-bank-account.go b/official/docs/golang/current/referral-customers/add-payment-method-with-bank-account.go index 0ec1520a..3909404a 100644 --- a/official/docs/golang/current/referral-customers/add-payment-method-with-bank-account.go +++ b/official/docs/golang/current/referral-customers/add-payment-method-with-bank-account.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func addPaymentMethodWithBankAccount() { diff --git a/official/docs/golang/current/referral-customers/add-payment-method-with-credit-card.go b/official/docs/golang/current/referral-customers/add-payment-method-with-credit-card.go index 26417bf7..9c179354 100644 --- a/official/docs/golang/current/referral-customers/add-payment-method-with-credit-card.go +++ b/official/docs/golang/current/referral-customers/add-payment-method-with-credit-card.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func addPaymentMethodWithCreditCard() { diff --git a/official/docs/golang/current/referral-customers/create.go b/official/docs/golang/current/referral-customers/create.go index bd11fb2d..c26e5781 100644 --- a/official/docs/golang/current/referral-customers/create.go +++ b/official/docs/golang/current/referral-customers/create.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func create() { diff --git a/official/docs/golang/current/referral-customers/list.go b/official/docs/golang/current/referral-customers/list.go index e8a68979..56fc667f 100644 --- a/official/docs/golang/current/referral-customers/list.go +++ b/official/docs/golang/current/referral-customers/list.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func list() { diff --git a/official/docs/golang/current/referral-customers/refund-by-amount.go b/official/docs/golang/current/referral-customers/refund-by-amount.go index 1067c01b..4dd62e5b 100644 --- a/official/docs/golang/current/referral-customers/refund-by-amount.go +++ b/official/docs/golang/current/referral-customers/refund-by-amount.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func refundByAmount() { diff --git a/official/docs/golang/current/referral-customers/refund-by-payment-log.go b/official/docs/golang/current/referral-customers/refund-by-payment-log.go index ef20fd40..80435b73 100644 --- a/official/docs/golang/current/referral-customers/refund-by-payment-log.go +++ b/official/docs/golang/current/referral-customers/refund-by-payment-log.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func refundByPaymentLog() { diff --git a/official/docs/golang/current/referral-customers/update.go b/official/docs/golang/current/referral-customers/update.go index 1db80c5e..a6c04f43 100644 --- a/official/docs/golang/current/referral-customers/update.go +++ b/official/docs/golang/current/referral-customers/update.go @@ -1,7 +1,7 @@ package example import ( - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func update() { diff --git a/official/docs/golang/current/refunds/create.go b/official/docs/golang/current/refunds/create.go index abc14209..0fc45bae 100644 --- a/official/docs/golang/current/refunds/create.go +++ b/official/docs/golang/current/refunds/create.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func create() { diff --git a/official/docs/golang/current/refunds/list.go b/official/docs/golang/current/refunds/list.go index 955a32be..087d9a74 100644 --- a/official/docs/golang/current/refunds/list.go +++ b/official/docs/golang/current/refunds/list.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func list() { diff --git a/official/docs/golang/current/refunds/retrieve.go b/official/docs/golang/current/refunds/retrieve.go index 4791e397..2e71642e 100644 --- a/official/docs/golang/current/refunds/retrieve.go +++ b/official/docs/golang/current/refunds/retrieve.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func retrieve() { diff --git a/official/docs/golang/current/reports/create.go b/official/docs/golang/current/reports/create.go index 17560199..8d622d32 100644 --- a/official/docs/golang/current/reports/create.go +++ b/official/docs/golang/current/reports/create.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func create() { diff --git a/official/docs/golang/current/reports/list.go b/official/docs/golang/current/reports/list.go index 771d3e6b..5213e1e5 100644 --- a/official/docs/golang/current/reports/list.go +++ b/official/docs/golang/current/reports/list.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func list() { diff --git a/official/docs/golang/current/reports/retrieve.go b/official/docs/golang/current/reports/retrieve.go index a4bc568b..3aadb599 100644 --- a/official/docs/golang/current/reports/retrieve.go +++ b/official/docs/golang/current/reports/retrieve.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func retrieve() { diff --git a/official/docs/golang/current/returns/create.go b/official/docs/golang/current/returns/create.go index 1d2f2b56..28012c9a 100644 --- a/official/docs/golang/current/returns/create.go +++ b/official/docs/golang/current/returns/create.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func create() { diff --git a/official/docs/golang/current/scan-form/create.go b/official/docs/golang/current/scan-form/create.go index 1c3b7420..9729892b 100644 --- a/official/docs/golang/current/scan-form/create.go +++ b/official/docs/golang/current/scan-form/create.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func create() { diff --git a/official/docs/golang/current/scan-form/list.go b/official/docs/golang/current/scan-form/list.go index ca6cbda9..5d506c0a 100644 --- a/official/docs/golang/current/scan-form/list.go +++ b/official/docs/golang/current/scan-form/list.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func list() { diff --git a/official/docs/golang/current/scan-form/retrieve.go b/official/docs/golang/current/scan-form/retrieve.go index 573881f4..235c1759 100644 --- a/official/docs/golang/current/scan-form/retrieve.go +++ b/official/docs/golang/current/scan-form/retrieve.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func retrieve() { diff --git a/official/docs/golang/current/shipments/buy.go b/official/docs/golang/current/shipments/buy.go index 30502771..a45b0b62 100644 --- a/official/docs/golang/current/shipments/buy.go +++ b/official/docs/golang/current/shipments/buy.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func buy() { diff --git a/official/docs/golang/current/shipments/create.go b/official/docs/golang/current/shipments/create.go index c7f90d40..0d204bee 100644 --- a/official/docs/golang/current/shipments/create.go +++ b/official/docs/golang/current/shipments/create.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func create() { diff --git a/official/docs/golang/current/shipments/label.go b/official/docs/golang/current/shipments/label.go index d7e7c423..37bb84bd 100644 --- a/official/docs/golang/current/shipments/label.go +++ b/official/docs/golang/current/shipments/label.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func label() { diff --git a/official/docs/golang/current/shipments/list.go b/official/docs/golang/current/shipments/list.go index 42b42be8..572693a5 100644 --- a/official/docs/golang/current/shipments/list.go +++ b/official/docs/golang/current/shipments/list.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func list() { diff --git a/official/docs/golang/current/shipments/one-call-buy.go b/official/docs/golang/current/shipments/one-call-buy.go index 835fb10d..f380bf93 100644 --- a/official/docs/golang/current/shipments/one-call-buy.go +++ b/official/docs/golang/current/shipments/one-call-buy.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func oneCallBuy() { diff --git a/official/docs/golang/current/shipments/retrieve.go b/official/docs/golang/current/shipments/retrieve.go index 443c1186..5e93a62b 100644 --- a/official/docs/golang/current/shipments/retrieve.go +++ b/official/docs/golang/current/shipments/retrieve.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func retrieve() { diff --git a/official/docs/golang/current/shipping-insurance/insure.go b/official/docs/golang/current/shipping-insurance/insure.go index 23901090..50876947 100644 --- a/official/docs/golang/current/shipping-insurance/insure.go +++ b/official/docs/golang/current/shipping-insurance/insure.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func insure() { diff --git a/official/docs/golang/current/shipping-refund/refund.go b/official/docs/golang/current/shipping-refund/refund.go index 7a3f5024..f931fb3b 100644 --- a/official/docs/golang/current/shipping-refund/refund.go +++ b/official/docs/golang/current/shipping-refund/refund.go @@ -3,7 +3,7 @@ package shipping_refund import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func refund() { diff --git a/official/docs/golang/current/smartrate/retrieve-estimated-delivery-date.go b/official/docs/golang/current/smartrate/retrieve-estimated-delivery-date.go index 2ab8a35a..7fdb4f3e 100644 --- a/official/docs/golang/current/smartrate/retrieve-estimated-delivery-date.go +++ b/official/docs/golang/current/smartrate/retrieve-estimated-delivery-date.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func retrieveEstimatedDeliveryDate() { diff --git a/official/docs/golang/current/smartrate/retrieve-recommend-ship-date.go b/official/docs/golang/current/smartrate/retrieve-recommend-ship-date.go index 600d0823..b56764d1 100644 --- a/official/docs/golang/current/smartrate/retrieve-recommend-ship-date.go +++ b/official/docs/golang/current/smartrate/retrieve-recommend-ship-date.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func retrieveRecommendShipDate() { diff --git a/official/docs/golang/current/smartrate/retrieve-standalone-smartrate-deliver-by.go b/official/docs/golang/current/smartrate/retrieve-standalone-smartrate-deliver-by.go index 2ebf5fc0..63970b4b 100644 --- a/official/docs/golang/current/smartrate/retrieve-standalone-smartrate-deliver-by.go +++ b/official/docs/golang/current/smartrate/retrieve-standalone-smartrate-deliver-by.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func retrieveStandaloneSmartrateDeliverBy() { diff --git a/official/docs/golang/current/smartrate/retrieve-standalone-smartrate-deliver-on.go b/official/docs/golang/current/smartrate/retrieve-standalone-smartrate-deliver-on.go index f457d2fd..1a61fd07 100644 --- a/official/docs/golang/current/smartrate/retrieve-standalone-smartrate-deliver-on.go +++ b/official/docs/golang/current/smartrate/retrieve-standalone-smartrate-deliver-on.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func retrieveStandaloneSmartrateDeliverOn() { diff --git a/official/docs/golang/current/smartrate/retrieve-time-in-transit-statistics.go b/official/docs/golang/current/smartrate/retrieve-time-in-transit-statistics.go index fc2ec4d4..36a24129 100644 --- a/official/docs/golang/current/smartrate/retrieve-time-in-transit-statistics.go +++ b/official/docs/golang/current/smartrate/retrieve-time-in-transit-statistics.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func retrieveTimeInTransitStatistics() { diff --git a/official/docs/golang/current/tax-identifiers/create.go b/official/docs/golang/current/tax-identifiers/create.go index 516798ef..227034f8 100644 --- a/official/docs/golang/current/tax-identifiers/create.go +++ b/official/docs/golang/current/tax-identifiers/create.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func create() { diff --git a/official/docs/golang/current/trackers/create.go b/official/docs/golang/current/trackers/create.go index 08289f5d..576fc281 100644 --- a/official/docs/golang/current/trackers/create.go +++ b/official/docs/golang/current/trackers/create.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func create() { diff --git a/official/docs/golang/current/trackers/list.go b/official/docs/golang/current/trackers/list.go index a5cddde4..e91210a3 100644 --- a/official/docs/golang/current/trackers/list.go +++ b/official/docs/golang/current/trackers/list.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func list() { diff --git a/official/docs/golang/current/trackers/retrieve.go b/official/docs/golang/current/trackers/retrieve.go index 2a471d7c..11ada963 100644 --- a/official/docs/golang/current/trackers/retrieve.go +++ b/official/docs/golang/current/trackers/retrieve.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func retrieve() { diff --git a/official/docs/golang/current/users/retrieve.go b/official/docs/golang/current/users/retrieve.go index 2eac9d9b..22906448 100644 --- a/official/docs/golang/current/users/retrieve.go +++ b/official/docs/golang/current/users/retrieve.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func retrieve() { diff --git a/official/docs/golang/current/users/update.go b/official/docs/golang/current/users/update.go index 1032cac2..5482a2c2 100644 --- a/official/docs/golang/current/users/update.go +++ b/official/docs/golang/current/users/update.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func update() { diff --git a/official/docs/golang/current/webhooks/create.go b/official/docs/golang/current/webhooks/create.go index 95704911..9bfed609 100644 --- a/official/docs/golang/current/webhooks/create.go +++ b/official/docs/golang/current/webhooks/create.go @@ -3,16 +3,22 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func create() { client := easypost.New("EASYPOST_API_KEY") - webhook, _ := client.CreateWebhookWithDetails( + webhook, _ := client.CreateWebhook( &easypost.CreateUpdateWebhookOptions{ URL: "example.com", WebhookSecret: "A1B2C3", + CustomHeaders: []easypost.WebhookCustomHeader{ + { + Name: "X-Header-Name", + Value: "header_value", + }, + }, }, ) diff --git a/official/docs/golang/current/webhooks/delete.go b/official/docs/golang/current/webhooks/delete.go index f6b66156..f83e608b 100644 --- a/official/docs/golang/current/webhooks/delete.go +++ b/official/docs/golang/current/webhooks/delete.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func delete() { diff --git a/official/docs/golang/current/webhooks/list.go b/official/docs/golang/current/webhooks/list.go index fd11b526..993ce5f1 100644 --- a/official/docs/golang/current/webhooks/list.go +++ b/official/docs/golang/current/webhooks/list.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func list() { diff --git a/official/docs/golang/current/webhooks/retrieve.go b/official/docs/golang/current/webhooks/retrieve.go index bfa5880a..ebbcbb72 100644 --- a/official/docs/golang/current/webhooks/retrieve.go +++ b/official/docs/golang/current/webhooks/retrieve.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func retrieve() { diff --git a/official/docs/golang/current/webhooks/update.go b/official/docs/golang/current/webhooks/update.go index 5aadad6b..f750ced7 100644 --- a/official/docs/golang/current/webhooks/update.go +++ b/official/docs/golang/current/webhooks/update.go @@ -3,7 +3,7 @@ package example import ( "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func update() { @@ -11,7 +11,15 @@ func update() { webhook, _ := client.UpdateWebhook( "hook_...", - &easypost.CreateUpdateWebhookOptions{}, + &easypost.CreateUpdateWebhookOptions{ + WebhookSecret: "A1B2C3", + CustomHeaders: []easypost.WebhookCustomHeader{ + { + Name: "X-Header-Name", + Value: "header_value", + }, + }, + }, ) fmt.Println(webhook) diff --git a/official/docs/golang/v4/addresses/create-and-verify.go b/official/docs/golang/v4/addresses/create-and-verify.go new file mode 100644 index 00000000..16d81885 --- /dev/null +++ b/official/docs/golang/v4/addresses/create-and-verify.go @@ -0,0 +1,26 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func createAndVerify() { + client := easypost.New("EASYPOST_API_KEY") + + address, _ := client.CreateAndVerifyAddress( + &easypost.Address{ + Street1: "000 unknown street", + City: "Not A City", + State: "ZZ", + Zip: "00001", + Country: "US", + Email: "test@example.com", + Phone: "5555555555", + }, + &easypost.CreateAddressOptions{}, + ) + + fmt.Println(address) +} diff --git a/official/docs/golang/v4/addresses/create.go b/official/docs/golang/v4/addresses/create.go new file mode 100644 index 00000000..64f50cf1 --- /dev/null +++ b/official/docs/golang/v4/addresses/create.go @@ -0,0 +1,27 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func create() { + client := easypost.New("EASYPOST_API_KEY") + + address, _ := client.CreateAddress( + &easypost.Address{ + Street1: "417 MONTGOMERY ST", + Street2: "FLOOR 5", + City: "SAN FRANCISCO", + State: "CA", + Zip: "94104", + Country: "US", + Company: "EasyPost", + Phone: "415-123-4567", + }, + &easypost.CreateAddressOptions{}, + ) + + fmt.Println(address) +} diff --git a/official/docs/golang/v4/addresses/list.go b/official/docs/golang/v4/addresses/list.go new file mode 100644 index 00000000..014f28ec --- /dev/null +++ b/official/docs/golang/v4/addresses/list.go @@ -0,0 +1,19 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func list() { + client := easypost.New("EASYPOST_API_KEY") + + addresses, _ := client.ListAddresses( + &easypost.ListOptions{ + PageSize: 5, + }, + ) + + fmt.Println(addresses) +} diff --git a/official/docs/golang/v4/addresses/retrieve.go b/official/docs/golang/v4/addresses/retrieve.go new file mode 100644 index 00000000..2719fbad --- /dev/null +++ b/official/docs/golang/v4/addresses/retrieve.go @@ -0,0 +1,15 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func retrieve() { + client := easypost.New("EASYPOST_API_KEY") + + address, _ := client.GetAddress("adr_...") + + fmt.Println(address) +} diff --git a/official/docs/golang/v4/addresses/verify-param.go b/official/docs/golang/v4/addresses/verify-param.go new file mode 100644 index 00000000..7c66f54d --- /dev/null +++ b/official/docs/golang/v4/addresses/verify-param.go @@ -0,0 +1,28 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func verifyParam() { + client := easypost.New("EASYPOST_API_KEY") + + address, _ := client.CreateAddress( + &easypost.Address{ + Street1: "000 unknown street", + City: "Not A City", + State: "ZZ", + Zip: "00001", + Country: "US", + Email: "test@example.com", + Phone: "5555555555", + }, + &easypost.CreateAddressOptions{ + Verify: []string{"true"}, + }, + ) + + fmt.Println(address) +} diff --git a/official/docs/golang/v4/addresses/verify-strict-param.go b/official/docs/golang/v4/addresses/verify-strict-param.go new file mode 100644 index 00000000..9f56655c --- /dev/null +++ b/official/docs/golang/v4/addresses/verify-strict-param.go @@ -0,0 +1,28 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func verifyStrictParam() { + client := easypost.New("EASYPOST_API_KEY") + + address, _ := client.CreateAddress( + &easypost.Address{ + Street1: "000 unknown street", + City: "Not A City", + State: "ZZ", + Zip: "00001", + Country: "US", + Email: "test@example.com", + Phone: "5555555555", + }, + &easypost.CreateAddressOptions{ + VerifyStrict: []string{"true"}, + }, + ) + + fmt.Println(address) +} diff --git a/official/docs/golang/v4/addresses/verify.go b/official/docs/golang/v4/addresses/verify.go new file mode 100644 index 00000000..dc580a41 --- /dev/null +++ b/official/docs/golang/v4/addresses/verify.go @@ -0,0 +1,15 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func verify() { + client := easypost.New("EASYPOST_API_KEY") + + address, _ := client.VerifyAddress("adr_...") + + fmt.Println(address) +} diff --git a/official/docs/golang/v4/api-keys/retrieve.go b/official/docs/golang/v4/api-keys/retrieve.go new file mode 100644 index 00000000..9ce4eb99 --- /dev/null +++ b/official/docs/golang/v4/api-keys/retrieve.go @@ -0,0 +1,21 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func retrieve() { + client := easypost.New("EASYPOST_API_KEY") + + // Retrieve all API keys including children + apiKeys, _ := client.GetAPIKeys() + + fmt.Println(apiKeys) + + // Retrieve API keys for a specific child user + childApiKeys, _ := client.GetAPIKeysForUser("user_...") + + fmt.Println(childApiKeys) +} diff --git a/official/docs/golang/v4/batches/add-shipments.go b/official/docs/golang/v4/batches/add-shipments.go new file mode 100644 index 00000000..90bbd129 --- /dev/null +++ b/official/docs/golang/v4/batches/add-shipments.go @@ -0,0 +1,17 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func addShipments() { + client := easypost.New("EASYPOST_API_KEY") + + shipment, _ := client.GetShipment("shp_...") + + batch, _ := client.AddShipmentsToBatch("batch_...", shipment) + + fmt.Println(batch) +} diff --git a/official/docs/golang/v4/batches/buy.go b/official/docs/golang/v4/batches/buy.go new file mode 100644 index 00000000..d0e9599e --- /dev/null +++ b/official/docs/golang/v4/batches/buy.go @@ -0,0 +1,32 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func buy() { + client := easypost.New("EASYPOST_API_KEY") + + createdBatch, _ := client.CreateBatch( + &easypost.Shipment{ + FromAddress: &easypost.Address{ + ID: "adr_...", + }, + ToAddress: &easypost.Address{ + ID: "adr_...", + }, + Parcel: &easypost.Parcel{ + ID: "prcl_...", + }, + Service: "First", + Carrier: "USPS", + CarrierAccountIDs: []string{"ca_..."}, + }, + ) + + batch, _ := client.BuyBatch(createdBatch.ID) + + fmt.Println(batch) +} diff --git a/official/docs/golang/v4/batches/create.go b/official/docs/golang/v4/batches/create.go new file mode 100644 index 00000000..fd87ac28 --- /dev/null +++ b/official/docs/golang/v4/batches/create.go @@ -0,0 +1,17 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func create() { + client := easypost.New("EASYPOST_API_KEY") + + shipment, _ := client.GetShipment("shp_...") + + batch, _ := client.CreateBatch(shipment) + + fmt.Println(batch) +} diff --git a/official/docs/golang/v4/batches/label.go b/official/docs/golang/v4/batches/label.go new file mode 100644 index 00000000..f08a4f9f --- /dev/null +++ b/official/docs/golang/v4/batches/label.go @@ -0,0 +1,15 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func label() { + client := easypost.New("EASYPOST_API_KEY") + + batch, _ := client.GetBatchLabels("batch_...", "PDF") + + fmt.Println(batch) +} diff --git a/official/docs/golang/v4/batches/list.go b/official/docs/golang/v4/batches/list.go new file mode 100644 index 00000000..59f3dfa2 --- /dev/null +++ b/official/docs/golang/v4/batches/list.go @@ -0,0 +1,19 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func list() { + client := easypost.New("EASYPOST_API_KEY") + + batches, _ := client.ListBatches( + &easypost.ListOptions{ + PageSize: 5, + }, + ) + + fmt.Println(batches) +} diff --git a/official/docs/golang/v4/batches/remove-shipments.go b/official/docs/golang/v4/batches/remove-shipments.go new file mode 100644 index 00000000..952f50c3 --- /dev/null +++ b/official/docs/golang/v4/batches/remove-shipments.go @@ -0,0 +1,17 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func removeShipments() { + client := easypost.New("EASYPOST_API_KEY") + + shipment, _ := client.GetShipment("shp_...") + + batch, _ := client.RemoveShipmentsFromBatch("batch_...", shipment) + + fmt.Println(batch) +} diff --git a/official/docs/golang/v4/batches/retrieve.go b/official/docs/golang/v4/batches/retrieve.go new file mode 100644 index 00000000..6c36de19 --- /dev/null +++ b/official/docs/golang/v4/batches/retrieve.go @@ -0,0 +1,15 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func retrieve() { + client := easypost.New("EASYPOST_API_KEY") + + batch, _ := client.GetBatch("batch_...") + + fmt.Println(batch) +} diff --git a/official/docs/golang/v4/batches/scan-forms.go b/official/docs/golang/v4/batches/scan-forms.go new file mode 100644 index 00000000..eb41a9d6 --- /dev/null +++ b/official/docs/golang/v4/batches/scan-forms.go @@ -0,0 +1,15 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func scanForms() { + client := easypost.New("EASYPOST_API_KEY") + + batch, _ := client.CreateBatchScanForms("batch_...", "pdf") + + fmt.Println(batch) +} diff --git a/official/docs/golang/v4/billing/create-ep-credit-card.go b/official/docs/golang/v4/billing/create-ep-credit-card.go new file mode 100644 index 00000000..1cd27787 --- /dev/null +++ b/official/docs/golang/v4/billing/create-ep-credit-card.go @@ -0,0 +1,20 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func createEpCreditCard() { + client := easypost.New("EASYPOST_API_KEY") + + creditCard, _ := client.AddReferralCustomerCreditCard("REFERRAL_USER_API_KEY", &easypost.CreditCardOptions{ + Number: "0123456789101234", + ExpMonth: "01", + ExpYear: "2025", + Cvc: "111", + }, easypost.PrimaryPaymentMethodPriority) + + fmt.Println(creditCard) +} diff --git a/official/docs/golang/v4/billing/delete.go b/official/docs/golang/v4/billing/delete.go new file mode 100644 index 00000000..57d9bec0 --- /dev/null +++ b/official/docs/golang/v4/billing/delete.go @@ -0,0 +1,15 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func delete() { + client := easypost.New("EASYPOST_API_KEY") + + err := client.DeletePaymentMethod(easypost.PrimaryPaymentMethodPriority) + + fmt.Println(err) +} diff --git a/official/docs/golang/v4/billing/fund.go b/official/docs/golang/v4/billing/fund.go new file mode 100644 index 00000000..2434fe1f --- /dev/null +++ b/official/docs/golang/v4/billing/fund.go @@ -0,0 +1,11 @@ +package example + +import ( + "github.com/EasyPost/easypost-go/v4" +) + +func fund() { + client := easypost.New("EASYPOST_API_KEY") + + _ = client.FundWallet("2000", easypost.PrimaryPaymentMethodPriority) +} diff --git a/official/docs/golang/v4/billing/list.go b/official/docs/golang/v4/billing/list.go new file mode 100644 index 00000000..b363f016 --- /dev/null +++ b/official/docs/golang/v4/billing/list.go @@ -0,0 +1,15 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func list() { + client := easypost.New("EASYPOST_API_KEY") + + paymentMethods, _ := client.RetrievePaymentMethods() + + fmt.Println(paymentMethods) +} diff --git a/official/docs/golang/v4/brand/update.go b/official/docs/golang/v4/brand/update.go new file mode 100644 index 00000000..352ebabe --- /dev/null +++ b/official/docs/golang/v4/brand/update.go @@ -0,0 +1,20 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func brand() { + client := easypost.New("EASYPOST_API_KEY") + + brand, _ := client.UpdateBrand( + map[string]interface{}{ + "color": "#303F9F", + }, + "user_...", + ) + + fmt.Println(brand) +} diff --git a/official/docs/golang/v4/carrier-accounts/create.go b/official/docs/golang/v4/carrier-accounts/create.go new file mode 100644 index 00000000..e93ac5c9 --- /dev/null +++ b/official/docs/golang/v4/carrier-accounts/create.go @@ -0,0 +1,43 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func create() { + client := easypost.New("EASYPOST_API_KEY") + + carrierAccount, _ := client.CreateCarrierAccount( + &easypost.CarrierAccount{ + Type: "DhlEcsAccount", + Description: "CA Location DHL eCommerce Solutions Account", + Credentials: map[string]string{ + "client_id": "123456", + "client_secret": "123abc", + "distribution_center": "USLAX1", + "pickup_id": "123456", + }, + TestCredentials: map[string]string{ + "client_id": "123456", + "client_secret": "123abc", + "distribution_center": "USLAX1", + "pickup_id": "123456", + }, + }, + ) + + fmt.Println(carrierAccount) + + // For UPS account creation, please use below method instead + + createUpsParameters := &easypost.UpsCarrierAccountCreationParameters{ + AccountNumber: "123456789", + Type: "UpsAccount", + } + + carrierAccount, _ = client.CreateUpsCarrierAccount(createUpsParameters) + + fmt.Println(carrierAccount) +} diff --git a/official/docs/golang/v4/carrier-accounts/delete.go b/official/docs/golang/v4/carrier-accounts/delete.go new file mode 100644 index 00000000..4e375cd9 --- /dev/null +++ b/official/docs/golang/v4/carrier-accounts/delete.go @@ -0,0 +1,15 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func delete() { + client := easypost.New("EASYPOST_API_KEY") + + err := client.DeleteCarrierAccount("ca_...") + + fmt.Println(err) +} diff --git a/official/docs/golang/v4/carrier-accounts/list.go b/official/docs/golang/v4/carrier-accounts/list.go new file mode 100644 index 00000000..bb9ca894 --- /dev/null +++ b/official/docs/golang/v4/carrier-accounts/list.go @@ -0,0 +1,15 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func list() { + client := easypost.New("EASYPOST_API_KEY") + + carrierAccounts, _ := client.ListCarrierAccounts() + + fmt.Println(carrierAccounts) +} diff --git a/official/docs/golang/v4/carrier-accounts/retrieve.go b/official/docs/golang/v4/carrier-accounts/retrieve.go new file mode 100644 index 00000000..bafc15a4 --- /dev/null +++ b/official/docs/golang/v4/carrier-accounts/retrieve.go @@ -0,0 +1,15 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func retrieve() { + client := easypost.New("EASYPOST_API_KEY") + + carrierAccount, _ := client.GetCarrierAccount("ca_...") + + fmt.Println(carrierAccount) +} diff --git a/official/docs/golang/v4/carrier-accounts/update.go b/official/docs/golang/v4/carrier-accounts/update.go new file mode 100644 index 00000000..60e82c1e --- /dev/null +++ b/official/docs/golang/v4/carrier-accounts/update.go @@ -0,0 +1,31 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func update() { + client := easypost.New("EASYPOST_API_KEY") + + carrierAccount, _ := client.UpdateCarrierAccount( + &easypost.CarrierAccount{ + ID: "ca_...", + Description: "FL Location DHL eCommerce Solutions Account", + Credentials: map[string]string{ + "pickup_id": "abc123", + }, + }, + ) + + // For UPS account update, please use below method instead + + updateParameters := &easypost.UpsCarrierAccountUpdateParameters{ + AccountNumber: "987654321", + } + + carrierAccount, _ = client.UpdateUpsCarrierAccount(carrierAccount.ID, updateParameters) + + fmt.Println(carrierAccount) +} diff --git a/official/docs/golang/v4/carrier-metadata/retrieve.go b/official/docs/golang/v4/carrier-metadata/retrieve.go new file mode 100644 index 00000000..680ed3c7 --- /dev/null +++ b/official/docs/golang/v4/carrier-metadata/retrieve.go @@ -0,0 +1,19 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func retrieve() { + client := easypost.New("EASYPOST_API_KEY") + + // Request all metadata for all carriers + carrierMetadata, _ := client.GetCarrierMetadata() + fmt.Println(carrierMetadata) + + // Request specific metadata for specific carriers + carrierMetadataWithFilters, _ := client.GetCarrierMetadataWithCarriersAndTypes([]string{"usps"}, []string{"service_levels", "predefined_packages"}) + fmt.Println(carrierMetadataWithFilters) +} diff --git a/official/docs/golang/v4/carrier-types/list.go b/official/docs/golang/v4/carrier-types/list.go new file mode 100644 index 00000000..3c8d3502 --- /dev/null +++ b/official/docs/golang/v4/carrier-types/list.go @@ -0,0 +1,15 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func list() { + client := easypost.New("EASYPOST_API_KEY") + + carrierTypes, _ := client.GetCarrierTypes() + + fmt.Println(carrierTypes) +} diff --git a/official/docs/golang/v4/child-users/create.go b/official/docs/golang/v4/child-users/create.go new file mode 100644 index 00000000..1b89c128 --- /dev/null +++ b/official/docs/golang/v4/child-users/create.go @@ -0,0 +1,20 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func create() { + client := easypost.New("EASYPOST_API_KEY") + + userName := "Child Account Name" + user, _ := client.CreateUser( + &easypost.UserOptions{ + Name: &userName, + }, + ) + + fmt.Println(user) +} diff --git a/official/docs/golang/v4/child-users/delete.go b/official/docs/golang/v4/child-users/delete.go new file mode 100644 index 00000000..097b2693 --- /dev/null +++ b/official/docs/golang/v4/child-users/delete.go @@ -0,0 +1,15 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func delete() { + client := easypost.New("EASYPOST_API_KEY") + + err := client.DeleteUser("user_...") + + fmt.Println(err) +} diff --git a/official/docs/golang/v4/child-users/list.go b/official/docs/golang/v4/child-users/list.go new file mode 100644 index 00000000..4c2cc165 --- /dev/null +++ b/official/docs/golang/v4/child-users/list.go @@ -0,0 +1,19 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func list() { + client := easypost.New("EASYPOST_API_KEY") + + childUsers, _ := client.ListChildUsers( + &easypost.ListOptions{ + PageSize: 5, + }, + ) + + fmt.Println(childUsers) +} diff --git a/official/docs/golang/v4/claims/cancel.go b/official/docs/golang/v4/claims/cancel.go new file mode 100644 index 00000000..2533f16a --- /dev/null +++ b/official/docs/golang/v4/claims/cancel.go @@ -0,0 +1,15 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func cancel() { + client := easypost.New("EASYPOST_API_KEY") + + claim, _ := client.CancelClaim("clm_...") + + fmt.Println(claim) +} diff --git a/official/docs/golang/v4/claims/create.go b/official/docs/golang/v4/claims/create.go new file mode 100644 index 00000000..17419ce7 --- /dev/null +++ b/official/docs/golang/v4/claims/create.go @@ -0,0 +1,25 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func create() { + client := easypost.New("EASYPOST_API_KEY") + + claim, _ := client.CreateClaim( + &easypost.CreateClaimParameters{ + Amount: 100.00, + TrackingCode: "EZ1000000001", + EmailEvidenceAttachments: []string{"REPLACE_WITH_BASE64_STRING"}, + InvoiceAttachments: []string{"REPLACE_WITH_BASE64_STRING"}, + SupportingDocumentationAttachments: []string{"REPLACE_WITH_BASE64_STRING"}, + Description: "Test Description", + ContactEmail: "test@example.com", + }, + ) + + fmt.Println(claim) +} diff --git a/official/docs/golang/v4/claims/list.go b/official/docs/golang/v4/claims/list.go new file mode 100644 index 00000000..794da003 --- /dev/null +++ b/official/docs/golang/v4/claims/list.go @@ -0,0 +1,19 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func list() { + client := easypost.New("EASYPOST_API_KEY") + + claims, _ := client.ListClaims( + &easypost.ListClaimsParameters{ + PageSize: 5, + }, + ) + + fmt.Println(claims) +} diff --git a/official/docs/golang/v4/claims/retrieve.go b/official/docs/golang/v4/claims/retrieve.go new file mode 100644 index 00000000..2e21dbdd --- /dev/null +++ b/official/docs/golang/v4/claims/retrieve.go @@ -0,0 +1,15 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func retrieve() { + client := easypost.New("EASYPOST_API_KEY") + + claim, _ := client.GetClaim("clm_...") + + fmt.Println(claim) +} diff --git a/official/docs/golang/v4/customs-infos/create.go b/official/docs/golang/v4/customs-infos/create.go new file mode 100644 index 00000000..d3b7218d --- /dev/null +++ b/official/docs/golang/v4/customs-infos/create.go @@ -0,0 +1,33 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func create() { + client := easypost.New("EASYPOST_API_KEY") + + customsInfo, _ := client.CreateCustomsInfo( + &easypost.CustomsInfo{ + CustomsCertify: true, + CustomsSigner: "Steve Brule", + ContentsType: "merchandise", + ContentsExplanation: "", + RestrictionType: "none", + EELPFC: "NOEEI 30.37(a)", + CustomsItems: []*easypost.CustomsItem{ + &easypost.CustomsItem{ + Description: "T-shirt", + Quantity: 1, + Value: 10.00, + Weight: 5, + OriginCountry: "US", + }, + }, + }, + ) + + fmt.Println(customsInfo) +} diff --git a/official/docs/golang/v4/customs-infos/retrieve.go b/official/docs/golang/v4/customs-infos/retrieve.go new file mode 100644 index 00000000..36375fa6 --- /dev/null +++ b/official/docs/golang/v4/customs-infos/retrieve.go @@ -0,0 +1,15 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func retrieve() { + client := easypost.New("EASYPOST_API_KEY") + + customsInfo, _ := client.GetCustomsInfo("cstinfo_...") + + fmt.Println(customsInfo) +} diff --git a/official/docs/golang/v4/customs-items/create.go b/official/docs/golang/v4/customs-items/create.go new file mode 100644 index 00000000..fed3b8a7 --- /dev/null +++ b/official/docs/golang/v4/customs-items/create.go @@ -0,0 +1,23 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func create() { + client := easypost.New("EASYPOST_API_KEY") + + customsItem, _ := client.CreateCustomsItem( + &easypost.CustomsItem{ + Description: "T-shirts", + Quantity: 1, + Value: 10.00, + Weight: 5, + OriginCountry: "US", + }, + ) + + fmt.Println(customsItem) +} diff --git a/official/docs/golang/v4/customs-items/retrieve.go b/official/docs/golang/v4/customs-items/retrieve.go new file mode 100644 index 00000000..b26b56ac --- /dev/null +++ b/official/docs/golang/v4/customs-items/retrieve.go @@ -0,0 +1,15 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func retrieve() { + client := easypost.New("EASYPOST_API_KEY") + + customsItem, _ := client.GetCustomsItem("cstitem_...") + + fmt.Println(customsItem) +} diff --git a/official/docs/golang/v4/endshipper/buy.go b/official/docs/golang/v4/endshipper/buy.go new file mode 100644 index 00000000..f9ac6ff2 --- /dev/null +++ b/official/docs/golang/v4/endshipper/buy.go @@ -0,0 +1,18 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func buy() { + client := easypost.New("EASYPOST_API_KEY") + + shipment, _ := client.GetShipment("shp_...") + rate, _ := client.LowestShipmentRate(shipment) + + shipment, _ = client.BuyShipmentWithEndShipper(shipment.ID, &rate, "0", "es_...") + + fmt.Println(shipment) +} diff --git a/official/docs/golang/v4/endshipper/create.go b/official/docs/golang/v4/endshipper/create.go new file mode 100644 index 00000000..b44e47fa --- /dev/null +++ b/official/docs/golang/v4/endshipper/create.go @@ -0,0 +1,28 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func create() { + client := easypost.New("EASYPOST_API_KEY") + + endshipper, _ := client.CreateEndShipper( + &easypost.Address{ + Name: "FOO BAR", + Company: "BAZ", + Street1: "164 TOWNSEND STREET UNIT 1", + Street2: "UNIT 1", + City: "SAN FRANCISCO", + State: "CA", + Zip: "94107", + Country: "US", + Phone: "555-555-5555", + Email: "FOO@EXAMPLE.COM", + }, + ) + + fmt.Println(endshipper) +} diff --git a/official/docs/golang/v4/endshipper/list.go b/official/docs/golang/v4/endshipper/list.go new file mode 100644 index 00000000..6f3ca78a --- /dev/null +++ b/official/docs/golang/v4/endshipper/list.go @@ -0,0 +1,19 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func list() { + client := easypost.New("EASYPOST_API_KEY") + + endshippers, _ := client.ListEndShippers( + &easypost.ListOptions{ + PageSize: 5, + }, + ) + + fmt.Println(endshippers) +} diff --git a/official/docs/golang/v4/endshipper/retrieve.go b/official/docs/golang/v4/endshipper/retrieve.go new file mode 100644 index 00000000..c3b1c57a --- /dev/null +++ b/official/docs/golang/v4/endshipper/retrieve.go @@ -0,0 +1,15 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func retrieve() { + client := easypost.New("EASYPOST_API_KEY") + + retrievedEndShipper, _ := client.GetEndShipper("es_...") + + fmt.Println(retrievedEndShipper) +} diff --git a/official/docs/golang/v4/endshipper/update.go b/official/docs/golang/v4/endshipper/update.go new file mode 100644 index 00000000..b28a6d29 --- /dev/null +++ b/official/docs/golang/v4/endshipper/update.go @@ -0,0 +1,28 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func update() { + client := easypost.New("EASYPOST_API_KEY") + + endShipper, _ := client.GetEndShipper("es_...") + + endShipper.Name = "NEW NAME" + endShipper.Company = "BAZ" + endShipper.Street1 = "164 TOWNSEND STREET UNIT 1" + endShipper.Street2 = "UNIT 1" + endShipper.City = "San Francisco" + endShipper.State = "CA" + endShipper.Zip = "94107" + endShipper.Country = "US" + endShipper.Phone = "555-555-5555" + endShipper.Email = "FOO@EXAMPLE.COM" + + updatedEndShipper, _ := client.UpdateEndShippers(endShipper) + + fmt.Println(updatedEndShipper) +} diff --git a/official/docs/golang/v4/events/list.go b/official/docs/golang/v4/events/list.go new file mode 100644 index 00000000..13ff840f --- /dev/null +++ b/official/docs/golang/v4/events/list.go @@ -0,0 +1,19 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func list() { + client := easypost.New("EASYPOST_API_KEY") + + events, _ := client.ListEvents( + &easypost.ListOptions{ + PageSize: 5, + }, + ) + + fmt.Println(events) +} diff --git a/official/docs/golang/v4/events/retrieve.go b/official/docs/golang/v4/events/retrieve.go new file mode 100644 index 00000000..4e39fc91 --- /dev/null +++ b/official/docs/golang/v4/events/retrieve.go @@ -0,0 +1,15 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func retrieve() { + client := easypost.New("EASYPOST_API_KEY") + + event, _ := client.GetEvent("evt_...") + + fmt.Println(event) +} diff --git a/official/docs/golang/v4/forms/create.go b/official/docs/golang/v4/forms/create.go new file mode 100644 index 00000000..10a29032 --- /dev/null +++ b/official/docs/golang/v4/forms/create.go @@ -0,0 +1,15 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func create() { + client := easypost.New("EASYPOST_API_KEY") + + shipmentWithForm, _ := client.GenerateShipmentForm("shp_...", "return_packing_slip") + + fmt.Println(shipmentWithForm) +} diff --git a/official/docs/golang/v4/insurance/create.go b/official/docs/golang/v4/insurance/create.go new file mode 100644 index 00000000..54dec3e6 --- /dev/null +++ b/official/docs/golang/v4/insurance/create.go @@ -0,0 +1,27 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func create() { + client := easypost.New("EASYPOST_API_KEY") + + toAddress, _ := client.GetAddress("adr_...") + fromAddress, _ := client.GetAddress("adr_...") + + insurance, _ := client.CreateInsurance( + &easypost.Insurance{ + ToAddress: toAddress, + FromAddress: fromAddress, + Reference: "InsuranceRef1", + Carrier: "USPS", + TrackingCode: "9400110898825022579493", + Amount: "100.00", + }, + ) + + fmt.Println(insurance) +} diff --git a/official/docs/golang/v4/insurance/list.go b/official/docs/golang/v4/insurance/list.go new file mode 100644 index 00000000..f89668d5 --- /dev/null +++ b/official/docs/golang/v4/insurance/list.go @@ -0,0 +1,19 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func list() { + client := easypost.New("EASYPOST_API_KEY") + + insurances, _ := client.ListInsurances( + &easypost.ListOptions{ + PageSize: 5, + }, + ) + + fmt.Println(insurances) +} diff --git a/official/docs/golang/v4/insurance/refund.go b/official/docs/golang/v4/insurance/refund.go new file mode 100644 index 00000000..0dd9ab02 --- /dev/null +++ b/official/docs/golang/v4/insurance/refund.go @@ -0,0 +1,15 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func refund() { + client := easypost.New("EASYPOST_API_KEY") + + insurance, _ := client.RefundInsurance("ins_...") + + fmt.Println(insurance) +} diff --git a/official/docs/golang/v4/insurance/retrieve.go b/official/docs/golang/v4/insurance/retrieve.go new file mode 100644 index 00000000..4c94509d --- /dev/null +++ b/official/docs/golang/v4/insurance/retrieve.go @@ -0,0 +1,15 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func retrieve() { + client := easypost.New("EASYPOST_API_KEY") + + insurance, _ := client.GetInsurance("ins_...") + + fmt.Println(insurance) +} diff --git a/official/docs/golang/v4/options/create-with-options.go b/official/docs/golang/v4/options/create-with-options.go new file mode 100644 index 00000000..4e465249 --- /dev/null +++ b/official/docs/golang/v4/options/create-with-options.go @@ -0,0 +1,28 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func createWithOptions() { + client := easypost.New("EASYPOST_API_KEY") + + toAddress, _ := client.GetAddress("shp_...") + fromAddress, _ := client.GetAddress("adr_...") + parcel, _ := client.GetParcel("prcl_...") + + shipment, _ := client.CreateShipment( + &easypost.Shipment{ + ToAddress: toAddress, + FromAddress: fromAddress, + Parcel: parcel, + Options: &easypost.ShipmentOptions{ + PrintCustom1: "Custom label message", + }, + }, + ) + + fmt.Println(shipment) +} diff --git a/official/docs/golang/v4/orders/buy.go b/official/docs/golang/v4/orders/buy.go new file mode 100644 index 00000000..f2ccc724 --- /dev/null +++ b/official/docs/golang/v4/orders/buy.go @@ -0,0 +1,15 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func buy() { + client := easypost.New("EASYPOST_API_KEY") + + order, _ := client.BuyOrder("order_...", "FedEx", "FEDEX_GROUND") + + fmt.Println(order) +} diff --git a/official/docs/golang/v4/orders/create.go b/official/docs/golang/v4/orders/create.go new file mode 100644 index 00000000..4309ec7b --- /dev/null +++ b/official/docs/golang/v4/orders/create.go @@ -0,0 +1,38 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func create() { + client := easypost.New("EASYPOST_API_KEY") + + toAddress, _ := client.GetAddress("adr_...") + fromAddress, _ := client.GetAddress("adr_...") + firstShipment := &easypost.Shipment{ + Parcel: &easypost.Parcel{ + Weight: 10.2, + }, + } + secondShipment := &easypost.Shipment{ + Parcel: &easypost.Parcel{ + PredefinedPackage: "FedExBox", + Weight: 17.5, + }, + } + + order, _ := client.CreateOrder( + &easypost.Order{ + ToAddress: toAddress, + FromAddress: fromAddress, + Shipments: []*easypost.Shipment{ + firstShipment, + secondShipment, + }, + }, + ) + + fmt.Println(order) +} diff --git a/official/docs/golang/v4/orders/one-call-buy.go b/official/docs/golang/v4/orders/one-call-buy.go new file mode 100644 index 00000000..b4f2ac60 --- /dev/null +++ b/official/docs/golang/v4/orders/one-call-buy.go @@ -0,0 +1,42 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func oneCallBuy() { + client := easypost.New("EASYPOST_API_KEY") + + toAddress, _ := client.GetAddress("adr_...") + fromAddress, _ := client.GetAddress("adr_...") + firstShipment := &easypost.Shipment{ + Parcel: &easypost.Parcel{ + Weight: 10.2, + }, + } + secondShipment := &easypost.Shipment{ + Parcel: &easypost.Parcel{ + PredefinedPackage: "FedExBox", + Weight: 17.5, + }, + } + + order, _ := client.CreateOrder( + &easypost.Order{ + Service: "NextDayAir", + ToAddress: toAddress, + FromAddress: fromAddress, + Shipments: []*easypost.Shipment{ + firstShipment, + secondShipment, + }, + }, + &easypost.CarrierAccount{ + ID: "ca_...", + }, + ) + + fmt.Println(order) +} diff --git a/official/docs/golang/v4/orders/retrieve.go b/official/docs/golang/v4/orders/retrieve.go new file mode 100644 index 00000000..8a3ee172 --- /dev/null +++ b/official/docs/golang/v4/orders/retrieve.go @@ -0,0 +1,15 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func retrieve() { + client := easypost.New("EASYPOST_API_KEY") + + order, _ := client.GetOrder("order_...") + + fmt.Println(order) +} diff --git a/official/docs/golang/v4/pagination/get-next-page.go b/official/docs/golang/v4/pagination/get-next-page.go new file mode 100644 index 00000000..08171bce --- /dev/null +++ b/official/docs/golang/v4/pagination/get-next-page.go @@ -0,0 +1,26 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func getNextPage() { + client := easypost.New("EASYPOST_API_KEY") + + // Get first page of results + shipments, _ := client.ListShipments( + &easypost.ListShipmentsOptions{ + PageSize: 5, + }, + ) + + // Provide the previous results page to move onto the next page + secondPage, _ := client.GetNextShipmentPage(shipments) + + // You can also ask for the next page to be of a specific size + lastPage, _ := client.GetNextShipmentPageWithPageSize(secondPage, 10) + + fmt.Println(lastPage) +} diff --git a/official/docs/golang/v4/parcels/create.go b/official/docs/golang/v4/parcels/create.go new file mode 100644 index 00000000..3b8a79b1 --- /dev/null +++ b/official/docs/golang/v4/parcels/create.go @@ -0,0 +1,22 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func create() { + client := easypost.New("EASYPOST_API_KEY") + + parcel, _ := client.CreateParcel( + &easypost.Parcel{ + Length: 20.2, + Width: 10.9, + Height: 5, + Weight: 65.9, + }, + ) + + fmt.Println(parcel) +} diff --git a/official/docs/golang/v4/parcels/retrieve.go b/official/docs/golang/v4/parcels/retrieve.go new file mode 100644 index 00000000..142f7596 --- /dev/null +++ b/official/docs/golang/v4/parcels/retrieve.go @@ -0,0 +1,15 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func retrieve() { + client := easypost.New("EASYPOST_API_KEY") + + parcel, _ := client.GetParcel("prcl_...") + + fmt.Println(parcel) +} diff --git a/official/docs/golang/v4/payloads/list.go b/official/docs/golang/v4/payloads/list.go new file mode 100644 index 00000000..0ff1ad4c --- /dev/null +++ b/official/docs/golang/v4/payloads/list.go @@ -0,0 +1,15 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func list() { + client := easypost.New("EASYPOST_API_KEY") + + payloads, _ := client.ListEventPayloads("evt_...") + + fmt.Println(payloads) +} diff --git a/official/docs/golang/v4/payloads/retrieve.go b/official/docs/golang/v4/payloads/retrieve.go new file mode 100644 index 00000000..6511c26d --- /dev/null +++ b/official/docs/golang/v4/payloads/retrieve.go @@ -0,0 +1,15 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func retrieve() { + client := easypost.New("EASYPOST_API_KEY") + + payload, _ := client.GetEventPayload("evt_...", "payload_...") + + fmt.Println(payload) +} diff --git a/official/docs/golang/v4/pickups/buy.go b/official/docs/golang/v4/pickups/buy.go new file mode 100644 index 00000000..8b34873e --- /dev/null +++ b/official/docs/golang/v4/pickups/buy.go @@ -0,0 +1,16 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func buy() { + client := easypost.New("EASYPOST_API_KEY") + + rate := &easypost.PickupRate{Carrier: "UPS", Service: "Same-day Pickup"} + pickup, _ := client.BuyPickup("pickup...", rate) + + fmt.Println(pickup) +} diff --git a/official/docs/golang/v4/pickups/cancel.go b/official/docs/golang/v4/pickups/cancel.go new file mode 100644 index 00000000..b1b18b04 --- /dev/null +++ b/official/docs/golang/v4/pickups/cancel.go @@ -0,0 +1,15 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func cancel() { + client := easypost.New("EASYPOST_API_KEY") + + pickup, _ := client.CancelPickup("pickup_...") + + fmt.Println(pickup) +} diff --git a/official/docs/golang/v4/pickups/create.go b/official/docs/golang/v4/pickups/create.go new file mode 100644 index 00000000..6d68630a --- /dev/null +++ b/official/docs/golang/v4/pickups/create.go @@ -0,0 +1,32 @@ +package example + +import ( + "fmt" + "time" + + "github.com/EasyPost/easypost-go/v4" +) + +func create() { + client := easypost.New("EASYPOST_API_KEY") + + var minDatetime easypost.DateTime = easypost.DateTime(time.Now()) + var maxDatetime easypost.DateTime = easypost.DateTime(time.Now().Add(time.Hour * 24 * 7)) + + pickup, _ := client.CreatePickup( + &easypost.Pickup{ + IsAccountAddress: false, + Address: &easypost.Address{ + ID: "adr_...", + }, + Shipment: &easypost.Shipment{ + ID: "shp_...", + }, + MinDatetime: &minDatetime, + MaxDatetime: &maxDatetime, + Instructions: "Special pickup instructions", + }, + ) + + fmt.Println(pickup) +} diff --git a/official/docs/golang/v4/pickups/list.go b/official/docs/golang/v4/pickups/list.go new file mode 100644 index 00000000..fe10aae3 --- /dev/null +++ b/official/docs/golang/v4/pickups/list.go @@ -0,0 +1,19 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func list() { + client := easypost.New("EASYPOST_API_KEY") + + pickups, _ := client.ListPickups( + &easypost.ListOptions{ + PageSize: 5, + }, + ) + + fmt.Println(pickups) +} diff --git a/official/docs/golang/v4/pickups/retrieve.go b/official/docs/golang/v4/pickups/retrieve.go new file mode 100644 index 00000000..a00426f7 --- /dev/null +++ b/official/docs/golang/v4/pickups/retrieve.go @@ -0,0 +1,15 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func retrieve() { + client := easypost.New("EASYPOST_API_KEY") + + pickup, _ := client.GetPickup("pickup_...") + + fmt.Println(pickup) +} diff --git a/official/docs/golang/v4/rates/regenerate.go b/official/docs/golang/v4/rates/regenerate.go new file mode 100644 index 00000000..7810d1b0 --- /dev/null +++ b/official/docs/golang/v4/rates/regenerate.go @@ -0,0 +1,15 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func regenerate() { + client := easypost.New("EASYPOST_API_KEY") + + shipment, _ := client.RerateShipment("shp_...") + + fmt.Println(shipment) +} diff --git a/official/docs/golang/v4/rates/retrieve-stateless.go b/official/docs/golang/v4/rates/retrieve-stateless.go new file mode 100644 index 00000000..a25ff541 --- /dev/null +++ b/official/docs/golang/v4/rates/retrieve-stateless.go @@ -0,0 +1,45 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func retrieveStateless() { + client := easypost.New("EASYPOST_API_KEY") + + shipmentDetails := &easypost.Shipment{ + ToAddress: &easypost.Address{ + Name: "Dr. Steve Brule", + Street1: "179 N Harbor Dr", + City: "Redondo Beach", + State: "CA", + Zip: "90277", + Country: "US", + Phone: "4155559999", + Email: "dr_steve_brule@gmail.com", + }, + FromAddress: &easypost.Address{ + Name: "EasyPost", + Street1: "417 Montgomery Street", + Street2: "5th Floor", + City: "San Francisco", + State: "CA", + Zip: "90277", + Country: "US", + Phone: "4155559999", + Email: "support@easypost.com", + }, + Parcel: &easypost.Parcel{ + Length: 20.2, + Width: 10.9, + Height: 5, + Weight: 65.9, + }, + } + + rates, _ := client.BetaGetStatelessRates(shipmentDetails) + + fmt.Println(rates) +} diff --git a/official/docs/golang/v4/rates/retrieve.go b/official/docs/golang/v4/rates/retrieve.go new file mode 100644 index 00000000..e5a0aec3 --- /dev/null +++ b/official/docs/golang/v4/rates/retrieve.go @@ -0,0 +1,15 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func retrieve() { + client := easypost.New("EASYPOST_API_KEY") + + rate, _ := client.GetRate("rate...") + + fmt.Println(rate) +} diff --git a/official/docs/golang/v4/referral-customers/add-payment-method-with-bank-account.go b/official/docs/golang/v4/referral-customers/add-payment-method-with-bank-account.go new file mode 100644 index 00000000..0ec1520a --- /dev/null +++ b/official/docs/golang/v4/referral-customers/add-payment-method-with-bank-account.go @@ -0,0 +1,15 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func addPaymentMethodWithBankAccount() { + client := easypost.New("EASYPOST_API_KEY") + + paymentMethod, _ := client.BetaAddPaymentMethod("cus_...", "ba_...", easypost.PrimaryPaymentMethodPriority) + + fmt.Println(paymentMethod) +} diff --git a/official/docs/golang/v4/referral-customers/add-payment-method-with-credit-card.go b/official/docs/golang/v4/referral-customers/add-payment-method-with-credit-card.go new file mode 100644 index 00000000..26417bf7 --- /dev/null +++ b/official/docs/golang/v4/referral-customers/add-payment-method-with-credit-card.go @@ -0,0 +1,15 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func addPaymentMethodWithCreditCard() { + client := easypost.New("EASYPOST_API_KEY") + + paymentMethod, _ := client.BetaAddPaymentMethod("cus_...", "card_...", easypost.PrimaryPaymentMethodPriority) + + fmt.Println(paymentMethod) +} diff --git a/official/docs/golang/v4/referral-customers/create.go b/official/docs/golang/v4/referral-customers/create.go new file mode 100644 index 00000000..bd11fb2d --- /dev/null +++ b/official/docs/golang/v4/referral-customers/create.go @@ -0,0 +1,25 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func create() { + client := easypost.New("EASYPOST_API_KEY") + + name := "Test Referral" + email := "test@example.com" + phone := "5555555555" + + referralUser, _ := client.CreateReferralCustomer( + &easypost.UserOptions{ + Name: &name, + Email: &email, + Phone: &phone, + }, + ) + + fmt.Println(referralUser) +} diff --git a/official/docs/golang/v4/referral-customers/list.go b/official/docs/golang/v4/referral-customers/list.go new file mode 100644 index 00000000..e8a68979 --- /dev/null +++ b/official/docs/golang/v4/referral-customers/list.go @@ -0,0 +1,19 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func list() { + client := easypost.New("EASYPOST_API_KEY") + + referralCustomerCollection, _ := client.ListReferralCustomers( + &easypost.ListOptions{ + PageSize: 5, + }, + ) + + fmt.Println(referralCustomerCollection) +} diff --git a/official/docs/golang/v4/referral-customers/refund-by-amount.go b/official/docs/golang/v4/referral-customers/refund-by-amount.go new file mode 100644 index 00000000..1067c01b --- /dev/null +++ b/official/docs/golang/v4/referral-customers/refund-by-amount.go @@ -0,0 +1,15 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func refundByAmount() { + client := easypost.New("EASYPOST_API_KEY") + + refund, _ := client.BetaRefundByAmount(2000) + + fmt.Println(refund) +} diff --git a/official/docs/golang/v4/referral-customers/refund-by-payment-log.go b/official/docs/golang/v4/referral-customers/refund-by-payment-log.go new file mode 100644 index 00000000..ef20fd40 --- /dev/null +++ b/official/docs/golang/v4/referral-customers/refund-by-payment-log.go @@ -0,0 +1,15 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func refundByPaymentLog() { + client := easypost.New("EASYPOST_API_KEY") + + refund, _ := client.BetaRefundByPaymentLog("paylog_...") + + fmt.Println(refund) +} diff --git a/official/docs/golang/v4/referral-customers/update.go b/official/docs/golang/v4/referral-customers/update.go new file mode 100644 index 00000000..1db80c5e --- /dev/null +++ b/official/docs/golang/v4/referral-customers/update.go @@ -0,0 +1,11 @@ +package example + +import ( + "github.com/EasyPost/easypost-go/v4" +) + +func update() { + client := easypost.New("EASYPOST_API_KEY") + + _, _ = client.UpdateReferralCustomerEmail("user_...", "new_email@example.com") +} diff --git a/official/docs/golang/v4/refunds/create.go b/official/docs/golang/v4/refunds/create.go new file mode 100644 index 00000000..abc14209 --- /dev/null +++ b/official/docs/golang/v4/refunds/create.go @@ -0,0 +1,20 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func create() { + client := easypost.New("EASYPOST_API_KEY") + + refunds, _ := client.CreateRefund( + map[string]interface{}{ + "carrier": "USPS", + "tracking_codes": []string{"EZ1000000001"}, + }, + ) + + fmt.Println(refunds) +} diff --git a/official/docs/golang/v4/refunds/list.go b/official/docs/golang/v4/refunds/list.go new file mode 100644 index 00000000..955a32be --- /dev/null +++ b/official/docs/golang/v4/refunds/list.go @@ -0,0 +1,19 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func list() { + client := easypost.New("EASYPOST_API_KEY") + + refunds, _ := client.ListRefunds( + &easypost.ListOptions{ + PageSize: 5, + }, + ) + + fmt.Println(refunds) +} diff --git a/official/docs/golang/v4/refunds/retrieve.go b/official/docs/golang/v4/refunds/retrieve.go new file mode 100644 index 00000000..4791e397 --- /dev/null +++ b/official/docs/golang/v4/refunds/retrieve.go @@ -0,0 +1,15 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func retrieve() { + client := easypost.New("EASYPOST_API_KEY") + + refund, _ := client.GetRefund("shp_...") + + fmt.Println(refund) +} diff --git a/official/docs/golang/v4/reports/create.go b/official/docs/golang/v4/reports/create.go new file mode 100644 index 00000000..17560199 --- /dev/null +++ b/official/docs/golang/v4/reports/create.go @@ -0,0 +1,23 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func create() { + client := easypost.New("EASYPOST_API_KEY") + + reportOptions := &easypost.Report{ + StartDate: "2022-10-01", + EndDate: "2022-10-31", + } + + report, _ := client.CreateReport( + "payment_log", + reportOptions, + ) + + fmt.Println(report) +} diff --git a/official/docs/golang/v4/reports/list.go b/official/docs/golang/v4/reports/list.go new file mode 100644 index 00000000..771d3e6b --- /dev/null +++ b/official/docs/golang/v4/reports/list.go @@ -0,0 +1,20 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func list() { + client := easypost.New("EASYPOST_API_KEY") + + reports, _ := client.ListReports( + "payment_log", + &easypost.ListOptions{ + PageSize: 5, + }, + ) + + fmt.Println(reports) +} diff --git a/official/docs/golang/v4/reports/retrieve.go b/official/docs/golang/v4/reports/retrieve.go new file mode 100644 index 00000000..a4bc568b --- /dev/null +++ b/official/docs/golang/v4/reports/retrieve.go @@ -0,0 +1,15 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func retrieve() { + client := easypost.New("EASYPOST_API_KEY") + + report, _ := client.GetReport("", "") + + fmt.Println(report) +} diff --git a/official/docs/golang/v4/returns/create.go b/official/docs/golang/v4/returns/create.go new file mode 100644 index 00000000..1d2f2b56 --- /dev/null +++ b/official/docs/golang/v4/returns/create.go @@ -0,0 +1,26 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func create() { + client := easypost.New("EASYPOST_API_KEY") + + toAddress, _ := client.GetAddress("adr_...") + fromAddress, _ := client.GetAddress("adr_...") + parcel, _ := client.GetParcel("prcl_...") + + shipment, _ := client.CreateShipment( + &easypost.Shipment{ + ToAddress: fromAddress, + FromAddress: toAddress, + Parcel: parcel, + IsReturn: true, + }, + ) + + fmt.Println(shipment) +} diff --git a/official/docs/golang/v4/scan-form/create.go b/official/docs/golang/v4/scan-form/create.go new file mode 100644 index 00000000..1c3b7420 --- /dev/null +++ b/official/docs/golang/v4/scan-form/create.go @@ -0,0 +1,15 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func create() { + client := easypost.New("EASYPOST_API_KEY") + + scanForm, _ := client.CreateScanForm("shp_...", "shp_...") + + fmt.Println(scanForm) +} diff --git a/official/docs/golang/v4/scan-form/list.go b/official/docs/golang/v4/scan-form/list.go new file mode 100644 index 00000000..ca6cbda9 --- /dev/null +++ b/official/docs/golang/v4/scan-form/list.go @@ -0,0 +1,19 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func list() { + client := easypost.New("EASYPOST_API_KEY") + + scanForms, _ := client.ListScanForms( + &easypost.ListOptions{ + PageSize: 5, + }, + ) + + fmt.Println(scanForms) +} diff --git a/official/docs/golang/v4/scan-form/retrieve.go b/official/docs/golang/v4/scan-form/retrieve.go new file mode 100644 index 00000000..573881f4 --- /dev/null +++ b/official/docs/golang/v4/scan-form/retrieve.go @@ -0,0 +1,15 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func retrieve() { + client := easypost.New("EASYPOST_API_KEY") + + scanForm, _ := client.GetScanForm("sf_...") + + fmt.Println(scanForm) +} diff --git a/official/docs/golang/v4/shipments/buy.go b/official/docs/golang/v4/shipments/buy.go new file mode 100644 index 00000000..30502771 --- /dev/null +++ b/official/docs/golang/v4/shipments/buy.go @@ -0,0 +1,18 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func buy() { + client := easypost.New("EASYPOST_API_KEY") + + shipment, _ := client.GetShipment("shp_...") + rate, _ := client.LowestShipmentRate(shipment) + + shipment, _ = client.BuyShipment(shipment.ID, &rate, "249.99") + + fmt.Println(shipment) +} diff --git a/official/docs/golang/v4/shipments/create.go b/official/docs/golang/v4/shipments/create.go new file mode 100644 index 00000000..c7f90d40 --- /dev/null +++ b/official/docs/golang/v4/shipments/create.go @@ -0,0 +1,48 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func create() { + client := easypost.New("EASYPOST_API_KEY") + + shipment, _ := client.CreateShipment( + &easypost.Shipment{ + ToAddress: &easypost.Address{ + Name: "Dr. Steve Brule", + Street1: "179 N Harbor Dr", + City: "Redondo Beach", + State: "CA", + Zip: "90277", + Country: "US", + Phone: "4155559999", + Email: "dr_steve_brule@gmail.com", + }, + FromAddress: &easypost.Address{ + Name: "EasyPost", + Street1: "417 Montgomery Street", + Street2: "5th Floor", + City: "San Francisco", + State: "CA", + Zip: "90277", + Country: "US", + Phone: "4155559999", + Email: "support@easypost.com", + }, + Parcel: &easypost.Parcel{ + Length: 20.2, + Width: 10.9, + Height: 5, + Weight: 65.9, + }, + CustomsInfo: &easypost.CustomsInfo{ + ID: "cstinfo_...", + }, + }, + ) + + fmt.Println(shipment) +} diff --git a/official/docs/golang/v4/shipments/label.go b/official/docs/golang/v4/shipments/label.go new file mode 100644 index 00000000..d7e7c423 --- /dev/null +++ b/official/docs/golang/v4/shipments/label.go @@ -0,0 +1,15 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func label() { + client := easypost.New("EASYPOST_API_KEY") + + shipment, _ := client.GetShipmentLabel("shp_...", "ZPL") + + fmt.Println(shipment) +} diff --git a/official/docs/golang/v4/shipments/list.go b/official/docs/golang/v4/shipments/list.go new file mode 100644 index 00000000..42b42be8 --- /dev/null +++ b/official/docs/golang/v4/shipments/list.go @@ -0,0 +1,19 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func list() { + client := easypost.New("EASYPOST_API_KEY") + + shipments, _ := client.ListShipments( + &easypost.ListShipmentsOptions{ + PageSize: 5, + }, + ) + + fmt.Println(shipments) +} diff --git a/official/docs/golang/v4/shipments/one-call-buy.go b/official/docs/golang/v4/shipments/one-call-buy.go new file mode 100644 index 00000000..835fb10d --- /dev/null +++ b/official/docs/golang/v4/shipments/one-call-buy.go @@ -0,0 +1,48 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func oneCallBuy() { + client := easypost.New("EASYPOST_API_KEY") + + shipment, _ := client.CreateShipment( + &easypost.Shipment{ + CarrierAccountIDs: []string{"ca_..."}, + Service: "NextDayAir", + Parcel: &easypost.Parcel{ + Length: 20.2, + Width: 10.9, + Height: 5, + Weight: 65.9, + }, + ToAddress: &easypost.Address{ + Name: "Dr. Steve Brule", + Street1: "179 N Harbor Dr", + City: "Redondo Beach", + State: "CA", + Zip: "90277", + Country: "US", + Phone: "4155559999", + Email: "dr_steve_brule@gmail.com", + }, + FromAddress: &easypost.Address{ + Name: "EasyPost", + Street1: "417 Montgomery Street", + Street2: "5th Floor", + City: "San Francisco", + State: "CA", + Zip: "90277", + Country: "US", + Phone: "4155559999", + Email: "support@easypost.com", + }, + Reference: "ShipmentRef", + }, + ) + + fmt.Println(shipment) +} diff --git a/official/docs/golang/v4/shipments/retrieve.go b/official/docs/golang/v4/shipments/retrieve.go new file mode 100644 index 00000000..443c1186 --- /dev/null +++ b/official/docs/golang/v4/shipments/retrieve.go @@ -0,0 +1,15 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func retrieve() { + client := easypost.New("EASYPOST_API_KEY") + + shipment, _ := client.GetShipment("shp_...") + + fmt.Println(shipment) +} diff --git a/official/docs/golang/v4/shipping-insurance/insure.go b/official/docs/golang/v4/shipping-insurance/insure.go new file mode 100644 index 00000000..23901090 --- /dev/null +++ b/official/docs/golang/v4/shipping-insurance/insure.go @@ -0,0 +1,15 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func insure() { + client := easypost.New("EASYPOST_API_KEY") + + shipment, _ := client.InsureShipment("shp_...", "100.00") + + fmt.Println(shipment) +} diff --git a/official/docs/golang/v4/shipping-refund/refund.go b/official/docs/golang/v4/shipping-refund/refund.go new file mode 100644 index 00000000..7a3f5024 --- /dev/null +++ b/official/docs/golang/v4/shipping-refund/refund.go @@ -0,0 +1,15 @@ +package shipping_refund + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func refund() { + client := easypost.New("EASYPOST_API_KEY") + + shipment, _ := client.RefundShipment("shp_...") + + fmt.Println(shipment) +} diff --git a/official/docs/golang/v4/smartrate/retrieve-estimated-delivery-date.go b/official/docs/golang/v4/smartrate/retrieve-estimated-delivery-date.go new file mode 100644 index 00000000..2ab8a35a --- /dev/null +++ b/official/docs/golang/v4/smartrate/retrieve-estimated-delivery-date.go @@ -0,0 +1,15 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func retrieveEstimatedDeliveryDate() { + client := easypost.New("EASYPOST_API_KEY") + + estimatedDeliveryDates, _ := client.GetShipmentEstimatedDeliveryDate("shp_...", "YYYY-MM-DD") + + fmt.Println(estimatedDeliveryDates) +} diff --git a/official/docs/golang/v4/smartrate/retrieve-recommend-ship-date.go b/official/docs/golang/v4/smartrate/retrieve-recommend-ship-date.go new file mode 100644 index 00000000..600d0823 --- /dev/null +++ b/official/docs/golang/v4/smartrate/retrieve-recommend-ship-date.go @@ -0,0 +1,15 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func retrieveRecommendShipDate() { + client := easypost.New("EASYPOST_API_KEY") + + rates, _ := client.RecommendShipDateForShipment("shp_...", "YYYY-MM-DD") + + fmt.Println(rates) +} diff --git a/official/docs/golang/v4/smartrate/retrieve-standalone-smartrate-deliver-by.go b/official/docs/golang/v4/smartrate/retrieve-standalone-smartrate-deliver-by.go new file mode 100644 index 00000000..2ebf5fc0 --- /dev/null +++ b/official/docs/golang/v4/smartrate/retrieve-standalone-smartrate-deliver-by.go @@ -0,0 +1,22 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func retrieveStandaloneSmartrateDeliverBy() { + client := easypost.New("EASYPOST_API_KEY") + + params := &easypost.EstimateDeliveryDateForZipPairParams{ + FromZip: "10001", + ToZip: "10002", + Carriers: []string{"UPS", "FedEx"}, + PlannedShipDate: "2024-07-18", + } + + estimates, _ := client.EstimateDeliveryDateForZipPair(params) + + fmt.Println(estimates) +} diff --git a/official/docs/golang/v4/smartrate/retrieve-standalone-smartrate-deliver-on.go b/official/docs/golang/v4/smartrate/retrieve-standalone-smartrate-deliver-on.go new file mode 100644 index 00000000..f457d2fd --- /dev/null +++ b/official/docs/golang/v4/smartrate/retrieve-standalone-smartrate-deliver-on.go @@ -0,0 +1,22 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func retrieveStandaloneSmartrateDeliverOn() { + client := easypost.New("EASYPOST_API_KEY") + + params := &easypost.RecommendShipDateForZipPairParams{ + FromZip: "10001", + ToZip: "10002", + Carriers: []string{"UPS", "FedEx"}, + DesiredDeliveryDate: "2024-07-18", + } + + recommendations, _ := client.RecommendShipDateForZipPair(params) + + fmt.Println(recommendations) +} diff --git a/official/docs/golang/v4/smartrate/retrieve-time-in-transit-statistics.go b/official/docs/golang/v4/smartrate/retrieve-time-in-transit-statistics.go new file mode 100644 index 00000000..fc2ec4d4 --- /dev/null +++ b/official/docs/golang/v4/smartrate/retrieve-time-in-transit-statistics.go @@ -0,0 +1,15 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func retrieveTimeInTransitStatistics() { + client := easypost.New("EASYPOST_API_KEY") + + smartRates, _ := client.GetShipmentSmartrates("shp_...") + + fmt.Println(smartRates) +} diff --git a/official/docs/golang/v4/tax-identifiers/create.go b/official/docs/golang/v4/tax-identifiers/create.go new file mode 100644 index 00000000..516798ef --- /dev/null +++ b/official/docs/golang/v4/tax-identifiers/create.go @@ -0,0 +1,33 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func create() { + client := easypost.New("EASYPOST_API_KEY") + + toAddress, _ := client.GetAddress("adr_...") + fromAddress, _ := client.GetAddress("adr_...") + parcel, _ := client.GetParcel("prcl_...") + + shipment, _ := client.CreateShipment( + &easypost.Shipment{ + ToAddress: toAddress, + FromAddress: fromAddress, + Parcel: parcel, + TaxIdentifiers: []*easypost.TaxIdentifier{ + &easypost.TaxIdentifier{ + Entity: "SENDER", + TaxId: "GB123456789", + IssuingCountry: "GB", + TaxIdType: "EORI", + }, + }, + }, + ) + + fmt.Println(shipment) +} diff --git a/official/docs/golang/v4/trackers/create.go b/official/docs/golang/v4/trackers/create.go new file mode 100644 index 00000000..08289f5d --- /dev/null +++ b/official/docs/golang/v4/trackers/create.go @@ -0,0 +1,20 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func create() { + client := easypost.New("EASYPOST_API_KEY") + + tracker, _ := client.CreateTracker( + &easypost.CreateTrackerOptions{ + TrackingCode: "EZ1000000001", + Carrier: "USPS", + }, + ) + + fmt.Println(tracker) +} diff --git a/official/docs/golang/v4/trackers/list.go b/official/docs/golang/v4/trackers/list.go new file mode 100644 index 00000000..a5cddde4 --- /dev/null +++ b/official/docs/golang/v4/trackers/list.go @@ -0,0 +1,19 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func list() { + client := easypost.New("EASYPOST_API_KEY") + + trackers, _ := client.ListTrackers( + &easypost.ListTrackersOptions{ + PageSize: 5, + }, + ) + + fmt.Println(trackers) +} diff --git a/official/docs/golang/v4/trackers/retrieve.go b/official/docs/golang/v4/trackers/retrieve.go new file mode 100644 index 00000000..2a471d7c --- /dev/null +++ b/official/docs/golang/v4/trackers/retrieve.go @@ -0,0 +1,15 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func retrieve() { + client := easypost.New("EASYPOST_API_KEY") + + tracker, _ := client.GetTracker("trk_...") + + fmt.Println(tracker) +} diff --git a/official/docs/golang/v4/users/retrieve.go b/official/docs/golang/v4/users/retrieve.go new file mode 100644 index 00000000..2eac9d9b --- /dev/null +++ b/official/docs/golang/v4/users/retrieve.go @@ -0,0 +1,19 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func retrieve() { + client := easypost.New("EASYPOST_API_KEY") + + // Retrieve the authenticated user + user, _ := client.RetrieveMe() + fmt.Println(user) + + // Retrieve a child user + user, _ = client.GetUser("user_...") + fmt.Println(user) +} diff --git a/official/docs/golang/v4/users/update.go b/official/docs/golang/v4/users/update.go new file mode 100644 index 00000000..1032cac2 --- /dev/null +++ b/official/docs/golang/v4/users/update.go @@ -0,0 +1,22 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func update() { + client := easypost.New("EASYPOST_API_KEY") + + rechargeAmount := "50.00" + + user, _ := client.UpdateUser( + &easypost.UserOptions{ + ID: "user_...", + RechargeAmount: &rechargeAmount, + }, + ) + + fmt.Println(user) +} diff --git a/official/docs/golang/v4/webhooks/create.go b/official/docs/golang/v4/webhooks/create.go new file mode 100644 index 00000000..95704911 --- /dev/null +++ b/official/docs/golang/v4/webhooks/create.go @@ -0,0 +1,20 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func create() { + client := easypost.New("EASYPOST_API_KEY") + + webhook, _ := client.CreateWebhookWithDetails( + &easypost.CreateUpdateWebhookOptions{ + URL: "example.com", + WebhookSecret: "A1B2C3", + }, + ) + + fmt.Println(webhook) +} diff --git a/official/docs/golang/v4/webhooks/delete.go b/official/docs/golang/v4/webhooks/delete.go new file mode 100644 index 00000000..f6b66156 --- /dev/null +++ b/official/docs/golang/v4/webhooks/delete.go @@ -0,0 +1,15 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func delete() { + client := easypost.New("EASYPOST_API_KEY") + + err := client.DeleteWebhook("hook_...") + + fmt.Println(err) +} diff --git a/official/docs/golang/v4/webhooks/list.go b/official/docs/golang/v4/webhooks/list.go new file mode 100644 index 00000000..fd11b526 --- /dev/null +++ b/official/docs/golang/v4/webhooks/list.go @@ -0,0 +1,15 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func list() { + client := easypost.New("EASYPOST_API_KEY") + + webhooks, _ := client.ListWebhooks() + + fmt.Println(webhooks) +} diff --git a/official/docs/golang/v4/webhooks/retrieve.go b/official/docs/golang/v4/webhooks/retrieve.go new file mode 100644 index 00000000..bfa5880a --- /dev/null +++ b/official/docs/golang/v4/webhooks/retrieve.go @@ -0,0 +1,15 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func retrieve() { + client := easypost.New("EASYPOST_API_KEY") + + webhook, _ := client.GetWebhook("hook_...") + + fmt.Println(webhook) +} diff --git a/official/docs/golang/v4/webhooks/update.go b/official/docs/golang/v4/webhooks/update.go new file mode 100644 index 00000000..5aadad6b --- /dev/null +++ b/official/docs/golang/v4/webhooks/update.go @@ -0,0 +1,18 @@ +package example + +import ( + "fmt" + + "github.com/EasyPost/easypost-go/v4" +) + +func update() { + client := easypost.New("EASYPOST_API_KEY") + + webhook, _ := client.UpdateWebhook( + "hook_...", + &easypost.CreateUpdateWebhookOptions{}, + ) + + fmt.Println(webhook) +} diff --git a/official/guides/errors-guide/curl/catch-error.sh b/official/guides/errors-guide/curl/catch-error.sh index d37020cc..d6e8774a 100644 --- a/official/guides/errors-guide/curl/catch-error.sh +++ b/official/guides/errors-guide/curl/catch-error.sh @@ -1,9 +1,6 @@ -curl -X POST https://api.easypost.com/v2/addresses \ +curl -X POST https://api.easypost.com/v2/shipments \ -u "$EASYPOST_API_KEY": \ -H 'Content-Type: application/json' \ -d '{ - "address": { - "street1": "..." - }, - "verify_strict": "true" -}' + "shipment": {} + }' diff --git a/official/guides/errors-guide/golang/catch-error.go b/official/guides/errors-guide/golang/catch-error.go index 78c9ed0c..8837f921 100644 --- a/official/guides/errors-guide/golang/catch-error.go +++ b/official/guides/errors-guide/golang/catch-error.go @@ -4,23 +4,33 @@ import ( "errors" "fmt" - "github.com/EasyPost/easypost-go/v4" + "github.com/EasyPost/easypost-go/v5" ) func main() { client := easypost.New("EASYPOST_API_KEY") - _, err := client.CreateAddress( - &easypost.Address{ - // address params here - }, - &easypost.CreateAddressOptions{ - VerifyStrict: []string{"true"}, - }, + // When the `errors` key is returned as an array of FieldError objects + _, err := client.CreateShipment( + &easypost.Shipment{}, // Simulate a request with missing parameters: PARAMETER.REQUIRED ) + var invalidRequestError *easypost.InvalidRequestError + if errors.As(err, &invalidRequestError) { + if errorsList, ok := invalidRequestError.Errors.([]interface{}); ok { + if fieldError, ok := errorsList[0].(*easypost.FieldError); ok { + fmt.Println(fieldError.Message) + } + } + } - var eperr *easypost.APIError - if errors.As(err, &eperr) { - fmt.Println(eperr.Code) + // When the `errors` key is returned as an array of strings + _, err = client.CreateClaim(&easypost.CreateClaimParameters{ + TrackingCode: "123", // Simulate a request with an invalid tracking code: NOT_FOUND + }) + var notFoundError *easypost.NotFoundError + if errors.As(err, ¬FoundError) { + if errorsList, ok := notFoundError.Errors.([]interface{}); ok { + fmt.Println(errorsList[0]) + } } }