@truetms/truetms-node 0.2.6 → 0.2.8

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.
@@ -0,0 +1,97 @@
1
+ query listTrips(
2
+ $search: String
3
+ $sort: TripSort
4
+ $skip: Int
5
+ $take: Int
6
+ $status: Status
7
+ $excludeCarrierAssigned: Boolean
8
+ $excludeDriverAssigned: Boolean
9
+ ) {
10
+ trips(
11
+ search: $search
12
+ sort: $sort
13
+ skip: $skip
14
+ take: $take
15
+ status: $status
16
+ excludeCarrierAssigned: $excludeCarrierAssigned
17
+ excludeDriverAssigned: $excludeDriverAssigned
18
+ ) {
19
+ count
20
+ data {
21
+ _id
22
+ tripNumber
23
+ status
24
+ shipments {
25
+ _id
26
+ shipmentNumber
27
+ referenceNumbers
28
+ isFromSplit
29
+ isFromRotation
30
+ parentShipment {
31
+ _id
32
+ }
33
+ }
34
+ shipmentLocations {
35
+ _id
36
+ name
37
+ addressLabel
38
+ location {
39
+ latitude
40
+ longitude
41
+ }
42
+ addressTimezone
43
+ locationType
44
+ arrivalTime
45
+ waitingDuration
46
+ setupDuration
47
+ serviceDuration
48
+ shipper {
49
+ _id
50
+ name
51
+ address {
52
+ label
53
+ }
54
+ addressTimezone
55
+ }
56
+ receiver {
57
+ _id
58
+ name
59
+ address {
60
+ label
61
+ }
62
+ addressTimezone
63
+ }
64
+ timeWindows {
65
+ fromDate
66
+ toDate
67
+ }
68
+ }
69
+ trailer {
70
+ _id
71
+ type
72
+ serialNumber
73
+ }
74
+ tractor {
75
+ _id
76
+ serialNumber
77
+ }
78
+ driver {
79
+ _id
80
+ firstname
81
+ lastname
82
+ }
83
+ carrier {
84
+ _id
85
+ name
86
+ code
87
+ }
88
+ firstPickupTime
89
+ lastDropoffTime
90
+ tags
91
+ customFields {
92
+ key
93
+ value
94
+ }
95
+ }
96
+ }
97
+ }
@@ -3,7 +3,7 @@ import { getSdk } from "../graphql/generated";
3
3
 
4
4
  const client = new GraphQLClient(
5
5
  process.env.TRUETMS_STAGE === "LOCAL"
6
- ? "http://localhost:3001/graphql"
6
+ ? "http://127.0.0.1:3001/graphql"
7
7
  : process.env.TRUETMS_STAGE === "QA"
8
8
  ? "https://qa-lynks-api.tecafrik.com/graphql"
9
9
  : process.env.TRUETMS_STAGE === "BETA"
package/src/sdk/index.ts CHANGED
@@ -5,6 +5,7 @@ import TrueTMSDriverSettlementsSdk from "./driverSettlements";
5
5
  import TrueTMSInvoicesSdk from "./invoices";
6
6
  import TrueTMSTractorsSdk from "./tractors";
7
7
  import TrueTMSTransactionsSdk from "./transactions";
8
+ import TrueTMSTripsSdk from "./trips";
8
9
  import TrueTMSUsersSdk from "./users";
9
10
 
10
11
  export type TrueTMSOptions = {
@@ -23,6 +24,7 @@ class TrueTMS {
23
24
  public users: TrueTMSUsersSdk;
24
25
  public transactions: TrueTMSTransactionsSdk;
25
26
  public businessEntities: TrueTMSBusinessEntitiesSdk;
27
+ public trips: TrueTMSTripsSdk;
26
28
 
27
29
  constructor(private options: TrueTMSOptions) {
28
30
  this.drivers = new TrueTMSDriverSdk(options);
@@ -33,6 +35,7 @@ class TrueTMS {
33
35
  this.users = new TrueTMSUsersSdk(options);
34
36
  this.transactions = new TrueTMSTransactionsSdk(options);
35
37
  this.businessEntities = new TrueTMSBusinessEntitiesSdk(options);
38
+ this.trips = new TrueTMSTripsSdk(options);
36
39
  }
37
40
  }
38
41
 
@@ -54,7 +57,7 @@ export function authenticateApiCall<F extends Function, R>(wrappedFn: F): F {
54
57
  clientSecret
55
58
  )
56
59
  ).access_token;
57
- return wrappedFn(...args, {
60
+ return wrappedFn(...(args.length ? args : [{}]), {
58
61
  Authorization: `Bearer ${accessToken}`,
59
62
  });
60
63
  } as F;
@@ -0,0 +1,10 @@
1
+ import { TrueTMSOptions, authenticateApiCall } from ".";
2
+ import trueTmsGraphqlClient from "../providers/truetms-graphql-client";
3
+
4
+ class TrueTMSTripsSdk {
5
+ constructor(private options: TrueTMSOptions) {}
6
+
7
+ listTrips = authenticateApiCall(trueTmsGraphqlClient.listTrips);
8
+ }
9
+
10
+ export default TrueTMSTripsSdk;