Skip to content

Commit d2c1ff8

Browse files
authored
Merge pull request #12 from 1415003719/2025-07
support 2025-07 version
2 parents 069b7d0 + 356129f commit d2c1ff8

21 files changed

+118
-38
lines changed

README.md

Lines changed: 81 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ Each SDK version is designed to work with a specific API version. Please refer t
4242

4343
| SDK Version | Supported API Version | Branch |
4444
| ----------- | --------------------- | ----------------------------------------------------------- |
45+
| 10.x.x | 2025-07 | https://github.com/AfterShip/tracking-sdk-java/tree/2025-07 |
4546
| 9.x.x | 2025-04 | https://github.com/AfterShip/tracking-sdk-java/tree/2025-04 |
4647
| 8.x.x | 2025-01 | https://github.com/AfterShip/tracking-sdk-java/tree/2025-01 |
4748
| 7.x.x | 2024-10 | https://github.com/AfterShip/tracking-sdk-java/tree/2024-10 |
@@ -108,7 +109,7 @@ public class App {
108109

109110
## Rate Limiter
110111

111-
See the [Rate Limit](https://www.aftership.com/docs/tracking/2025-04/quickstart/rate-limit) to understand the AfterShip rate limit policy.
112+
See the [Rate Limit](https://www.aftership.com/docs/tracking/2025-07/quickstart/rate-limit) to understand the AfterShip rate limit policy.
112113

113114
## Error Handling
114115

@@ -253,6 +254,61 @@ DetectCourierResponse response = CourierResource.detectCourier()
253254
System.out.println(response.getTotal());
254255
```
255256

257+
### /courier-connections
258+
259+
**POST** /courier-connections
260+
261+
```java
262+
PostCourierConnectionsRequest courierConnectionsRequest = new PostCourierConnectionsRequest();
263+
courierConnectionsRequest.setCourierSlug("dhl-api");
264+
Map credentials = new HashMap();
265+
credentials.put("api_key", "<dhl_pai_key>");
266+
courierConnectionsRequest.setCredentials(credentials);
267+
CourierConnection courierConnection = CourierConnectionResource.postCourierConnections()
268+
.setPostCourierConnectionsRequest(courierConnectionsRequest)
269+
.create();
270+
System.out.println(courierConnection.getId());
271+
```
272+
273+
**GET** /courier-connections
274+
275+
```java
276+
Page<CourierConnection> getCourierConnectionsResponse = CourierConnectionResource.getCourierConnections()
277+
.read();
278+
System.out.println(getCourierConnectionsResponse.getTotal());
279+
```
280+
281+
**GET** /courier-connections/:id
282+
283+
```java
284+
CourierConnection courierConnection = CourierConnectionResource.getCourierConnectionsById()
285+
.setId("<id>")
286+
.fetch();
287+
System.out.println(courierConnection.getCourierSlug());
288+
```
289+
290+
**PATCH** /courier-connections/:id
291+
292+
```java
293+
PutCourierConnectionsByIdRequest putCourierConnectionsByIdRequest = new PutCourierConnectionsByIdRequest();
294+
Map credentials = new HashMap();
295+
credentials.put("api_key", "<dhl_api_key>");
296+
putCourierConnectionsByIdRequest.setCredentials(credentials);
297+
CourierConnection courierConnection = CourierConnectionResource.putCourierConnectionsById()
298+
.setId("<id>")
299+
.setPutCourierConnectionsByIdRequest(putCourierConnectionsByIdRequest)
300+
.update();
301+
System.out.println(courierConnection.getCourierSlug());
302+
```
303+
304+
**DELETE** /courier-connections/:id
305+
306+
```java
307+
CourierConnection courierConnection = CourierConnectionResource.deleteCourierConnectionsById()
308+
.setId("<id>")
309+
.delete();
310+
System.out.println(courierConnection.getCourierSlug());
311+
```
256312
### /estimated-delivery-date
257313

258314
**POST** /estimated-delivery-date/predict-batch
@@ -280,6 +336,30 @@ PredictBatchResponse response = EstimatedDeliveryDateResource.predictBatch()
280336
System.out.println(response.getEstimatedDeliveryDates().get(0).getSlug());
281337
```
282338

339+
**POST** /estimated-delivery-date/predict
340+
341+
```java
342+
EstimatedDeliveryDateRequest edd = new EstimatedDeliveryDateRequest();
343+
edd.setSlug("<slug>");
344+
DestinationAddressEstimatedDeliveryDateRequest dest = new DestinationAddressEstimatedDeliveryDateRequest();
345+
dest.setCountryRegion("<ISO 3166-1 country/region code>");
346+
dest.setState("<ISO 3166-1 country/region code>");
347+
348+
edd.setDestinationAddress( dest);
349+
350+
OriginAddressEstimatedDeliveryDateRequest origin = new OriginAddressEstimatedDeliveryDateRequest();
351+
origin.setCountryRegion("<ISO 3166-1 country/region code>");
352+
origin.setState("<ISO 3166-1 country/region code>");
353+
edd.setOriginAddress(origin);
354+
355+
edd.setPickupTime("2024-08-01 06:42:30");
356+
357+
EstimatedDeliveryDateResponse response = EstimatedDeliveryDateResource.predict()
358+
.setEstimatedDeliveryDateRequest(edd)
359+
.create();
360+
System.out.println(response.getId());
361+
```
362+
283363
## Help
284364

285365
If you get stuck, we're here to help:

src/main/java/com/aftership/courier/CourierResource.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
import com.aftership.base.Resource;
88

99
public class CourierResource extends Resource {
10-
public static DetectCourierCreator detectCourier() {
11-
return new DetectCourierCreator();
12-
}
13-
1410
public static GetCouriersFetcher getCouriers() {
1511
return new GetCouriersFetcher();
1612
}
13+
14+
public static DetectCourierCreator detectCourier() {
15+
return new DetectCourierCreator();
16+
}
1717
}

src/main/java/com/aftership/courier/DetectCourierCreator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public DetectCourierCreator setDetectCourierRequest(DetectCourierRequest detectC
4343

4444
@Override
4545
public DetectCourierResponse create(AfterShipClient client) throws Exception {
46-
String path = "/tracking/2025-04/couriers/detect";
46+
String path = "/tracking/2025-07/couriers/detect";
4747
Request request = new Request(HttpMethod.POST, path);
4848
request.setBody((new Gson()).toJson(detectCourierRequest));
4949

src/main/java/com/aftership/courier/GetCouriersFetcher.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public GetCouriersFetcher setSlug(String slug) {
4949

5050
@Override
5151
public GetCouriersResponse fetch(AfterShipClient client) throws Exception {
52-
String path = "/tracking/2025-04/couriers";
52+
String path = "/tracking/2025-07/couriers";
5353
Request request = new Request(HttpMethod.GET, path);
5454
addQueryParams(request);
5555
setHeaderParams(request);

src/main/java/com/aftership/courier_connection/CourierConnectionResource.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ public static GetCourierConnectionsByIdFetcher getCourierConnectionsById() {
1111
return new GetCourierConnectionsByIdFetcher();
1212
}
1313

14-
public static GetCourierConnectionsReader getCourierConnections() {
15-
return new GetCourierConnectionsReader();
14+
public static DeleteCourierConnectionsByIdDeleter deleteCourierConnectionsById() {
15+
return new DeleteCourierConnectionsByIdDeleter();
1616
}
1717

1818
public static PutCourierConnectionsByIdUpdater putCourierConnectionsById() {
1919
return new PutCourierConnectionsByIdUpdater();
2020
}
2121

22-
public static DeleteCourierConnectionsByIdDeleter deleteCourierConnectionsById() {
23-
return new DeleteCourierConnectionsByIdDeleter();
22+
public static GetCourierConnectionsReader getCourierConnections() {
23+
return new GetCourierConnectionsReader();
2424
}
2525

2626
public static PostCourierConnectionsCreator postCourierConnections() {

src/main/java/com/aftership/courier_connection/DeleteCourierConnectionsByIdDeleter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public CourierConnection delete(AfterShipClient client) throws Exception {
4949
ErrorEnum.BAD_REQUEST.getCode(),
5050
ErrorEnum.BAD_REQUEST.getMessage() + ": `id` is invalid");
5151
}
52-
String path = String.format("/tracking/2025-04/courier-connections/%s", id);
52+
String path = String.format("/tracking/2025-07/courier-connections/%s", id);
5353
Request request = new Request(HttpMethod.DELETE, path);
5454
setHeaderParams(request);
5555
Response response = client.request(request);

src/main/java/com/aftership/courier_connection/GetCourierConnectionsByIdFetcher.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public CourierConnection fetch(AfterShipClient client) throws Exception {
4949
ErrorEnum.BAD_REQUEST.getCode(),
5050
ErrorEnum.BAD_REQUEST.getMessage() + ": `id` is invalid");
5151
}
52-
String path = String.format("/tracking/2025-04/courier-connections/%s", id);
52+
String path = String.format("/tracking/2025-07/courier-connections/%s", id);
5353
Request request = new Request(HttpMethod.GET, path);
5454
setHeaderParams(request);
5555
Response response = client.request(request);

src/main/java/com/aftership/courier_connection/GetCourierConnectionsReader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public GetCourierConnectionsReader setLimit(String limit) {
5858

5959
@Override
6060
public Page<CourierConnection> read(AfterShipClient client) throws Exception {
61-
String path = "/tracking/2025-04/courier-connections";
61+
String path = "/tracking/2025-07/courier-connections";
6262
Request request = new Request(HttpMethod.GET, path);
6363
addQueryParams(request);
6464
setHeaderParams(request);

src/main/java/com/aftership/courier_connection/PostCourierConnectionsCreator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public PostCourierConnectionsCreator setPostCourierConnectionsRequest(
4444

4545
@Override
4646
public CourierConnection create(AfterShipClient client) throws Exception {
47-
String path = "/tracking/2025-04/courier-connections";
47+
String path = "/tracking/2025-07/courier-connections";
4848
Request request = new Request(HttpMethod.POST, path);
4949
request.setBody((new Gson()).toJson(postCourierConnectionsRequest));
5050

src/main/java/com/aftership/courier_connection/PutCourierConnectionsByIdUpdater.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public CourierConnection update(AfterShipClient client) throws Exception {
5858
ErrorEnum.BAD_REQUEST.getCode(),
5959
ErrorEnum.BAD_REQUEST.getMessage() + ": `id` is invalid");
6060
}
61-
String path = String.format("/tracking/2025-04/courier-connections/%s", id);
61+
String path = String.format("/tracking/2025-07/courier-connections/%s", id);
6262
Request request = new Request(HttpMethod.PATCH, path);
6363
request.setBody((new Gson()).toJson(putCourierConnectionsByIdRequest));
6464

0 commit comments

Comments
 (0)