@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.
- package/dist/cjs/Client.d.ts +3 -0
- package/dist/cjs/Client.js +7 -2
- package/dist/cjs/api/resources/index.d.ts +1 -0
- package/dist/cjs/api/resources/index.js +2 -1
- package/dist/cjs/api/resources/tracking/client/Client.d.ts +26 -0
- package/dist/cjs/api/resources/tracking/client/Client.js +22 -0
- package/dist/cjs/api/resources/tracking/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/tracking/client/index.js +2 -0
- package/dist/cjs/api/resources/tracking/index.d.ts +2 -0
- package/dist/cjs/api/resources/tracking/index.js +18 -0
- package/dist/cjs/api/resources/tracking/resources/cargoByDriver/client/Client.d.ts +67 -0
- package/dist/cjs/api/resources/tracking/resources/cargoByDriver/client/Client.js +202 -0
- package/dist/cjs/api/resources/tracking/resources/cargoByDriver/client/index.d.ts +2 -0
- package/dist/cjs/api/resources/tracking/resources/cargoByDriver/client/index.js +17 -0
- package/dist/cjs/api/resources/tracking/resources/cargoByDriver/client/requests/CargoByDriverLastSeenRequest.d.ts +14 -0
- package/dist/cjs/api/resources/tracking/resources/cargoByDriver/client/requests/CargoByDriverUpdateReq.d.ts +19 -0
- package/dist/cjs/api/resources/tracking/resources/cargoByDriver/client/requests/index.d.ts +2 -0
- package/dist/cjs/api/resources/tracking/resources/cargoByDriver/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/tracking/resources/cargoByDriver/index.d.ts +1 -0
- package/dist/cjs/api/resources/tracking/resources/cargoByDriver/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 +43 -0
- package/dist/cjs/api/resources/tracking/resources/taskGroupByDriver/client/Client.d.ts +66 -0
- package/dist/cjs/api/resources/tracking/resources/taskGroupByDriver/client/Client.js +200 -0
- package/dist/cjs/api/resources/tracking/resources/taskGroupByDriver/client/index.d.ts +2 -0
- package/dist/cjs/api/resources/tracking/resources/taskGroupByDriver/client/index.js +17 -0
- package/dist/cjs/api/resources/tracking/resources/taskGroupByDriver/client/requests/TaskGroupByDriverLastSeenRequest.d.ts +12 -0
- package/dist/cjs/api/resources/tracking/resources/taskGroupByDriver/client/requests/TaskGroupByDriverLastSeenRequest.js +5 -0
- package/dist/cjs/api/resources/tracking/resources/taskGroupByDriver/client/requests/TaskGroupByDriverUpdateReq.d.ts +19 -0
- package/dist/cjs/api/resources/tracking/resources/taskGroupByDriver/client/requests/TaskGroupByDriverUpdateReq.js +5 -0
- package/dist/cjs/api/resources/tracking/resources/taskGroupByDriver/client/requests/index.d.ts +2 -0
- package/dist/cjs/api/resources/tracking/resources/taskGroupByDriver/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/tracking/resources/taskGroupByDriver/index.d.ts +1 -0
- package/dist/cjs/api/resources/tracking/resources/taskGroupByDriver/index.js +17 -0
- package/dist/cjs/api/types/Cargo1.d.ts +2 -0
- package/dist/cjs/api/types/CargoStatusEnum1.d.ts +10 -0
- package/dist/cjs/api/types/CargoStatusEnum1.js +12 -0
- package/dist/cjs/api/types/DecodedJwtWithOrgAndUserId.d.ts +1 -0
- package/dist/cjs/api/types/Driver1.d.ts +2 -2
- package/dist/cjs/api/types/TrackingCargoByDriverDataPoint1.d.ts +11 -0
- package/dist/cjs/api/types/TrackingCargoByDriverDataPoint1.js +5 -0
- package/dist/cjs/api/types/TrackingCargoByDriverDataPointMetadata1.d.ts +8 -0
- package/dist/cjs/api/types/TrackingCargoByDriverDataPointMetadata1.js +5 -0
- package/dist/cjs/api/types/TrackingTaskGroupByDriverDataPoint1.d.ts +11 -0
- package/dist/cjs/api/types/TrackingTaskGroupByDriverDataPoint1.js +5 -0
- package/dist/cjs/api/types/TrackingTaskGroupByDriverDataPointMetadata1.d.ts +7 -0
- package/dist/cjs/api/types/TrackingTaskGroupByDriverDataPointMetadata1.js +5 -0
- package/dist/cjs/api/types/index.d.ts +5 -2
- package/dist/cjs/api/types/index.js +5 -2
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Client.d.mts +3 -0
- package/dist/esm/Client.mjs +7 -2
- package/dist/esm/api/resources/index.d.mts +1 -0
- package/dist/esm/api/resources/index.mjs +1 -0
- package/dist/esm/api/resources/tracking/client/Client.d.mts +26 -0
- package/dist/esm/api/resources/tracking/client/Client.mjs +18 -0
- package/dist/esm/api/resources/tracking/client/index.d.mts +1 -0
- package/dist/esm/api/resources/tracking/client/index.mjs +1 -0
- package/dist/esm/api/resources/tracking/index.d.mts +2 -0
- package/dist/esm/api/resources/tracking/index.mjs +2 -0
- package/dist/esm/api/resources/tracking/resources/cargoByDriver/client/Client.d.mts +67 -0
- package/dist/esm/api/resources/tracking/resources/cargoByDriver/client/Client.mjs +165 -0
- package/dist/esm/api/resources/tracking/resources/cargoByDriver/client/index.d.mts +2 -0
- package/dist/esm/api/resources/tracking/resources/cargoByDriver/client/index.mjs +1 -0
- package/dist/esm/api/resources/tracking/resources/cargoByDriver/client/requests/CargoByDriverLastSeenRequest.d.mts +14 -0
- package/dist/esm/api/resources/tracking/resources/cargoByDriver/client/requests/CargoByDriverUpdateReq.d.mts +19 -0
- package/dist/esm/api/resources/tracking/resources/cargoByDriver/client/requests/index.d.mts +2 -0
- package/dist/esm/api/resources/tracking/resources/cargoByDriver/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/tracking/resources/cargoByDriver/index.d.mts +1 -0
- package/dist/esm/api/resources/tracking/resources/cargoByDriver/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/taskGroupByDriver/client/Client.d.mts +66 -0
- package/dist/esm/api/resources/tracking/resources/taskGroupByDriver/client/Client.mjs +163 -0
- package/dist/esm/api/resources/tracking/resources/taskGroupByDriver/client/index.d.mts +2 -0
- package/dist/esm/api/resources/tracking/resources/taskGroupByDriver/client/index.mjs +1 -0
- package/dist/esm/api/resources/tracking/resources/taskGroupByDriver/client/requests/TaskGroupByDriverLastSeenRequest.d.mts +12 -0
- package/dist/esm/api/resources/tracking/resources/taskGroupByDriver/client/requests/TaskGroupByDriverLastSeenRequest.mjs +4 -0
- package/dist/esm/api/resources/tracking/resources/taskGroupByDriver/client/requests/TaskGroupByDriverUpdateReq.d.mts +19 -0
- package/dist/esm/api/resources/tracking/resources/taskGroupByDriver/client/requests/TaskGroupByDriverUpdateReq.mjs +4 -0
- package/dist/esm/api/resources/tracking/resources/taskGroupByDriver/client/requests/index.d.mts +2 -0
- package/dist/esm/api/resources/tracking/resources/taskGroupByDriver/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/tracking/resources/taskGroupByDriver/index.d.mts +1 -0
- package/dist/esm/api/resources/tracking/resources/taskGroupByDriver/index.mjs +1 -0
- package/dist/esm/api/types/Cargo1.d.mts +2 -0
- package/dist/esm/api/types/CargoStatusEnum1.d.mts +10 -0
- package/dist/esm/api/types/CargoStatusEnum1.mjs +9 -0
- package/dist/esm/api/types/DecodedJwtWithOrgAndUserId.d.mts +1 -0
- package/dist/esm/api/types/Driver1.d.mts +2 -2
- package/dist/esm/api/types/TrackingCargoByDriverDataPoint1.d.mts +11 -0
- package/dist/esm/api/types/TrackingCargoByDriverDataPoint1.mjs +4 -0
- package/dist/esm/api/types/TrackingCargoByDriverDataPointMetadata1.d.mts +8 -0
- package/dist/esm/api/types/TrackingCargoByDriverDataPointMetadata1.mjs +4 -0
- package/dist/esm/api/types/TrackingTaskGroupByDriverDataPoint1.d.mts +11 -0
- package/dist/esm/api/types/TrackingTaskGroupByDriverDataPoint1.mjs +4 -0
- package/dist/esm/api/types/TrackingTaskGroupByDriverDataPointMetadata1.d.mts +7 -0
- package/dist/esm/api/types/TrackingTaskGroupByDriverDataPointMetadata1.mjs +4 -0
- package/dist/esm/api/types/index.d.mts +5 -2
- package/dist/esm/api/types/index.mjs +5 -2
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +273 -0
- package/dist/cjs/api/types/Tracker1.d.ts +0 -7
- package/dist/cjs/api/types/TrackerSession1.d.ts +0 -7
- package/dist/esm/api/types/Tracker1.d.mts +0 -7
- package/dist/esm/api/types/TrackerSession1.d.mts +0 -7
- /package/dist/cjs/api/{types/Tracker1.js → resources/tracking/resources/cargoByDriver/client/requests/CargoByDriverLastSeenRequest.js} +0 -0
- /package/dist/cjs/api/{types/TrackerSession1.js → resources/tracking/resources/cargoByDriver/client/requests/CargoByDriverUpdateReq.js} +0 -0
- /package/dist/esm/api/{types/Tracker1.mjs → resources/tracking/resources/cargoByDriver/client/requests/CargoByDriverLastSeenRequest.mjs} +0 -0
- /package/dist/esm/api/{types/TrackerSession1.mjs → resources/tracking/resources/cargoByDriver/client/requests/CargoByDriverUpdateReq.mjs} +0 -0
|
@@ -0,0 +1,67 @@
|
|
|
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 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,165 @@
|
|
|
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 CargoByDriver {
|
|
19
|
+
constructor(_options = {}) {
|
|
20
|
+
this._options = _options;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Returns the most recent data point in tracking.cargo_by_driver that matches the provided identifiers.
|
|
24
|
+
*
|
|
25
|
+
* @param {Chrt.tracking.CargoByDriverLastSeenRequest} request
|
|
26
|
+
* @param {CargoByDriver.RequestOptions} requestOptions - Request-specific configuration.
|
|
27
|
+
*
|
|
28
|
+
* @throws {@link Chrt.UnprocessableEntityError}
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* await client.tracking.cargoByDriver.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_driver/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_driver/last_seen.");
|
|
82
|
+
case "unknown":
|
|
83
|
+
throw new errors.ChrtError({
|
|
84
|
+
message: _response.error.errorMessage,
|
|
85
|
+
rawResponse: _response.rawResponse,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
});
|
|
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
|
+
_getAuthorizationHeader() {
|
|
157
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
158
|
+
const bearer = yield core.Supplier.get(this._options.token);
|
|
159
|
+
if (bearer != null) {
|
|
160
|
+
return `Bearer ${bearer}`;
|
|
161
|
+
}
|
|
162
|
+
return undefined;
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
}
|
|
@@ -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 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.mjs";
|
|
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 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./client/index.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./client/index.mjs";
|
|
@@ -0,0 +1,66 @@
|
|
|
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 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
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
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 TaskGroupByDriver {
|
|
19
|
+
constructor(_options = {}) {
|
|
20
|
+
this._options = _options;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Returns the most recent data point in tracking.task_group_by_driver for the given task_group_id.
|
|
24
|
+
*
|
|
25
|
+
* @param {Chrt.tracking.TaskGroupByDriverLastSeenRequest} request
|
|
26
|
+
* @param {TaskGroupByDriver.RequestOptions} requestOptions - Request-specific configuration.
|
|
27
|
+
*
|
|
28
|
+
* @throws {@link Chrt.UnprocessableEntityError}
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* await client.tracking.taskGroupByDriver.lastSeen({
|
|
32
|
+
* task_group_id: "task_group_id"
|
|
33
|
+
* })
|
|
34
|
+
*/
|
|
35
|
+
lastSeen(request, requestOptions) {
|
|
36
|
+
return core.HttpResponsePromise.fromPromise(this.__lastSeen(request, requestOptions));
|
|
37
|
+
}
|
|
38
|
+
__lastSeen(request, requestOptions) {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
var _a, _b, _c, _d;
|
|
41
|
+
const { task_group_id: taskGroupId } = request;
|
|
42
|
+
const _queryParams = {};
|
|
43
|
+
_queryParams["task_group_id"] = taskGroupId;
|
|
44
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
45
|
+
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/task_group_by_driver/last_seen"),
|
|
46
|
+
method: "GET",
|
|
47
|
+
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),
|
|
48
|
+
queryParameters: _queryParams,
|
|
49
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
50
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
51
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
52
|
+
});
|
|
53
|
+
if (_response.ok) {
|
|
54
|
+
return {
|
|
55
|
+
data: _response.body,
|
|
56
|
+
rawResponse: _response.rawResponse,
|
|
57
|
+
};
|
|
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 GET /tracking/task_group_by_driver/last_seen.");
|
|
80
|
+
case "unknown":
|
|
81
|
+
throw new errors.ChrtError({
|
|
82
|
+
message: _response.error.errorMessage,
|
|
83
|
+
rawResponse: _response.rawResponse,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Writes a data point to tracking.task_group_by_driver when the task group is in progress.
|
|
90
|
+
*
|
|
91
|
+
* @param {Chrt.tracking.TaskGroupByDriverUpdateReq} request
|
|
92
|
+
* @param {TaskGroupByDriver.RequestOptions} requestOptions - Request-specific configuration.
|
|
93
|
+
*
|
|
94
|
+
* @throws {@link Chrt.UnprocessableEntityError}
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* await client.tracking.taskGroupByDriver.update({
|
|
98
|
+
* task_group_id: "task_group_id",
|
|
99
|
+
* timestamp: "2024-01-15T09:30:00Z",
|
|
100
|
+
* location: {
|
|
101
|
+
* type: "Feature"
|
|
102
|
+
* }
|
|
103
|
+
* })
|
|
104
|
+
*/
|
|
105
|
+
update(request, requestOptions) {
|
|
106
|
+
return core.HttpResponsePromise.fromPromise(this.__update(request, requestOptions));
|
|
107
|
+
}
|
|
108
|
+
__update(request, requestOptions) {
|
|
109
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
110
|
+
var _a, _b, _c, _d;
|
|
111
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
112
|
+
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/task_group_by_driver/update"),
|
|
113
|
+
method: "POST",
|
|
114
|
+
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),
|
|
115
|
+
contentType: "application/json",
|
|
116
|
+
requestType: "json",
|
|
117
|
+
body: request,
|
|
118
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
119
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
120
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
121
|
+
});
|
|
122
|
+
if (_response.ok) {
|
|
123
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
124
|
+
}
|
|
125
|
+
if (_response.error.reason === "status-code") {
|
|
126
|
+
switch (_response.error.statusCode) {
|
|
127
|
+
case 422:
|
|
128
|
+
throw new Chrt.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
129
|
+
default:
|
|
130
|
+
throw new errors.ChrtError({
|
|
131
|
+
statusCode: _response.error.statusCode,
|
|
132
|
+
body: _response.error.body,
|
|
133
|
+
rawResponse: _response.rawResponse,
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
switch (_response.error.reason) {
|
|
138
|
+
case "non-json":
|
|
139
|
+
throw new errors.ChrtError({
|
|
140
|
+
statusCode: _response.error.statusCode,
|
|
141
|
+
body: _response.error.rawBody,
|
|
142
|
+
rawResponse: _response.rawResponse,
|
|
143
|
+
});
|
|
144
|
+
case "timeout":
|
|
145
|
+
throw new errors.ChrtTimeoutError("Timeout exceeded when calling POST /tracking/task_group_by_driver/update.");
|
|
146
|
+
case "unknown":
|
|
147
|
+
throw new errors.ChrtError({
|
|
148
|
+
message: _response.error.errorMessage,
|
|
149
|
+
rawResponse: _response.rawResponse,
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
_getAuthorizationHeader() {
|
|
155
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
156
|
+
const bearer = yield core.Supplier.get(this._options.token);
|
|
157
|
+
if (bearer != null) {
|
|
158
|
+
return `Bearer ${bearer}`;
|
|
159
|
+
}
|
|
160
|
+
return undefined;
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./requests/index.mjs";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as Chrt from "../../../../../../index.mjs";
|
|
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 TaskGroupByDriverUpdateReq {
|
|
16
|
+
task_group_id: string;
|
|
17
|
+
timestamp: string;
|
|
18
|
+
location: Chrt.LocationFeature;
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./client/index.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./client/index.mjs";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
export type CargoStatusEnum1 = "awaiting_pickup" | "in_transit" | "delivered" | "exception";
|
|
5
|
+
export declare const CargoStatusEnum1: {
|
|
6
|
+
readonly AwaitingPickup: "awaiting_pickup";
|
|
7
|
+
readonly InTransit: "in_transit";
|
|
8
|
+
readonly Delivered: "delivered";
|
|
9
|
+
readonly Exception: "exception";
|
|
10
|
+
};
|
|
@@ -13,6 +13,7 @@ export interface DecodedJwtWithOrgAndUserId {
|
|
|
13
13
|
sid?: string | null;
|
|
14
14
|
/** Must be a string starting with `user_` */
|
|
15
15
|
sub?: string | null;
|
|
16
|
+
sts?: boolean | null;
|
|
16
17
|
v?: number | null;
|
|
17
18
|
o?: Chrt.ClerkOrgData | null;
|
|
18
19
|
org_public_metadata?: Record<string, unknown> | null;
|
|
@@ -17,7 +17,7 @@ export interface Driver1 {
|
|
|
17
17
|
last_seen_at_timestamp?: string | null;
|
|
18
18
|
_id: string;
|
|
19
19
|
/** Must be a string starting with `org_` */
|
|
20
|
-
org_id
|
|
20
|
+
org_id: string;
|
|
21
21
|
/** Must be a string starting with `user_` */
|
|
22
|
-
user_id
|
|
22
|
+
user_id: string;
|
|
23
23
|
}
|