@stores.com/xpo 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +72 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,72 @@
1
+ # xpo
2
+
3
+ [![Test](https://github.com/stores-com/xpo/actions/workflows/test.yml/badge.svg)](https://github.com/stores-com/xpo/actions/workflows/test.yml)
4
+ [![Coverage Status](https://coveralls.io/repos/github/stores-com/xpo/badge.svg)](https://coveralls.io/github/stores-com/xpo)
5
+
6
+ XPO LTL Shipment Tracking API client for retrieving shipment status, reference numbers, and tracking events using PRO numbers.
7
+
8
+ ## Installation
9
+
10
+ ```
11
+ $ npm install @stores.com/xpo
12
+ ```
13
+
14
+ ## Usage
15
+
16
+ ```javascript
17
+ const XPO = require('@stores.com/xpo');
18
+
19
+ const xpo = new XPO({
20
+ api_key: 'your_api_key',
21
+ password: 'your_password',
22
+ username: 'your_username'
23
+ });
24
+ ```
25
+
26
+ ## Documentation
27
+
28
+ - https://www.xpo.com/help-center/integration-with-customer-systems/api/
29
+
30
+ ## Methods
31
+
32
+ ### getAccessToken()
33
+
34
+ XPO LTL APIs use the OAuth 2.0 protocol for authentication and authorization using the password grant type.
35
+
36
+ See: https://www.xpo.com/help-center/integration-with-customer-systems/api/
37
+
38
+ ```javascript
39
+ const accessToken = await xpo.getAccessToken();
40
+
41
+ console.log(accessToken);
42
+ // {
43
+ // access_token: '...',
44
+ // expires_in: '3600',
45
+ // token_type: 'Bearer'
46
+ // }
47
+ ```
48
+
49
+ ### getShipmentStatus(referenceNumbers, options)
50
+
51
+ Retrieves status and basic details about a shipment that match the search criteria based on PRO number(s) and/or customer reference number(s).
52
+
53
+ See: https://www.xpo.com/cdn/files/s1/XPO_API_Shipment_Tracking_Guide.pdf
54
+
55
+ ```javascript
56
+ const status = await xpo.getShipmentStatus('235825413');
57
+
58
+ console.log(status);
59
+ // {
60
+ // data: [{
61
+ // proNbr: '235825413',
62
+ // statusCd: 'DLVD',
63
+ // ...
64
+ // }]
65
+ // }
66
+ ```
67
+
68
+ You can also pass an array of reference numbers:
69
+
70
+ ```javascript
71
+ const status = await xpo.getShipmentStatus(['235825413', '235825414']);
72
+ ```
package/package.json CHANGED
@@ -26,5 +26,5 @@
26
26
  "coveralls": "node --test --test-concurrency=true --test-force-exit --experimental-test-coverage --test-reporter=spec --test-reporter-destination=stdout --test-reporter=lcov --test-reporter-destination=lcov.info && coveralls < lcov.info",
27
27
  "test": "node --test --test-concurrency=true --test-force-exit --test-reporter=spec"
28
28
  },
29
- "version": "0.2.0"
29
+ "version": "0.2.1"
30
30
  }