@chrt-inc/typescript-sdk 0.252.0 → 1.254.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.
- package/dist/cjs/Client.js +2 -2
- package/dist/cjs/api/resources/tracking/client/Client.d.ts +6 -0
- package/dist/cjs/api/resources/tracking/client/Client.js +18 -8
- package/dist/cjs/api/resources/tracking/resources/cargoByDevice/client/Client.d.ts +48 -0
- package/dist/cjs/api/resources/tracking/resources/cargoByDevice/client/Client.js +136 -0
- package/dist/cjs/api/resources/tracking/resources/cargoByDevice/client/index.d.ts +2 -0
- package/dist/cjs/api/resources/tracking/resources/cargoByDevice/client/index.js +17 -0
- package/dist/cjs/api/resources/tracking/resources/cargoByDevice/client/requests/CargoByDeviceLastSeenRequest.d.ts +14 -0
- package/dist/cjs/api/resources/tracking/resources/cargoByDevice/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/tracking/resources/cargoByDevice/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/tracking/resources/cargoByDevice/index.d.ts +1 -0
- package/dist/cjs/api/resources/tracking/resources/cargoByDevice/index.js +17 -0
- package/dist/cjs/api/resources/tracking/resources/cargoByDriver/client/Client.d.ts +1 -20
- package/dist/cjs/api/resources/tracking/resources/cargoByDriver/client/Client.js +1 -67
- package/dist/cjs/api/resources/tracking/resources/cargoByDriver/client/requests/index.d.ts +0 -1
- package/dist/cjs/api/resources/tracking/resources/driver/client/Client.d.ts +51 -0
- package/dist/cjs/api/resources/tracking/resources/driver/client/Client.js +134 -0
- package/dist/cjs/api/resources/tracking/resources/driver/client/index.d.ts +2 -0
- package/dist/cjs/api/resources/tracking/resources/driver/client/index.js +17 -0
- package/dist/cjs/api/resources/tracking/resources/{cargoByDriver/client/requests/CargoByDriverUpdateReq.d.ts → driver/client/requests/DriverUpdateReq.d.ts} +1 -1
- package/dist/cjs/api/resources/tracking/resources/driver/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/tracking/resources/driver/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/tracking/resources/driver/index.d.ts +1 -0
- package/dist/cjs/api/resources/tracking/resources/driver/index.js +17 -0
- package/dist/cjs/api/resources/tracking/resources/index.d.ts +4 -0
- package/dist/cjs/api/resources/tracking/resources/index.js +5 -1
- package/dist/cjs/api/resources/tracking/resources/sessionByDevice/client/Client.d.ts +30 -0
- package/dist/cjs/api/resources/tracking/resources/sessionByDevice/client/Client.js +146 -8
- package/dist/cjs/api/resources/tracking/resources/sessionByDevice/client/requests/SessionByDeviceDataPointsFancyRequest.d.ts +13 -0
- package/dist/cjs/api/resources/tracking/resources/sessionByDevice/client/requests/SessionByDeviceDataPointsFancyRequest.js +5 -0
- package/dist/cjs/api/resources/tracking/resources/sessionByDevice/client/requests/SessionByDeviceDataPointsRequest.d.ts +13 -0
- package/dist/cjs/api/resources/tracking/resources/sessionByDevice/client/requests/SessionByDeviceDataPointsRequest.js +5 -0
- package/dist/cjs/api/resources/tracking/resources/sessionByDevice/client/requests/index.d.ts +2 -0
- package/dist/cjs/api/resources/tracking/resources/taskGroupByDriver/client/Client.d.ts +1 -20
- package/dist/cjs/api/resources/tracking/resources/taskGroupByDriver/client/Client.js +1 -67
- package/dist/cjs/api/resources/tracking/resources/taskGroupByDriver/client/requests/index.d.ts +0 -1
- package/dist/cjs/api/types/DriverUpdateResp.d.ts +11 -0
- package/dist/cjs/api/types/DriverUpdateResp.js +5 -0
- package/dist/cjs/api/types/TrackingCargoByDeviceDataPoint1.d.ts +12 -0
- package/dist/cjs/api/types/TrackingCargoByDeviceDataPoint1.js +5 -0
- package/dist/cjs/api/types/TrackingCargoByDeviceDataPointMetadata1.d.ts +8 -0
- package/dist/cjs/api/types/TrackingCargoByDeviceDataPointMetadata1.js +5 -0
- package/dist/cjs/api/types/index.d.ts +3 -0
- package/dist/cjs/api/types/index.js +3 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Client.mjs +2 -2
- package/dist/esm/api/resources/tracking/client/Client.d.mts +6 -0
- package/dist/esm/api/resources/tracking/client/Client.mjs +10 -0
- package/dist/esm/api/resources/tracking/resources/cargoByDevice/client/Client.d.mts +48 -0
- package/dist/esm/api/resources/tracking/resources/cargoByDevice/client/Client.mjs +99 -0
- package/dist/esm/api/resources/tracking/resources/cargoByDevice/client/index.d.mts +2 -0
- package/dist/esm/api/resources/tracking/resources/cargoByDevice/client/index.mjs +1 -0
- package/dist/esm/api/resources/tracking/resources/cargoByDevice/client/requests/CargoByDeviceLastSeenRequest.d.mts +14 -0
- package/dist/esm/api/resources/tracking/resources/cargoByDevice/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/tracking/resources/cargoByDevice/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/tracking/resources/cargoByDevice/index.d.mts +1 -0
- package/dist/esm/api/resources/tracking/resources/cargoByDevice/index.mjs +1 -0
- package/dist/esm/api/resources/tracking/resources/cargoByDriver/client/Client.d.mts +1 -20
- package/dist/esm/api/resources/tracking/resources/cargoByDriver/client/Client.mjs +1 -67
- package/dist/esm/api/resources/tracking/resources/cargoByDriver/client/requests/index.d.mts +0 -1
- package/dist/esm/api/resources/tracking/resources/driver/client/Client.d.mts +51 -0
- package/dist/esm/api/resources/tracking/resources/driver/client/Client.mjs +97 -0
- package/dist/esm/api/resources/tracking/resources/driver/client/index.d.mts +2 -0
- package/dist/esm/api/resources/tracking/resources/driver/client/index.mjs +1 -0
- package/dist/esm/api/resources/tracking/resources/{cargoByDriver/client/requests/CargoByDriverUpdateReq.d.mts → driver/client/requests/DriverUpdateReq.d.mts} +1 -1
- package/dist/esm/api/resources/tracking/resources/driver/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/tracking/resources/driver/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/tracking/resources/driver/index.d.mts +1 -0
- package/dist/esm/api/resources/tracking/resources/driver/index.mjs +1 -0
- package/dist/esm/api/resources/tracking/resources/index.d.mts +4 -0
- package/dist/esm/api/resources/tracking/resources/index.mjs +4 -0
- package/dist/esm/api/resources/tracking/resources/sessionByDevice/client/Client.d.mts +30 -0
- package/dist/esm/api/resources/tracking/resources/sessionByDevice/client/Client.mjs +146 -8
- package/dist/esm/api/resources/tracking/resources/sessionByDevice/client/requests/SessionByDeviceDataPointsFancyRequest.d.mts +13 -0
- package/dist/esm/api/resources/tracking/resources/sessionByDevice/client/requests/SessionByDeviceDataPointsFancyRequest.mjs +4 -0
- package/dist/esm/api/resources/tracking/resources/sessionByDevice/client/requests/SessionByDeviceDataPointsRequest.d.mts +13 -0
- package/dist/esm/api/resources/tracking/resources/sessionByDevice/client/requests/SessionByDeviceDataPointsRequest.mjs +4 -0
- package/dist/esm/api/resources/tracking/resources/sessionByDevice/client/requests/index.d.mts +2 -0
- package/dist/esm/api/resources/tracking/resources/taskGroupByDriver/client/Client.d.mts +1 -20
- package/dist/esm/api/resources/tracking/resources/taskGroupByDriver/client/Client.mjs +1 -67
- package/dist/esm/api/resources/tracking/resources/taskGroupByDriver/client/requests/index.d.mts +0 -1
- package/dist/esm/api/types/DriverUpdateResp.d.mts +11 -0
- package/dist/esm/api/types/DriverUpdateResp.mjs +4 -0
- package/dist/esm/api/types/TrackingCargoByDeviceDataPoint1.d.mts +12 -0
- package/dist/esm/api/types/TrackingCargoByDeviceDataPoint1.mjs +4 -0
- package/dist/esm/api/types/TrackingCargoByDeviceDataPointMetadata1.d.mts +8 -0
- package/dist/esm/api/types/TrackingCargoByDeviceDataPointMetadata1.mjs +4 -0
- package/dist/esm/api/types/index.d.mts +3 -0
- package/dist/esm/api/types/index.mjs +3 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +159 -28
- package/dist/cjs/api/resources/tracking/resources/taskGroupByDriver/client/requests/TaskGroupByDriverUpdateReq.d.ts +0 -19
- package/dist/esm/api/resources/tracking/resources/taskGroupByDriver/client/requests/TaskGroupByDriverUpdateReq.d.mts +0 -19
- /package/dist/cjs/api/resources/tracking/resources/{cargoByDriver/client/requests/CargoByDriverUpdateReq.js → cargoByDevice/client/requests/CargoByDeviceLastSeenRequest.js} +0 -0
- /package/dist/cjs/api/resources/tracking/resources/{taskGroupByDriver/client/requests/TaskGroupByDriverUpdateReq.js → driver/client/requests/DriverUpdateReq.js} +0 -0
- /package/dist/esm/api/resources/tracking/resources/{cargoByDriver/client/requests/CargoByDriverUpdateReq.mjs → cargoByDevice/client/requests/CargoByDeviceLastSeenRequest.mjs} +0 -0
- /package/dist/esm/api/resources/tracking/resources/{taskGroupByDriver/client/requests/TaskGroupByDriverUpdateReq.mjs → driver/client/requests/DriverUpdateReq.mjs} +0 -0
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as environments from "../../../../environments.mjs";
|
|
5
5
|
import * as core from "../../../../core/index.mjs";
|
|
6
|
+
import { CargoByDevice } from "../resources/cargoByDevice/client/Client.mjs";
|
|
6
7
|
import { CargoByDriver } from "../resources/cargoByDriver/client/Client.mjs";
|
|
7
8
|
import { Devices } from "../resources/devices/client/Client.mjs";
|
|
9
|
+
import { Driver } from "../resources/driver/client/Client.mjs";
|
|
8
10
|
import { TaskGroupByDriver } from "../resources/taskGroupByDriver/client/Client.mjs";
|
|
9
11
|
import { SessionByDevice } from "../resources/sessionByDevice/client/Client.mjs";
|
|
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
|
}
|
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
|
+
import { CargoByDevice } from "../resources/cargoByDevice/client/Client.mjs";
|
|
4
5
|
import { CargoByDriver } from "../resources/cargoByDriver/client/Client.mjs";
|
|
5
6
|
import { Devices } from "../resources/devices/client/Client.mjs";
|
|
7
|
+
import { Driver } from "../resources/driver/client/Client.mjs";
|
|
6
8
|
import { TaskGroupByDriver } from "../resources/taskGroupByDriver/client/Client.mjs";
|
|
7
9
|
import { SessionByDevice } from "../resources/sessionByDevice/client/Client.mjs";
|
|
8
10
|
export class Tracking {
|
|
9
11
|
constructor(_options = {}) {
|
|
10
12
|
this._options = _options;
|
|
11
13
|
}
|
|
14
|
+
get cargoByDevice() {
|
|
15
|
+
var _a;
|
|
16
|
+
return ((_a = this._cargoByDevice) !== null && _a !== void 0 ? _a : (this._cargoByDevice = new CargoByDevice(this._options)));
|
|
17
|
+
}
|
|
12
18
|
get cargoByDriver() {
|
|
13
19
|
var _a;
|
|
14
20
|
return ((_a = this._cargoByDriver) !== null && _a !== void 0 ? _a : (this._cargoByDriver = new CargoByDriver(this._options)));
|
|
@@ -17,6 +23,10 @@ export class Tracking {
|
|
|
17
23
|
var _a;
|
|
18
24
|
return ((_a = this._devices) !== null && _a !== void 0 ? _a : (this._devices = new Devices(this._options)));
|
|
19
25
|
}
|
|
26
|
+
get driver() {
|
|
27
|
+
var _a;
|
|
28
|
+
return ((_a = this._driver) !== null && _a !== void 0 ? _a : (this._driver = new Driver(this._options)));
|
|
29
|
+
}
|
|
20
30
|
get taskGroupByDriver() {
|
|
21
31
|
var _a;
|
|
22
32
|
return ((_a = this._taskGroupByDriver) !== null && _a !== void 0 ? _a : (this._taskGroupByDriver = new TaskGroupByDriver(this._options)));
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as environments from "../../../../../../environments.mjs";
|
|
5
|
+
import * as core from "../../../../../../core/index.mjs";
|
|
6
|
+
import * as Chrt from "../../../../../index.mjs";
|
|
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,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
5
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
6
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
7
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
8
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
9
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
10
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
import * as environments from "../../../../../../environments.mjs";
|
|
14
|
+
import * as core from "../../../../../../core/index.mjs";
|
|
15
|
+
import * as Chrt from "../../../../../index.mjs";
|
|
16
|
+
import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.mjs";
|
|
17
|
+
import * as errors from "../../../../../../errors/index.mjs";
|
|
18
|
+
export class CargoByDevice {
|
|
19
|
+
constructor(_options = {}) {
|
|
20
|
+
this._options = _options;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* For a given cargo_id and task_group_id, returns the single most recent data point from tracking.cargo_by_device.
|
|
24
|
+
*
|
|
25
|
+
* @param {Chrt.tracking.CargoByDeviceLastSeenRequest} request
|
|
26
|
+
* @param {CargoByDevice.RequestOptions} requestOptions - Request-specific configuration.
|
|
27
|
+
*
|
|
28
|
+
* @throws {@link Chrt.UnprocessableEntityError}
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* await client.tracking.cargoByDevice.lastSeen({
|
|
32
|
+
* cargo_id: "cargo_id",
|
|
33
|
+
* task_group_id: "task_group_id"
|
|
34
|
+
* })
|
|
35
|
+
*/
|
|
36
|
+
lastSeen(request, requestOptions) {
|
|
37
|
+
return core.HttpResponsePromise.fromPromise(this.__lastSeen(request, requestOptions));
|
|
38
|
+
}
|
|
39
|
+
__lastSeen(request, requestOptions) {
|
|
40
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
var _a, _b, _c, _d;
|
|
42
|
+
const { cargo_id: cargoId, task_group_id: taskGroupId } = request;
|
|
43
|
+
const _queryParams = {};
|
|
44
|
+
_queryParams["cargo_id"] = cargoId;
|
|
45
|
+
_queryParams["task_group_id"] = taskGroupId;
|
|
46
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
47
|
+
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"),
|
|
48
|
+
method: "GET",
|
|
49
|
+
headers: mergeHeaders((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
50
|
+
queryParameters: _queryParams,
|
|
51
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
52
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
53
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
54
|
+
});
|
|
55
|
+
if (_response.ok) {
|
|
56
|
+
return {
|
|
57
|
+
data: _response.body,
|
|
58
|
+
rawResponse: _response.rawResponse,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
if (_response.error.reason === "status-code") {
|
|
62
|
+
switch (_response.error.statusCode) {
|
|
63
|
+
case 422:
|
|
64
|
+
throw new Chrt.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
65
|
+
default:
|
|
66
|
+
throw new errors.ChrtError({
|
|
67
|
+
statusCode: _response.error.statusCode,
|
|
68
|
+
body: _response.error.body,
|
|
69
|
+
rawResponse: _response.rawResponse,
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
switch (_response.error.reason) {
|
|
74
|
+
case "non-json":
|
|
75
|
+
throw new errors.ChrtError({
|
|
76
|
+
statusCode: _response.error.statusCode,
|
|
77
|
+
body: _response.error.rawBody,
|
|
78
|
+
rawResponse: _response.rawResponse,
|
|
79
|
+
});
|
|
80
|
+
case "timeout":
|
|
81
|
+
throw new errors.ChrtTimeoutError("Timeout exceeded when calling GET /tracking/cargo_by_device/last_seen.");
|
|
82
|
+
case "unknown":
|
|
83
|
+
throw new errors.ChrtError({
|
|
84
|
+
message: _response.error.errorMessage,
|
|
85
|
+
rawResponse: _response.rawResponse,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
_getAuthorizationHeader() {
|
|
91
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
92
|
+
const bearer = yield core.Supplier.get(this._options.token);
|
|
93
|
+
if (bearer != null) {
|
|
94
|
+
return `Bearer ${bearer}`;
|
|
95
|
+
}
|
|
96
|
+
return undefined;
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./requests/index.mjs";
|
|
@@ -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.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./client/index.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./client/index.mjs";
|
|
@@ -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
|
}
|
|
@@ -20,7 +20,7 @@ export class CargoByDriver {
|
|
|
20
20
|
this._options = _options;
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
|
-
* Returns the most recent data point in tracking.cargo_by_driver that matches the provided identifiers.
|
|
23
|
+
* 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.
|
|
24
24
|
*
|
|
25
25
|
* @param {Chrt.tracking.CargoByDriverLastSeenRequest} request
|
|
26
26
|
* @param {CargoByDriver.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -87,72 +87,6 @@ export class CargoByDriver {
|
|
|
87
87
|
}
|
|
88
88
|
});
|
|
89
89
|
}
|
|
90
|
-
/**
|
|
91
|
-
* Given a driver_id and task_group_id, find cargos on the task group and write tracking points for those with status IN_TRANSIT.
|
|
92
|
-
*
|
|
93
|
-
* @param {Chrt.tracking.CargoByDriverUpdateReq} request
|
|
94
|
-
* @param {CargoByDriver.RequestOptions} requestOptions - Request-specific configuration.
|
|
95
|
-
*
|
|
96
|
-
* @throws {@link Chrt.UnprocessableEntityError}
|
|
97
|
-
*
|
|
98
|
-
* @example
|
|
99
|
-
* await client.tracking.cargoByDriver.update({
|
|
100
|
-
* task_group_id: "task_group_id",
|
|
101
|
-
* timestamp: "2024-01-15T09:30:00Z",
|
|
102
|
-
* location: {
|
|
103
|
-
* type: "Feature"
|
|
104
|
-
* }
|
|
105
|
-
* })
|
|
106
|
-
*/
|
|
107
|
-
update(request, requestOptions) {
|
|
108
|
-
return core.HttpResponsePromise.fromPromise(this.__update(request, requestOptions));
|
|
109
|
-
}
|
|
110
|
-
__update(request, requestOptions) {
|
|
111
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
112
|
-
var _a, _b, _c, _d;
|
|
113
|
-
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
114
|
-
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"),
|
|
115
|
-
method: "POST",
|
|
116
|
-
headers: mergeHeaders((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
117
|
-
contentType: "application/json",
|
|
118
|
-
requestType: "json",
|
|
119
|
-
body: request,
|
|
120
|
-
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
121
|
-
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
122
|
-
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
123
|
-
});
|
|
124
|
-
if (_response.ok) {
|
|
125
|
-
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
126
|
-
}
|
|
127
|
-
if (_response.error.reason === "status-code") {
|
|
128
|
-
switch (_response.error.statusCode) {
|
|
129
|
-
case 422:
|
|
130
|
-
throw new Chrt.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
131
|
-
default:
|
|
132
|
-
throw new errors.ChrtError({
|
|
133
|
-
statusCode: _response.error.statusCode,
|
|
134
|
-
body: _response.error.body,
|
|
135
|
-
rawResponse: _response.rawResponse,
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
switch (_response.error.reason) {
|
|
140
|
-
case "non-json":
|
|
141
|
-
throw new errors.ChrtError({
|
|
142
|
-
statusCode: _response.error.statusCode,
|
|
143
|
-
body: _response.error.rawBody,
|
|
144
|
-
rawResponse: _response.rawResponse,
|
|
145
|
-
});
|
|
146
|
-
case "timeout":
|
|
147
|
-
throw new errors.ChrtTimeoutError("Timeout exceeded when calling POST /tracking/cargo_by_driver/update.");
|
|
148
|
-
case "unknown":
|
|
149
|
-
throw new errors.ChrtError({
|
|
150
|
-
message: _response.error.errorMessage,
|
|
151
|
-
rawResponse: _response.rawResponse,
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
90
|
_getAuthorizationHeader() {
|
|
157
91
|
return __awaiter(this, void 0, void 0, function* () {
|
|
158
92
|
const bearer = yield core.Supplier.get(this._options.token);
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as environments from "../../../../../../environments.mjs";
|
|
5
|
+
import * as core from "../../../../../../core/index.mjs";
|
|
6
|
+
import * as Chrt from "../../../../../index.mjs";
|
|
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
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
5
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
6
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
7
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
8
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
9
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
10
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
import * as environments from "../../../../../../environments.mjs";
|
|
14
|
+
import * as core from "../../../../../../core/index.mjs";
|
|
15
|
+
import * as Chrt from "../../../../../index.mjs";
|
|
16
|
+
import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.mjs";
|
|
17
|
+
import * as errors from "../../../../../../errors/index.mjs";
|
|
18
|
+
export class Driver {
|
|
19
|
+
constructor(_options = {}) {
|
|
20
|
+
this._options = _options;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* 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.
|
|
24
|
+
*
|
|
25
|
+
* @param {Chrt.tracking.DriverUpdateReq} request
|
|
26
|
+
* @param {Driver.RequestOptions} requestOptions - Request-specific configuration.
|
|
27
|
+
*
|
|
28
|
+
* @throws {@link Chrt.UnprocessableEntityError}
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* await client.tracking.driver.update({
|
|
32
|
+
* task_group_id: "task_group_id",
|
|
33
|
+
* timestamp: "2024-01-15T09:30:00Z",
|
|
34
|
+
* location: {
|
|
35
|
+
* type: "Feature"
|
|
36
|
+
* }
|
|
37
|
+
* })
|
|
38
|
+
*/
|
|
39
|
+
update(request, requestOptions) {
|
|
40
|
+
return core.HttpResponsePromise.fromPromise(this.__update(request, requestOptions));
|
|
41
|
+
}
|
|
42
|
+
__update(request, requestOptions) {
|
|
43
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
var _a, _b, _c, _d;
|
|
45
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
46
|
+
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/driver/update"),
|
|
47
|
+
method: "POST",
|
|
48
|
+
headers: mergeHeaders((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
49
|
+
contentType: "application/json",
|
|
50
|
+
requestType: "json",
|
|
51
|
+
body: request,
|
|
52
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
53
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
54
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
55
|
+
});
|
|
56
|
+
if (_response.ok) {
|
|
57
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
58
|
+
}
|
|
59
|
+
if (_response.error.reason === "status-code") {
|
|
60
|
+
switch (_response.error.statusCode) {
|
|
61
|
+
case 422:
|
|
62
|
+
throw new Chrt.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
63
|
+
default:
|
|
64
|
+
throw new errors.ChrtError({
|
|
65
|
+
statusCode: _response.error.statusCode,
|
|
66
|
+
body: _response.error.body,
|
|
67
|
+
rawResponse: _response.rawResponse,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
switch (_response.error.reason) {
|
|
72
|
+
case "non-json":
|
|
73
|
+
throw new errors.ChrtError({
|
|
74
|
+
statusCode: _response.error.statusCode,
|
|
75
|
+
body: _response.error.rawBody,
|
|
76
|
+
rawResponse: _response.rawResponse,
|
|
77
|
+
});
|
|
78
|
+
case "timeout":
|
|
79
|
+
throw new errors.ChrtTimeoutError("Timeout exceeded when calling POST /tracking/driver/update.");
|
|
80
|
+
case "unknown":
|
|
81
|
+
throw new errors.ChrtError({
|
|
82
|
+
message: _response.error.errorMessage,
|
|
83
|
+
rawResponse: _response.rawResponse,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
_getAuthorizationHeader() {
|
|
89
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
90
|
+
const bearer = yield core.Supplier.get(this._options.token);
|
|
91
|
+
if (bearer != null) {
|
|
92
|
+
return `Bearer ${bearer}`;
|
|
93
|
+
}
|
|
94
|
+
return undefined;
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./requests/index.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { type DriverUpdateReq } from "./DriverUpdateReq.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./client/index.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./client/index.mjs";
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
export * as cargoByDevice from "./cargoByDevice/index.mjs";
|
|
1
2
|
export * as cargoByDriver from "./cargoByDriver/index.mjs";
|
|
2
3
|
export * as devices from "./devices/index.mjs";
|
|
4
|
+
export * as driver from "./driver/index.mjs";
|
|
3
5
|
export * as taskGroupByDriver from "./taskGroupByDriver/index.mjs";
|
|
4
6
|
export * as sessionByDevice from "./sessionByDevice/index.mjs";
|
|
7
|
+
export * from "./cargoByDevice/client/requests/index.mjs";
|
|
5
8
|
export * from "./cargoByDriver/client/requests/index.mjs";
|
|
6
9
|
export * from "./devices/client/requests/index.mjs";
|
|
10
|
+
export * from "./driver/client/requests/index.mjs";
|
|
7
11
|
export * from "./taskGroupByDriver/client/requests/index.mjs";
|
|
8
12
|
export * from "./sessionByDevice/client/requests/index.mjs";
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
export * as cargoByDevice from "./cargoByDevice/index.mjs";
|
|
1
2
|
export * as cargoByDriver from "./cargoByDriver/index.mjs";
|
|
2
3
|
export * as devices from "./devices/index.mjs";
|
|
4
|
+
export * as driver from "./driver/index.mjs";
|
|
3
5
|
export * as taskGroupByDriver from "./taskGroupByDriver/index.mjs";
|
|
4
6
|
export * as sessionByDevice from "./sessionByDevice/index.mjs";
|
|
7
|
+
export * from "./cargoByDevice/client/requests/index.mjs";
|
|
5
8
|
export * from "./cargoByDriver/client/requests/index.mjs";
|
|
6
9
|
export * from "./devices/client/requests/index.mjs";
|
|
10
|
+
export * from "./driver/client/requests/index.mjs";
|
|
7
11
|
export * from "./taskGroupByDriver/client/requests/index.mjs";
|
|
8
12
|
export * from "./sessionByDevice/client/requests/index.mjs";
|
|
@@ -43,6 +43,36 @@ export declare class SessionByDevice {
|
|
|
43
43
|
*/
|
|
44
44
|
lastSeen(request: Chrt.tracking.SessionByDeviceLastSeenRequest, requestOptions?: SessionByDevice.RequestOptions): core.HttpResponsePromise<(Chrt.TrackingSessionByDeviceDataPoint1 | null) | undefined>;
|
|
45
45
|
private __lastSeen;
|
|
46
|
+
/**
|
|
47
|
+
* Return a specified number of data points for a session, intelligently sampled across the time range.
|
|
48
|
+
*
|
|
49
|
+
* @param {Chrt.tracking.SessionByDeviceDataPointsRequest} request
|
|
50
|
+
* @param {SessionByDevice.RequestOptions} requestOptions - Request-specific configuration.
|
|
51
|
+
*
|
|
52
|
+
* @throws {@link Chrt.UnprocessableEntityError}
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* await client.tracking.sessionByDevice.dataPoints({
|
|
56
|
+
* session_id: "session_id"
|
|
57
|
+
* })
|
|
58
|
+
*/
|
|
59
|
+
dataPoints(request: Chrt.tracking.SessionByDeviceDataPointsRequest, requestOptions?: SessionByDevice.RequestOptions): core.HttpResponsePromise<Chrt.TrackingSessionByDeviceDataPoint1[]>;
|
|
60
|
+
private __dataPoints;
|
|
61
|
+
/**
|
|
62
|
+
* Return data points for a session with intelligent stop/movement detection. Detects stops (location barely changes for >5 minutes) and shows up to 5 markers. For movement, samples data points lightly.
|
|
63
|
+
*
|
|
64
|
+
* @param {Chrt.tracking.SessionByDeviceDataPointsFancyRequest} request
|
|
65
|
+
* @param {SessionByDevice.RequestOptions} requestOptions - Request-specific configuration.
|
|
66
|
+
*
|
|
67
|
+
* @throws {@link Chrt.UnprocessableEntityError}
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* await client.tracking.sessionByDevice.dataPointsFancy({
|
|
71
|
+
* session_id: "session_id"
|
|
72
|
+
* })
|
|
73
|
+
*/
|
|
74
|
+
dataPointsFancy(request: Chrt.tracking.SessionByDeviceDataPointsFancyRequest, requestOptions?: SessionByDevice.RequestOptions): core.HttpResponsePromise<Chrt.TrackingSessionByDeviceDataPoint1[]>;
|
|
75
|
+
private __dataPointsFancy;
|
|
46
76
|
/**
|
|
47
77
|
* Create a session for a device and link the device to it.
|
|
48
78
|
*
|