Skip to content

Commit 14dfce2

Browse files
authored
Merge pull request #31 from 1415003719/2025-07
update structure
2 parents cfe97fe + 343f171 commit 14dfce2

File tree

178 files changed

+1121
-4326
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

178 files changed

+1121
-4326
lines changed

README.md

Lines changed: 145 additions & 118 deletions
Large diffs are not rendered by default.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@aftership/tracking-sdk",
3-
"version": "14.0.0",
3+
"version": "15.0.0",
44
"description": "Tracking NodeJS SDK",
55
"main": "dist/aftership.js",
66
"types": "dist/aftership.d.ts",
@@ -27,7 +27,8 @@
2727
},
2828
"keywords": [
2929
"aftership",
30-
"tracking"
30+
"tracking",
31+
"dhl"
3132
],
3233
"devDependencies": {
3334
"@types/node": "^20.11.25",

src/aftership.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
* This code was auto generated by AfterShip SDK Generator.
33
* Do not edit the class manually.
44
*/
5-
import { CourierConnectionApi } from "./api/CourierConnection";
6-
import { CourierApi } from "./api/Courier";
75
import { TrackingApi } from "./api/Tracking";
6+
import { CourierApi } from "./api/Courier";
7+
import { CourierConnectionApi } from "./api/CourierConnection";
88
import { EstimatedDeliveryDateApi } from "./api/EstimatedDeliveryDate";
99
import { AftershipError, AfterShipErrorCodes } from "./error";
1010
import { AuthType } from "./lib/authentication";
@@ -30,12 +30,12 @@ export interface Options {
3030
proxy?: string;
3131
}
3232

33-
const SDK_ENV_PREFIX = "AFTERSHIP_TRACKING_SDK";
33+
const SDK_ENV_PREFIX = "AFTERSHIP_TRACKING_SDK_";
3434

3535
export class AfterShip {
36-
public readonly courierConnection: CourierConnectionApi;
37-
public readonly courier: CourierApi;
3836
public readonly tracking: TrackingApi;
37+
public readonly courier: CourierApi;
38+
public readonly courierConnection: CourierConnectionApi;
3939
public readonly estimatedDeliveryDate: EstimatedDeliveryDateApi;
4040
private readonly options: Options;
4141

@@ -100,9 +100,9 @@ export class AfterShip {
100100
user_agent: this.options.user_agent,
101101
proxy: parseProxy(this.options.proxy),
102102
});
103-
this.courierConnection = new CourierConnectionApi(request);
104-
this.courier = new CourierApi(request);
105103
this.tracking = new TrackingApi(request);
104+
this.courier = new CourierApi(request);
105+
this.courierConnection = new CourierConnectionApi(request);
106106
this.estimatedDeliveryDate = new EstimatedDeliveryDateApi(request);
107107
}
108108

src/api/Courier.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
*/
55
import { Request } from "../lib/request";
66
import { AftershipError, AfterShipErrorCodes } from "../error";
7-
import { GetCouriersQuery } from "../model/GetCouriersQuery";
87
import { GetCouriersResponse } from "../model/GetCouriersResponse";
8+
import { GetCouriersQuery } from "../model/GetCouriersQuery";
99
import { DetectCourierRequest } from "../model/DetectCourierRequest";
1010
import { DetectCourierResponse } from "../model/DetectCourierResponse";
1111

@@ -23,14 +23,12 @@ export class CourierApi {
2323
query?: GetCouriersQuery,
2424
headers?: { [key: string]: any },
2525
): Promise<GetCouriersResponse> {
26+
const url = `/tracking/2025-07/couriers`;
2627
return this.request.makeRequest<GetCouriersResponse>({
27-
url: `/tracking/2025-07/couriers`,
28+
url: url,
2829
method: "GET",
2930
query,
3031
headers,
31-
request_legacy_tag: "",
32-
response_legacy_tag: "",
33-
is_paging: false,
3432
});
3533
}
3634
/**
@@ -40,14 +38,12 @@ export class CourierApi {
4038
body: DetectCourierRequest,
4139
headers?: { [key: string]: any },
4240
): Promise<DetectCourierResponse> {
41+
const url = `/tracking/2025-07/couriers/detect`;
4342
return this.request.makeRequest<DetectCourierResponse>({
44-
url: `/tracking/2025-07/couriers/detect`,
43+
url: url,
4544
method: "POST",
4645
body,
4746
headers,
48-
request_legacy_tag: "",
49-
response_legacy_tag: "",
50-
is_paging: false,
5147
});
5248
}
5349
}

src/api/CourierConnection.ts

Lines changed: 38 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
*/
55
import { Request } from "../lib/request";
66
import { AftershipError, AfterShipErrorCodes } from "../error";
7+
import { PutCourierConnectionsByIdResponse } from "../model/PutCourierConnectionsByIdResponse";
78
import { DeleteCourierConnectionsByIdResponse } from "../model/DeleteCourierConnectionsByIdResponse";
8-
import { GetCourierConnectionsQuery } from "../model/GetCourierConnectionsQuery";
99
import { GetCourierConnectionsResponse } from "../model/GetCourierConnectionsResponse";
10+
import { GetCourierConnectionsQuery } from "../model/GetCourierConnectionsQuery";
1011
import { PostCourierConnectionsRequest } from "../model/PostCourierConnectionsRequest";
1112
import { PostCourierConnectionsResponse } from "../model/PostCourierConnectionsResponse";
12-
import { PutCourierConnectionsByIdRequest } from "../model/PutCourierConnectionsByIdRequest";
13-
import { PutCourierConnectionsByIdResponse } from "../model/PutCourierConnectionsByIdResponse";
1413
import { GetCourierConnectionsByIdResponse } from "../model/GetCourierConnectionsByIdResponse";
14+
import { PutCourierConnectionsByIdRequest } from "../model/PutCourierConnectionsByIdRequest";
1515

1616
export class CourierConnectionApi {
1717
private readonly request: Request;
@@ -20,44 +20,19 @@ export class CourierConnectionApi {
2020
this.request = request;
2121
}
2222

23-
/**
24-
* Delete a courier connection.
25-
*/
26-
public async deleteCourierConnectionsById(
27-
id: string,
28-
headers?: { [key: string]: any },
29-
): Promise<DeleteCourierConnectionsByIdResponse> {
30-
if (!id) {
31-
throw new AftershipError(
32-
"Invalid params: id",
33-
AfterShipErrorCodes.VALUE_INVALID,
34-
);
35-
}
36-
37-
return this.request.makeRequest<DeleteCourierConnectionsByIdResponse>({
38-
url: `/tracking/2025-07/courier-connections/${id}`,
39-
method: "DELETE",
40-
headers,
41-
request_legacy_tag: "",
42-
response_legacy_tag: "",
43-
is_paging: false,
44-
});
45-
}
4623
/**
4724
* Get courier connection results of multiple courier connections.
4825
*/
4926
public async getCourierConnections(
5027
query?: GetCourierConnectionsQuery,
5128
headers?: { [key: string]: any },
5229
): Promise<GetCourierConnectionsResponse> {
30+
const url = `/tracking/2025-07/courier-connections`;
5331
return this.request.makeRequest<GetCourierConnectionsResponse>({
54-
url: `/tracking/2025-07/courier-connections`,
32+
url: url,
5533
method: "GET",
5634
query,
5735
headers,
58-
request_legacy_tag: "",
59-
response_legacy_tag: "courier_connections",
60-
is_paging: true,
6136
});
6237
}
6338
/**
@@ -67,14 +42,32 @@ export class CourierConnectionApi {
6742
body: PostCourierConnectionsRequest,
6843
headers?: { [key: string]: any },
6944
): Promise<PostCourierConnectionsResponse> {
45+
const url = `/tracking/2025-07/courier-connections`;
7046
return this.request.makeRequest<PostCourierConnectionsResponse>({
71-
url: `/tracking/2025-07/courier-connections`,
47+
url: url,
7248
method: "POST",
7349
body,
7450
headers,
75-
request_legacy_tag: "",
76-
response_legacy_tag: "",
77-
is_paging: false,
51+
});
52+
}
53+
/**
54+
* Get courier connection results of a single courier connection.
55+
*/
56+
public async getCourierConnectionsById(
57+
id: string,
58+
headers?: { [key: string]: any },
59+
): Promise<GetCourierConnectionsByIdResponse> {
60+
if (!id) {
61+
throw new AftershipError(
62+
"Invalid params: id",
63+
AfterShipErrorCodes.BAD_REQUEST,
64+
);
65+
}
66+
const url = `/tracking/2025-07/courier-connections/${id}`;
67+
return this.request.makeRequest<GetCourierConnectionsByIdResponse>({
68+
url: url,
69+
method: "GET",
70+
headers,
7871
});
7972
}
8073
/**
@@ -88,41 +81,35 @@ export class CourierConnectionApi {
8881
if (!id) {
8982
throw new AftershipError(
9083
"Invalid params: id",
91-
AfterShipErrorCodes.VALUE_INVALID,
84+
AfterShipErrorCodes.BAD_REQUEST,
9285
);
9386
}
94-
87+
const url = `/tracking/2025-07/courier-connections/${id}`;
9588
return this.request.makeRequest<PutCourierConnectionsByIdResponse>({
96-
url: `/tracking/2025-07/courier-connections/${id}`,
89+
url: url,
9790
method: "PATCH",
9891
body,
9992
headers,
100-
request_legacy_tag: "",
101-
response_legacy_tag: "",
102-
is_paging: false,
10393
});
10494
}
10595
/**
106-
* Get courier connection results of a single courier connection.
96+
* Delete a courier connection.
10797
*/
108-
public async getCourierConnectionsById(
98+
public async deleteCourierConnectionsById(
10999
id: string,
110100
headers?: { [key: string]: any },
111-
): Promise<GetCourierConnectionsByIdResponse> {
101+
): Promise<DeleteCourierConnectionsByIdResponse> {
112102
if (!id) {
113103
throw new AftershipError(
114104
"Invalid params: id",
115-
AfterShipErrorCodes.VALUE_INVALID,
105+
AfterShipErrorCodes.BAD_REQUEST,
116106
);
117107
}
118-
119-
return this.request.makeRequest<GetCourierConnectionsByIdResponse>({
120-
url: `/tracking/2025-07/courier-connections/${id}`,
121-
method: "GET",
108+
const url = `/tracking/2025-07/courier-connections/${id}`;
109+
return this.request.makeRequest<DeleteCourierConnectionsByIdResponse>({
110+
url: url,
111+
method: "DELETE",
122112
headers,
123-
request_legacy_tag: "",
124-
response_legacy_tag: "",
125-
is_paging: false,
126113
});
127114
}
128115
}

src/api/EstimatedDeliveryDate.ts

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55
import { Request } from "../lib/request";
66
import { AftershipError, AfterShipErrorCodes } from "../error";
7-
import { PredictRequest } from "../model/PredictRequest";
7+
import { EstimatedDeliveryDateRequest } from "../model/EstimatedDeliveryDateRequest";
88
import { PredictResponse } from "../model/PredictResponse";
99
import { PredictBatchRequest } from "../model/PredictBatchRequest";
1010
import { PredictBatchResponse } from "../model/PredictBatchResponse";
@@ -20,17 +20,15 @@ export class EstimatedDeliveryDateApi {
2020
* &gt; The estimated delivery date is provided by AfterShip, based on its AI-predictive model. You can display the EDD on the product page, cart, and order checkout page. It indicates when a customer will receive the order.You can use to activate this feature.
2121
*/
2222
public async predict(
23-
body: PredictRequest,
23+
body: EstimatedDeliveryDateRequest,
2424
headers?: { [key: string]: any },
2525
): Promise<PredictResponse> {
26+
const url = `/tracking/2025-07/estimated-delivery-date/predict`;
2627
return this.request.makeRequest<PredictResponse>({
27-
url: `/tracking/2025-07/estimated-delivery-date/predict`,
28+
url: url,
2829
method: "POST",
2930
body,
3031
headers,
31-
request_legacy_tag: "",
32-
response_legacy_tag: "",
33-
is_paging: false,
3432
});
3533
}
3634
/**
@@ -40,14 +38,12 @@ export class EstimatedDeliveryDateApi {
4038
body: PredictBatchRequest,
4139
headers?: { [key: string]: any },
4240
): Promise<PredictBatchResponse> {
41+
const url = `/tracking/2025-07/estimated-delivery-date/predict-batch`;
4342
return this.request.makeRequest<PredictBatchResponse>({
44-
url: `/tracking/2025-07/estimated-delivery-date/predict-batch`,
43+
url: url,
4544
method: "POST",
4645
body,
4746
headers,
48-
request_legacy_tag: "",
49-
response_legacy_tag: "",
50-
is_paging: false,
5147
});
5248
}
5349
}

0 commit comments

Comments
 (0)