@chrt-inc/typescript-sdk 0.252.0 → 1.258.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 (106) hide show
  1. package/dist/cjs/Client.js +2 -2
  2. package/dist/cjs/api/resources/tracking/client/Client.d.ts +6 -0
  3. package/dist/cjs/api/resources/tracking/client/Client.js +18 -8
  4. package/dist/cjs/api/resources/tracking/resources/cargoByDevice/client/Client.d.ts +48 -0
  5. package/dist/cjs/api/resources/tracking/resources/cargoByDevice/client/Client.js +136 -0
  6. package/dist/cjs/api/resources/tracking/resources/cargoByDevice/client/index.d.ts +2 -0
  7. package/dist/cjs/api/resources/tracking/resources/cargoByDevice/client/index.js +17 -0
  8. package/dist/cjs/api/resources/tracking/resources/cargoByDevice/client/requests/CargoByDeviceLastSeenRequest.d.ts +14 -0
  9. package/dist/cjs/api/resources/tracking/resources/cargoByDevice/client/requests/index.d.ts +1 -0
  10. package/dist/cjs/api/resources/tracking/resources/cargoByDevice/client/requests/index.js +2 -0
  11. package/dist/cjs/api/resources/tracking/resources/cargoByDevice/index.d.ts +1 -0
  12. package/dist/cjs/api/resources/tracking/resources/cargoByDevice/index.js +17 -0
  13. package/dist/cjs/api/resources/tracking/resources/cargoByDriver/client/Client.d.ts +1 -20
  14. package/dist/cjs/api/resources/tracking/resources/cargoByDriver/client/Client.js +1 -67
  15. package/dist/cjs/api/resources/tracking/resources/cargoByDriver/client/requests/index.d.ts +0 -1
  16. package/dist/cjs/api/resources/tracking/resources/devices/client/Client.d.ts +3 -5
  17. package/dist/cjs/api/resources/tracking/resources/devices/client/Client.js +12 -9
  18. package/dist/cjs/api/resources/tracking/resources/devices/client/requests/DevicesGetRequest.d.ts +3 -4
  19. package/dist/cjs/api/resources/tracking/resources/driver/client/Client.d.ts +51 -0
  20. package/dist/cjs/api/resources/tracking/resources/driver/client/Client.js +134 -0
  21. package/dist/cjs/api/resources/tracking/resources/driver/client/index.d.ts +2 -0
  22. package/dist/cjs/api/resources/tracking/resources/driver/client/index.js +17 -0
  23. package/dist/cjs/api/resources/tracking/resources/{cargoByDriver/client/requests/CargoByDriverUpdateReq.d.ts → driver/client/requests/DriverUpdateReq.d.ts} +1 -1
  24. package/dist/cjs/api/resources/tracking/resources/driver/client/requests/index.d.ts +1 -0
  25. package/dist/cjs/api/resources/tracking/resources/driver/client/requests/index.js +2 -0
  26. package/dist/cjs/api/resources/tracking/resources/driver/index.d.ts +1 -0
  27. package/dist/cjs/api/resources/tracking/resources/driver/index.js +17 -0
  28. package/dist/cjs/api/resources/tracking/resources/index.d.ts +4 -0
  29. package/dist/cjs/api/resources/tracking/resources/index.js +5 -1
  30. package/dist/cjs/api/resources/tracking/resources/sessionByDevice/client/Client.d.ts +30 -0
  31. package/dist/cjs/api/resources/tracking/resources/sessionByDevice/client/Client.js +146 -8
  32. package/dist/cjs/api/resources/tracking/resources/sessionByDevice/client/requests/SessionByDeviceDataPointsFancyRequest.d.ts +13 -0
  33. package/dist/cjs/api/resources/tracking/resources/sessionByDevice/client/requests/SessionByDeviceDataPointsFancyRequest.js +5 -0
  34. package/dist/cjs/api/resources/tracking/resources/sessionByDevice/client/requests/SessionByDeviceDataPointsRequest.d.ts +13 -0
  35. package/dist/cjs/api/resources/tracking/resources/sessionByDevice/client/requests/SessionByDeviceDataPointsRequest.js +5 -0
  36. package/dist/cjs/api/resources/tracking/resources/sessionByDevice/client/requests/index.d.ts +2 -0
  37. package/dist/cjs/api/resources/tracking/resources/taskGroupByDriver/client/Client.d.ts +1 -20
  38. package/dist/cjs/api/resources/tracking/resources/taskGroupByDriver/client/Client.js +1 -67
  39. package/dist/cjs/api/resources/tracking/resources/taskGroupByDriver/client/requests/index.d.ts +0 -1
  40. package/dist/cjs/api/types/DriverUpdateResp.d.ts +11 -0
  41. package/dist/cjs/api/types/DriverUpdateResp.js +5 -0
  42. package/dist/cjs/api/types/TrackingCargoByDeviceDataPoint1.d.ts +12 -0
  43. package/dist/cjs/api/types/TrackingCargoByDeviceDataPoint1.js +5 -0
  44. package/dist/cjs/api/types/TrackingCargoByDeviceDataPointMetadata1.d.ts +8 -0
  45. package/dist/cjs/api/types/TrackingCargoByDeviceDataPointMetadata1.js +5 -0
  46. package/dist/cjs/api/types/index.d.ts +3 -0
  47. package/dist/cjs/api/types/index.js +3 -0
  48. package/dist/cjs/version.d.ts +1 -1
  49. package/dist/cjs/version.js +1 -1
  50. package/dist/esm/Client.mjs +2 -2
  51. package/dist/esm/api/resources/tracking/client/Client.d.mts +6 -0
  52. package/dist/esm/api/resources/tracking/client/Client.mjs +10 -0
  53. package/dist/esm/api/resources/tracking/resources/cargoByDevice/client/Client.d.mts +48 -0
  54. package/dist/esm/api/resources/tracking/resources/cargoByDevice/client/Client.mjs +99 -0
  55. package/dist/esm/api/resources/tracking/resources/cargoByDevice/client/index.d.mts +2 -0
  56. package/dist/esm/api/resources/tracking/resources/cargoByDevice/client/index.mjs +1 -0
  57. package/dist/esm/api/resources/tracking/resources/cargoByDevice/client/requests/CargoByDeviceLastSeenRequest.d.mts +14 -0
  58. package/dist/esm/api/resources/tracking/resources/cargoByDevice/client/requests/index.d.mts +1 -0
  59. package/dist/esm/api/resources/tracking/resources/cargoByDevice/client/requests/index.mjs +1 -0
  60. package/dist/esm/api/resources/tracking/resources/cargoByDevice/index.d.mts +1 -0
  61. package/dist/esm/api/resources/tracking/resources/cargoByDevice/index.mjs +1 -0
  62. package/dist/esm/api/resources/tracking/resources/cargoByDriver/client/Client.d.mts +1 -20
  63. package/dist/esm/api/resources/tracking/resources/cargoByDriver/client/Client.mjs +1 -67
  64. package/dist/esm/api/resources/tracking/resources/cargoByDriver/client/requests/index.d.mts +0 -1
  65. package/dist/esm/api/resources/tracking/resources/devices/client/Client.d.mts +3 -5
  66. package/dist/esm/api/resources/tracking/resources/devices/client/Client.mjs +12 -9
  67. package/dist/esm/api/resources/tracking/resources/devices/client/requests/DevicesGetRequest.d.mts +3 -4
  68. package/dist/esm/api/resources/tracking/resources/driver/client/Client.d.mts +51 -0
  69. package/dist/esm/api/resources/tracking/resources/driver/client/Client.mjs +97 -0
  70. package/dist/esm/api/resources/tracking/resources/driver/client/index.d.mts +2 -0
  71. package/dist/esm/api/resources/tracking/resources/driver/client/index.mjs +1 -0
  72. package/dist/esm/api/resources/tracking/resources/{cargoByDriver/client/requests/CargoByDriverUpdateReq.d.mts → driver/client/requests/DriverUpdateReq.d.mts} +1 -1
  73. package/dist/esm/api/resources/tracking/resources/driver/client/requests/index.d.mts +1 -0
  74. package/dist/esm/api/resources/tracking/resources/driver/client/requests/index.mjs +1 -0
  75. package/dist/esm/api/resources/tracking/resources/driver/index.d.mts +1 -0
  76. package/dist/esm/api/resources/tracking/resources/driver/index.mjs +1 -0
  77. package/dist/esm/api/resources/tracking/resources/index.d.mts +4 -0
  78. package/dist/esm/api/resources/tracking/resources/index.mjs +4 -0
  79. package/dist/esm/api/resources/tracking/resources/sessionByDevice/client/Client.d.mts +30 -0
  80. package/dist/esm/api/resources/tracking/resources/sessionByDevice/client/Client.mjs +146 -8
  81. package/dist/esm/api/resources/tracking/resources/sessionByDevice/client/requests/SessionByDeviceDataPointsFancyRequest.d.mts +13 -0
  82. package/dist/esm/api/resources/tracking/resources/sessionByDevice/client/requests/SessionByDeviceDataPointsFancyRequest.mjs +4 -0
  83. package/dist/esm/api/resources/tracking/resources/sessionByDevice/client/requests/SessionByDeviceDataPointsRequest.d.mts +13 -0
  84. package/dist/esm/api/resources/tracking/resources/sessionByDevice/client/requests/SessionByDeviceDataPointsRequest.mjs +4 -0
  85. package/dist/esm/api/resources/tracking/resources/sessionByDevice/client/requests/index.d.mts +2 -0
  86. package/dist/esm/api/resources/tracking/resources/taskGroupByDriver/client/Client.d.mts +1 -20
  87. package/dist/esm/api/resources/tracking/resources/taskGroupByDriver/client/Client.mjs +1 -67
  88. package/dist/esm/api/resources/tracking/resources/taskGroupByDriver/client/requests/index.d.mts +0 -1
  89. package/dist/esm/api/types/DriverUpdateResp.d.mts +11 -0
  90. package/dist/esm/api/types/DriverUpdateResp.mjs +4 -0
  91. package/dist/esm/api/types/TrackingCargoByDeviceDataPoint1.d.mts +12 -0
  92. package/dist/esm/api/types/TrackingCargoByDeviceDataPoint1.mjs +4 -0
  93. package/dist/esm/api/types/TrackingCargoByDeviceDataPointMetadata1.d.mts +8 -0
  94. package/dist/esm/api/types/TrackingCargoByDeviceDataPointMetadata1.mjs +4 -0
  95. package/dist/esm/api/types/index.d.mts +3 -0
  96. package/dist/esm/api/types/index.mjs +3 -0
  97. package/dist/esm/version.d.mts +1 -1
  98. package/dist/esm/version.mjs +1 -1
  99. package/package.json +1 -1
  100. package/reference.md +161 -32
  101. package/dist/cjs/api/resources/tracking/resources/taskGroupByDriver/client/requests/TaskGroupByDriverUpdateReq.d.ts +0 -19
  102. package/dist/esm/api/resources/tracking/resources/taskGroupByDriver/client/requests/TaskGroupByDriverUpdateReq.d.mts +0 -19
  103. /package/dist/cjs/api/resources/tracking/resources/{cargoByDriver/client/requests/CargoByDriverUpdateReq.js → cargoByDevice/client/requests/CargoByDeviceLastSeenRequest.js} +0 -0
  104. /package/dist/cjs/api/resources/tracking/resources/{taskGroupByDriver/client/requests/TaskGroupByDriverUpdateReq.js → driver/client/requests/DriverUpdateReq.js} +0 -0
  105. /package/dist/esm/api/resources/tracking/resources/{cargoByDriver/client/requests/CargoByDriverUpdateReq.mjs → cargoByDevice/client/requests/CargoByDeviceLastSeenRequest.mjs} +0 -0
  106. /package/dist/esm/api/resources/tracking/resources/{taskGroupByDriver/client/requests/TaskGroupByDriverUpdateReq.mjs → driver/client/requests/DriverUpdateReq.mjs} +0 -0
@@ -68,8 +68,8 @@ class ChrtClient {
68
68
  this._options = Object.assign(Object.assign({}, _options), { headers: (0, headers_js_1.mergeHeaders)({
69
69
  "X-Fern-Language": "JavaScript",
70
70
  "X-Fern-SDK-Name": "@chrt-inc/typescript-sdk",
71
- "X-Fern-SDK-Version": "0.252.0",
72
- "User-Agent": "@chrt-inc/typescript-sdk/0.252.0",
71
+ "X-Fern-SDK-Version": "1.258.0",
72
+ "User-Agent": "@chrt-inc/typescript-sdk/1.258.0",
73
73
  "X-Fern-Runtime": core.RUNTIME.type,
74
74
  "X-Fern-Runtime-Version": core.RUNTIME.version,
75
75
  }, _options === null || _options === void 0 ? void 0 : _options.headers) });
@@ -3,8 +3,10 @@
3
3
  */
4
4
  import * as environments from "../../../../environments.js";
5
5
  import * as core from "../../../../core/index.js";
6
+ import { CargoByDevice } from "../resources/cargoByDevice/client/Client.js";
6
7
  import { CargoByDriver } from "../resources/cargoByDriver/client/Client.js";
7
8
  import { Devices } from "../resources/devices/client/Client.js";
9
+ import { Driver } from "../resources/driver/client/Client.js";
8
10
  import { TaskGroupByDriver } from "../resources/taskGroupByDriver/client/Client.js";
9
11
  import { SessionByDevice } from "../resources/sessionByDevice/client/Client.js";
10
12
  export declare namespace Tracking {
@@ -20,13 +22,17 @@ export declare namespace Tracking {
20
22
  }
21
23
  export declare class Tracking {
22
24
  protected readonly _options: Tracking.Options;
25
+ protected _cargoByDevice: CargoByDevice | undefined;
23
26
  protected _cargoByDriver: CargoByDriver | undefined;
24
27
  protected _devices: Devices | undefined;
28
+ protected _driver: Driver | undefined;
25
29
  protected _taskGroupByDriver: TaskGroupByDriver | undefined;
26
30
  protected _sessionByDevice: SessionByDevice | undefined;
27
31
  constructor(_options?: Tracking.Options);
32
+ get cargoByDevice(): CargoByDevice;
28
33
  get cargoByDriver(): CargoByDriver;
29
34
  get devices(): Devices;
35
+ get driver(): Driver;
30
36
  get taskGroupByDriver(): TaskGroupByDriver;
31
37
  get sessionByDevice(): SessionByDevice;
32
38
  }
@@ -4,29 +4,39 @@
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.Tracking = void 0;
7
- const Client_js_1 = require("../resources/cargoByDriver/client/Client.js");
8
- const Client_js_2 = require("../resources/devices/client/Client.js");
9
- const Client_js_3 = require("../resources/taskGroupByDriver/client/Client.js");
10
- const Client_js_4 = require("../resources/sessionByDevice/client/Client.js");
7
+ const Client_js_1 = require("../resources/cargoByDevice/client/Client.js");
8
+ const Client_js_2 = require("../resources/cargoByDriver/client/Client.js");
9
+ const Client_js_3 = require("../resources/devices/client/Client.js");
10
+ const Client_js_4 = require("../resources/driver/client/Client.js");
11
+ const Client_js_5 = require("../resources/taskGroupByDriver/client/Client.js");
12
+ const Client_js_6 = require("../resources/sessionByDevice/client/Client.js");
11
13
  class Tracking {
12
14
  constructor(_options = {}) {
13
15
  this._options = _options;
14
16
  }
17
+ get cargoByDevice() {
18
+ var _a;
19
+ return ((_a = this._cargoByDevice) !== null && _a !== void 0 ? _a : (this._cargoByDevice = new Client_js_1.CargoByDevice(this._options)));
20
+ }
15
21
  get cargoByDriver() {
16
22
  var _a;
17
- return ((_a = this._cargoByDriver) !== null && _a !== void 0 ? _a : (this._cargoByDriver = new Client_js_1.CargoByDriver(this._options)));
23
+ return ((_a = this._cargoByDriver) !== null && _a !== void 0 ? _a : (this._cargoByDriver = new Client_js_2.CargoByDriver(this._options)));
18
24
  }
19
25
  get devices() {
20
26
  var _a;
21
- return ((_a = this._devices) !== null && _a !== void 0 ? _a : (this._devices = new Client_js_2.Devices(this._options)));
27
+ return ((_a = this._devices) !== null && _a !== void 0 ? _a : (this._devices = new Client_js_3.Devices(this._options)));
28
+ }
29
+ get driver() {
30
+ var _a;
31
+ return ((_a = this._driver) !== null && _a !== void 0 ? _a : (this._driver = new Client_js_4.Driver(this._options)));
22
32
  }
23
33
  get taskGroupByDriver() {
24
34
  var _a;
25
- return ((_a = this._taskGroupByDriver) !== null && _a !== void 0 ? _a : (this._taskGroupByDriver = new Client_js_3.TaskGroupByDriver(this._options)));
35
+ return ((_a = this._taskGroupByDriver) !== null && _a !== void 0 ? _a : (this._taskGroupByDriver = new Client_js_5.TaskGroupByDriver(this._options)));
26
36
  }
27
37
  get sessionByDevice() {
28
38
  var _a;
29
- return ((_a = this._sessionByDevice) !== null && _a !== void 0 ? _a : (this._sessionByDevice = new Client_js_4.SessionByDevice(this._options)));
39
+ return ((_a = this._sessionByDevice) !== null && _a !== void 0 ? _a : (this._sessionByDevice = new Client_js_6.SessionByDevice(this._options)));
30
40
  }
31
41
  }
32
42
  exports.Tracking = Tracking;
@@ -0,0 +1,48 @@
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 CargoByDevice {
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 CargoByDevice {
29
+ protected readonly _options: CargoByDevice.Options;
30
+ constructor(_options?: CargoByDevice.Options);
31
+ /**
32
+ * For a given cargo_id and task_group_id, returns the single most recent data point from tracking.cargo_by_device.
33
+ *
34
+ * @param {Chrt.tracking.CargoByDeviceLastSeenRequest} request
35
+ * @param {CargoByDevice.RequestOptions} requestOptions - Request-specific configuration.
36
+ *
37
+ * @throws {@link Chrt.UnprocessableEntityError}
38
+ *
39
+ * @example
40
+ * await client.tracking.cargoByDevice.lastSeen({
41
+ * cargo_id: "cargo_id",
42
+ * task_group_id: "task_group_id"
43
+ * })
44
+ */
45
+ lastSeen(request: Chrt.tracking.CargoByDeviceLastSeenRequest, requestOptions?: CargoByDevice.RequestOptions): core.HttpResponsePromise<(Chrt.TrackingCargoByDeviceDataPoint1 | null) | undefined>;
46
+ private __lastSeen;
47
+ protected _getAuthorizationHeader(): Promise<string | undefined>;
48
+ }
@@ -0,0 +1,136 @@
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.CargoByDevice = 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 CargoByDevice {
55
+ constructor(_options = {}) {
56
+ this._options = _options;
57
+ }
58
+ /**
59
+ * For a given cargo_id and task_group_id, returns the single most recent data point from tracking.cargo_by_device.
60
+ *
61
+ * @param {Chrt.tracking.CargoByDeviceLastSeenRequest} request
62
+ * @param {CargoByDevice.RequestOptions} requestOptions - Request-specific configuration.
63
+ *
64
+ * @throws {@link Chrt.UnprocessableEntityError}
65
+ *
66
+ * @example
67
+ * await client.tracking.cargoByDevice.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_device/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_device/last_seen.");
118
+ case "unknown":
119
+ throw new errors.ChrtError({
120
+ message: _response.error.errorMessage,
121
+ rawResponse: _response.rawResponse,
122
+ });
123
+ }
124
+ });
125
+ }
126
+ _getAuthorizationHeader() {
127
+ return __awaiter(this, void 0, void 0, function* () {
128
+ const bearer = yield core.Supplier.get(this._options.token);
129
+ if (bearer != null) {
130
+ return `Bearer ${bearer}`;
131
+ }
132
+ return undefined;
133
+ });
134
+ }
135
+ }
136
+ exports.CargoByDevice = CargoByDevice;
@@ -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 CargoByDeviceLastSeenRequest {
12
+ cargo_id: string;
13
+ task_group_id: string;
14
+ }
@@ -0,0 +1 @@
1
+ export { type CargoByDeviceLastSeenRequest } from "./CargoByDeviceLastSeenRequest.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);
@@ -29,7 +29,7 @@ export declare class CargoByDriver {
29
29
  protected readonly _options: CargoByDriver.Options;
30
30
  constructor(_options?: CargoByDriver.Options);
31
31
  /**
32
- * Returns the most recent data point in tracking.cargo_by_driver that matches the provided identifiers.
32
+ * Returns the most recent data point in tracking.cargo_by_driver that matches the provided identifiers. Data is written by the unified /driver/update endpoint.
33
33
  *
34
34
  * @param {Chrt.tracking.CargoByDriverLastSeenRequest} request
35
35
  * @param {CargoByDriver.RequestOptions} requestOptions - Request-specific configuration.
@@ -44,24 +44,5 @@ export declare class CargoByDriver {
44
44
  */
45
45
  lastSeen(request: Chrt.tracking.CargoByDriverLastSeenRequest, requestOptions?: CargoByDriver.RequestOptions): core.HttpResponsePromise<(Chrt.TrackingCargoByDriverDataPoint1 | null) | undefined>;
46
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
47
  protected _getAuthorizationHeader(): Promise<string | undefined>;
67
48
  }
@@ -56,7 +56,7 @@ class CargoByDriver {
56
56
  this._options = _options;
57
57
  }
58
58
  /**
59
- * Returns the most recent data point in tracking.cargo_by_driver that matches the provided identifiers.
59
+ * Returns the most recent data point in tracking.cargo_by_driver that matches the provided identifiers. Data is written by the unified /driver/update endpoint.
60
60
  *
61
61
  * @param {Chrt.tracking.CargoByDriverLastSeenRequest} request
62
62
  * @param {CargoByDriver.RequestOptions} requestOptions - Request-specific configuration.
@@ -123,72 +123,6 @@ class CargoByDriver {
123
123
  }
124
124
  });
125
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
126
  _getAuthorizationHeader() {
193
127
  return __awaiter(this, void 0, void 0, function* () {
194
128
  const bearer = yield core.Supplier.get(this._options.token);
@@ -1,2 +1 @@
1
1
  export { type CargoByDriverLastSeenRequest } from "./CargoByDriverLastSeenRequest.js";
2
- export { type CargoByDriverUpdateReq } from "./CargoByDriverUpdateReq.js";
@@ -44,7 +44,7 @@ export declare class Devices {
44
44
  registerToOrg(request: Chrt.tracking.DevicesRegisterToOrgRequest, requestOptions?: Devices.RequestOptions): core.HttpResponsePromise<string>;
45
45
  private __registerToOrg;
46
46
  /**
47
- * Get a device by device_mac_address.
47
+ * Get a device by device_mac_address or device_id.
48
48
  *
49
49
  * @param {Chrt.tracking.DevicesGetRequest} request
50
50
  * @param {Devices.RequestOptions} requestOptions - Request-specific configuration.
@@ -52,11 +52,9 @@ export declare class Devices {
52
52
  * @throws {@link Chrt.UnprocessableEntityError}
53
53
  *
54
54
  * @example
55
- * await client.tracking.devices.get({
56
- * device_mac_address: "device_mac_address"
57
- * })
55
+ * await client.tracking.devices.get()
58
56
  */
59
- get(request: Chrt.tracking.DevicesGetRequest, requestOptions?: Devices.RequestOptions): core.HttpResponsePromise<Chrt.Device1>;
57
+ get(request?: Chrt.tracking.DevicesGetRequest, requestOptions?: Devices.RequestOptions): core.HttpResponsePromise<Chrt.Device1>;
60
58
  private __get;
61
59
  /**
62
60
  * List all devices registered to the caller's org.
@@ -119,7 +119,7 @@ class Devices {
119
119
  });
120
120
  }
121
121
  /**
122
- * Get a device by device_mac_address.
122
+ * Get a device by device_mac_address or device_id.
123
123
  *
124
124
  * @param {Chrt.tracking.DevicesGetRequest} request
125
125
  * @param {Devices.RequestOptions} requestOptions - Request-specific configuration.
@@ -127,19 +127,22 @@ class Devices {
127
127
  * @throws {@link Chrt.UnprocessableEntityError}
128
128
  *
129
129
  * @example
130
- * await client.tracking.devices.get({
131
- * device_mac_address: "device_mac_address"
132
- * })
130
+ * await client.tracking.devices.get()
133
131
  */
134
- get(request, requestOptions) {
132
+ get(request = {}, requestOptions) {
135
133
  return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions));
136
134
  }
137
- __get(request, requestOptions) {
138
- return __awaiter(this, void 0, void 0, function* () {
135
+ __get() {
136
+ return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
139
137
  var _a, _b, _c, _d;
140
- const { device_mac_address: deviceMacAddress } = request;
138
+ const { device_mac_address: deviceMacAddress, device_id: deviceId } = request;
141
139
  const _queryParams = {};
142
- _queryParams["device_mac_address"] = deviceMacAddress;
140
+ if (deviceMacAddress !== undefined) {
141
+ _queryParams["device_mac_address"] = deviceMacAddress;
142
+ }
143
+ if (deviceId !== undefined) {
144
+ _queryParams["device_id"] = deviceId;
145
+ }
143
146
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
144
147
  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/devices"),
145
148
  method: "GET",
@@ -3,10 +3,9 @@
3
3
  */
4
4
  /**
5
5
  * @example
6
- * {
7
- * device_mac_address: "device_mac_address"
8
- * }
6
+ * {}
9
7
  */
10
8
  export interface DevicesGetRequest {
11
- device_mac_address: string;
9
+ device_mac_address?: string | null;
10
+ device_id?: string | null;
12
11
  }
@@ -0,0 +1,51 @@
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 Driver {
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 Driver {
29
+ protected readonly _options: Driver.Options;
30
+ constructor(_options?: Driver.Options);
31
+ /**
32
+ * Unified endpoint for driver location updates. Automatically determines whether to update task group tracking (if IN_PROGRESS) and/or cargo tracking (if IN_TRANSIT) based on current states.
33
+ *
34
+ * @param {Chrt.tracking.DriverUpdateReq} request
35
+ * @param {Driver.RequestOptions} requestOptions - Request-specific configuration.
36
+ *
37
+ * @throws {@link Chrt.UnprocessableEntityError}
38
+ *
39
+ * @example
40
+ * await client.tracking.driver.update({
41
+ * task_group_id: "task_group_id",
42
+ * timestamp: "2024-01-15T09:30:00Z",
43
+ * location: {
44
+ * type: "Feature"
45
+ * }
46
+ * })
47
+ */
48
+ update(request: Chrt.tracking.DriverUpdateReq, requestOptions?: Driver.RequestOptions): core.HttpResponsePromise<Chrt.DriverUpdateResp>;
49
+ private __update;
50
+ protected _getAuthorizationHeader(): Promise<string | undefined>;
51
+ }