Skip to content

Commit 343f171

Browse files
author
Watson Zuo
committed
update slug group to string
1 parent 20391b3 commit 343f171

12 files changed

+121
-144
lines changed

README.md

Lines changed: 95 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ If you need support using AfterShip products, please contact [email protected]
2020
- [Error Handling](#error-handling)
2121
- [Error List](#error-list)
2222
- [Endpoints](#endpoints)
23-
- [/courier-connections](#courier-connections)
24-
- [/estimated-delivery-date](#estimated-delivery-date)
2523
- [/trackings](#trackings)
2624
- [/couriers](#couriers)
25+
- [/courier-connections](#courier-connections)
26+
- [/estimated-delivery-date](#estimated-delivery-date)
2727
- [Help](#help)
2828
- [License](#license)
2929

@@ -140,15 +140,6 @@ The SDK will return an error object when there is any error during the request,
140140

141141
The AfterShip instance has the following properties which are exactly the same as the API endpoints:
142142

143-
- courierConnection
144-
- Get courier connections
145-
- Create courier connections
146-
- Get courier connection by id
147-
- Update courier connection by id
148-
- Delete courier connection by id
149-
- estimatedDeliveryDate
150-
- Prediction for the Estimated Delivery Date
151-
- Batch prediction for the Estimated Delivery Date
152143
- tracking
153144
- Get trackings
154145
- Create a tracking
@@ -160,202 +151,211 @@ The AfterShip instance has the following properties which are exactly the same a
160151
- courier
161152
- Get couriers
162153
- Detect courier
154+
- courierConnection
155+
- Get courier connections
156+
- Create courier connections
157+
- Get courier connection by id
158+
- Update courier connection by id
159+
- Delete courier connection by id
160+
- estimatedDeliveryDate
161+
- Prediction for the Estimated Delivery Date
162+
- Batch prediction for the Estimated Delivery Date
163163

164-
### /courier-connections
164+
### /trackings
165165

166-
**GET** /courier-connections
166+
**GET** /trackings
167167

168168
```javascript
169169
const query = {};
170170

171-
aftership.courierConnection
172-
.getCourierConnections(query)
171+
aftership.tracking
172+
.getTrackings(query)
173173
.then((result) => console.log(result))
174174
.catch((e) => console.log(e));
175175
```
176176

177-
**POST** /courier-connections
177+
**POST** /trackings
178178

179179
```javascript
180-
const postCourierConnectionsRequestBody = {
181-
courier_slug: "valid_value",
182-
credentials: {},
180+
const createTrackingRequestBody = {
181+
tracking_number: "valid_value",
183182
};
184183

185-
aftership.courierConnection
186-
.postCourierConnections(postCourierConnectionsRequestBody)
184+
aftership.tracking
185+
.createTracking(createTrackingRequestBody)
187186
.then((result) => console.log(result))
188187
.catch((e) => console.log(e));
189188
```
190189

191-
**GET** /courier-connections/{id}
190+
**GET** /trackings/{id}
192191

193192
```javascript
194-
aftership.courierConnection
195-
.getCourierConnectionsById("valid_value")
193+
const query = {};
194+
195+
aftership.tracking
196+
.getTrackingById(
197+
"valid_value",
198+
199+
query,
200+
)
196201
.then((result) => console.log(result))
197202
.catch((e) => console.log(e));
198203
```
199204

200-
**PATCH** /courier-connections/{id}
205+
**PUT** /trackings/{id}
201206

202207
```javascript
203-
const putCourierConnectionsByIdRequestBody = {
204-
credentials: {},
205-
};
208+
const updateTrackingByIdRequestBody = {};
206209

207-
aftership.courierConnection
208-
.putCourierConnectionsById(
209-
"valid_value",
210-
putCourierConnectionsByIdRequestBody,
211-
)
210+
aftership.tracking
211+
.updateTrackingById("valid_value", updateTrackingByIdRequestBody)
212212
.then((result) => console.log(result))
213213
.catch((e) => console.log(e));
214214
```
215215

216-
**DELETE** /courier-connections/{id}
216+
**DELETE** /trackings/{id}
217217

218218
```javascript
219-
aftership.courierConnection
220-
.deleteCourierConnectionsById("valid_value")
219+
aftership.tracking
220+
.deleteTrackingById("valid_value")
221221
.then((result) => console.log(result))
222222
.catch((e) => console.log(e));
223223
```
224224

225-
### /estimated-delivery-date
226-
227-
**POST** /estimated-delivery-date/predict
225+
**POST** /trackings/{id}/retrack
228226

229227
```javascript
230-
const predictRequestBody = {
231-
slug: "valid_value",
232-
origin_address: {}, // EstimatedDeliveryDateRequestOriginAddress
233-
destination_address: {}, // EstimatedDeliveryDateRequestDestinationAddress
234-
};
235-
236-
aftership.estimatedDeliveryDate
237-
.predict(predictRequestBody)
228+
aftership.tracking
229+
.retrackTrackingById("valid_value")
238230
.then((result) => console.log(result))
239231
.catch((e) => console.log(e));
240232
```
241233

242-
**POST** /estimated-delivery-date/predict-batch
234+
**POST** /trackings/{id}/mark-as-completed
243235

244236
```javascript
245-
const predictBatchRequestBody = {};
237+
const markTrackingCompletedByIdRequestBody = {};
246238

247-
aftership.estimatedDeliveryDate
248-
.predictBatch(predictBatchRequestBody)
239+
aftership.tracking
240+
.markTrackingCompletedById(
241+
"valid_value",
242+
markTrackingCompletedByIdRequestBody,
243+
)
249244
.then((result) => console.log(result))
250245
.catch((e) => console.log(e));
251246
```
252247

253-
### /trackings
248+
### /couriers
254249

255-
**GET** /trackings
250+
**GET** /couriers
256251

257252
```javascript
258253
const query = {};
259254

260-
aftership.tracking
261-
.getTrackings(query)
255+
aftership.courier
256+
.getCouriers(query)
262257
.then((result) => console.log(result))
263258
.catch((e) => console.log(e));
264259
```
265260

266-
**POST** /trackings
261+
**POST** /couriers/detect
267262

268263
```javascript
269-
const createTrackingRequestBody = {
264+
const detectCourierRequestBody = {
270265
tracking_number: "valid_value",
271266
};
272267

273-
aftership.tracking
274-
.createTracking(createTrackingRequestBody)
268+
aftership.courier
269+
.detectCourier(detectCourierRequestBody)
275270
.then((result) => console.log(result))
276271
.catch((e) => console.log(e));
277272
```
278273

279-
**GET** /trackings/{id}
274+
### /courier-connections
275+
276+
**GET** /courier-connections
280277

281278
```javascript
282279
const query = {};
283280

284-
aftership.tracking
285-
.getTrackingById(
286-
"valid_value",
287-
288-
query,
289-
)
281+
aftership.courierConnection
282+
.getCourierConnections(query)
290283
.then((result) => console.log(result))
291284
.catch((e) => console.log(e));
292285
```
293286

294-
**PUT** /trackings/{id}
287+
**POST** /courier-connections
295288

296289
```javascript
297-
const updateTrackingByIdRequestBody = {};
290+
const postCourierConnectionsRequestBody = {
291+
courier_slug: "valid_value",
292+
credentials: {},
293+
};
298294

299-
aftership.tracking
300-
.updateTrackingById("valid_value", updateTrackingByIdRequestBody)
295+
aftership.courierConnection
296+
.postCourierConnections(postCourierConnectionsRequestBody)
301297
.then((result) => console.log(result))
302298
.catch((e) => console.log(e));
303299
```
304300

305-
**DELETE** /trackings/{id}
301+
**GET** /courier-connections/{id}
306302

307303
```javascript
308-
aftership.tracking
309-
.deleteTrackingById("valid_value")
304+
aftership.courierConnection
305+
.getCourierConnectionsById("valid_value")
310306
.then((result) => console.log(result))
311307
.catch((e) => console.log(e));
312308
```
313309

314-
**POST** /trackings/{id}/retrack
310+
**PATCH** /courier-connections/{id}
315311

316312
```javascript
317-
aftership.tracking
318-
.retrackTrackingById("valid_value")
313+
const putCourierConnectionsByIdRequestBody = {
314+
credentials: {},
315+
};
316+
317+
aftership.courierConnection
318+
.putCourierConnectionsById(
319+
"valid_value",
320+
putCourierConnectionsByIdRequestBody,
321+
)
319322
.then((result) => console.log(result))
320323
.catch((e) => console.log(e));
321324
```
322325

323-
**POST** /trackings/{id}/mark-as-completed
326+
**DELETE** /courier-connections/{id}
324327

325328
```javascript
326-
const markTrackingCompletedByIdRequestBody = {};
327-
328-
aftership.tracking
329-
.markTrackingCompletedById(
330-
"valid_value",
331-
markTrackingCompletedByIdRequestBody,
332-
)
329+
aftership.courierConnection
330+
.deleteCourierConnectionsById("valid_value")
333331
.then((result) => console.log(result))
334332
.catch((e) => console.log(e));
335333
```
336334

337-
### /couriers
335+
### /estimated-delivery-date
338336

339-
**GET** /couriers
337+
**POST** /estimated-delivery-date/predict
340338

341339
```javascript
342-
const query = {};
340+
const predictRequestBody = {
341+
slug: "valid_value",
342+
origin_address: {}, // EstimatedDeliveryDateRequestOriginAddress
343+
destination_address: {}, // EstimatedDeliveryDateRequestDestinationAddress
344+
};
343345

344-
aftership.courier
345-
.getCouriers(query)
346+
aftership.estimatedDeliveryDate
347+
.predict(predictRequestBody)
346348
.then((result) => console.log(result))
347349
.catch((e) => console.log(e));
348350
```
349351

350-
**POST** /couriers/detect
352+
**POST** /estimated-delivery-date/predict-batch
351353

352354
```javascript
353-
const detectCourierRequestBody = {
354-
tracking_number: "valid_value",
355-
};
355+
const predictBatchRequestBody = {};
356356

357-
aftership.courier
358-
.detectCourier(detectCourierRequestBody)
357+
aftership.estimatedDeliveryDate
358+
.predictBatch(predictBatchRequestBody)
359359
.then((result) => console.log(result))
360360
.catch((e) => console.log(e));
361361
```

src/aftership.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
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 { EstimatedDeliveryDateApi } from "./api/EstimatedDeliveryDate";
75
import { TrackingApi } from "./api/Tracking";
86
import { CourierApi } from "./api/Courier";
7+
import { CourierConnectionApi } from "./api/CourierConnection";
8+
import { EstimatedDeliveryDateApi } from "./api/EstimatedDeliveryDate";
99
import { AftershipError, AfterShipErrorCodes } from "./error";
1010
import { AuthType } from "./lib/authentication";
1111
import {
@@ -33,10 +33,10 @@ export interface Options {
3333
const SDK_ENV_PREFIX = "AFTERSHIP_TRACKING_SDK_";
3434

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

4242
constructor(options?: Options) {
@@ -100,10 +100,10 @@ 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.estimatedDeliveryDate = new EstimatedDeliveryDateApi(request);
105103
this.tracking = new TrackingApi(request);
106104
this.courier = new CourierApi(request);
105+
this.courierConnection = new CourierConnectionApi(request);
106+
this.estimatedDeliveryDate = new EstimatedDeliveryDateApi(request);
107107
}
108108

109109
private validateOptions() {

src/api/Courier.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
*/
55
import { Request } from "../lib/request";
66
import { AftershipError, AfterShipErrorCodes } from "../error";
7+
import { GetCouriersResponse } from "../model/GetCouriersResponse";
78
import { GetCouriersQuery } from "../model/GetCouriersQuery";
89
import { DetectCourierRequest } from "../model/DetectCourierRequest";
910
import { DetectCourierResponse } from "../model/DetectCourierResponse";
10-
import { GetCouriersResponse } from "../model/GetCouriersResponse";
1111

1212
export class CourierApi {
1313
private readonly request: Request;

src/api/CourierConnection.ts

Lines changed: 1 addition & 1 deletion
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";
89
import { GetCourierConnectionsResponse } from "../model/GetCourierConnectionsResponse";
910
import { GetCourierConnectionsQuery } from "../model/GetCourierConnectionsQuery";
1011
import { PostCourierConnectionsRequest } from "../model/PostCourierConnectionsRequest";
1112
import { PostCourierConnectionsResponse } from "../model/PostCourierConnectionsResponse";
1213
import { GetCourierConnectionsByIdResponse } from "../model/GetCourierConnectionsByIdResponse";
1314
import { PutCourierConnectionsByIdRequest } from "../model/PutCourierConnectionsByIdRequest";
14-
import { PutCourierConnectionsByIdResponse } from "../model/PutCourierConnectionsByIdResponse";
1515

1616
export class CourierConnectionApi {
1717
private readonly request: Request;

0 commit comments

Comments
 (0)