Skip to content

Conversation

@LoganSimonsen
Copy link
Contributor

When creating a User via POST /v2/users, the EasyPost API returns an api_keys array on the User object.

The Java client currently drops this field during deserialization, which forces consumers to call GET /v2/api_keys and filter the results in memory. This can be inefficient at scale.

This PR:

  • Adds @SerializedName("api_keys") private List<ApiKey> apiKeys; to BaseUser

This is a backwards-compatible change that simply exposes existing response data and aligns the Java client behavior with other EasyPost client libraries.

@LoganSimonsen LoganSimonsen requested review from a team as code owners December 1, 2025 22:36
ReferralCustomer extends BaseUser, which now has the apiKeys field.
Having apiKeys in both classes causes a Gson duplicate field error
during JSON deserialization.
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.

We'll want some changes here

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.

This should do the trick, though we can't test it via our test suite because we redact the api_keys key in cassettes. I'll release this then give it a whirl before letting the customer know.

We don't typically use the serialized name annotation so I removed it. We use a package lombok which automatically adds getters and automagically knows the names of the keys based on casing.

@Justintime50 Justintime50 merged commit 7cdc33e into EasyPost:master Dec 1, 2025
21 checks passed
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.

3 participants