@chrt-inc/typescript-sdk 0.227.1 → 0.231.0

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 (112) hide show
  1. package/dist/cjs/Client.d.ts +3 -0
  2. package/dist/cjs/Client.js +7 -2
  3. package/dist/cjs/api/resources/index.d.ts +1 -0
  4. package/dist/cjs/api/resources/index.js +2 -1
  5. package/dist/cjs/api/resources/tracking/client/Client.d.ts +26 -0
  6. package/dist/cjs/api/resources/tracking/client/Client.js +22 -0
  7. package/dist/cjs/api/resources/tracking/client/index.d.ts +1 -0
  8. package/dist/cjs/api/resources/tracking/client/index.js +2 -0
  9. package/dist/cjs/api/resources/tracking/index.d.ts +2 -0
  10. package/dist/cjs/api/resources/tracking/index.js +18 -0
  11. package/dist/cjs/api/resources/tracking/resources/cargoByDriver/client/Client.d.ts +67 -0
  12. package/dist/cjs/api/resources/tracking/resources/cargoByDriver/client/Client.js +202 -0
  13. package/dist/cjs/api/resources/tracking/resources/cargoByDriver/client/index.d.ts +2 -0
  14. package/dist/cjs/api/resources/tracking/resources/cargoByDriver/client/index.js +17 -0
  15. package/dist/cjs/api/resources/tracking/resources/cargoByDriver/client/requests/CargoByDriverLastSeenRequest.d.ts +14 -0
  16. package/dist/cjs/api/resources/tracking/resources/cargoByDriver/client/requests/CargoByDriverUpdateReq.d.ts +19 -0
  17. package/dist/cjs/api/resources/tracking/resources/cargoByDriver/client/requests/index.d.ts +2 -0
  18. package/dist/cjs/api/resources/tracking/resources/cargoByDriver/client/requests/index.js +2 -0
  19. package/dist/cjs/api/resources/tracking/resources/cargoByDriver/index.d.ts +1 -0
  20. package/dist/cjs/api/resources/tracking/resources/cargoByDriver/index.js +17 -0
  21. package/dist/cjs/api/resources/tracking/resources/index.d.ts +4 -0
  22. package/dist/cjs/api/resources/tracking/resources/index.js +43 -0
  23. package/dist/cjs/api/resources/tracking/resources/taskGroupByDriver/client/Client.d.ts +66 -0
  24. package/dist/cjs/api/resources/tracking/resources/taskGroupByDriver/client/Client.js +200 -0
  25. package/dist/cjs/api/resources/tracking/resources/taskGroupByDriver/client/index.d.ts +2 -0
  26. package/dist/cjs/api/resources/tracking/resources/taskGroupByDriver/client/index.js +17 -0
  27. package/dist/cjs/api/resources/tracking/resources/taskGroupByDriver/client/requests/TaskGroupByDriverLastSeenRequest.d.ts +12 -0
  28. package/dist/cjs/api/resources/tracking/resources/taskGroupByDriver/client/requests/TaskGroupByDriverLastSeenRequest.js +5 -0
  29. package/dist/cjs/api/resources/tracking/resources/taskGroupByDriver/client/requests/TaskGroupByDriverUpdateReq.d.ts +19 -0
  30. package/dist/cjs/api/resources/tracking/resources/taskGroupByDriver/client/requests/TaskGroupByDriverUpdateReq.js +5 -0
  31. package/dist/cjs/api/resources/tracking/resources/taskGroupByDriver/client/requests/index.d.ts +2 -0
  32. package/dist/cjs/api/resources/tracking/resources/taskGroupByDriver/client/requests/index.js +2 -0
  33. package/dist/cjs/api/resources/tracking/resources/taskGroupByDriver/index.d.ts +1 -0
  34. package/dist/cjs/api/resources/tracking/resources/taskGroupByDriver/index.js +17 -0
  35. package/dist/cjs/api/types/Cargo1.d.ts +2 -0
  36. package/dist/cjs/api/types/CargoStatusEnum1.d.ts +10 -0
  37. package/dist/cjs/api/types/CargoStatusEnum1.js +12 -0
  38. package/dist/cjs/api/types/DecodedJwtWithOrgAndUserId.d.ts +1 -0
  39. package/dist/cjs/api/types/Driver1.d.ts +2 -2
  40. package/dist/cjs/api/types/TrackingCargoByDriverDataPoint1.d.ts +11 -0
  41. package/dist/cjs/api/types/TrackingCargoByDriverDataPoint1.js +5 -0
  42. package/dist/cjs/api/types/TrackingCargoByDriverDataPointMetadata1.d.ts +8 -0
  43. package/dist/cjs/api/types/TrackingCargoByDriverDataPointMetadata1.js +5 -0
  44. package/dist/cjs/api/types/TrackingTaskGroupByDriverDataPoint1.d.ts +11 -0
  45. package/dist/cjs/api/types/TrackingTaskGroupByDriverDataPoint1.js +5 -0
  46. package/dist/cjs/api/types/TrackingTaskGroupByDriverDataPointMetadata1.d.ts +7 -0
  47. package/dist/cjs/api/types/TrackingTaskGroupByDriverDataPointMetadata1.js +5 -0
  48. package/dist/cjs/api/types/index.d.ts +5 -2
  49. package/dist/cjs/api/types/index.js +5 -2
  50. package/dist/cjs/version.d.ts +1 -1
  51. package/dist/cjs/version.js +1 -1
  52. package/dist/esm/Client.d.mts +3 -0
  53. package/dist/esm/Client.mjs +7 -2
  54. package/dist/esm/api/resources/index.d.mts +1 -0
  55. package/dist/esm/api/resources/index.mjs +1 -0
  56. package/dist/esm/api/resources/tracking/client/Client.d.mts +26 -0
  57. package/dist/esm/api/resources/tracking/client/Client.mjs +18 -0
  58. package/dist/esm/api/resources/tracking/client/index.d.mts +1 -0
  59. package/dist/esm/api/resources/tracking/client/index.mjs +1 -0
  60. package/dist/esm/api/resources/tracking/index.d.mts +2 -0
  61. package/dist/esm/api/resources/tracking/index.mjs +2 -0
  62. package/dist/esm/api/resources/tracking/resources/cargoByDriver/client/Client.d.mts +67 -0
  63. package/dist/esm/api/resources/tracking/resources/cargoByDriver/client/Client.mjs +165 -0
  64. package/dist/esm/api/resources/tracking/resources/cargoByDriver/client/index.d.mts +2 -0
  65. package/dist/esm/api/resources/tracking/resources/cargoByDriver/client/index.mjs +1 -0
  66. package/dist/esm/api/resources/tracking/resources/cargoByDriver/client/requests/CargoByDriverLastSeenRequest.d.mts +14 -0
  67. package/dist/esm/api/resources/tracking/resources/cargoByDriver/client/requests/CargoByDriverUpdateReq.d.mts +19 -0
  68. package/dist/esm/api/resources/tracking/resources/cargoByDriver/client/requests/index.d.mts +2 -0
  69. package/dist/esm/api/resources/tracking/resources/cargoByDriver/client/requests/index.mjs +1 -0
  70. package/dist/esm/api/resources/tracking/resources/cargoByDriver/index.d.mts +1 -0
  71. package/dist/esm/api/resources/tracking/resources/cargoByDriver/index.mjs +1 -0
  72. package/dist/esm/api/resources/tracking/resources/index.d.mts +4 -0
  73. package/dist/esm/api/resources/tracking/resources/index.mjs +4 -0
  74. package/dist/esm/api/resources/tracking/resources/taskGroupByDriver/client/Client.d.mts +66 -0
  75. package/dist/esm/api/resources/tracking/resources/taskGroupByDriver/client/Client.mjs +163 -0
  76. package/dist/esm/api/resources/tracking/resources/taskGroupByDriver/client/index.d.mts +2 -0
  77. package/dist/esm/api/resources/tracking/resources/taskGroupByDriver/client/index.mjs +1 -0
  78. package/dist/esm/api/resources/tracking/resources/taskGroupByDriver/client/requests/TaskGroupByDriverLastSeenRequest.d.mts +12 -0
  79. package/dist/esm/api/resources/tracking/resources/taskGroupByDriver/client/requests/TaskGroupByDriverLastSeenRequest.mjs +4 -0
  80. package/dist/esm/api/resources/tracking/resources/taskGroupByDriver/client/requests/TaskGroupByDriverUpdateReq.d.mts +19 -0
  81. package/dist/esm/api/resources/tracking/resources/taskGroupByDriver/client/requests/TaskGroupByDriverUpdateReq.mjs +4 -0
  82. package/dist/esm/api/resources/tracking/resources/taskGroupByDriver/client/requests/index.d.mts +2 -0
  83. package/dist/esm/api/resources/tracking/resources/taskGroupByDriver/client/requests/index.mjs +1 -0
  84. package/dist/esm/api/resources/tracking/resources/taskGroupByDriver/index.d.mts +1 -0
  85. package/dist/esm/api/resources/tracking/resources/taskGroupByDriver/index.mjs +1 -0
  86. package/dist/esm/api/types/Cargo1.d.mts +2 -0
  87. package/dist/esm/api/types/CargoStatusEnum1.d.mts +10 -0
  88. package/dist/esm/api/types/CargoStatusEnum1.mjs +9 -0
  89. package/dist/esm/api/types/DecodedJwtWithOrgAndUserId.d.mts +1 -0
  90. package/dist/esm/api/types/Driver1.d.mts +2 -2
  91. package/dist/esm/api/types/TrackingCargoByDriverDataPoint1.d.mts +11 -0
  92. package/dist/esm/api/types/TrackingCargoByDriverDataPoint1.mjs +4 -0
  93. package/dist/esm/api/types/TrackingCargoByDriverDataPointMetadata1.d.mts +8 -0
  94. package/dist/esm/api/types/TrackingCargoByDriverDataPointMetadata1.mjs +4 -0
  95. package/dist/esm/api/types/TrackingTaskGroupByDriverDataPoint1.d.mts +11 -0
  96. package/dist/esm/api/types/TrackingTaskGroupByDriverDataPoint1.mjs +4 -0
  97. package/dist/esm/api/types/TrackingTaskGroupByDriverDataPointMetadata1.d.mts +7 -0
  98. package/dist/esm/api/types/TrackingTaskGroupByDriverDataPointMetadata1.mjs +4 -0
  99. package/dist/esm/api/types/index.d.mts +5 -2
  100. package/dist/esm/api/types/index.mjs +5 -2
  101. package/dist/esm/version.d.mts +1 -1
  102. package/dist/esm/version.mjs +1 -1
  103. package/package.json +1 -1
  104. package/reference.md +273 -0
  105. package/dist/cjs/api/types/Tracker1.d.ts +0 -7
  106. package/dist/cjs/api/types/TrackerSession1.d.ts +0 -7
  107. package/dist/esm/api/types/Tracker1.d.mts +0 -7
  108. package/dist/esm/api/types/TrackerSession1.d.mts +0 -7
  109. /package/dist/cjs/api/{types/Tracker1.js → resources/tracking/resources/cargoByDriver/client/requests/CargoByDriverLastSeenRequest.js} +0 -0
  110. /package/dist/cjs/api/{types/TrackerSession1.js → resources/tracking/resources/cargoByDriver/client/requests/CargoByDriverUpdateReq.js} +0 -0
  111. /package/dist/esm/api/{types/Tracker1.mjs → resources/tracking/resources/cargoByDriver/client/requests/CargoByDriverLastSeenRequest.mjs} +0 -0
  112. /package/dist/esm/api/{types/TrackerSession1.mjs → resources/tracking/resources/cargoByDriver/client/requests/CargoByDriverUpdateReq.mjs} +0 -0
@@ -26,6 +26,7 @@ import { Users } from "./api/resources/users/client/Client.js";
26
26
  import { Utils } from "./api/resources/utils/client/Client.js";
27
27
  import { Notifications } from "./api/resources/notifications/client/Client.js";
28
28
  import { OrgConnectionInfos } from "./api/resources/orgConnectionInfos/client/Client.js";
29
+ import { Tracking } from "./api/resources/tracking/client/Client.js";
29
30
  export declare namespace ChrtClient {
30
31
  interface Options {
31
32
  environment?: core.Supplier<environments.ChrtEnvironment | string>;
@@ -72,6 +73,7 @@ export declare class ChrtClient {
72
73
  protected _utils: Utils | undefined;
73
74
  protected _notifications: Notifications | undefined;
74
75
  protected _orgConnectionInfos: OrgConnectionInfos | undefined;
76
+ protected _tracking: Tracking | undefined;
75
77
  constructor(_options?: ChrtClient.Options);
76
78
  get dev(): Dev;
77
79
  get drivers(): Drivers;
@@ -96,4 +98,5 @@ export declare class ChrtClient {
96
98
  get utils(): Utils;
97
99
  get notifications(): Notifications;
98
100
  get orgConnectionInfos(): OrgConnectionInfos;
101
+ get tracking(): Tracking;
99
102
  }
@@ -62,13 +62,14 @@ const Client_js_20 = require("./api/resources/users/client/Client.js");
62
62
  const Client_js_21 = require("./api/resources/utils/client/Client.js");
63
63
  const Client_js_22 = require("./api/resources/notifications/client/Client.js");
64
64
  const Client_js_23 = require("./api/resources/orgConnectionInfos/client/Client.js");
65
+ const Client_js_24 = require("./api/resources/tracking/client/Client.js");
65
66
  class ChrtClient {
66
67
  constructor(_options = {}) {
67
68
  this._options = Object.assign(Object.assign({}, _options), { headers: (0, headers_js_1.mergeHeaders)({
68
69
  "X-Fern-Language": "JavaScript",
69
70
  "X-Fern-SDK-Name": "@chrt-inc/typescript-sdk",
70
- "X-Fern-SDK-Version": "0.227.1",
71
- "User-Agent": "@chrt-inc/typescript-sdk/0.227.1",
71
+ "X-Fern-SDK-Version": "0.231.0",
72
+ "User-Agent": "@chrt-inc/typescript-sdk/0.231.0",
72
73
  "X-Fern-Runtime": core.RUNTIME.type,
73
74
  "X-Fern-Runtime-Version": core.RUNTIME.version,
74
75
  }, _options === null || _options === void 0 ? void 0 : _options.headers) });
@@ -165,5 +166,9 @@ class ChrtClient {
165
166
  var _a;
166
167
  return ((_a = this._orgConnectionInfos) !== null && _a !== void 0 ? _a : (this._orgConnectionInfos = new Client_js_23.OrgConnectionInfos(this._options)));
167
168
  }
169
+ get tracking() {
170
+ var _a;
171
+ return ((_a = this._tracking) !== null && _a !== void 0 ? _a : (this._tracking = new Client_js_24.Tracking(this._options)));
172
+ }
168
173
  }
169
174
  exports.ChrtClient = ChrtClient;
@@ -21,6 +21,7 @@ export * as users from "./users/index.js";
21
21
  export * as utils from "./utils/index.js";
22
22
  export * as notifications from "./notifications/index.js";
23
23
  export * as orgConnectionInfos from "./orgConnectionInfos/index.js";
24
+ export * as tracking from "./tracking/index.js";
24
25
  export * from "./dev/client/requests/index.js";
25
26
  export * from "./drivers/client/requests/index.js";
26
27
  export * from "./milestones/client/requests/index.js";
@@ -36,7 +36,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
36
36
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.orgConnectionInfos = exports.notifications = exports.utils = exports.users = exports.root = exports.payments = exports.orgs = exports.milestoneNotifications = exports.shipperContactInfo = exports.taskGroups = exports.connections = exports.courierPayDriverPayouts = exports.shipperPayCourierPayments = exports.shipperPayCourierLineItemGroups = exports.courierPayDriverLineItemGroups = exports.shipperPayCourierRateSheets = exports.courierPayDriverRateSheets = exports.orders = exports.orgProfiles = exports.offChrtShipperOrgInfo = exports.milestones = exports.drivers = exports.dev = void 0;
39
+ exports.tracking = exports.orgConnectionInfos = exports.notifications = exports.utils = exports.users = exports.root = exports.payments = exports.orgs = exports.milestoneNotifications = exports.shipperContactInfo = exports.taskGroups = exports.connections = exports.courierPayDriverPayouts = exports.shipperPayCourierPayments = exports.shipperPayCourierLineItemGroups = exports.courierPayDriverLineItemGroups = exports.shipperPayCourierRateSheets = exports.courierPayDriverRateSheets = exports.orders = exports.orgProfiles = exports.offChrtShipperOrgInfo = exports.milestones = exports.drivers = exports.dev = void 0;
40
40
  exports.dev = __importStar(require("./dev/index.js"));
41
41
  exports.drivers = __importStar(require("./drivers/index.js"));
42
42
  exports.milestones = __importStar(require("./milestones/index.js"));
@@ -60,6 +60,7 @@ exports.users = __importStar(require("./users/index.js"));
60
60
  exports.utils = __importStar(require("./utils/index.js"));
61
61
  exports.notifications = __importStar(require("./notifications/index.js"));
62
62
  exports.orgConnectionInfos = __importStar(require("./orgConnectionInfos/index.js"));
63
+ exports.tracking = __importStar(require("./tracking/index.js"));
63
64
  __exportStar(require("./dev/client/requests/index.js"), exports);
64
65
  __exportStar(require("./drivers/client/requests/index.js"), exports);
65
66
  __exportStar(require("./milestones/client/requests/index.js"), exports);
@@ -0,0 +1,26 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as environments from "../../../../environments.js";
5
+ import * as core from "../../../../core/index.js";
6
+ import { CargoByDriver } from "../resources/cargoByDriver/client/Client.js";
7
+ import { TaskGroupByDriver } from "../resources/taskGroupByDriver/client/Client.js";
8
+ export declare namespace Tracking {
9
+ interface Options {
10
+ environment?: core.Supplier<environments.ChrtEnvironment | string>;
11
+ /** Specify a custom URL to connect the client to. */
12
+ baseUrl?: core.Supplier<string>;
13
+ token?: core.Supplier<core.BearerToken | undefined>;
14
+ /** Additional headers to include in requests. */
15
+ headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
16
+ fetcher?: core.FetchFunction;
17
+ }
18
+ }
19
+ export declare class Tracking {
20
+ protected readonly _options: Tracking.Options;
21
+ protected _cargoByDriver: CargoByDriver | undefined;
22
+ protected _taskGroupByDriver: TaskGroupByDriver | undefined;
23
+ constructor(_options?: Tracking.Options);
24
+ get cargoByDriver(): CargoByDriver;
25
+ get taskGroupByDriver(): TaskGroupByDriver;
26
+ }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Tracking = void 0;
7
+ const Client_js_1 = require("../resources/cargoByDriver/client/Client.js");
8
+ const Client_js_2 = require("../resources/taskGroupByDriver/client/Client.js");
9
+ class Tracking {
10
+ constructor(_options = {}) {
11
+ this._options = _options;
12
+ }
13
+ get cargoByDriver() {
14
+ var _a;
15
+ return ((_a = this._cargoByDriver) !== null && _a !== void 0 ? _a : (this._cargoByDriver = new Client_js_1.CargoByDriver(this._options)));
16
+ }
17
+ get taskGroupByDriver() {
18
+ var _a;
19
+ return ((_a = this._taskGroupByDriver) !== null && _a !== void 0 ? _a : (this._taskGroupByDriver = new Client_js_2.TaskGroupByDriver(this._options)));
20
+ }
21
+ }
22
+ exports.Tracking = Tracking;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ export * from "./client/index.js";
2
+ export * from "./resources/index.js";
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./client/index.js"), exports);
18
+ __exportStar(require("./resources/index.js"), exports);
@@ -0,0 +1,67 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as environments from "../../../../../../environments.js";
5
+ import * as core from "../../../../../../core/index.js";
6
+ import * as Chrt from "../../../../../index.js";
7
+ export declare namespace CargoByDriver {
8
+ interface Options {
9
+ environment?: core.Supplier<environments.ChrtEnvironment | string>;
10
+ /** Specify a custom URL to connect the client to. */
11
+ baseUrl?: core.Supplier<string>;
12
+ token?: core.Supplier<core.BearerToken | undefined>;
13
+ /** Additional headers to include in requests. */
14
+ headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
15
+ fetcher?: core.FetchFunction;
16
+ }
17
+ interface RequestOptions {
18
+ /** The maximum time to wait for a response in seconds. */
19
+ timeoutInSeconds?: number;
20
+ /** The number of times to retry the request. Defaults to 2. */
21
+ maxRetries?: number;
22
+ /** A hook to abort the request. */
23
+ abortSignal?: AbortSignal;
24
+ /** Additional headers to include in the request. */
25
+ headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
26
+ }
27
+ }
28
+ export declare class CargoByDriver {
29
+ protected readonly _options: CargoByDriver.Options;
30
+ constructor(_options?: CargoByDriver.Options);
31
+ /**
32
+ * Returns the most recent data point in tracking.cargo_by_driver that matches the provided identifiers.
33
+ *
34
+ * @param {Chrt.tracking.CargoByDriverLastSeenRequest} request
35
+ * @param {CargoByDriver.RequestOptions} requestOptions - Request-specific configuration.
36
+ *
37
+ * @throws {@link Chrt.UnprocessableEntityError}
38
+ *
39
+ * @example
40
+ * await client.tracking.cargoByDriver.lastSeen({
41
+ * cargo_id: "cargo_id",
42
+ * task_group_id: "task_group_id"
43
+ * })
44
+ */
45
+ lastSeen(request: Chrt.tracking.CargoByDriverLastSeenRequest, requestOptions?: CargoByDriver.RequestOptions): core.HttpResponsePromise<(Chrt.TrackingCargoByDriverDataPoint1 | null) | undefined>;
46
+ private __lastSeen;
47
+ /**
48
+ * Given a driver_id and task_group_id, find cargos on the task group and write tracking points for those with status IN_TRANSIT.
49
+ *
50
+ * @param {Chrt.tracking.CargoByDriverUpdateReq} request
51
+ * @param {CargoByDriver.RequestOptions} requestOptions - Request-specific configuration.
52
+ *
53
+ * @throws {@link Chrt.UnprocessableEntityError}
54
+ *
55
+ * @example
56
+ * await client.tracking.cargoByDriver.update({
57
+ * task_group_id: "task_group_id",
58
+ * timestamp: "2024-01-15T09:30:00Z",
59
+ * location: {
60
+ * type: "Feature"
61
+ * }
62
+ * })
63
+ */
64
+ update(request: Chrt.tracking.CargoByDriverUpdateReq, requestOptions?: CargoByDriver.RequestOptions): core.HttpResponsePromise<number>;
65
+ private __update;
66
+ protected _getAuthorizationHeader(): Promise<string | undefined>;
67
+ }
@@ -0,0 +1,202 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
38
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
39
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
40
+ return new (P || (P = Promise))(function (resolve, reject) {
41
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
42
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
43
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
44
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
45
+ });
46
+ };
47
+ Object.defineProperty(exports, "__esModule", { value: true });
48
+ exports.CargoByDriver = void 0;
49
+ const environments = __importStar(require("../../../../../../environments.js"));
50
+ const core = __importStar(require("../../../../../../core/index.js"));
51
+ const Chrt = __importStar(require("../../../../../index.js"));
52
+ const headers_js_1 = require("../../../../../../core/headers.js");
53
+ const errors = __importStar(require("../../../../../../errors/index.js"));
54
+ class CargoByDriver {
55
+ constructor(_options = {}) {
56
+ this._options = _options;
57
+ }
58
+ /**
59
+ * Returns the most recent data point in tracking.cargo_by_driver that matches the provided identifiers.
60
+ *
61
+ * @param {Chrt.tracking.CargoByDriverLastSeenRequest} request
62
+ * @param {CargoByDriver.RequestOptions} requestOptions - Request-specific configuration.
63
+ *
64
+ * @throws {@link Chrt.UnprocessableEntityError}
65
+ *
66
+ * @example
67
+ * await client.tracking.cargoByDriver.lastSeen({
68
+ * cargo_id: "cargo_id",
69
+ * task_group_id: "task_group_id"
70
+ * })
71
+ */
72
+ lastSeen(request, requestOptions) {
73
+ return core.HttpResponsePromise.fromPromise(this.__lastSeen(request, requestOptions));
74
+ }
75
+ __lastSeen(request, requestOptions) {
76
+ return __awaiter(this, void 0, void 0, function* () {
77
+ var _a, _b, _c, _d;
78
+ const { cargo_id: cargoId, task_group_id: taskGroupId } = request;
79
+ const _queryParams = {};
80
+ _queryParams["cargo_id"] = cargoId;
81
+ _queryParams["task_group_id"] = taskGroupId;
82
+ const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
83
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.ChrtEnvironment.Local, "tracking/cargo_by_driver/last_seen"),
84
+ method: "GET",
85
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
86
+ queryParameters: _queryParams,
87
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
88
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
89
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
90
+ });
91
+ if (_response.ok) {
92
+ return {
93
+ data: _response.body,
94
+ rawResponse: _response.rawResponse,
95
+ };
96
+ }
97
+ if (_response.error.reason === "status-code") {
98
+ switch (_response.error.statusCode) {
99
+ case 422:
100
+ throw new Chrt.UnprocessableEntityError(_response.error.body, _response.rawResponse);
101
+ default:
102
+ throw new errors.ChrtError({
103
+ statusCode: _response.error.statusCode,
104
+ body: _response.error.body,
105
+ rawResponse: _response.rawResponse,
106
+ });
107
+ }
108
+ }
109
+ switch (_response.error.reason) {
110
+ case "non-json":
111
+ throw new errors.ChrtError({
112
+ statusCode: _response.error.statusCode,
113
+ body: _response.error.rawBody,
114
+ rawResponse: _response.rawResponse,
115
+ });
116
+ case "timeout":
117
+ throw new errors.ChrtTimeoutError("Timeout exceeded when calling GET /tracking/cargo_by_driver/last_seen.");
118
+ case "unknown":
119
+ throw new errors.ChrtError({
120
+ message: _response.error.errorMessage,
121
+ rawResponse: _response.rawResponse,
122
+ });
123
+ }
124
+ });
125
+ }
126
+ /**
127
+ * Given a driver_id and task_group_id, find cargos on the task group and write tracking points for those with status IN_TRANSIT.
128
+ *
129
+ * @param {Chrt.tracking.CargoByDriverUpdateReq} request
130
+ * @param {CargoByDriver.RequestOptions} requestOptions - Request-specific configuration.
131
+ *
132
+ * @throws {@link Chrt.UnprocessableEntityError}
133
+ *
134
+ * @example
135
+ * await client.tracking.cargoByDriver.update({
136
+ * task_group_id: "task_group_id",
137
+ * timestamp: "2024-01-15T09:30:00Z",
138
+ * location: {
139
+ * type: "Feature"
140
+ * }
141
+ * })
142
+ */
143
+ update(request, requestOptions) {
144
+ return core.HttpResponsePromise.fromPromise(this.__update(request, requestOptions));
145
+ }
146
+ __update(request, requestOptions) {
147
+ return __awaiter(this, void 0, void 0, function* () {
148
+ var _a, _b, _c, _d;
149
+ const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
150
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.ChrtEnvironment.Local, "tracking/cargo_by_driver/update"),
151
+ method: "POST",
152
+ headers: (0, headers_js_1.mergeHeaders)((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
153
+ contentType: "application/json",
154
+ requestType: "json",
155
+ body: request,
156
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
157
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
158
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
159
+ });
160
+ if (_response.ok) {
161
+ return { data: _response.body, rawResponse: _response.rawResponse };
162
+ }
163
+ if (_response.error.reason === "status-code") {
164
+ switch (_response.error.statusCode) {
165
+ case 422:
166
+ throw new Chrt.UnprocessableEntityError(_response.error.body, _response.rawResponse);
167
+ default:
168
+ throw new errors.ChrtError({
169
+ statusCode: _response.error.statusCode,
170
+ body: _response.error.body,
171
+ rawResponse: _response.rawResponse,
172
+ });
173
+ }
174
+ }
175
+ switch (_response.error.reason) {
176
+ case "non-json":
177
+ throw new errors.ChrtError({
178
+ statusCode: _response.error.statusCode,
179
+ body: _response.error.rawBody,
180
+ rawResponse: _response.rawResponse,
181
+ });
182
+ case "timeout":
183
+ throw new errors.ChrtTimeoutError("Timeout exceeded when calling POST /tracking/cargo_by_driver/update.");
184
+ case "unknown":
185
+ throw new errors.ChrtError({
186
+ message: _response.error.errorMessage,
187
+ rawResponse: _response.rawResponse,
188
+ });
189
+ }
190
+ });
191
+ }
192
+ _getAuthorizationHeader() {
193
+ return __awaiter(this, void 0, void 0, function* () {
194
+ const bearer = yield core.Supplier.get(this._options.token);
195
+ if (bearer != null) {
196
+ return `Bearer ${bearer}`;
197
+ }
198
+ return undefined;
199
+ });
200
+ }
201
+ }
202
+ exports.CargoByDriver = CargoByDriver;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ export * from "./requests/index.js";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./requests/index.js"), exports);
@@ -0,0 +1,14 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * @example
6
+ * {
7
+ * cargo_id: "cargo_id",
8
+ * task_group_id: "task_group_id"
9
+ * }
10
+ */
11
+ export interface CargoByDriverLastSeenRequest {
12
+ cargo_id: string;
13
+ task_group_id: string;
14
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Chrt from "../../../../../../index.js";
5
+ /**
6
+ * @example
7
+ * {
8
+ * task_group_id: "task_group_id",
9
+ * timestamp: "2024-01-15T09:30:00Z",
10
+ * location: {
11
+ * type: "Feature"
12
+ * }
13
+ * }
14
+ */
15
+ export interface CargoByDriverUpdateReq {
16
+ task_group_id: string;
17
+ timestamp: string;
18
+ location: Chrt.LocationFeature;
19
+ }
@@ -0,0 +1,2 @@
1
+ export { type CargoByDriverLastSeenRequest } from "./CargoByDriverLastSeenRequest.js";
2
+ export { type CargoByDriverUpdateReq } from "./CargoByDriverUpdateReq.js";
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export * from "./client/index.js";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./client/index.js"), exports);
@@ -0,0 +1,4 @@
1
+ export * as cargoByDriver from "./cargoByDriver/index.js";
2
+ export * as taskGroupByDriver from "./taskGroupByDriver/index.js";
3
+ export * from "./cargoByDriver/client/requests/index.js";
4
+ export * from "./taskGroupByDriver/client/requests/index.js";
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
36
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.taskGroupByDriver = exports.cargoByDriver = void 0;
40
+ exports.cargoByDriver = __importStar(require("./cargoByDriver/index.js"));
41
+ exports.taskGroupByDriver = __importStar(require("./taskGroupByDriver/index.js"));
42
+ __exportStar(require("./cargoByDriver/client/requests/index.js"), exports);
43
+ __exportStar(require("./taskGroupByDriver/client/requests/index.js"), exports);
@@ -0,0 +1,66 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as environments from "../../../../../../environments.js";
5
+ import * as core from "../../../../../../core/index.js";
6
+ import * as Chrt from "../../../../../index.js";
7
+ export declare namespace TaskGroupByDriver {
8
+ interface Options {
9
+ environment?: core.Supplier<environments.ChrtEnvironment | string>;
10
+ /** Specify a custom URL to connect the client to. */
11
+ baseUrl?: core.Supplier<string>;
12
+ token?: core.Supplier<core.BearerToken | undefined>;
13
+ /** Additional headers to include in requests. */
14
+ headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
15
+ fetcher?: core.FetchFunction;
16
+ }
17
+ interface RequestOptions {
18
+ /** The maximum time to wait for a response in seconds. */
19
+ timeoutInSeconds?: number;
20
+ /** The number of times to retry the request. Defaults to 2. */
21
+ maxRetries?: number;
22
+ /** A hook to abort the request. */
23
+ abortSignal?: AbortSignal;
24
+ /** Additional headers to include in the request. */
25
+ headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
26
+ }
27
+ }
28
+ export declare class TaskGroupByDriver {
29
+ protected readonly _options: TaskGroupByDriver.Options;
30
+ constructor(_options?: TaskGroupByDriver.Options);
31
+ /**
32
+ * Returns the most recent data point in tracking.task_group_by_driver for the given task_group_id.
33
+ *
34
+ * @param {Chrt.tracking.TaskGroupByDriverLastSeenRequest} request
35
+ * @param {TaskGroupByDriver.RequestOptions} requestOptions - Request-specific configuration.
36
+ *
37
+ * @throws {@link Chrt.UnprocessableEntityError}
38
+ *
39
+ * @example
40
+ * await client.tracking.taskGroupByDriver.lastSeen({
41
+ * task_group_id: "task_group_id"
42
+ * })
43
+ */
44
+ lastSeen(request: Chrt.tracking.TaskGroupByDriverLastSeenRequest, requestOptions?: TaskGroupByDriver.RequestOptions): core.HttpResponsePromise<(Chrt.TrackingTaskGroupByDriverDataPoint1 | null) | undefined>;
45
+ private __lastSeen;
46
+ /**
47
+ * Writes a data point to tracking.task_group_by_driver when the task group is in progress.
48
+ *
49
+ * @param {Chrt.tracking.TaskGroupByDriverUpdateReq} request
50
+ * @param {TaskGroupByDriver.RequestOptions} requestOptions - Request-specific configuration.
51
+ *
52
+ * @throws {@link Chrt.UnprocessableEntityError}
53
+ *
54
+ * @example
55
+ * await client.tracking.taskGroupByDriver.update({
56
+ * task_group_id: "task_group_id",
57
+ * timestamp: "2024-01-15T09:30:00Z",
58
+ * location: {
59
+ * type: "Feature"
60
+ * }
61
+ * })
62
+ */
63
+ update(request: Chrt.tracking.TaskGroupByDriverUpdateReq, requestOptions?: TaskGroupByDriver.RequestOptions): core.HttpResponsePromise<boolean>;
64
+ private __update;
65
+ protected _getAuthorizationHeader(): Promise<string | undefined>;
66
+ }