Skip to content

Commit

Permalink
Remove invalid code
Browse files Browse the repository at this point in the history
  • Loading branch information
liaohanfei committed Nov 21, 2023
1 parent 21a0b38 commit 4288e29
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 57 deletions.
23 changes: 8 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,10 @@ npm install trackingmore-sdk-nodejs
const TrackingMore = require('trackingmore-sdk-nodejs')
const key = 'you api key'
const trackingmore = new TrackingMore(key)
try {
trackingmore.couriers.getAllCouriers()
.then(result => console.log(result))
.catch(e => console.log(e))
} catch (error) {
console.error('An error occurred:', error.message)
}

trackingmore.couriers.getAllCouriers()
.then(result => console.log(result))
.catch(e => console.error('An error occurred:', e.message))
```

## Testing
Expand All @@ -48,14 +45,10 @@ npm run test or npm test
Simply add a try-catch block

```javascript
try {
// Get all couriers (couriers/all)
trackingmore.couriers.getAllCouriers()
.then(result => console.log(result))
.catch(e => console.log(e))
} catch (error) {
console.error('An error occurred:', error.message)
}
// Get all couriers (couriers/all)
trackingmore.couriers.getAllCouriers()
.then(result => console.log(result))
.catch(e => console.error('An error occurred:', e.message))

```

Expand Down
47 changes: 6 additions & 41 deletions example/example.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,20 @@ const key = 'you api key'
const trackingmore = new TrackingMore(key)


try {
// Get all couriers (couriers/all)
trackingmore.couriers.getAllCouriers()
.then(result => console.log(result))
.catch(e => console.log(e))
} catch (error) {
console.error('An error occurred:', error.message)
}
// Get all couriers (couriers/all)
trackingmore.couriers.getAllCouriers()
.then(result => console.log(result))
.catch(e => console.log(e))



// try {
// // Detect courier (couriers/detect)
// const params = {'tracking_number': ''}
// trackingmore.couriers.detect(params)
// .then(result => console.log(result))
// .catch(e => console.log(e))
// } catch (error) {
// console.error('An error occurred:', error.message)
// }


// try {
// // Create a Tracking (trackings/create)
// const params = {
// 'tracking_number': '9400111899562537624326',
Expand All @@ -39,12 +31,8 @@ try {
// trackingmore.trackings.createTracking(params)
// .then(result => console.log(result))
// .catch(e => console.log(e))
// } catch (error) {
// console.error('An error occurred:', error.message)
// }


// try {
// // Get results (trackings/get)
// // const params = {
// // 'tracking_numbers': '9400111899562537624656',
Expand All @@ -61,12 +49,8 @@ try {
// trackingmore.trackings.getTrackingResults(params)
// .then(result => console.log(result))
// .catch(e => console.log(e))
// } catch (error) {
// console.error('An error occurred:', error.message)
// }


// try {
// // Create trackings (trackings/batch)
// const params = [{
// 'tracking_number': '9400111899562537680047',
Expand All @@ -78,11 +62,7 @@ try {
// trackingmore.trackings.batchCreateTrackings(params)
// .then(result => console.log(result))
// .catch(e => console.log(e))
// } catch (error) {
// console.error('An error occurred:', error.message)
// }

// try {
// // Update a Tracking by ID (trackings/update)
// const params = {
// 'customer_name': 'New name',
Expand All @@ -92,40 +72,25 @@ try {
// trackingmore.trackings.updateTrackingByID(idString, params)
// .then(result => console.log(result))
// .catch(e => console.log(e))
// } catch (error) {
// console.error('An error occurred:', error.message)
// }


// try {
// // Delete Tracking by ID (trackings/delete)
// const idString = "9a135b15b5d983e1d8950d99022db0c7"
// trackingmore.trackings.deleteTrackingByID(idString)
// .then(result => console.log(result))
// .catch(e => console.log(e))
// } catch (error) {
// console.error('An error occurred:', error.message)
// }


// try {
// // Retrack expired Tracking by ID (trackings/retrack)
// const idString = "99f4ed7fc73aa83fe68fd69ab6458b28"
// trackingmore.trackings.retrackTrackingByID(idString)
// .then(result => console.log(result))
// .catch(e => console.log(e))
// } catch (error) {
// console.error('An error occurred:', error.message)
// }

// try {
// // Create an air waybill (awb)
// const params = {
// 'awb_number': '235-69030430',
// }
// trackingmore.airWaybills.createAnAirWayBill(params)
// .then(result => console.log(result))
// .catch(e => console.log(e))
// } catch (error) {
// console.error('An error occurred:', error.message)
// }
// .catch(e => console.log(e))
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "trackingmore-sdk-nodejs",
"version": "1.0.7",
"version": "1.0.8",
"description": "node.js SDK for TrackingMore API",
"main": "src/index.js",
"scripts": {
Expand Down

0 comments on commit 4288e29

Please sign in to comment.