Skip to content

Commit a51b212

Browse files
authored
Merge pull request #20 from 1415003719/2025-07
support 2025-07
2 parents 60e96b4 + 77fdc84 commit a51b212

15 files changed

+91
-91
lines changed

README.md

Lines changed: 2 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+
| 12.x.x | 2025-07 | https://github.com/AfterShip/tracking-sdk-php/tree/2025-07 |
4546
| 11.x.x | 2025-04 | https://github.com/AfterShip/tracking-sdk-php/tree/2025-04 |
4647
| 10.x.x | 2025-01 | https://github.com/AfterShip/tracking-sdk-php/tree/2025-01 |
4748
| 9.x.x | 2024-10 | https://github.com/AfterShip/tracking-sdk-php/tree/2024-10 |
@@ -97,7 +98,7 @@ try {
9798

9899
## Rate Limiter
99100

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

102103
## Error Handling
103104

src/API/Courier.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,32 +23,32 @@ public function __construct(Http $httpClient)
2323
/**
2424
* @throws AfterShipError
2525
*/
26-
public function getCouriers(
27-
GetCouriersQuery $query = null,
26+
public function detectCourier(
27+
\Tracking\API\Courier\DetectCourierRequest $body,
2828
array $headers = []
29-
): \Tracking\API\Courier\GetCouriersResponse {
29+
): \Tracking\API\Courier\DetectCourierResponse {
3030
$options = [
3131
'headers' => $headers,
32-
'query' => $query ? $query->toArray() : [],
32+
33+
'json' => $body->toRequestArray(),
3334
];
34-
$resp = $this->httpClient->request('GET', sprintf("/tracking/2025-04/couriers"), $options);
35+
$resp = $this->httpClient->request('POST', sprintf("/tracking/2025-07/couriers/detect"), $options);
3536

36-
return $this->parseSingleResource($resp, \Tracking\API\Courier\GetCouriersResponse::class);
37+
return $this->parseSingleResource($resp, \Tracking\API\Courier\DetectCourierResponse::class);
3738
}
3839
/**
3940
* @throws AfterShipError
4041
*/
41-
public function detectCourier(
42-
\Tracking\API\Courier\DetectCourierRequest $body,
42+
public function getCouriers(
43+
GetCouriersQuery $query = null,
4344
array $headers = []
44-
): \Tracking\API\Courier\DetectCourierResponse {
45+
): \Tracking\API\Courier\GetCouriersResponse {
4546
$options = [
4647
'headers' => $headers,
47-
48-
'json' => $body->toRequestArray(),
48+
'query' => $query ? $query->toArray() : [],
4949
];
50-
$resp = $this->httpClient->request('POST', sprintf("/tracking/2025-04/couriers/detect"), $options);
50+
$resp = $this->httpClient->request('GET', sprintf("/tracking/2025-07/couriers"), $options);
5151

52-
return $this->parseSingleResource($resp, \Tracking\API\Courier\DetectCourierResponse::class);
52+
return $this->parseSingleResource($resp, \Tracking\API\Courier\GetCouriersResponse::class);
5353
}
5454
}

src/API/CourierConnection.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,20 @@ public function __construct(Http $httpClient)
2323
/**
2424
* @throws AfterShipError
2525
*/
26-
public function putCourierConnectionsById(
26+
public function getCourierConnectionsById(
2727
string $id,
28-
\Tracking\API\CourierConnection\PutCourierConnectionsByIdRequest $body,
2928
array $headers = []
30-
): \Tracking\API\CourierConnection\PutCourierConnectionsByIdResponse {
29+
): \Tracking\API\CourierConnection\GetCourierConnectionsByIdResponse {
3130
if ($id === "") {
3231
throw ErrorCode::genLocalError(ErrorCode::INVALID_REQUEST, "Param 'id' cannot be an empty string");
3332
}
3433

3534
$options = [
3635
'headers' => $headers,
37-
38-
'json' => $body->toRequestArray(),
3936
];
40-
$resp = $this->httpClient->request('PATCH', sprintf("/tracking/2025-04/courier-connections/%s", $id), $options);
37+
$resp = $this->httpClient->request('GET', sprintf("/tracking/2025-07/courier-connections/%s", $id), $options);
4138

42-
return $this->parseSingleResource($resp, \Tracking\API\CourierConnection\PutCourierConnectionsByIdResponse::class);
39+
return $this->parseSingleResource($resp, \Tracking\API\CourierConnection\GetCourierConnectionsByIdResponse::class);
4340
}
4441
/**
4542
* @throws AfterShipError
@@ -52,7 +49,7 @@ public function getCourierConnections(
5249
'headers' => $headers,
5350
'query' => $query ? $query->toArray() : [],
5451
];
55-
$resp = $this->httpClient->request('GET', sprintf("/tracking/2025-04/courier-connections"), $options);
52+
$resp = $this->httpClient->request('GET', sprintf("/tracking/2025-07/courier-connections"), $options);
5653

5754
return $this->parseSingleResource($resp, \Tracking\API\CourierConnection\GetCourierConnectionsResponse::class);
5855
}
@@ -68,27 +65,30 @@ public function postCourierConnections(
6865

6966
'json' => $body->toRequestArray(),
7067
];
71-
$resp = $this->httpClient->request('POST', sprintf("/tracking/2025-04/courier-connections"), $options);
68+
$resp = $this->httpClient->request('POST', sprintf("/tracking/2025-07/courier-connections"), $options);
7269

7370
return $this->parseSingleResource($resp, \Tracking\API\CourierConnection\PostCourierConnectionsResponse::class);
7471
}
7572
/**
7673
* @throws AfterShipError
7774
*/
78-
public function getCourierConnectionsById(
75+
public function putCourierConnectionsById(
7976
string $id,
77+
\Tracking\API\CourierConnection\PutCourierConnectionsByIdRequest $body,
8078
array $headers = []
81-
): \Tracking\API\CourierConnection\GetCourierConnectionsByIdResponse {
79+
): \Tracking\API\CourierConnection\PutCourierConnectionsByIdResponse {
8280
if ($id === "") {
8381
throw ErrorCode::genLocalError(ErrorCode::INVALID_REQUEST, "Param 'id' cannot be an empty string");
8482
}
8583

8684
$options = [
8785
'headers' => $headers,
86+
87+
'json' => $body->toRequestArray(),
8888
];
89-
$resp = $this->httpClient->request('GET', sprintf("/tracking/2025-04/courier-connections/%s", $id), $options);
89+
$resp = $this->httpClient->request('PATCH', sprintf("/tracking/2025-07/courier-connections/%s", $id), $options);
9090

91-
return $this->parseSingleResource($resp, \Tracking\API\CourierConnection\GetCourierConnectionsByIdResponse::class);
91+
return $this->parseSingleResource($resp, \Tracking\API\CourierConnection\PutCourierConnectionsByIdResponse::class);
9292
}
9393
/**
9494
* @throws AfterShipError
@@ -104,7 +104,7 @@ public function deleteCourierConnectionsById(
104104
$options = [
105105
'headers' => $headers,
106106
];
107-
$resp = $this->httpClient->request('DELETE', sprintf("/tracking/2025-04/courier-connections/%s", $id), $options);
107+
$resp = $this->httpClient->request('DELETE', sprintf("/tracking/2025-07/courier-connections/%s", $id), $options);
108108

109109
return $this->parseSingleResource($resp, \Tracking\API\CourierConnection\DeleteCourierConnectionsByIdResponse::class);
110110
}

src/API/EstimatedDeliveryDate.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function predict(
3131

3232
'json' => $body->toRequestArray(),
3333
];
34-
$resp = $this->httpClient->request('POST', sprintf("/tracking/2025-04/estimated-delivery-date/predict"), $options);
34+
$resp = $this->httpClient->request('POST', sprintf("/tracking/2025-07/estimated-delivery-date/predict"), $options);
3535

3636
return $this->parseSingleResource($resp, \Tracking\API\EstimatedDeliveryDate\PredictResponse::class);
3737
}
@@ -47,7 +47,7 @@ public function predictBatch(
4747

4848
'json' => $body->toRequestArray(),
4949
];
50-
$resp = $this->httpClient->request('POST', sprintf("/tracking/2025-04/estimated-delivery-date/predict-batch"), $options);
50+
$resp = $this->httpClient->request('POST', sprintf("/tracking/2025-07/estimated-delivery-date/predict-batch"), $options);
5151

5252
return $this->parseSingleResource($resp, \Tracking\API\EstimatedDeliveryDate\PredictBatchResponse::class);
5353
}

src/API/Tracking.php

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
use Tracking\Exception\AfterShipError;
1010
use Tracking\Exception\ErrorCode;
1111
use Tracking\Transport\Http;
12-
use Tracking\API\Tracking\GetTrackingsQuery;
1312
use Tracking\API\Tracking\GetTrackingByIdQuery;
13+
use Tracking\API\Tracking\GetTrackingsQuery;
1414

1515
class Tracking extends APIBase
1616
{
@@ -24,33 +24,41 @@ public function __construct(Http $httpClient)
2424
/**
2525
* @throws AfterShipError
2626
*/
27-
public function getTrackings(
28-
GetTrackingsQuery $query = null,
27+
public function updateTrackingById(
28+
string $id,
29+
\Tracking\API\Tracking\UpdateTrackingByIdRequest $body,
2930
array $headers = []
30-
): \Tracking\API\Tracking\GetTrackingsResponse {
31+
): \Tracking\API\Tracking\UpdateTrackingByIdResponse {
32+
if ($id === "") {
33+
throw ErrorCode::genLocalError(ErrorCode::INVALID_REQUEST, "Param 'id' cannot be an empty string");
34+
}
35+
3136
$options = [
3237
'headers' => $headers,
33-
'query' => $query ? $query->toArray() : [],
38+
39+
'json' => $body->toRequestArray(),
3440
];
35-
$resp = $this->httpClient->request('GET', sprintf("/tracking/2025-04/trackings"), $options);
41+
$resp = $this->httpClient->request('PUT', sprintf("/tracking/2025-07/trackings/%s", $id), $options);
3642

37-
return $this->parseSingleResource($resp, \Tracking\API\Tracking\GetTrackingsResponse::class);
43+
return $this->parseSingleResource($resp, \Tracking\API\Tracking\UpdateTrackingByIdResponse::class);
3844
}
3945
/**
4046
* @throws AfterShipError
4147
*/
42-
public function createTracking(
43-
\Tracking\API\Tracking\CreateTrackingRequest $body,
48+
public function deleteTrackingById(
49+
string $id,
4450
array $headers = []
45-
): \Tracking\API\Tracking\CreateTrackingResponse {
51+
): \Tracking\API\Tracking\DeleteTrackingByIdResponse {
52+
if ($id === "") {
53+
throw ErrorCode::genLocalError(ErrorCode::INVALID_REQUEST, "Param 'id' cannot be an empty string");
54+
}
55+
4656
$options = [
4757
'headers' => $headers,
48-
49-
'json' => $body->toRequestArray(),
5058
];
51-
$resp = $this->httpClient->request('POST', sprintf("/tracking/2025-04/trackings"), $options);
59+
$resp = $this->httpClient->request('DELETE', sprintf("/tracking/2025-07/trackings/%s", $id), $options);
5260

53-
return $this->parseSingleResource($resp, \Tracking\API\Tracking\CreateTrackingResponse::class);
61+
return $this->parseSingleResource($resp, \Tracking\API\Tracking\DeleteTrackingByIdResponse::class);
5462
}
5563
/**
5664
* @throws AfterShipError
@@ -68,51 +76,40 @@ public function getTrackingById(
6876
'headers' => $headers,
6977
'query' => $query ? $query->toArray() : [],
7078
];
71-
$resp = $this->httpClient->request('GET', sprintf("/tracking/2025-04/trackings/%s", $id), $options);
79+
$resp = $this->httpClient->request('GET', sprintf("/tracking/2025-07/trackings/%s", $id), $options);
7280

7381
return $this->parseSingleResource($resp, \Tracking\API\Tracking\GetTrackingByIdResponse::class);
7482
}
7583
/**
7684
* @throws AfterShipError
7785
*/
78-
public function markTrackingCompletedById(
79-
string $id,
80-
\Tracking\API\Tracking\MarkTrackingCompletedByIdRequest $body,
86+
public function getTrackings(
87+
GetTrackingsQuery $query = null,
8188
array $headers = []
82-
): \Tracking\API\Tracking\MarkTrackingCompletedByIdResponse {
83-
if ($id === "") {
84-
throw ErrorCode::genLocalError(ErrorCode::INVALID_REQUEST, "Param 'id' cannot be an empty string");
85-
}
86-
89+
): \Tracking\API\Tracking\GetTrackingsResponse {
8790
$options = [
8891
'headers' => $headers,
89-
90-
'json' => $body->toRequestArray(),
92+
'query' => $query ? $query->toArray() : [],
9193
];
92-
$resp = $this->httpClient->request('POST', sprintf("/tracking/2025-04/trackings/%s/mark-as-completed", $id), $options);
94+
$resp = $this->httpClient->request('GET', sprintf("/tracking/2025-07/trackings"), $options);
9395

94-
return $this->parseSingleResource($resp, \Tracking\API\Tracking\MarkTrackingCompletedByIdResponse::class);
96+
return $this->parseSingleResource($resp, \Tracking\API\Tracking\GetTrackingsResponse::class);
9597
}
9698
/**
9799
* @throws AfterShipError
98100
*/
99-
public function updateTrackingById(
100-
string $id,
101-
\Tracking\API\Tracking\UpdateTrackingByIdRequest $body,
101+
public function createTracking(
102+
\Tracking\API\Tracking\CreateTrackingRequest $body,
102103
array $headers = []
103-
): \Tracking\API\Tracking\UpdateTrackingByIdResponse {
104-
if ($id === "") {
105-
throw ErrorCode::genLocalError(ErrorCode::INVALID_REQUEST, "Param 'id' cannot be an empty string");
106-
}
107-
104+
): \Tracking\API\Tracking\CreateTrackingResponse {
108105
$options = [
109106
'headers' => $headers,
110107

111108
'json' => $body->toRequestArray(),
112109
];
113-
$resp = $this->httpClient->request('PUT', sprintf("/tracking/2025-04/trackings/%s", $id), $options);
110+
$resp = $this->httpClient->request('POST', sprintf("/tracking/2025-07/trackings"), $options);
114111

115-
return $this->parseSingleResource($resp, \Tracking\API\Tracking\UpdateTrackingByIdResponse::class);
112+
return $this->parseSingleResource($resp, \Tracking\API\Tracking\CreateTrackingResponse::class);
116113
}
117114
/**
118115
* @throws AfterShipError
@@ -128,26 +125,29 @@ public function retrackTrackingById(
128125
$options = [
129126
'headers' => $headers,
130127
];
131-
$resp = $this->httpClient->request('POST', sprintf("/tracking/2025-04/trackings/%s/retrack", $id), $options);
128+
$resp = $this->httpClient->request('POST', sprintf("/tracking/2025-07/trackings/%s/retrack", $id), $options);
132129

133130
return $this->parseSingleResource($resp, \Tracking\API\Tracking\RetrackTrackingByIdResponse::class);
134131
}
135132
/**
136133
* @throws AfterShipError
137134
*/
138-
public function deleteTrackingById(
135+
public function markTrackingCompletedById(
139136
string $id,
137+
\Tracking\API\Tracking\MarkTrackingCompletedByIdRequest $body,
140138
array $headers = []
141-
): \Tracking\API\Tracking\DeleteTrackingByIdResponse {
139+
): \Tracking\API\Tracking\MarkTrackingCompletedByIdResponse {
142140
if ($id === "") {
143141
throw ErrorCode::genLocalError(ErrorCode::INVALID_REQUEST, "Param 'id' cannot be an empty string");
144142
}
145143

146144
$options = [
147145
'headers' => $headers,
146+
147+
'json' => $body->toRequestArray(),
148148
];
149-
$resp = $this->httpClient->request('DELETE', sprintf("/tracking/2025-04/trackings/%s", $id), $options);
149+
$resp = $this->httpClient->request('POST', sprintf("/tracking/2025-07/trackings/%s/mark-as-completed", $id), $options);
150150

151-
return $this->parseSingleResource($resp, \Tracking\API\Tracking\DeleteTrackingByIdResponse::class);
151+
return $this->parseSingleResource($resp, \Tracking\API\Tracking\MarkTrackingCompletedByIdResponse::class);
152152
}
153153
}

src/API/Tracking/LatestEstimatedDeliveryCreateTrackingResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class LatestEstimatedDeliveryCreateTrackingResponse extends Base
3030
*/
3131
public $datetime_max;
3232
/**
33-
* @var string|null Explains the reason for a change to the latest_estimated_delivery. This string will only have a value if:1. The source for the latest EDD is AfterShip EDD. 2. The reason for the change is known.For a comprehensive list of reasons, please refer to this document.
33+
* @var string|null Explains the reason for a change to the latest_estimated_delivery. This string will only have a value if:1. The source for the latest EDD is AfterShip EDD. 2. The reason for the change is known.For a comprehensive list of reasons, please refer to .
3434
*/
3535
public $revise_reason;
3636
}

src/API/Tracking/LatestEstimatedDeliveryDeleteTrackingByIdResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class LatestEstimatedDeliveryDeleteTrackingByIdResponse extends Base
3030
*/
3131
public $datetime_max;
3232
/**
33-
* @var string|null Explains the reason for a change to the latest_estimated_delivery. This string will only have a value if:1. The source for the latest EDD is AfterShip EDD. 2. The reason for the change is known.For a comprehensive list of reasons, please refer to this document.
33+
* @var string|null Explains the reason for a change to the latest_estimated_delivery. This string will only have a value if:1. The source for the latest EDD is AfterShip EDD. 2. The reason for the change is known.For a comprehensive list of reasons, please refer to .
3434
*/
3535
public $revise_reason;
3636
}

src/API/Tracking/LatestEstimatedDeliveryGetTrackingByIdResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class LatestEstimatedDeliveryGetTrackingByIdResponse extends Base
3030
*/
3131
public $datetime_max;
3232
/**
33-
* @var string|null Explains the reason for a change to the latest_estimated_delivery. This string will only have a value if:1. The source for the latest EDD is AfterShip EDD. 2. The reason for the change is known.For a comprehensive list of reasons, please refer to this document.
33+
* @var string|null Explains the reason for a change to the latest_estimated_delivery. This string will only have a value if:1. The source for the latest EDD is AfterShip EDD. 2. The reason for the change is known.For a comprehensive list of reasons, please refer to .
3434
*/
3535
public $revise_reason;
3636
}

src/API/Tracking/LatestEstimatedDeliveryMarkTrackingCompletedByIdResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class LatestEstimatedDeliveryMarkTrackingCompletedByIdResponse extends Base
3030
*/
3131
public $datetime_max;
3232
/**
33-
* @var string|null Explains the reason for a change to the latest_estimated_delivery. This string will only have a value if:1. The source for the latest EDD is AfterShip EDD. 2. The reason for the change is known.For a comprehensive list of reasons, please refer to this document.
33+
* @var string|null Explains the reason for a change to the latest_estimated_delivery. This string will only have a value if:1. The source for the latest EDD is AfterShip EDD. 2. The reason for the change is known.For a comprehensive list of reasons, please refer to .
3434
*/
3535
public $revise_reason;
3636
}

src/API/Tracking/LatestEstimatedDeliveryRetrackTrackingByIdResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class LatestEstimatedDeliveryRetrackTrackingByIdResponse extends Base
3030
*/
3131
public $datetime_max;
3232
/**
33-
* @var string|null Explains the reason for a change to the latest_estimated_delivery. This string will only have a value if:1. The source for the latest EDD is AfterShip EDD. 2. The reason for the change is known.For a comprehensive list of reasons, please refer to this document.
33+
* @var string|null Explains the reason for a change to the latest_estimated_delivery. This string will only have a value if:1. The source for the latest EDD is AfterShip EDD. 2. The reason for the change is known.For a comprehensive list of reasons, please refer to .
3434
*/
3535
public $revise_reason;
3636
}

0 commit comments

Comments
 (0)