Skip to content

Conversation

@hollyabrams
Copy link
Contributor

No description provided.

@hollyabrams hollyabrams requested a review from a team as a code owner July 1, 2025 15:21
Copy link
Member

@Justintime50 Justintime50 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went halfway through the PR and found a few issues that need to be resolved.

Best way to verify these work as intended is to write them up (as you've done, nice work - I know it can be a lot!) and then actually run them to ensure the response we got back made sense and there weren't any syntax errors or missing params. To go along with our promise that all examples are runnable (except for replacing IDs as needed), this is the perfect way to verify since it'll be just like a user copy/pasting the example.

If we can fix these few issues and run each one to ensure it's setup correct, we'll be golden!

Comment on lines 13 to 21
var client = new EasyPost.Client(new EasyPost.ClientConfiguration("EASYPOST_API_KEY"));
EasyPost.Models.API.Shipment shipment = await client.Shipment.Retrieve("shp_...");
shipment = await client.Shipment.Luma(
shipment.Id,
rulesetName: "ruleset_name",
plannedShipDate: "2025-07-03",
deliverByDate: "2025-07-06"
);
Console.WriteLine(JsonConvert.SerializeObject(shipment, Formatting.Indented));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: let's split each of these statements by an empty line like other examples are


func buy() {
client := easypost.New("EASYPOST_API_KEY")
shipment, _ := client.CreateShipment(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: this is creating a shipment, not buying with luma


func oneCallBuy() {
client := easypost.New("EASYPOST_API_KEY")
shipment, _ := client.CreateShipment(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: this is creating a shipment, not buying with luma


func promise() {
client := easypost.New("EASYPOST_API_KEY")
shipment, _ := client.CreateShipment(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: this is creating a shipment, not getting the promise with luma

public static void main(String[] args) throws Exception {
EasyPostClient client = new EasyPostClient("EASYPOST_API_KEY");
Shipment shipment = client.shipment.create(
Map.of(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: we don't use Map.of anywhere else in our examples, can we instead set it up like the others? (though, I do like this so maybe holistically we can replace the Java ones to clean them up!)

EasyPostClient client = new EasyPostClient("EASYPOST_API_KEY");
Shipment lumaPromise = client.shipment.lumaPromise(
Map.of(
"shipment", Map.of(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: same as above with Map.of

const api = new EasyPost('EASYPOST_API_KEY');

(async () => {
const shipment = await api.Shipment.create({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: this only creates a shipment, not buys it with luma

const client = new EasyPostClient('EASYPOST_API_KEY');

(async () => {
const promise = await client.Shipment.lumaPromise({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: lumaPromise is not defined, it's probably client.Luma.promise or similar

Copy link
Member

@Justintime50 Justintime50 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really close! There's a couple of small consistency things, then let's get this merged!

Weight = 65.9
},
CarrierAccounts = new List<string> { "ca_..." },
PersistLabel = true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: with keeping examples as simple as possible, all extra params could(should) be left off - they'll still be defined on the docs but the snippets themselves should contain only what's necessary to get a happy response back.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, this is why running the example is important 😅

We need carrier accounts for one-call buys, we do not need persist label

shipment, _ := client.GetShipment("shp_...")
lumaRequest := &easypost.LumaRequest{
Shipment: easypost.Shipment{ID: shipment.ID},
RulesetName: "ruleset_...",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: with the consistency, we should have all examples across all libs share the same params - in this case the ruleset name should be defined the same across all

@Justintime50 Justintime50 merged commit 95e8f09 into EasyPost:master Jul 25, 2025
9 checks passed
@hollyabrams hollyabrams deleted the luma-guide-code-snippets branch July 25, 2025 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants