File tree Expand file tree Collapse file tree 26 files changed +818
-10
lines changed
Expand file tree Collapse file tree 26 files changed +818
-10
lines changed Original file line number Diff line number Diff line change @@ -6,5 +6,5 @@ require (
66 github.com/EasyPost/easypost-go/v2 v2.20.0
77 github.com/EasyPost/easypost-go/v3 v3.2.0
88 github.com/EasyPost/easypost-go/v4 v4.6.0
9- github.com/EasyPost/easypost-go/v5 v5.0 .0
9+ github.com/EasyPost/easypost-go/v5 v5.2 .0
1010)
Original file line number Diff line number Diff line change @@ -4,8 +4,8 @@ github.com/EasyPost/easypost-go/v3 v3.2.0 h1:dNWmPG1AkpgYFJxhw/zGzCz1JOVXPpNIi8+
44github.com/EasyPost/easypost-go/v3 v3.2.0 /go.mod h1:WDD0qkjwxedVKFXCcdJBz22rtRHpuxjGazgSVcTfdIw =
55github.com/EasyPost/easypost-go/v4 v4.6.0 h1:wxMK4wkGEG5vW/4Vdy3rwE9iqww1eQ1xS6oYWUZbhrc =
66github.com/EasyPost/easypost-go/v4 v4.6.0 /go.mod h1:WGoS4tmjHquhooMNmY6RirP+KWeYV/akcf/Jg9Q6fsk =
7- github.com/EasyPost/easypost-go/v5 v5.0 .0 h1:w6Jp4wBD0Desgk4a1kbJpbEMexBYMz9VWPPrFeTdsak =
8- github.com/EasyPost/easypost-go/v5 v5.0 .0 /go.mod h1:wUxStg92sBzWO3m2yoFAN7CbZTr25zQeFog48itvfnw =
7+ github.com/EasyPost/easypost-go/v5 v5.2 .0 h1:UKv0AWKugaue3QGW1RvTBg6/V1Gy/QGCXVC458bcQYU =
8+ github.com/EasyPost/easypost-go/v5 v5.2 .0 /go.mod h1:wUxStg92sBzWO3m2yoFAN7CbZTr25zQeFog48itvfnw =
99github.com/davecgh/go-spew v1.1.0 /go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38 =
1010github.com/davecgh/go-spew v1.1.1 /go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38 =
1111github.com/dnaeon/go-vcr v1.2.0 /go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ =
Original file line number Diff line number Diff line change 1+ using System ;
2+ using System . Collections . Generic ;
3+ using System . Threading . Tasks ;
4+ using EasyPost ;
5+ using Newtonsoft . Json ;
6+
7+ namespace EasyPostExamples
8+ {
9+ public class Examples
10+ {
11+ public static async Task Main ( )
12+ {
13+ var client = new EasyPost . Client ( new EasyPost . ClientConfiguration ( "EASYPOST_API_KEY" ) ) ;
14+
15+ EasyPost . Models . API . Shipment shipment = await client . Shipment . Retrieve ( "shp_..." ) ;
16+
17+ shipment = await client . Shipment . BuyLuma (
18+ "shp_..." ,
19+ rulesetName : "ruleset_..." ,
20+ plannedShipDate : "2025-07-18" ,
21+ deliverByDate : "2025-07-20"
22+ ) ;
23+
24+ Console . WriteLine ( JsonConvert . SerializeObject ( shipment , Formatting . Indented ) ) ;
25+ }
26+ }
27+ }
Original file line number Diff line number Diff line change 1+ using System ;
2+ using System . Collections . Generic ;
3+ using System . Threading . Tasks ;
4+ using EasyPost ;
5+ using Newtonsoft . Json ;
6+
7+ namespace EasyPostExamples
8+ {
9+ public class Examples
10+ {
11+ public static async Task Main ( )
12+ {
13+ var client = new EasyPost . Client ( new EasyPost . ClientConfiguration ( "EASYPOST_API_KEY" ) ) ;
14+
15+ EasyPost . Parameters . Shipment . Create parameters = new ( )
16+ {
17+ ToAddress = new EasyPost . Parameters . Address . Create
18+ {
19+ Name = "Dr. Steve Brule" ,
20+ Street1 = "5744 Silverton Ave" ,
21+ City = "McKinney" ,
22+ State = "TX" ,
23+ Zip = "75070" ,
24+ Country = "US" ,
25+ Phone = "8573875756" ,
26+ Email = "dr_steve_brule@gmail.com"
27+ } ,
28+ FromAddress = new EasyPost . Parameters . Address . Create
29+ {
30+ Name = "EasyPost" ,
31+ Street1 = "417 Montgomery Street" ,
32+ Street2 = "5th Floor" ,
33+ City = "San Francisco" ,
34+ State = "CA" ,
35+ Zip = "94104" ,
36+ Country = "US" ,
37+ Phone = "4153334445" ,
38+ Email = "support@easypost.com"
39+ } ,
40+ Parcel = new EasyPost . Parameters . Parcel . Create
41+ {
42+ Length = 20.2 ,
43+ Width = 10.9 ,
44+ Height = 5 ,
45+ Weight = 65.9
46+ } ,
47+ CarrierAccountIds = new List < string > { "ca_..." } ,
48+ RulesetName = "ruleset_..." ,
49+ PlannedShipDate = "2025-07-18" ,
50+ DeliverByDate = "2025-07-20"
51+ } ;
52+
53+ EasyPost . Models . API . Shipment shipment = await client . Shipment . CreateAndBuyLuma ( parameters ) ;
54+
55+ Console . WriteLine ( JsonConvert . SerializeObject ( shipment , Formatting . Indented ) ) ;
56+ }
57+ }
58+ }
Original file line number Diff line number Diff line change 1+ using System ;
2+ using System . Collections . Generic ;
3+ using System . Threading . Tasks ;
4+ using EasyPost ;
5+ using Newtonsoft . Json ;
6+
7+ namespace EasyPostExamples
8+ {
9+ public class Examples
10+ {
11+ public static async Task Main ( )
12+ {
13+ var client = new EasyPost . Client ( new EasyPost . ClientConfiguration ( "EASYPOST_API_KEY" ) ) ;
14+
15+ EasyPost . Parameters . Luma . GetPromise parameters = new ( )
16+ {
17+ ToAddress = new EasyPost . Parameters . Address . Create
18+ {
19+ Name = "Dr. Steve Brule" ,
20+ Street1 = "5744 Silverton Ave" ,
21+ City = "McKinney" ,
22+ State = "TX" ,
23+ Zip = "75070" ,
24+ Country = "US" ,
25+ Phone = "8573875756" ,
26+ Email = "dr_steve_brule@gmail.com"
27+ } ,
28+ FromAddress = new EasyPost . Parameters . Address . Create
29+ {
30+ Name = "EasyPost" ,
31+ Street1 = "417 Montgomery Street" ,
32+ Street2 = "5th Floor" ,
33+ City = "San Francisco" ,
34+ State = "CA" ,
35+ Zip = "94104" ,
36+ Country = "US" ,
37+ Phone = "4153334445" ,
38+ Email = "support@easypost.com"
39+ } ,
40+ Parcel = new EasyPost . Parameters . Parcel . Create
41+ {
42+ Length = 20.2 ,
43+ Width = 10.9 ,
44+ Height = 5 ,
45+ Weight = 65.9
46+ } ,
47+ RulesetName = "ruleset_..." ,
48+ PlannedShipDate = "2025-07-18" ,
49+ DeliverByDate = "2025-07-20"
50+ } ;
51+
52+ EasyPost . Models . API . LumaInfo lumaInfo = await client . Luma . GetPromise ( parameters ) ;
53+
54+ Console . WriteLine ( JsonConvert . SerializeObject ( lumaInfo , Formatting . Indented ) ) ;
55+ }
56+ }
57+ }
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ curl -X POST https://api.easypost.com/v2/shipments/shp_.../luma \
22 -u " EASYPOST_API_KEY" : \
33 -H ' Content-Type: application/json' \
44 -d ' {
5- "ruleset_name": "ruleset_name ",
6- "planned_ship_date": "YYYY-MM-DD"
5+ "ruleset_name": ""ruleset_..." ",
6+ "planned_ship_date": "YYYY-MM-DD",
77 "deliver_by_date": "YYYY-MM-DD"
88 }'
Original file line number Diff line number Diff line change @@ -30,11 +30,9 @@ curl -X POST https://api.easypost.com/v2/shipments/luma \
3030 "height": "5",
3131 "weight": "65.9"
3232 },
33- "carrier_accounts": ["ca_1", "ca_2"],
34- "persist_label": true,
35- "ruleset_name": "required_deliver_by_date",
33+ "carrier_accounts": ["ca_..."],
34+ "ruleset_name": "ruleset_...",
3635 "planned_ship_date": "2025-05-14",
37- "deliver_by_date": "2025-05-16",
38- "insurance": "50.00"
36+ "deliver_by_date": "2025-05-16"
3937 }
4038 }'
Original file line number Diff line number Diff line change 1+ curl -X POST ' https://api.easypost.com/v2/luma/promise' \
2+ -u " EASYPOST_API_KEY" : \
3+ -H ' Content-Type: application/json' \
4+ -d ' {
5+ "shipment": {
6+ "to_address": {
7+ "name": "Dr. Steve Brule",
8+ "street1": "5744 Silverton Ave",
9+ "city": "McKinney",
10+ "state": "TX",
11+ "zip": "75070",
12+ "country": "US",
13+ "phone": "8573875756",
14+ "email": "dr_steve_brule@gmail.com"
15+ },
16+ "from_address": {
17+ "name": "EasyPost",
18+ "street1": "417 Montgomery Street",
19+ "street2": "5th Floor",
20+ "city": "San Francisco",
21+ "state": "CA",
22+ "zip": "94104",
23+ "country": "US",
24+ "phone": "4153334445",
25+ "email": "support@easypost.com"
26+ },
27+ "parcel": {
28+ "length": "20.2",
29+ "width": "10.9",
30+ "height": "5",
31+ "weight": "65.9"
32+ },
33+ "ruleset_name": "ruleset_...",
34+ "planned_ship_date": "2025-07-03",
35+ "deliver_by_date": "2025-07-06"
36+ }
37+ }'
Original file line number Diff line number Diff line change 1+ package example
2+
3+ import (
4+ "fmt"
5+
6+ "github.com/EasyPost/easypost-go/v5"
7+ )
8+
9+ func buy () {
10+ client := easypost .New ("EASYPOST_API_KEY" )
11+
12+ shipment , _ := client .GetShipment ("shp_..." )
13+ lumaRequest := & easypost.LumaRequest {
14+ Shipment : easypost.Shipment {ID : shipment .ID },
15+ RulesetName : "ruleset_..." ,
16+ PlannedShipDate : "2025-07-21" ,
17+ DeliverByDate : "2025-07-25" ,
18+ PersistLabel : false ,
19+ }
20+
21+ shipment , _ = client .BuyLumaShipment (shipment .ID , lumaRequest )
22+
23+ fmt .Println (shipment )
24+ }
Original file line number Diff line number Diff line change 1+ package example
2+
3+ import (
4+ "fmt"
5+
6+ "github.com/EasyPost/easypost-go/v5"
7+ )
8+
9+ func oneCallBuy () {
10+ client := easypost .New ("EASYPOST_API_KEY" )
11+
12+ lumaRequest := & easypost.LumaRequest {
13+ Shipment : easypost.Shipment {
14+ CarrierAccountIDs : []string {"ca_..." },
15+ Parcel : & easypost.Parcel {
16+ Length : 20.2 ,
17+ Width : 10.9 ,
18+ Height : 5 ,
19+ Weight : 65.9 ,
20+ },
21+ ToAddress : & easypost.Address {
22+ Name : "Dr. Steve Brule" ,
23+ Street1 : "179 N Harbor Dr" ,
24+ City : "Redondo Beach" ,
25+ State : "CA" ,
26+ Zip : "90277" ,
27+ Country : "US" ,
28+ Phone : "4155559999" ,
29+ Email : "dr_steve_brule@gmail.com" ,
30+ },
31+ FromAddress : & easypost.Address {
32+ Name : "EasyPost" ,
33+ Street1 : "417 Montgomery Street" ,
34+ Street2 : "5th Floor" ,
35+ City : "San Francisco" ,
36+ State : "CA" ,
37+ Zip : "90277" ,
38+ Country : "US" ,
39+ Phone : "4155559999" ,
40+ Email : "support@easypost.com" ,
41+ },
42+ },
43+ RulesetName : "ruleset_..." ,
44+ PlannedShipDate : "2025-07-21" ,
45+ DeliverByDate : "2025-07-25" ,
46+ }
47+
48+ shipment , _ := client .CreateAndBuyLumaShipment (lumaRequest )
49+
50+ fmt .Println (shipment )
51+ }
You can’t perform that action at this time.
0 commit comments