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

Update README #579

Merged
merged 1 commit into from
Aug 2, 2024
Merged
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
83 changes: 42 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,60 +22,61 @@ A simple create & buy shipment example:

```csharp
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using EasyPost;
using Newtonsoft.Json;
using EasyPost.Parameters;

namespace example
namespace Example;

class ExampleClass
{
class exampleClass
static async Task Main()
{
static async Task Main()
var client = new Client(new ClientConfiguration(Environment.GetEnvironmentVariable("EASYPOST_API_KEY")));

var createParameters = new EasyPost.Parameters.Shipment.Create()
{
Client client = new Client(new ClientConfiguration(Environment.GetEnvironmentVariable("EASYPOST_API_KEY")));

Parameters.Shipment.Create createParameters = new() {
ToAddress = new Parameters.Address.Create {
Name = "Dr. Steve Brule",
Street1 = "179 N Harbor Dr",
City = "Redondo Beach",
State = "CA",
Zip = "90277",
Country = "US",
Phone = "8573875756",
Email = "[email protected]"
},
FromAddress = new Parameters.Address.Create {
Name = "EasyPost",
Street1 = "417 Montgomery Street",
Street2 = "5th Floor",
City = "San Francisco",
State = "CA",
Zip = "94104",
Country = "US",
Phone = "4153334445",
Email = "[email protected]"
},
Parcel = new Parameters.Parcel.Create {
Length = 20.2,
Width = 10.9,
Height = 5,
Weight = 65.9
}
ToAddress = new EasyPost.Parameters.Address.Create
{
Name = "Dr. Steve Brule",
Street1 = "179 N Harbor Dr",
City = "Redondo Beach",
State = "CA",
Zip = "90277",
Country = "US",
Phone = "8573875756",
Email = "[email protected]"
},
FromAddress = new EasyPost.Parameters.Address.Create
{
Name = "EasyPost",
Street1 = "417 Montgomery Street",
Street2 = "5th Floor",
City = "San Francisco",
State = "CA",
Zip = "94104",
Country = "US",
Phone = "4153334445",
Email = "[email protected]"
},
Parcel = new EasyPost.Parameters.Parcel.Create
{
Length = 20.2,
Width = 10.9,
Height = 5,
Weight = 65.9
}
};

Shipment shipment = await client.Shipment.Create(parameters);
var shipment = await client.Shipment.Create(createParameters);

Rate rate = shipment.LowestRate();
var rate = shipment.LowestRate();

Paramaters.Shipment.Buy buyParameters = new(rate);
var buyParameters = new EasyPost.Parameters.Shipment.Buy(rate);

Shipment purchasedShipment = await client.Shipment.Buy(shipment.Id, buyParameters);
var purchasedShipment = await client.Shipment.Buy(shipment.Id, buyParameters);

Console.WriteLine(JsonConvert.SerializeObject(purchasedShipment, Formatting.Indented));
}
Console.WriteLine(JsonConvert.SerializeObject(purchasedShipment, Formatting.Indented));
}
}
```
Expand Down
Loading