@chrt-inc/typescript-sdk 1.1020.0 → 1.1023.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/resources/devices/client/Client.d.ts +47 -1
- package/dist/cjs/api/resources/tracking/resources/devices/client/Client.js +195 -1
- package/dist/cjs/api/resources/tracking/resources/devices/client/requests/DevicesForCargoV1Request.d.ts +12 -0
- package/dist/cjs/api/resources/tracking/resources/devices/client/requests/DevicesForCargoV1Request.js +5 -0
- package/dist/cjs/api/resources/tracking/resources/devices/client/requests/DevicesLinkToCargoV1Request.d.ts +14 -0
- package/dist/cjs/api/resources/tracking/resources/devices/client/requests/DevicesLinkToCargoV1Request.js +5 -0
- package/dist/cjs/api/resources/tracking/resources/devices/client/requests/DevicesUnlinkFromCargoV1Request.d.ts +12 -0
- package/dist/cjs/api/resources/tracking/resources/devices/client/requests/DevicesUnlinkFromCargoV1Request.js +5 -0
- package/dist/cjs/api/resources/tracking/resources/devices/client/requests/index.d.ts +3 -0
- package/dist/cjs/api/types/DeviceForCargoRes.d.ts +17 -0
- package/dist/cjs/api/types/DeviceForCargoRes.js +5 -0
- package/dist/cjs/api/types/index.d.ts +1 -0
- package/dist/cjs/api/types/index.js +1 -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/resources/devices/client/Client.d.mts +47 -1
- package/dist/esm/api/resources/tracking/resources/devices/client/Client.mjs +195 -1
- package/dist/esm/api/resources/tracking/resources/devices/client/requests/DevicesForCargoV1Request.d.mts +12 -0
- package/dist/esm/api/resources/tracking/resources/devices/client/requests/DevicesForCargoV1Request.mjs +4 -0
- package/dist/esm/api/resources/tracking/resources/devices/client/requests/DevicesLinkToCargoV1Request.d.mts +14 -0
- package/dist/esm/api/resources/tracking/resources/devices/client/requests/DevicesLinkToCargoV1Request.mjs +4 -0
- package/dist/esm/api/resources/tracking/resources/devices/client/requests/DevicesUnlinkFromCargoV1Request.d.mts +12 -0
- package/dist/esm/api/resources/tracking/resources/devices/client/requests/DevicesUnlinkFromCargoV1Request.mjs +4 -0
- package/dist/esm/api/resources/tracking/resources/devices/client/requests/index.d.mts +3 -0
- package/dist/esm/api/types/DeviceForCargoRes.d.mts +17 -0
- package/dist/esm/api/types/DeviceForCargoRes.mjs +4 -0
- package/dist/esm/api/types/index.d.mts +1 -0
- package/dist/esm/api/types/index.mjs +1 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +197 -1
package/dist/cjs/Client.js
CHANGED
|
@@ -62,8 +62,8 @@ class ChrtClient {
|
|
|
62
62
|
this._options = Object.assign(Object.assign({}, _options), { headers: (0, headers_js_1.mergeHeaders)({
|
|
63
63
|
"X-Fern-Language": "JavaScript",
|
|
64
64
|
"X-Fern-SDK-Name": "@chrt-inc/typescript-sdk",
|
|
65
|
-
"X-Fern-SDK-Version": "1.
|
|
66
|
-
"User-Agent": "@chrt-inc/typescript-sdk/1.
|
|
65
|
+
"X-Fern-SDK-Version": "1.1023.0",
|
|
66
|
+
"User-Agent": "@chrt-inc/typescript-sdk/1.1023.0",
|
|
67
67
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
68
68
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
69
69
|
}, _options === null || _options === void 0 ? void 0 : _options.headers) });
|
|
@@ -31,7 +31,7 @@ export declare class Devices {
|
|
|
31
31
|
protected readonly _options: Devices.Options;
|
|
32
32
|
constructor(_options?: Devices.Options);
|
|
33
33
|
/**
|
|
34
|
-
* Archives a device
|
|
34
|
+
* Archives a device without an active session or cargo. Terminate or unlink tracking first. | auth: api_key | () -> (bool)
|
|
35
35
|
*
|
|
36
36
|
* @param {Chrt.tracking.DevicesArchiveV1Request} request
|
|
37
37
|
* @param {Devices.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -45,6 +45,21 @@ export declare class Devices {
|
|
|
45
45
|
*/
|
|
46
46
|
archiveV1(request: Chrt.tracking.DevicesArchiveV1Request, requestOptions?: Devices.RequestOptions): core.HttpResponsePromise<boolean>;
|
|
47
47
|
private __archiveV1;
|
|
48
|
+
/**
|
|
49
|
+
* Lists devices currently or previously linked to a cargo, ordered by MAC address. Access follows the cargo's order. | authz_personas=[coordinator_org_operators, shipper_org_operators, executor_org_operators, driver_for_executor] | () -> (list[DeviceForCargoRes])
|
|
50
|
+
*
|
|
51
|
+
* @param {Chrt.tracking.DevicesForCargoV1Request} request
|
|
52
|
+
* @param {Devices.RequestOptions} requestOptions - Request-specific configuration.
|
|
53
|
+
*
|
|
54
|
+
* @throws {@link Chrt.UnprocessableEntityError}
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* await client.tracking.devices.forCargoV1({
|
|
58
|
+
* cargo_id: "cargo_id"
|
|
59
|
+
* })
|
|
60
|
+
*/
|
|
61
|
+
forCargoV1(request: Chrt.tracking.DevicesForCargoV1Request, requestOptions?: Devices.RequestOptions): core.HttpResponsePromise<Chrt.DeviceForCargoRes[]>;
|
|
62
|
+
private __forCargoV1;
|
|
48
63
|
/**
|
|
49
64
|
* Retrieves a single device by its ID with expanded sessions and cargos. Access restricted to the caller's organization or shared organizations. | auth: api_key | authz: min_org_role=operator | () -> (DeviceExpandedRes)
|
|
50
65
|
*
|
|
@@ -60,6 +75,22 @@ export declare class Devices {
|
|
|
60
75
|
*/
|
|
61
76
|
getV1(request: Chrt.tracking.DevicesGetV1Request, requestOptions?: Devices.RequestOptions): core.HttpResponsePromise<Chrt.DeviceExpandedRes>;
|
|
62
77
|
private __getV1;
|
|
78
|
+
/**
|
|
79
|
+
* Links an owned device to cargo and activates its tracker. Relinking the same cargo reactivates a stopped tracker. | authz: min_org_role=operator | authz_personas=[coordinator_org_operators, shipper_org_operators, executor_org_operators] | () -> (bool)
|
|
80
|
+
*
|
|
81
|
+
* @param {Chrt.tracking.DevicesLinkToCargoV1Request} request
|
|
82
|
+
* @param {Devices.RequestOptions} requestOptions - Request-specific configuration.
|
|
83
|
+
*
|
|
84
|
+
* @throws {@link Chrt.UnprocessableEntityError}
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* await client.tracking.devices.linkToCargoV1({
|
|
88
|
+
* device_id: "device_id",
|
|
89
|
+
* cargo_id: "cargo_id"
|
|
90
|
+
* })
|
|
91
|
+
*/
|
|
92
|
+
linkToCargoV1(request: Chrt.tracking.DevicesLinkToCargoV1Request, requestOptions?: Devices.RequestOptions): core.HttpResponsePromise<boolean>;
|
|
93
|
+
private __linkToCargoV1;
|
|
63
94
|
/**
|
|
64
95
|
* Lists devices with filtering, sorting, and pagination. Use org_scope to restrict to owned, shared, or both (default). | auth: api_key | authz: min_org_role=operator | () -> (DeviceListRes)
|
|
65
96
|
*
|
|
@@ -143,6 +174,21 @@ export declare class Devices {
|
|
|
143
174
|
*/
|
|
144
175
|
typeaheadV1(request: Chrt.tracking.DevicesTypeaheadV1Request, requestOptions?: Devices.RequestOptions): core.HttpResponsePromise<Chrt.DeviceTypeaheadResult[]>;
|
|
145
176
|
private __typeaheadV1;
|
|
177
|
+
/**
|
|
178
|
+
* Unlinks an owned device from its cargo and deactivates its tracker. Returns false when the device is not linked to cargo. | authz: min_org_role=operator | () -> (bool)
|
|
179
|
+
*
|
|
180
|
+
* @param {Chrt.tracking.DevicesUnlinkFromCargoV1Request} request
|
|
181
|
+
* @param {Devices.RequestOptions} requestOptions - Request-specific configuration.
|
|
182
|
+
*
|
|
183
|
+
* @throws {@link Chrt.UnprocessableEntityError}
|
|
184
|
+
*
|
|
185
|
+
* @example
|
|
186
|
+
* await client.tracking.devices.unlinkFromCargoV1({
|
|
187
|
+
* device_id: "device_id"
|
|
188
|
+
* })
|
|
189
|
+
*/
|
|
190
|
+
unlinkFromCargoV1(request: Chrt.tracking.DevicesUnlinkFromCargoV1Request, requestOptions?: Devices.RequestOptions): core.HttpResponsePromise<boolean>;
|
|
191
|
+
private __unlinkFromCargoV1;
|
|
146
192
|
/**
|
|
147
193
|
* Unpauses a device. Closes the open pause time window. | auth: api_key | () -> (bool)
|
|
148
194
|
*
|
|
@@ -67,7 +67,7 @@ class Devices {
|
|
|
67
67
|
this._options = _options;
|
|
68
68
|
}
|
|
69
69
|
/**
|
|
70
|
-
* Archives a device
|
|
70
|
+
* Archives a device without an active session or cargo. Terminate or unlink tracking first. | auth: api_key | () -> (bool)
|
|
71
71
|
*
|
|
72
72
|
* @param {Chrt.tracking.DevicesArchiveV1Request} request
|
|
73
73
|
* @param {Devices.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -130,6 +130,70 @@ class Devices {
|
|
|
130
130
|
}
|
|
131
131
|
});
|
|
132
132
|
}
|
|
133
|
+
/**
|
|
134
|
+
* Lists devices currently or previously linked to a cargo, ordered by MAC address. Access follows the cargo's order. | authz_personas=[coordinator_org_operators, shipper_org_operators, executor_org_operators, driver_for_executor] | () -> (list[DeviceForCargoRes])
|
|
135
|
+
*
|
|
136
|
+
* @param {Chrt.tracking.DevicesForCargoV1Request} request
|
|
137
|
+
* @param {Devices.RequestOptions} requestOptions - Request-specific configuration.
|
|
138
|
+
*
|
|
139
|
+
* @throws {@link Chrt.UnprocessableEntityError}
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* await client.tracking.devices.forCargoV1({
|
|
143
|
+
* cargo_id: "cargo_id"
|
|
144
|
+
* })
|
|
145
|
+
*/
|
|
146
|
+
forCargoV1(request, requestOptions) {
|
|
147
|
+
return core.HttpResponsePromise.fromPromise(this.__forCargoV1(request, requestOptions));
|
|
148
|
+
}
|
|
149
|
+
__forCargoV1(request, requestOptions) {
|
|
150
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
151
|
+
var _a, _b, _c, _d;
|
|
152
|
+
const { cargo_id: cargoId } = request;
|
|
153
|
+
const _queryParams = {};
|
|
154
|
+
_queryParams["cargo_id"] = cargoId;
|
|
155
|
+
let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
156
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
157
|
+
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.ChrtEnvironment.Local, "tracking/devices/for_cargo/v1"),
|
|
158
|
+
method: "GET",
|
|
159
|
+
headers: _headers,
|
|
160
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
161
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
162
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
163
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
164
|
+
});
|
|
165
|
+
if (_response.ok) {
|
|
166
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
167
|
+
}
|
|
168
|
+
if (_response.error.reason === "status-code") {
|
|
169
|
+
switch (_response.error.statusCode) {
|
|
170
|
+
case 422:
|
|
171
|
+
throw new Chrt.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
172
|
+
default:
|
|
173
|
+
throw new errors.ChrtError({
|
|
174
|
+
statusCode: _response.error.statusCode,
|
|
175
|
+
body: _response.error.body,
|
|
176
|
+
rawResponse: _response.rawResponse,
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
switch (_response.error.reason) {
|
|
181
|
+
case "non-json":
|
|
182
|
+
throw new errors.ChrtError({
|
|
183
|
+
statusCode: _response.error.statusCode,
|
|
184
|
+
body: _response.error.rawBody,
|
|
185
|
+
rawResponse: _response.rawResponse,
|
|
186
|
+
});
|
|
187
|
+
case "timeout":
|
|
188
|
+
throw new errors.ChrtTimeoutError("Timeout exceeded when calling GET /tracking/devices/for_cargo/v1.");
|
|
189
|
+
case "unknown":
|
|
190
|
+
throw new errors.ChrtError({
|
|
191
|
+
message: _response.error.errorMessage,
|
|
192
|
+
rawResponse: _response.rawResponse,
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
}
|
|
133
197
|
/**
|
|
134
198
|
* Retrieves a single device by its ID with expanded sessions and cargos. Access restricted to the caller's organization or shared organizations. | auth: api_key | authz: min_org_role=operator | () -> (DeviceExpandedRes)
|
|
135
199
|
*
|
|
@@ -194,6 +258,72 @@ class Devices {
|
|
|
194
258
|
}
|
|
195
259
|
});
|
|
196
260
|
}
|
|
261
|
+
/**
|
|
262
|
+
* Links an owned device to cargo and activates its tracker. Relinking the same cargo reactivates a stopped tracker. | authz: min_org_role=operator | authz_personas=[coordinator_org_operators, shipper_org_operators, executor_org_operators] | () -> (bool)
|
|
263
|
+
*
|
|
264
|
+
* @param {Chrt.tracking.DevicesLinkToCargoV1Request} request
|
|
265
|
+
* @param {Devices.RequestOptions} requestOptions - Request-specific configuration.
|
|
266
|
+
*
|
|
267
|
+
* @throws {@link Chrt.UnprocessableEntityError}
|
|
268
|
+
*
|
|
269
|
+
* @example
|
|
270
|
+
* await client.tracking.devices.linkToCargoV1({
|
|
271
|
+
* device_id: "device_id",
|
|
272
|
+
* cargo_id: "cargo_id"
|
|
273
|
+
* })
|
|
274
|
+
*/
|
|
275
|
+
linkToCargoV1(request, requestOptions) {
|
|
276
|
+
return core.HttpResponsePromise.fromPromise(this.__linkToCargoV1(request, requestOptions));
|
|
277
|
+
}
|
|
278
|
+
__linkToCargoV1(request, requestOptions) {
|
|
279
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
280
|
+
var _a, _b, _c, _d;
|
|
281
|
+
const { device_id: deviceId, cargo_id: cargoId } = request;
|
|
282
|
+
const _queryParams = {};
|
|
283
|
+
_queryParams["device_id"] = deviceId;
|
|
284
|
+
_queryParams["cargo_id"] = cargoId;
|
|
285
|
+
let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
286
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
287
|
+
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.ChrtEnvironment.Local, "tracking/devices/link_to_cargo/v1"),
|
|
288
|
+
method: "POST",
|
|
289
|
+
headers: _headers,
|
|
290
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
291
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
292
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
293
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
294
|
+
});
|
|
295
|
+
if (_response.ok) {
|
|
296
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
297
|
+
}
|
|
298
|
+
if (_response.error.reason === "status-code") {
|
|
299
|
+
switch (_response.error.statusCode) {
|
|
300
|
+
case 422:
|
|
301
|
+
throw new Chrt.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
302
|
+
default:
|
|
303
|
+
throw new errors.ChrtError({
|
|
304
|
+
statusCode: _response.error.statusCode,
|
|
305
|
+
body: _response.error.body,
|
|
306
|
+
rawResponse: _response.rawResponse,
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
switch (_response.error.reason) {
|
|
311
|
+
case "non-json":
|
|
312
|
+
throw new errors.ChrtError({
|
|
313
|
+
statusCode: _response.error.statusCode,
|
|
314
|
+
body: _response.error.rawBody,
|
|
315
|
+
rawResponse: _response.rawResponse,
|
|
316
|
+
});
|
|
317
|
+
case "timeout":
|
|
318
|
+
throw new errors.ChrtTimeoutError("Timeout exceeded when calling POST /tracking/devices/link_to_cargo/v1.");
|
|
319
|
+
case "unknown":
|
|
320
|
+
throw new errors.ChrtError({
|
|
321
|
+
message: _response.error.errorMessage,
|
|
322
|
+
rawResponse: _response.rawResponse,
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
});
|
|
326
|
+
}
|
|
197
327
|
/**
|
|
198
328
|
* Lists devices with filtering, sorting, and pagination. Use org_scope to restrict to owned, shared, or both (default). | auth: api_key | authz: min_org_role=operator | () -> (DeviceListRes)
|
|
199
329
|
*
|
|
@@ -546,6 +676,70 @@ class Devices {
|
|
|
546
676
|
}
|
|
547
677
|
});
|
|
548
678
|
}
|
|
679
|
+
/**
|
|
680
|
+
* Unlinks an owned device from its cargo and deactivates its tracker. Returns false when the device is not linked to cargo. | authz: min_org_role=operator | () -> (bool)
|
|
681
|
+
*
|
|
682
|
+
* @param {Chrt.tracking.DevicesUnlinkFromCargoV1Request} request
|
|
683
|
+
* @param {Devices.RequestOptions} requestOptions - Request-specific configuration.
|
|
684
|
+
*
|
|
685
|
+
* @throws {@link Chrt.UnprocessableEntityError}
|
|
686
|
+
*
|
|
687
|
+
* @example
|
|
688
|
+
* await client.tracking.devices.unlinkFromCargoV1({
|
|
689
|
+
* device_id: "device_id"
|
|
690
|
+
* })
|
|
691
|
+
*/
|
|
692
|
+
unlinkFromCargoV1(request, requestOptions) {
|
|
693
|
+
return core.HttpResponsePromise.fromPromise(this.__unlinkFromCargoV1(request, requestOptions));
|
|
694
|
+
}
|
|
695
|
+
__unlinkFromCargoV1(request, requestOptions) {
|
|
696
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
697
|
+
var _a, _b, _c, _d;
|
|
698
|
+
const { device_id: deviceId } = request;
|
|
699
|
+
const _queryParams = {};
|
|
700
|
+
_queryParams["device_id"] = deviceId;
|
|
701
|
+
let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
702
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
703
|
+
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.ChrtEnvironment.Local, "tracking/devices/unlink_from_cargo/v1"),
|
|
704
|
+
method: "POST",
|
|
705
|
+
headers: _headers,
|
|
706
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
707
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
708
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
709
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
710
|
+
});
|
|
711
|
+
if (_response.ok) {
|
|
712
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
713
|
+
}
|
|
714
|
+
if (_response.error.reason === "status-code") {
|
|
715
|
+
switch (_response.error.statusCode) {
|
|
716
|
+
case 422:
|
|
717
|
+
throw new Chrt.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
718
|
+
default:
|
|
719
|
+
throw new errors.ChrtError({
|
|
720
|
+
statusCode: _response.error.statusCode,
|
|
721
|
+
body: _response.error.body,
|
|
722
|
+
rawResponse: _response.rawResponse,
|
|
723
|
+
});
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
switch (_response.error.reason) {
|
|
727
|
+
case "non-json":
|
|
728
|
+
throw new errors.ChrtError({
|
|
729
|
+
statusCode: _response.error.statusCode,
|
|
730
|
+
body: _response.error.rawBody,
|
|
731
|
+
rawResponse: _response.rawResponse,
|
|
732
|
+
});
|
|
733
|
+
case "timeout":
|
|
734
|
+
throw new errors.ChrtTimeoutError("Timeout exceeded when calling POST /tracking/devices/unlink_from_cargo/v1.");
|
|
735
|
+
case "unknown":
|
|
736
|
+
throw new errors.ChrtError({
|
|
737
|
+
message: _response.error.errorMessage,
|
|
738
|
+
rawResponse: _response.rawResponse,
|
|
739
|
+
});
|
|
740
|
+
}
|
|
741
|
+
});
|
|
742
|
+
}
|
|
549
743
|
/**
|
|
550
744
|
* Unpauses a device. Closes the open pause time window. | auth: api_key | () -> (bool)
|
|
551
745
|
*
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* @example
|
|
6
|
+
* {
|
|
7
|
+
* device_id: "device_id",
|
|
8
|
+
* cargo_id: "cargo_id"
|
|
9
|
+
* }
|
|
10
|
+
*/
|
|
11
|
+
export interface DevicesLinkToCargoV1Request {
|
|
12
|
+
device_id: string;
|
|
13
|
+
cargo_id: string;
|
|
14
|
+
}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
export { type DevicesArchiveV1Request } from "./DevicesArchiveV1Request.js";
|
|
2
|
+
export { type DevicesForCargoV1Request } from "./DevicesForCargoV1Request.js";
|
|
2
3
|
export { type DevicesGetV1Request } from "./DevicesGetV1Request.js";
|
|
4
|
+
export { type DevicesLinkToCargoV1Request } from "./DevicesLinkToCargoV1Request.js";
|
|
3
5
|
export { type DevicesListV1Request } from "./DevicesListV1Request.js";
|
|
4
6
|
export { type DevicesPauseV1Request } from "./DevicesPauseV1Request.js";
|
|
5
7
|
export { type DeviceClientCreate1 } from "./DeviceClientCreate1.js";
|
|
6
8
|
export { type DevicesTypeaheadV1Request } from "./DevicesTypeaheadV1Request.js";
|
|
9
|
+
export { type DevicesUnlinkFromCargoV1Request } from "./DevicesUnlinkFromCargoV1Request.js";
|
|
7
10
|
export { type DevicesUnpauseV1Request } from "./DevicesUnpauseV1Request.js";
|
|
8
11
|
export { type DeviceClientUpdate1 } from "./DeviceClientUpdate1.js";
|
|
9
12
|
export { type DevicesUpdateSharedOrgsReq1 } from "./DevicesUpdateSharedOrgsReq1.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as Chrt from "../index.js";
|
|
5
|
+
/**
|
|
6
|
+
* A device as seen by the cargo's order parties, who may not own or share the device.
|
|
7
|
+
*
|
|
8
|
+
* NOTE - excludes device_token (the webhook secret), location, and owner-only fields.
|
|
9
|
+
*/
|
|
10
|
+
export interface DeviceForCargoRes {
|
|
11
|
+
device_id: string;
|
|
12
|
+
device_mac_address: string;
|
|
13
|
+
is_currently_linked: boolean;
|
|
14
|
+
last_seen_at_timestamp?: string | null;
|
|
15
|
+
last_seen_battery_level?: string | null;
|
|
16
|
+
type?: Chrt.TrackingDeviceTypeEnum1 | null;
|
|
17
|
+
}
|
|
@@ -298,6 +298,7 @@ export * from "./DepartmentTypeaheadFieldEnum.js";
|
|
|
298
298
|
export * from "./DepartmentTypeaheadResult.js";
|
|
299
299
|
export * from "./DepartmentTypeaheadValue.js";
|
|
300
300
|
export * from "./DeviceExpandedRes.js";
|
|
301
|
+
export * from "./DeviceForCargoRes.js";
|
|
301
302
|
export * from "./DeviceLimitedForList1.js";
|
|
302
303
|
export * from "./DeviceListRes.js";
|
|
303
304
|
export * from "./DevicePausedTimeWindow1.js";
|
|
@@ -314,6 +314,7 @@ __exportStar(require("./DepartmentTypeaheadFieldEnum.js"), exports);
|
|
|
314
314
|
__exportStar(require("./DepartmentTypeaheadResult.js"), exports);
|
|
315
315
|
__exportStar(require("./DepartmentTypeaheadValue.js"), exports);
|
|
316
316
|
__exportStar(require("./DeviceExpandedRes.js"), exports);
|
|
317
|
+
__exportStar(require("./DeviceForCargoRes.js"), exports);
|
|
317
318
|
__exportStar(require("./DeviceLimitedForList1.js"), exports);
|
|
318
319
|
__exportStar(require("./DeviceListRes.js"), exports);
|
|
319
320
|
__exportStar(require("./DevicePausedTimeWindow1.js"), exports);
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "1.
|
|
1
|
+
export declare const SDK_VERSION = "1.1023.0";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/Client.mjs
CHANGED
|
@@ -26,8 +26,8 @@ export class ChrtClient {
|
|
|
26
26
|
this._options = Object.assign(Object.assign({}, _options), { headers: mergeHeaders({
|
|
27
27
|
"X-Fern-Language": "JavaScript",
|
|
28
28
|
"X-Fern-SDK-Name": "@chrt-inc/typescript-sdk",
|
|
29
|
-
"X-Fern-SDK-Version": "1.
|
|
30
|
-
"User-Agent": "@chrt-inc/typescript-sdk/1.
|
|
29
|
+
"X-Fern-SDK-Version": "1.1023.0",
|
|
30
|
+
"User-Agent": "@chrt-inc/typescript-sdk/1.1023.0",
|
|
31
31
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
32
32
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
33
33
|
}, _options === null || _options === void 0 ? void 0 : _options.headers) });
|
|
@@ -31,7 +31,7 @@ export declare class Devices {
|
|
|
31
31
|
protected readonly _options: Devices.Options;
|
|
32
32
|
constructor(_options?: Devices.Options);
|
|
33
33
|
/**
|
|
34
|
-
* Archives a device
|
|
34
|
+
* Archives a device without an active session or cargo. Terminate or unlink tracking first. | auth: api_key | () -> (bool)
|
|
35
35
|
*
|
|
36
36
|
* @param {Chrt.tracking.DevicesArchiveV1Request} request
|
|
37
37
|
* @param {Devices.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -45,6 +45,21 @@ export declare class Devices {
|
|
|
45
45
|
*/
|
|
46
46
|
archiveV1(request: Chrt.tracking.DevicesArchiveV1Request, requestOptions?: Devices.RequestOptions): core.HttpResponsePromise<boolean>;
|
|
47
47
|
private __archiveV1;
|
|
48
|
+
/**
|
|
49
|
+
* Lists devices currently or previously linked to a cargo, ordered by MAC address. Access follows the cargo's order. | authz_personas=[coordinator_org_operators, shipper_org_operators, executor_org_operators, driver_for_executor] | () -> (list[DeviceForCargoRes])
|
|
50
|
+
*
|
|
51
|
+
* @param {Chrt.tracking.DevicesForCargoV1Request} request
|
|
52
|
+
* @param {Devices.RequestOptions} requestOptions - Request-specific configuration.
|
|
53
|
+
*
|
|
54
|
+
* @throws {@link Chrt.UnprocessableEntityError}
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* await client.tracking.devices.forCargoV1({
|
|
58
|
+
* cargo_id: "cargo_id"
|
|
59
|
+
* })
|
|
60
|
+
*/
|
|
61
|
+
forCargoV1(request: Chrt.tracking.DevicesForCargoV1Request, requestOptions?: Devices.RequestOptions): core.HttpResponsePromise<Chrt.DeviceForCargoRes[]>;
|
|
62
|
+
private __forCargoV1;
|
|
48
63
|
/**
|
|
49
64
|
* Retrieves a single device by its ID with expanded sessions and cargos. Access restricted to the caller's organization or shared organizations. | auth: api_key | authz: min_org_role=operator | () -> (DeviceExpandedRes)
|
|
50
65
|
*
|
|
@@ -60,6 +75,22 @@ export declare class Devices {
|
|
|
60
75
|
*/
|
|
61
76
|
getV1(request: Chrt.tracking.DevicesGetV1Request, requestOptions?: Devices.RequestOptions): core.HttpResponsePromise<Chrt.DeviceExpandedRes>;
|
|
62
77
|
private __getV1;
|
|
78
|
+
/**
|
|
79
|
+
* Links an owned device to cargo and activates its tracker. Relinking the same cargo reactivates a stopped tracker. | authz: min_org_role=operator | authz_personas=[coordinator_org_operators, shipper_org_operators, executor_org_operators] | () -> (bool)
|
|
80
|
+
*
|
|
81
|
+
* @param {Chrt.tracking.DevicesLinkToCargoV1Request} request
|
|
82
|
+
* @param {Devices.RequestOptions} requestOptions - Request-specific configuration.
|
|
83
|
+
*
|
|
84
|
+
* @throws {@link Chrt.UnprocessableEntityError}
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* await client.tracking.devices.linkToCargoV1({
|
|
88
|
+
* device_id: "device_id",
|
|
89
|
+
* cargo_id: "cargo_id"
|
|
90
|
+
* })
|
|
91
|
+
*/
|
|
92
|
+
linkToCargoV1(request: Chrt.tracking.DevicesLinkToCargoV1Request, requestOptions?: Devices.RequestOptions): core.HttpResponsePromise<boolean>;
|
|
93
|
+
private __linkToCargoV1;
|
|
63
94
|
/**
|
|
64
95
|
* Lists devices with filtering, sorting, and pagination. Use org_scope to restrict to owned, shared, or both (default). | auth: api_key | authz: min_org_role=operator | () -> (DeviceListRes)
|
|
65
96
|
*
|
|
@@ -143,6 +174,21 @@ export declare class Devices {
|
|
|
143
174
|
*/
|
|
144
175
|
typeaheadV1(request: Chrt.tracking.DevicesTypeaheadV1Request, requestOptions?: Devices.RequestOptions): core.HttpResponsePromise<Chrt.DeviceTypeaheadResult[]>;
|
|
145
176
|
private __typeaheadV1;
|
|
177
|
+
/**
|
|
178
|
+
* Unlinks an owned device from its cargo and deactivates its tracker. Returns false when the device is not linked to cargo. | authz: min_org_role=operator | () -> (bool)
|
|
179
|
+
*
|
|
180
|
+
* @param {Chrt.tracking.DevicesUnlinkFromCargoV1Request} request
|
|
181
|
+
* @param {Devices.RequestOptions} requestOptions - Request-specific configuration.
|
|
182
|
+
*
|
|
183
|
+
* @throws {@link Chrt.UnprocessableEntityError}
|
|
184
|
+
*
|
|
185
|
+
* @example
|
|
186
|
+
* await client.tracking.devices.unlinkFromCargoV1({
|
|
187
|
+
* device_id: "device_id"
|
|
188
|
+
* })
|
|
189
|
+
*/
|
|
190
|
+
unlinkFromCargoV1(request: Chrt.tracking.DevicesUnlinkFromCargoV1Request, requestOptions?: Devices.RequestOptions): core.HttpResponsePromise<boolean>;
|
|
191
|
+
private __unlinkFromCargoV1;
|
|
146
192
|
/**
|
|
147
193
|
* Unpauses a device. Closes the open pause time window. | auth: api_key | () -> (bool)
|
|
148
194
|
*
|
|
@@ -31,7 +31,7 @@ export class Devices {
|
|
|
31
31
|
this._options = _options;
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
|
-
* Archives a device
|
|
34
|
+
* Archives a device without an active session or cargo. Terminate or unlink tracking first. | auth: api_key | () -> (bool)
|
|
35
35
|
*
|
|
36
36
|
* @param {Chrt.tracking.DevicesArchiveV1Request} request
|
|
37
37
|
* @param {Devices.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -94,6 +94,70 @@ export class Devices {
|
|
|
94
94
|
}
|
|
95
95
|
});
|
|
96
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* Lists devices currently or previously linked to a cargo, ordered by MAC address. Access follows the cargo's order. | authz_personas=[coordinator_org_operators, shipper_org_operators, executor_org_operators, driver_for_executor] | () -> (list[DeviceForCargoRes])
|
|
99
|
+
*
|
|
100
|
+
* @param {Chrt.tracking.DevicesForCargoV1Request} request
|
|
101
|
+
* @param {Devices.RequestOptions} requestOptions - Request-specific configuration.
|
|
102
|
+
*
|
|
103
|
+
* @throws {@link Chrt.UnprocessableEntityError}
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* await client.tracking.devices.forCargoV1({
|
|
107
|
+
* cargo_id: "cargo_id"
|
|
108
|
+
* })
|
|
109
|
+
*/
|
|
110
|
+
forCargoV1(request, requestOptions) {
|
|
111
|
+
return core.HttpResponsePromise.fromPromise(this.__forCargoV1(request, requestOptions));
|
|
112
|
+
}
|
|
113
|
+
__forCargoV1(request, requestOptions) {
|
|
114
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
115
|
+
var _a, _b, _c, _d;
|
|
116
|
+
const { cargo_id: cargoId } = request;
|
|
117
|
+
const _queryParams = {};
|
|
118
|
+
_queryParams["cargo_id"] = cargoId;
|
|
119
|
+
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
120
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
121
|
+
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.ChrtEnvironment.Local, "tracking/devices/for_cargo/v1"),
|
|
122
|
+
method: "GET",
|
|
123
|
+
headers: _headers,
|
|
124
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
125
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
126
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
127
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
128
|
+
});
|
|
129
|
+
if (_response.ok) {
|
|
130
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
131
|
+
}
|
|
132
|
+
if (_response.error.reason === "status-code") {
|
|
133
|
+
switch (_response.error.statusCode) {
|
|
134
|
+
case 422:
|
|
135
|
+
throw new Chrt.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
136
|
+
default:
|
|
137
|
+
throw new errors.ChrtError({
|
|
138
|
+
statusCode: _response.error.statusCode,
|
|
139
|
+
body: _response.error.body,
|
|
140
|
+
rawResponse: _response.rawResponse,
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
switch (_response.error.reason) {
|
|
145
|
+
case "non-json":
|
|
146
|
+
throw new errors.ChrtError({
|
|
147
|
+
statusCode: _response.error.statusCode,
|
|
148
|
+
body: _response.error.rawBody,
|
|
149
|
+
rawResponse: _response.rawResponse,
|
|
150
|
+
});
|
|
151
|
+
case "timeout":
|
|
152
|
+
throw new errors.ChrtTimeoutError("Timeout exceeded when calling GET /tracking/devices/for_cargo/v1.");
|
|
153
|
+
case "unknown":
|
|
154
|
+
throw new errors.ChrtError({
|
|
155
|
+
message: _response.error.errorMessage,
|
|
156
|
+
rawResponse: _response.rawResponse,
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
}
|
|
97
161
|
/**
|
|
98
162
|
* Retrieves a single device by its ID with expanded sessions and cargos. Access restricted to the caller's organization or shared organizations. | auth: api_key | authz: min_org_role=operator | () -> (DeviceExpandedRes)
|
|
99
163
|
*
|
|
@@ -158,6 +222,72 @@ export class Devices {
|
|
|
158
222
|
}
|
|
159
223
|
});
|
|
160
224
|
}
|
|
225
|
+
/**
|
|
226
|
+
* Links an owned device to cargo and activates its tracker. Relinking the same cargo reactivates a stopped tracker. | authz: min_org_role=operator | authz_personas=[coordinator_org_operators, shipper_org_operators, executor_org_operators] | () -> (bool)
|
|
227
|
+
*
|
|
228
|
+
* @param {Chrt.tracking.DevicesLinkToCargoV1Request} request
|
|
229
|
+
* @param {Devices.RequestOptions} requestOptions - Request-specific configuration.
|
|
230
|
+
*
|
|
231
|
+
* @throws {@link Chrt.UnprocessableEntityError}
|
|
232
|
+
*
|
|
233
|
+
* @example
|
|
234
|
+
* await client.tracking.devices.linkToCargoV1({
|
|
235
|
+
* device_id: "device_id",
|
|
236
|
+
* cargo_id: "cargo_id"
|
|
237
|
+
* })
|
|
238
|
+
*/
|
|
239
|
+
linkToCargoV1(request, requestOptions) {
|
|
240
|
+
return core.HttpResponsePromise.fromPromise(this.__linkToCargoV1(request, requestOptions));
|
|
241
|
+
}
|
|
242
|
+
__linkToCargoV1(request, requestOptions) {
|
|
243
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
244
|
+
var _a, _b, _c, _d;
|
|
245
|
+
const { device_id: deviceId, cargo_id: cargoId } = request;
|
|
246
|
+
const _queryParams = {};
|
|
247
|
+
_queryParams["device_id"] = deviceId;
|
|
248
|
+
_queryParams["cargo_id"] = cargoId;
|
|
249
|
+
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
250
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
251
|
+
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.ChrtEnvironment.Local, "tracking/devices/link_to_cargo/v1"),
|
|
252
|
+
method: "POST",
|
|
253
|
+
headers: _headers,
|
|
254
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
255
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
256
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
257
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
258
|
+
});
|
|
259
|
+
if (_response.ok) {
|
|
260
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
261
|
+
}
|
|
262
|
+
if (_response.error.reason === "status-code") {
|
|
263
|
+
switch (_response.error.statusCode) {
|
|
264
|
+
case 422:
|
|
265
|
+
throw new Chrt.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
266
|
+
default:
|
|
267
|
+
throw new errors.ChrtError({
|
|
268
|
+
statusCode: _response.error.statusCode,
|
|
269
|
+
body: _response.error.body,
|
|
270
|
+
rawResponse: _response.rawResponse,
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
switch (_response.error.reason) {
|
|
275
|
+
case "non-json":
|
|
276
|
+
throw new errors.ChrtError({
|
|
277
|
+
statusCode: _response.error.statusCode,
|
|
278
|
+
body: _response.error.rawBody,
|
|
279
|
+
rawResponse: _response.rawResponse,
|
|
280
|
+
});
|
|
281
|
+
case "timeout":
|
|
282
|
+
throw new errors.ChrtTimeoutError("Timeout exceeded when calling POST /tracking/devices/link_to_cargo/v1.");
|
|
283
|
+
case "unknown":
|
|
284
|
+
throw new errors.ChrtError({
|
|
285
|
+
message: _response.error.errorMessage,
|
|
286
|
+
rawResponse: _response.rawResponse,
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
}
|
|
161
291
|
/**
|
|
162
292
|
* Lists devices with filtering, sorting, and pagination. Use org_scope to restrict to owned, shared, or both (default). | auth: api_key | authz: min_org_role=operator | () -> (DeviceListRes)
|
|
163
293
|
*
|
|
@@ -510,6 +640,70 @@ export class Devices {
|
|
|
510
640
|
}
|
|
511
641
|
});
|
|
512
642
|
}
|
|
643
|
+
/**
|
|
644
|
+
* Unlinks an owned device from its cargo and deactivates its tracker. Returns false when the device is not linked to cargo. | authz: min_org_role=operator | () -> (bool)
|
|
645
|
+
*
|
|
646
|
+
* @param {Chrt.tracking.DevicesUnlinkFromCargoV1Request} request
|
|
647
|
+
* @param {Devices.RequestOptions} requestOptions - Request-specific configuration.
|
|
648
|
+
*
|
|
649
|
+
* @throws {@link Chrt.UnprocessableEntityError}
|
|
650
|
+
*
|
|
651
|
+
* @example
|
|
652
|
+
* await client.tracking.devices.unlinkFromCargoV1({
|
|
653
|
+
* device_id: "device_id"
|
|
654
|
+
* })
|
|
655
|
+
*/
|
|
656
|
+
unlinkFromCargoV1(request, requestOptions) {
|
|
657
|
+
return core.HttpResponsePromise.fromPromise(this.__unlinkFromCargoV1(request, requestOptions));
|
|
658
|
+
}
|
|
659
|
+
__unlinkFromCargoV1(request, requestOptions) {
|
|
660
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
661
|
+
var _a, _b, _c, _d;
|
|
662
|
+
const { device_id: deviceId } = request;
|
|
663
|
+
const _queryParams = {};
|
|
664
|
+
_queryParams["device_id"] = deviceId;
|
|
665
|
+
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
666
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
667
|
+
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.ChrtEnvironment.Local, "tracking/devices/unlink_from_cargo/v1"),
|
|
668
|
+
method: "POST",
|
|
669
|
+
headers: _headers,
|
|
670
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
671
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
672
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
673
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
674
|
+
});
|
|
675
|
+
if (_response.ok) {
|
|
676
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
677
|
+
}
|
|
678
|
+
if (_response.error.reason === "status-code") {
|
|
679
|
+
switch (_response.error.statusCode) {
|
|
680
|
+
case 422:
|
|
681
|
+
throw new Chrt.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
682
|
+
default:
|
|
683
|
+
throw new errors.ChrtError({
|
|
684
|
+
statusCode: _response.error.statusCode,
|
|
685
|
+
body: _response.error.body,
|
|
686
|
+
rawResponse: _response.rawResponse,
|
|
687
|
+
});
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
switch (_response.error.reason) {
|
|
691
|
+
case "non-json":
|
|
692
|
+
throw new errors.ChrtError({
|
|
693
|
+
statusCode: _response.error.statusCode,
|
|
694
|
+
body: _response.error.rawBody,
|
|
695
|
+
rawResponse: _response.rawResponse,
|
|
696
|
+
});
|
|
697
|
+
case "timeout":
|
|
698
|
+
throw new errors.ChrtTimeoutError("Timeout exceeded when calling POST /tracking/devices/unlink_from_cargo/v1.");
|
|
699
|
+
case "unknown":
|
|
700
|
+
throw new errors.ChrtError({
|
|
701
|
+
message: _response.error.errorMessage,
|
|
702
|
+
rawResponse: _response.rawResponse,
|
|
703
|
+
});
|
|
704
|
+
}
|
|
705
|
+
});
|
|
706
|
+
}
|
|
513
707
|
/**
|
|
514
708
|
* Unpauses a device. Closes the open pause time window. | auth: api_key | () -> (bool)
|
|
515
709
|
*
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* @example
|
|
6
|
+
* {
|
|
7
|
+
* device_id: "device_id",
|
|
8
|
+
* cargo_id: "cargo_id"
|
|
9
|
+
* }
|
|
10
|
+
*/
|
|
11
|
+
export interface DevicesLinkToCargoV1Request {
|
|
12
|
+
device_id: string;
|
|
13
|
+
cargo_id: string;
|
|
14
|
+
}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
export { type DevicesArchiveV1Request } from "./DevicesArchiveV1Request.mjs";
|
|
2
|
+
export { type DevicesForCargoV1Request } from "./DevicesForCargoV1Request.mjs";
|
|
2
3
|
export { type DevicesGetV1Request } from "./DevicesGetV1Request.mjs";
|
|
4
|
+
export { type DevicesLinkToCargoV1Request } from "./DevicesLinkToCargoV1Request.mjs";
|
|
3
5
|
export { type DevicesListV1Request } from "./DevicesListV1Request.mjs";
|
|
4
6
|
export { type DevicesPauseV1Request } from "./DevicesPauseV1Request.mjs";
|
|
5
7
|
export { type DeviceClientCreate1 } from "./DeviceClientCreate1.mjs";
|
|
6
8
|
export { type DevicesTypeaheadV1Request } from "./DevicesTypeaheadV1Request.mjs";
|
|
9
|
+
export { type DevicesUnlinkFromCargoV1Request } from "./DevicesUnlinkFromCargoV1Request.mjs";
|
|
7
10
|
export { type DevicesUnpauseV1Request } from "./DevicesUnpauseV1Request.mjs";
|
|
8
11
|
export { type DeviceClientUpdate1 } from "./DeviceClientUpdate1.mjs";
|
|
9
12
|
export { type DevicesUpdateSharedOrgsReq1 } from "./DevicesUpdateSharedOrgsReq1.mjs";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as Chrt from "../index.mjs";
|
|
5
|
+
/**
|
|
6
|
+
* A device as seen by the cargo's order parties, who may not own or share the device.
|
|
7
|
+
*
|
|
8
|
+
* NOTE - excludes device_token (the webhook secret), location, and owner-only fields.
|
|
9
|
+
*/
|
|
10
|
+
export interface DeviceForCargoRes {
|
|
11
|
+
device_id: string;
|
|
12
|
+
device_mac_address: string;
|
|
13
|
+
is_currently_linked: boolean;
|
|
14
|
+
last_seen_at_timestamp?: string | null;
|
|
15
|
+
last_seen_battery_level?: string | null;
|
|
16
|
+
type?: Chrt.TrackingDeviceTypeEnum1 | null;
|
|
17
|
+
}
|
|
@@ -298,6 +298,7 @@ export * from "./DepartmentTypeaheadFieldEnum.mjs";
|
|
|
298
298
|
export * from "./DepartmentTypeaheadResult.mjs";
|
|
299
299
|
export * from "./DepartmentTypeaheadValue.mjs";
|
|
300
300
|
export * from "./DeviceExpandedRes.mjs";
|
|
301
|
+
export * from "./DeviceForCargoRes.mjs";
|
|
301
302
|
export * from "./DeviceLimitedForList1.mjs";
|
|
302
303
|
export * from "./DeviceListRes.mjs";
|
|
303
304
|
export * from "./DevicePausedTimeWindow1.mjs";
|
|
@@ -298,6 +298,7 @@ export * from "./DepartmentTypeaheadFieldEnum.mjs";
|
|
|
298
298
|
export * from "./DepartmentTypeaheadResult.mjs";
|
|
299
299
|
export * from "./DepartmentTypeaheadValue.mjs";
|
|
300
300
|
export * from "./DeviceExpandedRes.mjs";
|
|
301
|
+
export * from "./DeviceForCargoRes.mjs";
|
|
301
302
|
export * from "./DeviceLimitedForList1.mjs";
|
|
302
303
|
export * from "./DeviceListRes.mjs";
|
|
303
304
|
export * from "./DevicePausedTimeWindow1.mjs";
|
package/dist/esm/version.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "1.
|
|
1
|
+
export declare const SDK_VERSION = "1.1023.0";
|
package/dist/esm/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "1.
|
|
1
|
+
export const SDK_VERSION = "1.1023.0";
|
package/package.json
CHANGED
package/reference.md
CHANGED
|
@@ -33592,7 +33592,7 @@ await client.shippingIntegrations.xcelerator.orders.typeaheadV1({
|
|
|
33592
33592
|
<dl>
|
|
33593
33593
|
<dd>
|
|
33594
33594
|
|
|
33595
|
-
Archives a device
|
|
33595
|
+
Archives a device without an active session or cargo. Terminate or unlink tracking first. | auth: api_key | () -> (bool)
|
|
33596
33596
|
|
|
33597
33597
|
</dd>
|
|
33598
33598
|
</dl>
|
|
@@ -33645,6 +33645,71 @@ await client.tracking.devices.archiveV1({
|
|
|
33645
33645
|
</dl>
|
|
33646
33646
|
</details>
|
|
33647
33647
|
|
|
33648
|
+
<details><summary><code>client.tracking.devices.<a href="/src/api/resources/tracking/resources/devices/client/Client.ts">forCargoV1</a>({ ...params }) -> Chrt.DeviceForCargoRes[]</code></summary>
|
|
33649
|
+
<dl>
|
|
33650
|
+
<dd>
|
|
33651
|
+
|
|
33652
|
+
#### 📝 Description
|
|
33653
|
+
|
|
33654
|
+
<dl>
|
|
33655
|
+
<dd>
|
|
33656
|
+
|
|
33657
|
+
<dl>
|
|
33658
|
+
<dd>
|
|
33659
|
+
|
|
33660
|
+
Lists devices currently or previously linked to a cargo, ordered by MAC address. Access follows the cargo's order. | authz_personas=[coordinator_org_operators, shipper_org_operators, executor_org_operators, driver_for_executor] | () -> (list[DeviceForCargoRes])
|
|
33661
|
+
|
|
33662
|
+
</dd>
|
|
33663
|
+
</dl>
|
|
33664
|
+
</dd>
|
|
33665
|
+
</dl>
|
|
33666
|
+
|
|
33667
|
+
#### 🔌 Usage
|
|
33668
|
+
|
|
33669
|
+
<dl>
|
|
33670
|
+
<dd>
|
|
33671
|
+
|
|
33672
|
+
<dl>
|
|
33673
|
+
<dd>
|
|
33674
|
+
|
|
33675
|
+
```typescript
|
|
33676
|
+
await client.tracking.devices.forCargoV1({
|
|
33677
|
+
cargo_id: "cargo_id",
|
|
33678
|
+
});
|
|
33679
|
+
```
|
|
33680
|
+
|
|
33681
|
+
</dd>
|
|
33682
|
+
</dl>
|
|
33683
|
+
</dd>
|
|
33684
|
+
</dl>
|
|
33685
|
+
|
|
33686
|
+
#### ⚙️ Parameters
|
|
33687
|
+
|
|
33688
|
+
<dl>
|
|
33689
|
+
<dd>
|
|
33690
|
+
|
|
33691
|
+
<dl>
|
|
33692
|
+
<dd>
|
|
33693
|
+
|
|
33694
|
+
**request:** `Chrt.tracking.DevicesForCargoV1Request`
|
|
33695
|
+
|
|
33696
|
+
</dd>
|
|
33697
|
+
</dl>
|
|
33698
|
+
|
|
33699
|
+
<dl>
|
|
33700
|
+
<dd>
|
|
33701
|
+
|
|
33702
|
+
**requestOptions:** `Devices.RequestOptions`
|
|
33703
|
+
|
|
33704
|
+
</dd>
|
|
33705
|
+
</dl>
|
|
33706
|
+
</dd>
|
|
33707
|
+
</dl>
|
|
33708
|
+
|
|
33709
|
+
</dd>
|
|
33710
|
+
</dl>
|
|
33711
|
+
</details>
|
|
33712
|
+
|
|
33648
33713
|
<details><summary><code>client.tracking.devices.<a href="/src/api/resources/tracking/resources/devices/client/Client.ts">getV1</a>({ ...params }) -> Chrt.DeviceExpandedRes</code></summary>
|
|
33649
33714
|
<dl>
|
|
33650
33715
|
<dd>
|
|
@@ -33710,6 +33775,72 @@ await client.tracking.devices.getV1({
|
|
|
33710
33775
|
</dl>
|
|
33711
33776
|
</details>
|
|
33712
33777
|
|
|
33778
|
+
<details><summary><code>client.tracking.devices.<a href="/src/api/resources/tracking/resources/devices/client/Client.ts">linkToCargoV1</a>({ ...params }) -> boolean</code></summary>
|
|
33779
|
+
<dl>
|
|
33780
|
+
<dd>
|
|
33781
|
+
|
|
33782
|
+
#### 📝 Description
|
|
33783
|
+
|
|
33784
|
+
<dl>
|
|
33785
|
+
<dd>
|
|
33786
|
+
|
|
33787
|
+
<dl>
|
|
33788
|
+
<dd>
|
|
33789
|
+
|
|
33790
|
+
Links an owned device to cargo and activates its tracker. Relinking the same cargo reactivates a stopped tracker. | authz: min_org_role=operator | authz_personas=[coordinator_org_operators, shipper_org_operators, executor_org_operators] | () -> (bool)
|
|
33791
|
+
|
|
33792
|
+
</dd>
|
|
33793
|
+
</dl>
|
|
33794
|
+
</dd>
|
|
33795
|
+
</dl>
|
|
33796
|
+
|
|
33797
|
+
#### 🔌 Usage
|
|
33798
|
+
|
|
33799
|
+
<dl>
|
|
33800
|
+
<dd>
|
|
33801
|
+
|
|
33802
|
+
<dl>
|
|
33803
|
+
<dd>
|
|
33804
|
+
|
|
33805
|
+
```typescript
|
|
33806
|
+
await client.tracking.devices.linkToCargoV1({
|
|
33807
|
+
device_id: "device_id",
|
|
33808
|
+
cargo_id: "cargo_id",
|
|
33809
|
+
});
|
|
33810
|
+
```
|
|
33811
|
+
|
|
33812
|
+
</dd>
|
|
33813
|
+
</dl>
|
|
33814
|
+
</dd>
|
|
33815
|
+
</dl>
|
|
33816
|
+
|
|
33817
|
+
#### ⚙️ Parameters
|
|
33818
|
+
|
|
33819
|
+
<dl>
|
|
33820
|
+
<dd>
|
|
33821
|
+
|
|
33822
|
+
<dl>
|
|
33823
|
+
<dd>
|
|
33824
|
+
|
|
33825
|
+
**request:** `Chrt.tracking.DevicesLinkToCargoV1Request`
|
|
33826
|
+
|
|
33827
|
+
</dd>
|
|
33828
|
+
</dl>
|
|
33829
|
+
|
|
33830
|
+
<dl>
|
|
33831
|
+
<dd>
|
|
33832
|
+
|
|
33833
|
+
**requestOptions:** `Devices.RequestOptions`
|
|
33834
|
+
|
|
33835
|
+
</dd>
|
|
33836
|
+
</dl>
|
|
33837
|
+
</dd>
|
|
33838
|
+
</dl>
|
|
33839
|
+
|
|
33840
|
+
</dd>
|
|
33841
|
+
</dl>
|
|
33842
|
+
</details>
|
|
33843
|
+
|
|
33713
33844
|
<details><summary><code>client.tracking.devices.<a href="/src/api/resources/tracking/resources/devices/client/Client.ts">listV1</a>({ ...params }) -> Chrt.DeviceListRes</code></summary>
|
|
33714
33845
|
<dl>
|
|
33715
33846
|
<dd>
|
|
@@ -33993,6 +34124,71 @@ await client.tracking.devices.typeaheadV1({
|
|
|
33993
34124
|
</dl>
|
|
33994
34125
|
</details>
|
|
33995
34126
|
|
|
34127
|
+
<details><summary><code>client.tracking.devices.<a href="/src/api/resources/tracking/resources/devices/client/Client.ts">unlinkFromCargoV1</a>({ ...params }) -> boolean</code></summary>
|
|
34128
|
+
<dl>
|
|
34129
|
+
<dd>
|
|
34130
|
+
|
|
34131
|
+
#### 📝 Description
|
|
34132
|
+
|
|
34133
|
+
<dl>
|
|
34134
|
+
<dd>
|
|
34135
|
+
|
|
34136
|
+
<dl>
|
|
34137
|
+
<dd>
|
|
34138
|
+
|
|
34139
|
+
Unlinks an owned device from its cargo and deactivates its tracker. Returns false when the device is not linked to cargo. | authz: min_org_role=operator | () -> (bool)
|
|
34140
|
+
|
|
34141
|
+
</dd>
|
|
34142
|
+
</dl>
|
|
34143
|
+
</dd>
|
|
34144
|
+
</dl>
|
|
34145
|
+
|
|
34146
|
+
#### 🔌 Usage
|
|
34147
|
+
|
|
34148
|
+
<dl>
|
|
34149
|
+
<dd>
|
|
34150
|
+
|
|
34151
|
+
<dl>
|
|
34152
|
+
<dd>
|
|
34153
|
+
|
|
34154
|
+
```typescript
|
|
34155
|
+
await client.tracking.devices.unlinkFromCargoV1({
|
|
34156
|
+
device_id: "device_id",
|
|
34157
|
+
});
|
|
34158
|
+
```
|
|
34159
|
+
|
|
34160
|
+
</dd>
|
|
34161
|
+
</dl>
|
|
34162
|
+
</dd>
|
|
34163
|
+
</dl>
|
|
34164
|
+
|
|
34165
|
+
#### ⚙️ Parameters
|
|
34166
|
+
|
|
34167
|
+
<dl>
|
|
34168
|
+
<dd>
|
|
34169
|
+
|
|
34170
|
+
<dl>
|
|
34171
|
+
<dd>
|
|
34172
|
+
|
|
34173
|
+
**request:** `Chrt.tracking.DevicesUnlinkFromCargoV1Request`
|
|
34174
|
+
|
|
34175
|
+
</dd>
|
|
34176
|
+
</dl>
|
|
34177
|
+
|
|
34178
|
+
<dl>
|
|
34179
|
+
<dd>
|
|
34180
|
+
|
|
34181
|
+
**requestOptions:** `Devices.RequestOptions`
|
|
34182
|
+
|
|
34183
|
+
</dd>
|
|
34184
|
+
</dl>
|
|
34185
|
+
</dd>
|
|
34186
|
+
</dl>
|
|
34187
|
+
|
|
34188
|
+
</dd>
|
|
34189
|
+
</dl>
|
|
34190
|
+
</details>
|
|
34191
|
+
|
|
33996
34192
|
<details><summary><code>client.tracking.devices.<a href="/src/api/resources/tracking/resources/devices/client/Client.ts">unpauseV1</a>({ ...params }) -> boolean</code></summary>
|
|
33997
34193
|
<dl>
|
|
33998
34194
|
<dd>
|