Skip to content

Commit 29ee1d7

Browse files
committed
feat: add tracking_codes to tracker index endpoint
1 parent bdcac18 commit 29ee1d7

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## Next Release
44

55
- Adds `WebhookCustomHeader` model, allowing `custom_headers` to be passed when creating/updating a webhook
6+
- Adds `tracking_codes` param to tracker index endpoint
67
- Fixes error parsing
78
- Allows for alternative format of `errors` field (previously we deserialized the `errors` field into a list of `Error` objects; however, sometimes the errors are simply a list of strings. This change make the `errors` field a list of `Object` allowing for either the new `FieldError` object or a list of strings. Users will need to check for the type of error returned and handle appropriately)
89
- Removed the unused `Error` model

src/main/java/com/easypost/model/TrackerCollection.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ public class TrackerCollection extends PaginatedCollection<Tracker> {
1414
@Setter
1515
private String trackingCode;
1616

17+
@Setter
18+
private List<String> trackingCodes;
19+
1720
@Setter
1821
private String carrier;
1922

@@ -33,6 +36,9 @@ protected final Map<String, Object> buildNextPageParameters(List<Tracker> tracke
3336
if (trackingCode != null) {
3437
parameters.put("tracking_code", trackingCode);
3538
}
39+
if (trackingCodes != null) {
40+
parameters.put("tracking_codes", trackingCodes);
41+
}
3642
if (carrier != null) {
3743
parameters.put("carrier", carrier);
3844
}

src/main/java/com/easypost/service/TrackerService.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ public TrackerCollection all(final Map<String, Object> params) throws EasyPostEx
6868
Requestor.request(RequestMethod.GET, endpoint, params, TrackerCollection.class, client);
6969
// we store the params in the collection so that we can use them to get the next page
7070
trackerCollection.setTrackingCode(InternalUtilities.getOrDefault(params, "tracking_code", null));
71+
trackerCollection.setTrackingCodes(InternalUtilities.getOrDefault(params, "tracking_codes", null));
7172
trackerCollection.setCarrier(InternalUtilities.getOrDefault(params, "carrier", null));
7273

7374
return trackerCollection;

0 commit comments

Comments
 (0)