Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: order snippets to include multiple shipments #133

Merged
merged 2 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions official/docs/csharp/current/orders/create.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ public static async Task Main()
{
var client = new EasyPost.Client(new EasyPost.ClientConfiguration("EASYPOST_API_KEY"));

Shipment shipment = await client.Shipment.Retrieve("shp_...");

Parameters.Order.Create parameters = new()
{
ToAddress = new Parameters.Address.Create
Expand All @@ -38,7 +36,24 @@ public static async Task Main()
Country = "US",
Zip = "94104"
},
Shipments = new List<IShipmentParameter>() { shipment }
Shipments = new List<IShipmentParameter>
{
new Parameters.Shipment.Create()
{
Parcel = new Parameters.Parcel.Create
{
Weight = 10.2
}
},
new Parameters.Shipment.Create()
{
Parcel = new Parameters.Parcel.Create
{
PredefinedPackage = "FedExBox",
Weight = 17.5
}
}
},
};

Order order = await client.Order.Create(parameters);
Expand Down
15 changes: 13 additions & 2 deletions official/docs/golang/current/orders/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,25 @@ func main() {

toAddress, _ := client.GetAddress("adr_...")
fromAddress, _ := client.GetAddress("adr_...")
shipment, _ := client.GetShipment("shp_...")
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{
shipment,
firstShipment,
secondShipment,
},
},
)
Expand Down
5 changes: 1 addition & 4 deletions official/docs/golang/current/orders/one-call-buy.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,11 @@ func main() {

toAddress, _ := client.GetAddress("adr_...")
fromAddress, _ := client.GetAddress("adr_...")

firstShipment := &easypost.Shipment{
Parcel: &easypost.Parcel{
PredefinedPackage: "FedExBox",
Weight: 10.4,
Weight: 10.2,
},
}

secondShipment := &easypost.Shipment{
Parcel: &easypost.Parcel{
PredefinedPackage: "FedExBox",
Expand Down
1 change: 0 additions & 1 deletion official/docs/node/current/orders/one-call-buy.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const client = new EasyPostClient('EASYPOST_API_KEY');
shipments: [
{
parcel: {
predefined_package: 'FedExBox',
weight: 10.2,
},
},
Expand Down
1 change: 0 additions & 1 deletion official/docs/python/current/orders/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
shipments=[
{
"parcel": {
"predefined_package": "FedExBox",
"weight": 10.2,
}
},
Expand Down
1 change: 0 additions & 1 deletion official/docs/python/current/orders/one-call-buy.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
shipments=[
{
"parcel": {
"predefined_package": "FedExBox",
"weight": 10.2,
}
},
Expand Down
Loading
Loading