@samsarahq/samsara 7.2.1 → 8.0.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/BaseClient.js +2 -2
- package/dist/cjs/api/resources/betaApIs/client/Client.d.ts +30 -0
- package/dist/cjs/api/resources/betaApIs/client/Client.js +91 -0
- package/dist/cjs/api/resources/{previewApIs → betaApIs}/client/requests/ListAssociationsRequest.d.ts +3 -4
- package/dist/cjs/api/resources/betaApIs/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/previewApIs/client/Client.d.ts +0 -37
- package/dist/cjs/api/resources/previewApIs/client/Client.js +0 -98
- package/dist/cjs/api/resources/previewApIs/client/requests/index.d.ts +0 -1
- package/dist/cjs/api/types/AssociationResponseBody.d.ts +3 -3
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/api/resources/betaApIs/client/Client.d.mts +30 -0
- package/dist/esm/api/resources/betaApIs/client/Client.mjs +91 -0
- package/dist/esm/api/resources/{previewApIs → betaApIs}/client/requests/ListAssociationsRequest.d.mts +3 -4
- package/dist/esm/api/resources/betaApIs/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/previewApIs/client/Client.d.mts +0 -37
- package/dist/esm/api/resources/previewApIs/client/Client.mjs +0 -98
- package/dist/esm/api/resources/previewApIs/client/requests/index.d.mts +0 -1
- package/dist/esm/api/types/AssociationResponseBody.d.mts +3 -3
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +72 -79
- /package/dist/cjs/api/resources/{previewApIs → betaApIs}/client/requests/ListAssociationsRequest.js +0 -0
- /package/dist/esm/api/resources/{previewApIs → betaApIs}/client/requests/ListAssociationsRequest.mjs +0 -0
package/dist/cjs/BaseClient.js
CHANGED
|
@@ -44,8 +44,8 @@ function normalizeClientOptions(options) {
|
|
|
44
44
|
const headers = (0, headers_js_1.mergeHeaders)({
|
|
45
45
|
"X-Fern-Language": "JavaScript",
|
|
46
46
|
"X-Fern-SDK-Name": "@samsarahq/samsara",
|
|
47
|
-
"X-Fern-SDK-Version": "
|
|
48
|
-
"User-Agent": "@samsarahq/samsara/
|
|
47
|
+
"X-Fern-SDK-Version": "8.0.0",
|
|
48
|
+
"User-Agent": "@samsarahq/samsara/8.0.0",
|
|
49
49
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
50
50
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
51
51
|
"X-Samsara-Version": (_a = options === null || options === void 0 ? void 0 : options.version) !== null && _a !== void 0 ? _a : "2025-06-11",
|
|
@@ -491,6 +491,36 @@ export declare class BetaApIsClient {
|
|
|
491
491
|
*/
|
|
492
492
|
getDevices(request?: Samsara.GetDevicesRequest, requestOptions?: BetaApIsClient.RequestOptions): core.HttpResponsePromise<Samsara.DevicesGetDevicesResponseBody>;
|
|
493
493
|
private __getDevices;
|
|
494
|
+
/**
|
|
495
|
+
* List associations between vehicles and peripheral devices within a given time range. Associations represent the relationship between a central device (vehicle) and a peripheral device (e.g. asset tag). An association with a null endTime is still active. If no endTime query parameter is provided, all associations from startTime onward are returned, including currently active (open) associations.
|
|
496
|
+
*
|
|
497
|
+
* <b>Rate limit:</b> 5 requests/sec (learn more about rate limits <a href="https://developers.samsara.com/docs/rate-limits" target="_blank">here</a>).
|
|
498
|
+
*
|
|
499
|
+
* To use this endpoint, select **Read Assets** under the Assets category when creating or editing an API token. <a href="https://developers.samsara.com/docs/authentication#scopes-for-api-tokens" target="_blank">Learn More.</a>
|
|
500
|
+
*
|
|
501
|
+
*
|
|
502
|
+
* **Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our <a href="https://forms.gle/zkD4NCH7HjKb7mm69" target="_blank">API feedback form</a>. If you encountered an issue or noticed inaccuracies in the API documentation, please <a href="https://www.samsara.com/help" target="_blank">submit a case</a> to our support team.
|
|
503
|
+
*
|
|
504
|
+
* @param {Samsara.ListAssociationsRequest} request
|
|
505
|
+
* @param {BetaApIsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
506
|
+
*
|
|
507
|
+
* @throws {@link Samsara.UnauthorizedError}
|
|
508
|
+
* @throws {@link Samsara.NotFoundError}
|
|
509
|
+
* @throws {@link Samsara.MethodNotAllowedError}
|
|
510
|
+
* @throws {@link Samsara.TooManyRequestsError}
|
|
511
|
+
* @throws {@link Samsara.InternalServerError}
|
|
512
|
+
* @throws {@link Samsara.NotImplementedError}
|
|
513
|
+
* @throws {@link Samsara.BadGatewayError}
|
|
514
|
+
* @throws {@link Samsara.ServiceUnavailableError}
|
|
515
|
+
* @throws {@link Samsara.GatewayTimeoutError}
|
|
516
|
+
*
|
|
517
|
+
* @example
|
|
518
|
+
* await client.betaApIs.listAssociations({
|
|
519
|
+
* startTime: "startTime"
|
|
520
|
+
* })
|
|
521
|
+
*/
|
|
522
|
+
listAssociations(request: Samsara.ListAssociationsRequest, requestOptions?: BetaApIsClient.RequestOptions): core.HttpResponsePromise<Samsara.AssociationsListAssociationsResponseBody>;
|
|
523
|
+
private __listAssociations;
|
|
494
524
|
/**
|
|
495
525
|
* List all assets that are currently marked as missing for the organization.
|
|
496
526
|
*
|
|
@@ -1500,6 +1500,97 @@ class BetaApIsClient {
|
|
|
1500
1500
|
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/devices");
|
|
1501
1501
|
});
|
|
1502
1502
|
}
|
|
1503
|
+
/**
|
|
1504
|
+
* List associations between vehicles and peripheral devices within a given time range. Associations represent the relationship between a central device (vehicle) and a peripheral device (e.g. asset tag). An association with a null endTime is still active. If no endTime query parameter is provided, all associations from startTime onward are returned, including currently active (open) associations.
|
|
1505
|
+
*
|
|
1506
|
+
* <b>Rate limit:</b> 5 requests/sec (learn more about rate limits <a href="https://developers.samsara.com/docs/rate-limits" target="_blank">here</a>).
|
|
1507
|
+
*
|
|
1508
|
+
* To use this endpoint, select **Read Assets** under the Assets category when creating or editing an API token. <a href="https://developers.samsara.com/docs/authentication#scopes-for-api-tokens" target="_blank">Learn More.</a>
|
|
1509
|
+
*
|
|
1510
|
+
*
|
|
1511
|
+
* **Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our <a href="https://forms.gle/zkD4NCH7HjKb7mm69" target="_blank">API feedback form</a>. If you encountered an issue or noticed inaccuracies in the API documentation, please <a href="https://www.samsara.com/help" target="_blank">submit a case</a> to our support team.
|
|
1512
|
+
*
|
|
1513
|
+
* @param {Samsara.ListAssociationsRequest} request
|
|
1514
|
+
* @param {BetaApIsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
1515
|
+
*
|
|
1516
|
+
* @throws {@link Samsara.UnauthorizedError}
|
|
1517
|
+
* @throws {@link Samsara.NotFoundError}
|
|
1518
|
+
* @throws {@link Samsara.MethodNotAllowedError}
|
|
1519
|
+
* @throws {@link Samsara.TooManyRequestsError}
|
|
1520
|
+
* @throws {@link Samsara.InternalServerError}
|
|
1521
|
+
* @throws {@link Samsara.NotImplementedError}
|
|
1522
|
+
* @throws {@link Samsara.BadGatewayError}
|
|
1523
|
+
* @throws {@link Samsara.ServiceUnavailableError}
|
|
1524
|
+
* @throws {@link Samsara.GatewayTimeoutError}
|
|
1525
|
+
*
|
|
1526
|
+
* @example
|
|
1527
|
+
* await client.betaApIs.listAssociations({
|
|
1528
|
+
* startTime: "startTime"
|
|
1529
|
+
* })
|
|
1530
|
+
*/
|
|
1531
|
+
listAssociations(request, requestOptions) {
|
|
1532
|
+
return core.HttpResponsePromise.fromPromise(this.__listAssociations(request, requestOptions));
|
|
1533
|
+
}
|
|
1534
|
+
__listAssociations(request, requestOptions) {
|
|
1535
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1536
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
1537
|
+
const { peripheralIds, startTime, endTime, after } = request;
|
|
1538
|
+
const _queryParams = {
|
|
1539
|
+
peripheralIds,
|
|
1540
|
+
startTime,
|
|
1541
|
+
endTime,
|
|
1542
|
+
after,
|
|
1543
|
+
};
|
|
1544
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
1545
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "X-Samsara-Version": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.version }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
1546
|
+
const _response = yield core.fetcher({
|
|
1547
|
+
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.SamsaraEnvironment.ProductionApi, "fleet/assets/associations"),
|
|
1548
|
+
method: "GET",
|
|
1549
|
+
headers: _headers,
|
|
1550
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
1551
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
1552
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
1553
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
1554
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
1555
|
+
logging: this._options.logging,
|
|
1556
|
+
});
|
|
1557
|
+
if (_response.ok) {
|
|
1558
|
+
return {
|
|
1559
|
+
data: _response.body,
|
|
1560
|
+
rawResponse: _response.rawResponse,
|
|
1561
|
+
};
|
|
1562
|
+
}
|
|
1563
|
+
if (_response.error.reason === "status-code") {
|
|
1564
|
+
switch (_response.error.statusCode) {
|
|
1565
|
+
case 401:
|
|
1566
|
+
throw new Samsara.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
1567
|
+
case 404:
|
|
1568
|
+
throw new Samsara.NotFoundError(_response.error.body, _response.rawResponse);
|
|
1569
|
+
case 405:
|
|
1570
|
+
throw new Samsara.MethodNotAllowedError(_response.error.body, _response.rawResponse);
|
|
1571
|
+
case 429:
|
|
1572
|
+
throw new Samsara.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
1573
|
+
case 500:
|
|
1574
|
+
throw new Samsara.InternalServerError(_response.error.body, _response.rawResponse);
|
|
1575
|
+
case 501:
|
|
1576
|
+
throw new Samsara.NotImplementedError(_response.error.body, _response.rawResponse);
|
|
1577
|
+
case 502:
|
|
1578
|
+
throw new Samsara.BadGatewayError(_response.error.body, _response.rawResponse);
|
|
1579
|
+
case 503:
|
|
1580
|
+
throw new Samsara.ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
1581
|
+
case 504:
|
|
1582
|
+
throw new Samsara.GatewayTimeoutError(_response.error.body, _response.rawResponse);
|
|
1583
|
+
default:
|
|
1584
|
+
throw new errors.SamsaraError({
|
|
1585
|
+
statusCode: _response.error.statusCode,
|
|
1586
|
+
body: _response.error.body,
|
|
1587
|
+
rawResponse: _response.rawResponse,
|
|
1588
|
+
});
|
|
1589
|
+
}
|
|
1590
|
+
}
|
|
1591
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/fleet/assets/associations");
|
|
1592
|
+
});
|
|
1593
|
+
}
|
|
1503
1594
|
/**
|
|
1504
1595
|
* List all assets that are currently marked as missing for the organization.
|
|
1505
1596
|
*
|
package/dist/cjs/api/resources/{previewApIs → betaApIs}/client/requests/ListAssociationsRequest.d.ts
RENAMED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @example
|
|
3
3
|
* {
|
|
4
|
-
* startTime: "startTime"
|
|
5
|
-
* endTime: "endTime"
|
|
4
|
+
* startTime: "startTime"
|
|
6
5
|
* }
|
|
7
6
|
*/
|
|
8
7
|
export interface ListAssociationsRequest {
|
|
@@ -10,8 +9,8 @@ export interface ListAssociationsRequest {
|
|
|
10
9
|
peripheralIds?: string | string[];
|
|
11
10
|
/** A start time in RFC 3339 format. Millisecond precision and timezones are supported. (Examples: 2019-06-13T19:08:25Z, 2019-06-13T19:08:25.455Z, OR 2015-09-15T14:00:12-04:00). */
|
|
12
11
|
startTime: string;
|
|
13
|
-
/** An end time in RFC 3339 format. Millisecond precision and timezones are supported. (Examples: 2019-06-13T19:08:25Z, 2019-06-13T19:08:25.455Z, OR 2015-09-15T14:00:12-04:00). */
|
|
14
|
-
endTime
|
|
12
|
+
/** An end time in RFC 3339 format. Millisecond precision and timezones are supported. (Examples: 2019-06-13T19:08:25Z, 2019-06-13T19:08:25.455Z, OR 2015-09-15T14:00:12-04:00). If not provided, all associations from startTime onward are returned, including currently active (open) associations. */
|
|
13
|
+
endTime?: string;
|
|
15
14
|
/** If specified, this should be the endCursor value from the previous page of results. When present, this request will return the next page of results that occur immediately after the previous page of results. */
|
|
16
15
|
after?: string;
|
|
17
16
|
}
|
|
@@ -40,6 +40,7 @@ export type { GetVehicleSafetyScoreTripsRequest } from "./GetVehicleSafetyScoreT
|
|
|
40
40
|
export type { HosDailyLogsUpdateShippingDocsRequestBody } from "./HosDailyLogsUpdateShippingDocsRequestBody.js";
|
|
41
41
|
export type { JobsCreateJobRequestBody } from "./JobsCreateJobRequestBody.js";
|
|
42
42
|
export type { JobsPatchJobRequestBody } from "./JobsPatchJobRequestBody.js";
|
|
43
|
+
export type { ListAssociationsRequest } from "./ListAssociationsRequest.js";
|
|
43
44
|
export type { ListCarbCtcVehicleHistoryRequest } from "./ListCarbCtcVehicleHistoryRequest.js";
|
|
44
45
|
export type { ListCarbCtcVehiclesRequest } from "./ListCarbCtcVehiclesRequest.js";
|
|
45
46
|
export type { ListDeviceRecoveryMissingAssetsRequest } from "./ListDeviceRecoveryMissingAssetsRequest.js";
|
|
@@ -10,43 +10,6 @@ export declare namespace PreviewApIsClient {
|
|
|
10
10
|
export declare class PreviewApIsClient {
|
|
11
11
|
protected readonly _options: NormalizedClientOptionsWithAuth<PreviewApIsClient.Options>;
|
|
12
12
|
constructor(options?: PreviewApIsClient.Options);
|
|
13
|
-
/**
|
|
14
|
-
* List associations between vehicles and peripheral devices within a given time range. Associations represent the relationship between a central device (vehicle) and a peripheral device (e.g. asset tag). An association with a null endTime is still active.
|
|
15
|
-
*
|
|
16
|
-
* <b>Rate limit:</b> 5 requests/sec (learn more about rate limits <a href="https://developers.samsara.com/docs/rate-limits" target="_blank">here</a>).
|
|
17
|
-
*
|
|
18
|
-
* To use this endpoint, select **Read Assets** under the Assets category when creating or editing an API token. <a href="https://developers.samsara.com/docs/authentication#scopes-for-api-tokens" target="_blank">Learn More.</a>
|
|
19
|
-
*
|
|
20
|
-
* Endpoints in this section are in Preview. These APIs are not functional and are instead for soliciting feedback from our API users on the intended design of this API. Additionally, it is not guaranteed that we will be releasing an endpoint included in this section to production. This means that developers should **NOT** rely on these APIs to build business critical applications
|
|
21
|
-
*
|
|
22
|
-
* - Samsara may change the structure of a preview API's interface without versioning or any notice to API users.
|
|
23
|
-
*
|
|
24
|
-
* - When an endpoint becomes generally available, it will be announced in the API [changelog](https://developers.samsara.com/changelog).
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* **Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our <a href="https://forms.gle/zkD4NCH7HjKb7mm69" target="_blank">API feedback form</a>. If you encountered an issue or noticed inaccuracies in the API documentation, please <a href="https://www.samsara.com/help" target="_blank">submit a case</a> to our support team.
|
|
28
|
-
*
|
|
29
|
-
* @param {Samsara.ListAssociationsRequest} request
|
|
30
|
-
* @param {PreviewApIsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
31
|
-
*
|
|
32
|
-
* @throws {@link Samsara.UnauthorizedError}
|
|
33
|
-
* @throws {@link Samsara.NotFoundError}
|
|
34
|
-
* @throws {@link Samsara.MethodNotAllowedError}
|
|
35
|
-
* @throws {@link Samsara.TooManyRequestsError}
|
|
36
|
-
* @throws {@link Samsara.InternalServerError}
|
|
37
|
-
* @throws {@link Samsara.NotImplementedError}
|
|
38
|
-
* @throws {@link Samsara.BadGatewayError}
|
|
39
|
-
* @throws {@link Samsara.ServiceUnavailableError}
|
|
40
|
-
* @throws {@link Samsara.GatewayTimeoutError}
|
|
41
|
-
*
|
|
42
|
-
* @example
|
|
43
|
-
* await client.previewApIs.listAssociations({
|
|
44
|
-
* startTime: "startTime",
|
|
45
|
-
* endTime: "endTime"
|
|
46
|
-
* })
|
|
47
|
-
*/
|
|
48
|
-
listAssociations(request: Samsara.ListAssociationsRequest, requestOptions?: PreviewApIsClient.RequestOptions): core.HttpResponsePromise<Samsara.AssociationsListAssociationsResponseBody>;
|
|
49
|
-
private __listAssociations;
|
|
50
13
|
/**
|
|
51
14
|
* Creates a short-lived auth token for a driver.
|
|
52
15
|
*
|
|
@@ -55,104 +55,6 @@ class PreviewApIsClient {
|
|
|
55
55
|
constructor(options = {}) {
|
|
56
56
|
this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
|
|
57
57
|
}
|
|
58
|
-
/**
|
|
59
|
-
* List associations between vehicles and peripheral devices within a given time range. Associations represent the relationship between a central device (vehicle) and a peripheral device (e.g. asset tag). An association with a null endTime is still active.
|
|
60
|
-
*
|
|
61
|
-
* <b>Rate limit:</b> 5 requests/sec (learn more about rate limits <a href="https://developers.samsara.com/docs/rate-limits" target="_blank">here</a>).
|
|
62
|
-
*
|
|
63
|
-
* To use this endpoint, select **Read Assets** under the Assets category when creating or editing an API token. <a href="https://developers.samsara.com/docs/authentication#scopes-for-api-tokens" target="_blank">Learn More.</a>
|
|
64
|
-
*
|
|
65
|
-
* Endpoints in this section are in Preview. These APIs are not functional and are instead for soliciting feedback from our API users on the intended design of this API. Additionally, it is not guaranteed that we will be releasing an endpoint included in this section to production. This means that developers should **NOT** rely on these APIs to build business critical applications
|
|
66
|
-
*
|
|
67
|
-
* - Samsara may change the structure of a preview API's interface without versioning or any notice to API users.
|
|
68
|
-
*
|
|
69
|
-
* - When an endpoint becomes generally available, it will be announced in the API [changelog](https://developers.samsara.com/changelog).
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
* **Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our <a href="https://forms.gle/zkD4NCH7HjKb7mm69" target="_blank">API feedback form</a>. If you encountered an issue or noticed inaccuracies in the API documentation, please <a href="https://www.samsara.com/help" target="_blank">submit a case</a> to our support team.
|
|
73
|
-
*
|
|
74
|
-
* @param {Samsara.ListAssociationsRequest} request
|
|
75
|
-
* @param {PreviewApIsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
76
|
-
*
|
|
77
|
-
* @throws {@link Samsara.UnauthorizedError}
|
|
78
|
-
* @throws {@link Samsara.NotFoundError}
|
|
79
|
-
* @throws {@link Samsara.MethodNotAllowedError}
|
|
80
|
-
* @throws {@link Samsara.TooManyRequestsError}
|
|
81
|
-
* @throws {@link Samsara.InternalServerError}
|
|
82
|
-
* @throws {@link Samsara.NotImplementedError}
|
|
83
|
-
* @throws {@link Samsara.BadGatewayError}
|
|
84
|
-
* @throws {@link Samsara.ServiceUnavailableError}
|
|
85
|
-
* @throws {@link Samsara.GatewayTimeoutError}
|
|
86
|
-
*
|
|
87
|
-
* @example
|
|
88
|
-
* await client.previewApIs.listAssociations({
|
|
89
|
-
* startTime: "startTime",
|
|
90
|
-
* endTime: "endTime"
|
|
91
|
-
* })
|
|
92
|
-
*/
|
|
93
|
-
listAssociations(request, requestOptions) {
|
|
94
|
-
return core.HttpResponsePromise.fromPromise(this.__listAssociations(request, requestOptions));
|
|
95
|
-
}
|
|
96
|
-
__listAssociations(request, requestOptions) {
|
|
97
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
98
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
99
|
-
const { peripheralIds, startTime, endTime, after } = request;
|
|
100
|
-
const _queryParams = {
|
|
101
|
-
peripheralIds,
|
|
102
|
-
startTime,
|
|
103
|
-
endTime,
|
|
104
|
-
after,
|
|
105
|
-
};
|
|
106
|
-
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
107
|
-
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "X-Samsara-Version": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.version }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
108
|
-
const _response = yield core.fetcher({
|
|
109
|
-
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.SamsaraEnvironment.ProductionApi, "preview/fleet/assets/associations"),
|
|
110
|
-
method: "GET",
|
|
111
|
-
headers: _headers,
|
|
112
|
-
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
113
|
-
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
114
|
-
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
115
|
-
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
116
|
-
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
117
|
-
logging: this._options.logging,
|
|
118
|
-
});
|
|
119
|
-
if (_response.ok) {
|
|
120
|
-
return {
|
|
121
|
-
data: _response.body,
|
|
122
|
-
rawResponse: _response.rawResponse,
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
if (_response.error.reason === "status-code") {
|
|
126
|
-
switch (_response.error.statusCode) {
|
|
127
|
-
case 401:
|
|
128
|
-
throw new Samsara.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
129
|
-
case 404:
|
|
130
|
-
throw new Samsara.NotFoundError(_response.error.body, _response.rawResponse);
|
|
131
|
-
case 405:
|
|
132
|
-
throw new Samsara.MethodNotAllowedError(_response.error.body, _response.rawResponse);
|
|
133
|
-
case 429:
|
|
134
|
-
throw new Samsara.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
135
|
-
case 500:
|
|
136
|
-
throw new Samsara.InternalServerError(_response.error.body, _response.rawResponse);
|
|
137
|
-
case 501:
|
|
138
|
-
throw new Samsara.NotImplementedError(_response.error.body, _response.rawResponse);
|
|
139
|
-
case 502:
|
|
140
|
-
throw new Samsara.BadGatewayError(_response.error.body, _response.rawResponse);
|
|
141
|
-
case 503:
|
|
142
|
-
throw new Samsara.ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
143
|
-
case 504:
|
|
144
|
-
throw new Samsara.GatewayTimeoutError(_response.error.body, _response.rawResponse);
|
|
145
|
-
default:
|
|
146
|
-
throw new errors.SamsaraError({
|
|
147
|
-
statusCode: _response.error.statusCode,
|
|
148
|
-
body: _response.error.body,
|
|
149
|
-
rawResponse: _response.rawResponse,
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/preview/fleet/assets/associations");
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
58
|
/**
|
|
157
59
|
* Creates a short-lived auth token for a driver.
|
|
158
60
|
*
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export type { DriversAuthTokenCreateDriverAuthTokenRequestBody } from "./DriversAuthTokenCreateDriverAuthTokenRequestBody.js";
|
|
2
|
-
export type { ListAssociationsRequest } from "./ListAssociationsRequest.js";
|
|
3
2
|
export type { LockVehicleRequest } from "./LockVehicleRequest.js";
|
|
4
3
|
export { SafetyEventsV2PatchSafetyEventsV2BatchRequestBody } from "./SafetyEventsV2PatchSafetyEventsV2BatchRequestBody.js";
|
|
5
4
|
export type { UnlockVehicleRequest } from "./UnlockVehicleRequest.js";
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* An association between a
|
|
2
|
+
* An association between a central device (e.g. vehicle gateway) and a peripheral device.
|
|
3
3
|
*/
|
|
4
4
|
export interface AssociationResponseBody {
|
|
5
5
|
/** The time when this association ended, in RFC 3339 format. Null if the association is still active. */
|
|
6
6
|
associationEndTime?: string | undefined;
|
|
7
7
|
/** The time when this association started, in RFC 3339 format. */
|
|
8
8
|
associationStartTime: string;
|
|
9
|
+
/** The Samsara ID of the central device in this association. */
|
|
10
|
+
centralId: string;
|
|
9
11
|
/** The Samsara ID of the peripheral device in this association. */
|
|
10
12
|
peripheralId: string;
|
|
11
13
|
/** The human-readable name of the peripheral device, if available. */
|
|
12
14
|
peripheralName?: string | undefined;
|
|
13
|
-
/** The Samsara ID of the vehicle (central device) in this association. */
|
|
14
|
-
vehicleId: string;
|
|
15
15
|
}
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "
|
|
1
|
+
export declare const SDK_VERSION = "8.0.0";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/BaseClient.mjs
CHANGED
|
@@ -7,8 +7,8 @@ export function normalizeClientOptions(options) {
|
|
|
7
7
|
const headers = mergeHeaders({
|
|
8
8
|
"X-Fern-Language": "JavaScript",
|
|
9
9
|
"X-Fern-SDK-Name": "@samsarahq/samsara",
|
|
10
|
-
"X-Fern-SDK-Version": "
|
|
11
|
-
"User-Agent": "@samsarahq/samsara/
|
|
10
|
+
"X-Fern-SDK-Version": "8.0.0",
|
|
11
|
+
"User-Agent": "@samsarahq/samsara/8.0.0",
|
|
12
12
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
13
13
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
14
14
|
"X-Samsara-Version": (_a = options === null || options === void 0 ? void 0 : options.version) !== null && _a !== void 0 ? _a : "2025-06-11",
|
|
@@ -491,6 +491,36 @@ export declare class BetaApIsClient {
|
|
|
491
491
|
*/
|
|
492
492
|
getDevices(request?: Samsara.GetDevicesRequest, requestOptions?: BetaApIsClient.RequestOptions): core.HttpResponsePromise<Samsara.DevicesGetDevicesResponseBody>;
|
|
493
493
|
private __getDevices;
|
|
494
|
+
/**
|
|
495
|
+
* List associations between vehicles and peripheral devices within a given time range. Associations represent the relationship between a central device (vehicle) and a peripheral device (e.g. asset tag). An association with a null endTime is still active. If no endTime query parameter is provided, all associations from startTime onward are returned, including currently active (open) associations.
|
|
496
|
+
*
|
|
497
|
+
* <b>Rate limit:</b> 5 requests/sec (learn more about rate limits <a href="https://developers.samsara.com/docs/rate-limits" target="_blank">here</a>).
|
|
498
|
+
*
|
|
499
|
+
* To use this endpoint, select **Read Assets** under the Assets category when creating or editing an API token. <a href="https://developers.samsara.com/docs/authentication#scopes-for-api-tokens" target="_blank">Learn More.</a>
|
|
500
|
+
*
|
|
501
|
+
*
|
|
502
|
+
* **Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our <a href="https://forms.gle/zkD4NCH7HjKb7mm69" target="_blank">API feedback form</a>. If you encountered an issue or noticed inaccuracies in the API documentation, please <a href="https://www.samsara.com/help" target="_blank">submit a case</a> to our support team.
|
|
503
|
+
*
|
|
504
|
+
* @param {Samsara.ListAssociationsRequest} request
|
|
505
|
+
* @param {BetaApIsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
506
|
+
*
|
|
507
|
+
* @throws {@link Samsara.UnauthorizedError}
|
|
508
|
+
* @throws {@link Samsara.NotFoundError}
|
|
509
|
+
* @throws {@link Samsara.MethodNotAllowedError}
|
|
510
|
+
* @throws {@link Samsara.TooManyRequestsError}
|
|
511
|
+
* @throws {@link Samsara.InternalServerError}
|
|
512
|
+
* @throws {@link Samsara.NotImplementedError}
|
|
513
|
+
* @throws {@link Samsara.BadGatewayError}
|
|
514
|
+
* @throws {@link Samsara.ServiceUnavailableError}
|
|
515
|
+
* @throws {@link Samsara.GatewayTimeoutError}
|
|
516
|
+
*
|
|
517
|
+
* @example
|
|
518
|
+
* await client.betaApIs.listAssociations({
|
|
519
|
+
* startTime: "startTime"
|
|
520
|
+
* })
|
|
521
|
+
*/
|
|
522
|
+
listAssociations(request: Samsara.ListAssociationsRequest, requestOptions?: BetaApIsClient.RequestOptions): core.HttpResponsePromise<Samsara.AssociationsListAssociationsResponseBody>;
|
|
523
|
+
private __listAssociations;
|
|
494
524
|
/**
|
|
495
525
|
* List all assets that are currently marked as missing for the organization.
|
|
496
526
|
*
|
|
@@ -1464,6 +1464,97 @@ export class BetaApIsClient {
|
|
|
1464
1464
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/devices");
|
|
1465
1465
|
});
|
|
1466
1466
|
}
|
|
1467
|
+
/**
|
|
1468
|
+
* List associations between vehicles and peripheral devices within a given time range. Associations represent the relationship between a central device (vehicle) and a peripheral device (e.g. asset tag). An association with a null endTime is still active. If no endTime query parameter is provided, all associations from startTime onward are returned, including currently active (open) associations.
|
|
1469
|
+
*
|
|
1470
|
+
* <b>Rate limit:</b> 5 requests/sec (learn more about rate limits <a href="https://developers.samsara.com/docs/rate-limits" target="_blank">here</a>).
|
|
1471
|
+
*
|
|
1472
|
+
* To use this endpoint, select **Read Assets** under the Assets category when creating or editing an API token. <a href="https://developers.samsara.com/docs/authentication#scopes-for-api-tokens" target="_blank">Learn More.</a>
|
|
1473
|
+
*
|
|
1474
|
+
*
|
|
1475
|
+
* **Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our <a href="https://forms.gle/zkD4NCH7HjKb7mm69" target="_blank">API feedback form</a>. If you encountered an issue or noticed inaccuracies in the API documentation, please <a href="https://www.samsara.com/help" target="_blank">submit a case</a> to our support team.
|
|
1476
|
+
*
|
|
1477
|
+
* @param {Samsara.ListAssociationsRequest} request
|
|
1478
|
+
* @param {BetaApIsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
1479
|
+
*
|
|
1480
|
+
* @throws {@link Samsara.UnauthorizedError}
|
|
1481
|
+
* @throws {@link Samsara.NotFoundError}
|
|
1482
|
+
* @throws {@link Samsara.MethodNotAllowedError}
|
|
1483
|
+
* @throws {@link Samsara.TooManyRequestsError}
|
|
1484
|
+
* @throws {@link Samsara.InternalServerError}
|
|
1485
|
+
* @throws {@link Samsara.NotImplementedError}
|
|
1486
|
+
* @throws {@link Samsara.BadGatewayError}
|
|
1487
|
+
* @throws {@link Samsara.ServiceUnavailableError}
|
|
1488
|
+
* @throws {@link Samsara.GatewayTimeoutError}
|
|
1489
|
+
*
|
|
1490
|
+
* @example
|
|
1491
|
+
* await client.betaApIs.listAssociations({
|
|
1492
|
+
* startTime: "startTime"
|
|
1493
|
+
* })
|
|
1494
|
+
*/
|
|
1495
|
+
listAssociations(request, requestOptions) {
|
|
1496
|
+
return core.HttpResponsePromise.fromPromise(this.__listAssociations(request, requestOptions));
|
|
1497
|
+
}
|
|
1498
|
+
__listAssociations(request, requestOptions) {
|
|
1499
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1500
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
1501
|
+
const { peripheralIds, startTime, endTime, after } = request;
|
|
1502
|
+
const _queryParams = {
|
|
1503
|
+
peripheralIds,
|
|
1504
|
+
startTime,
|
|
1505
|
+
endTime,
|
|
1506
|
+
after,
|
|
1507
|
+
};
|
|
1508
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
1509
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ "X-Samsara-Version": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.version }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
1510
|
+
const _response = yield core.fetcher({
|
|
1511
|
+
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.SamsaraEnvironment.ProductionApi, "fleet/assets/associations"),
|
|
1512
|
+
method: "GET",
|
|
1513
|
+
headers: _headers,
|
|
1514
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
1515
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
1516
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
1517
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
1518
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
1519
|
+
logging: this._options.logging,
|
|
1520
|
+
});
|
|
1521
|
+
if (_response.ok) {
|
|
1522
|
+
return {
|
|
1523
|
+
data: _response.body,
|
|
1524
|
+
rawResponse: _response.rawResponse,
|
|
1525
|
+
};
|
|
1526
|
+
}
|
|
1527
|
+
if (_response.error.reason === "status-code") {
|
|
1528
|
+
switch (_response.error.statusCode) {
|
|
1529
|
+
case 401:
|
|
1530
|
+
throw new Samsara.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
1531
|
+
case 404:
|
|
1532
|
+
throw new Samsara.NotFoundError(_response.error.body, _response.rawResponse);
|
|
1533
|
+
case 405:
|
|
1534
|
+
throw new Samsara.MethodNotAllowedError(_response.error.body, _response.rawResponse);
|
|
1535
|
+
case 429:
|
|
1536
|
+
throw new Samsara.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
1537
|
+
case 500:
|
|
1538
|
+
throw new Samsara.InternalServerError(_response.error.body, _response.rawResponse);
|
|
1539
|
+
case 501:
|
|
1540
|
+
throw new Samsara.NotImplementedError(_response.error.body, _response.rawResponse);
|
|
1541
|
+
case 502:
|
|
1542
|
+
throw new Samsara.BadGatewayError(_response.error.body, _response.rawResponse);
|
|
1543
|
+
case 503:
|
|
1544
|
+
throw new Samsara.ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
1545
|
+
case 504:
|
|
1546
|
+
throw new Samsara.GatewayTimeoutError(_response.error.body, _response.rawResponse);
|
|
1547
|
+
default:
|
|
1548
|
+
throw new errors.SamsaraError({
|
|
1549
|
+
statusCode: _response.error.statusCode,
|
|
1550
|
+
body: _response.error.body,
|
|
1551
|
+
rawResponse: _response.rawResponse,
|
|
1552
|
+
});
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1555
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/fleet/assets/associations");
|
|
1556
|
+
});
|
|
1557
|
+
}
|
|
1467
1558
|
/**
|
|
1468
1559
|
* List all assets that are currently marked as missing for the organization.
|
|
1469
1560
|
*
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @example
|
|
3
3
|
* {
|
|
4
|
-
* startTime: "startTime"
|
|
5
|
-
* endTime: "endTime"
|
|
4
|
+
* startTime: "startTime"
|
|
6
5
|
* }
|
|
7
6
|
*/
|
|
8
7
|
export interface ListAssociationsRequest {
|
|
@@ -10,8 +9,8 @@ export interface ListAssociationsRequest {
|
|
|
10
9
|
peripheralIds?: string | string[];
|
|
11
10
|
/** A start time in RFC 3339 format. Millisecond precision and timezones are supported. (Examples: 2019-06-13T19:08:25Z, 2019-06-13T19:08:25.455Z, OR 2015-09-15T14:00:12-04:00). */
|
|
12
11
|
startTime: string;
|
|
13
|
-
/** An end time in RFC 3339 format. Millisecond precision and timezones are supported. (Examples: 2019-06-13T19:08:25Z, 2019-06-13T19:08:25.455Z, OR 2015-09-15T14:00:12-04:00). */
|
|
14
|
-
endTime
|
|
12
|
+
/** An end time in RFC 3339 format. Millisecond precision and timezones are supported. (Examples: 2019-06-13T19:08:25Z, 2019-06-13T19:08:25.455Z, OR 2015-09-15T14:00:12-04:00). If not provided, all associations from startTime onward are returned, including currently active (open) associations. */
|
|
13
|
+
endTime?: string;
|
|
15
14
|
/** If specified, this should be the endCursor value from the previous page of results. When present, this request will return the next page of results that occur immediately after the previous page of results. */
|
|
16
15
|
after?: string;
|
|
17
16
|
}
|
|
@@ -40,6 +40,7 @@ export type { GetVehicleSafetyScoreTripsRequest } from "./GetVehicleSafetyScoreT
|
|
|
40
40
|
export type { HosDailyLogsUpdateShippingDocsRequestBody } from "./HosDailyLogsUpdateShippingDocsRequestBody.mjs";
|
|
41
41
|
export type { JobsCreateJobRequestBody } from "./JobsCreateJobRequestBody.mjs";
|
|
42
42
|
export type { JobsPatchJobRequestBody } from "./JobsPatchJobRequestBody.mjs";
|
|
43
|
+
export type { ListAssociationsRequest } from "./ListAssociationsRequest.mjs";
|
|
43
44
|
export type { ListCarbCtcVehicleHistoryRequest } from "./ListCarbCtcVehicleHistoryRequest.mjs";
|
|
44
45
|
export type { ListCarbCtcVehiclesRequest } from "./ListCarbCtcVehiclesRequest.mjs";
|
|
45
46
|
export type { ListDeviceRecoveryMissingAssetsRequest } from "./ListDeviceRecoveryMissingAssetsRequest.mjs";
|
|
@@ -10,43 +10,6 @@ export declare namespace PreviewApIsClient {
|
|
|
10
10
|
export declare class PreviewApIsClient {
|
|
11
11
|
protected readonly _options: NormalizedClientOptionsWithAuth<PreviewApIsClient.Options>;
|
|
12
12
|
constructor(options?: PreviewApIsClient.Options);
|
|
13
|
-
/**
|
|
14
|
-
* List associations between vehicles and peripheral devices within a given time range. Associations represent the relationship between a central device (vehicle) and a peripheral device (e.g. asset tag). An association with a null endTime is still active.
|
|
15
|
-
*
|
|
16
|
-
* <b>Rate limit:</b> 5 requests/sec (learn more about rate limits <a href="https://developers.samsara.com/docs/rate-limits" target="_blank">here</a>).
|
|
17
|
-
*
|
|
18
|
-
* To use this endpoint, select **Read Assets** under the Assets category when creating or editing an API token. <a href="https://developers.samsara.com/docs/authentication#scopes-for-api-tokens" target="_blank">Learn More.</a>
|
|
19
|
-
*
|
|
20
|
-
* Endpoints in this section are in Preview. These APIs are not functional and are instead for soliciting feedback from our API users on the intended design of this API. Additionally, it is not guaranteed that we will be releasing an endpoint included in this section to production. This means that developers should **NOT** rely on these APIs to build business critical applications
|
|
21
|
-
*
|
|
22
|
-
* - Samsara may change the structure of a preview API's interface without versioning or any notice to API users.
|
|
23
|
-
*
|
|
24
|
-
* - When an endpoint becomes generally available, it will be announced in the API [changelog](https://developers.samsara.com/changelog).
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* **Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our <a href="https://forms.gle/zkD4NCH7HjKb7mm69" target="_blank">API feedback form</a>. If you encountered an issue or noticed inaccuracies in the API documentation, please <a href="https://www.samsara.com/help" target="_blank">submit a case</a> to our support team.
|
|
28
|
-
*
|
|
29
|
-
* @param {Samsara.ListAssociationsRequest} request
|
|
30
|
-
* @param {PreviewApIsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
31
|
-
*
|
|
32
|
-
* @throws {@link Samsara.UnauthorizedError}
|
|
33
|
-
* @throws {@link Samsara.NotFoundError}
|
|
34
|
-
* @throws {@link Samsara.MethodNotAllowedError}
|
|
35
|
-
* @throws {@link Samsara.TooManyRequestsError}
|
|
36
|
-
* @throws {@link Samsara.InternalServerError}
|
|
37
|
-
* @throws {@link Samsara.NotImplementedError}
|
|
38
|
-
* @throws {@link Samsara.BadGatewayError}
|
|
39
|
-
* @throws {@link Samsara.ServiceUnavailableError}
|
|
40
|
-
* @throws {@link Samsara.GatewayTimeoutError}
|
|
41
|
-
*
|
|
42
|
-
* @example
|
|
43
|
-
* await client.previewApIs.listAssociations({
|
|
44
|
-
* startTime: "startTime",
|
|
45
|
-
* endTime: "endTime"
|
|
46
|
-
* })
|
|
47
|
-
*/
|
|
48
|
-
listAssociations(request: Samsara.ListAssociationsRequest, requestOptions?: PreviewApIsClient.RequestOptions): core.HttpResponsePromise<Samsara.AssociationsListAssociationsResponseBody>;
|
|
49
|
-
private __listAssociations;
|
|
50
13
|
/**
|
|
51
14
|
* Creates a short-lived auth token for a driver.
|
|
52
15
|
*
|
|
@@ -19,104 +19,6 @@ export class PreviewApIsClient {
|
|
|
19
19
|
constructor(options = {}) {
|
|
20
20
|
this._options = normalizeClientOptionsWithAuth(options);
|
|
21
21
|
}
|
|
22
|
-
/**
|
|
23
|
-
* List associations between vehicles and peripheral devices within a given time range. Associations represent the relationship between a central device (vehicle) and a peripheral device (e.g. asset tag). An association with a null endTime is still active.
|
|
24
|
-
*
|
|
25
|
-
* <b>Rate limit:</b> 5 requests/sec (learn more about rate limits <a href="https://developers.samsara.com/docs/rate-limits" target="_blank">here</a>).
|
|
26
|
-
*
|
|
27
|
-
* To use this endpoint, select **Read Assets** under the Assets category when creating or editing an API token. <a href="https://developers.samsara.com/docs/authentication#scopes-for-api-tokens" target="_blank">Learn More.</a>
|
|
28
|
-
*
|
|
29
|
-
* Endpoints in this section are in Preview. These APIs are not functional and are instead for soliciting feedback from our API users on the intended design of this API. Additionally, it is not guaranteed that we will be releasing an endpoint included in this section to production. This means that developers should **NOT** rely on these APIs to build business critical applications
|
|
30
|
-
*
|
|
31
|
-
* - Samsara may change the structure of a preview API's interface without versioning or any notice to API users.
|
|
32
|
-
*
|
|
33
|
-
* - When an endpoint becomes generally available, it will be announced in the API [changelog](https://developers.samsara.com/changelog).
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* **Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our <a href="https://forms.gle/zkD4NCH7HjKb7mm69" target="_blank">API feedback form</a>. If you encountered an issue or noticed inaccuracies in the API documentation, please <a href="https://www.samsara.com/help" target="_blank">submit a case</a> to our support team.
|
|
37
|
-
*
|
|
38
|
-
* @param {Samsara.ListAssociationsRequest} request
|
|
39
|
-
* @param {PreviewApIsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
40
|
-
*
|
|
41
|
-
* @throws {@link Samsara.UnauthorizedError}
|
|
42
|
-
* @throws {@link Samsara.NotFoundError}
|
|
43
|
-
* @throws {@link Samsara.MethodNotAllowedError}
|
|
44
|
-
* @throws {@link Samsara.TooManyRequestsError}
|
|
45
|
-
* @throws {@link Samsara.InternalServerError}
|
|
46
|
-
* @throws {@link Samsara.NotImplementedError}
|
|
47
|
-
* @throws {@link Samsara.BadGatewayError}
|
|
48
|
-
* @throws {@link Samsara.ServiceUnavailableError}
|
|
49
|
-
* @throws {@link Samsara.GatewayTimeoutError}
|
|
50
|
-
*
|
|
51
|
-
* @example
|
|
52
|
-
* await client.previewApIs.listAssociations({
|
|
53
|
-
* startTime: "startTime",
|
|
54
|
-
* endTime: "endTime"
|
|
55
|
-
* })
|
|
56
|
-
*/
|
|
57
|
-
listAssociations(request, requestOptions) {
|
|
58
|
-
return core.HttpResponsePromise.fromPromise(this.__listAssociations(request, requestOptions));
|
|
59
|
-
}
|
|
60
|
-
__listAssociations(request, requestOptions) {
|
|
61
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
63
|
-
const { peripheralIds, startTime, endTime, after } = request;
|
|
64
|
-
const _queryParams = {
|
|
65
|
-
peripheralIds,
|
|
66
|
-
startTime,
|
|
67
|
-
endTime,
|
|
68
|
-
after,
|
|
69
|
-
};
|
|
70
|
-
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
71
|
-
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ "X-Samsara-Version": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.version }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
72
|
-
const _response = yield core.fetcher({
|
|
73
|
-
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.SamsaraEnvironment.ProductionApi, "preview/fleet/assets/associations"),
|
|
74
|
-
method: "GET",
|
|
75
|
-
headers: _headers,
|
|
76
|
-
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
77
|
-
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
78
|
-
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
79
|
-
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
80
|
-
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
81
|
-
logging: this._options.logging,
|
|
82
|
-
});
|
|
83
|
-
if (_response.ok) {
|
|
84
|
-
return {
|
|
85
|
-
data: _response.body,
|
|
86
|
-
rawResponse: _response.rawResponse,
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
if (_response.error.reason === "status-code") {
|
|
90
|
-
switch (_response.error.statusCode) {
|
|
91
|
-
case 401:
|
|
92
|
-
throw new Samsara.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
93
|
-
case 404:
|
|
94
|
-
throw new Samsara.NotFoundError(_response.error.body, _response.rawResponse);
|
|
95
|
-
case 405:
|
|
96
|
-
throw new Samsara.MethodNotAllowedError(_response.error.body, _response.rawResponse);
|
|
97
|
-
case 429:
|
|
98
|
-
throw new Samsara.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
99
|
-
case 500:
|
|
100
|
-
throw new Samsara.InternalServerError(_response.error.body, _response.rawResponse);
|
|
101
|
-
case 501:
|
|
102
|
-
throw new Samsara.NotImplementedError(_response.error.body, _response.rawResponse);
|
|
103
|
-
case 502:
|
|
104
|
-
throw new Samsara.BadGatewayError(_response.error.body, _response.rawResponse);
|
|
105
|
-
case 503:
|
|
106
|
-
throw new Samsara.ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
107
|
-
case 504:
|
|
108
|
-
throw new Samsara.GatewayTimeoutError(_response.error.body, _response.rawResponse);
|
|
109
|
-
default:
|
|
110
|
-
throw new errors.SamsaraError({
|
|
111
|
-
statusCode: _response.error.statusCode,
|
|
112
|
-
body: _response.error.body,
|
|
113
|
-
rawResponse: _response.rawResponse,
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/preview/fleet/assets/associations");
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
22
|
/**
|
|
121
23
|
* Creates a short-lived auth token for a driver.
|
|
122
24
|
*
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export type { DriversAuthTokenCreateDriverAuthTokenRequestBody } from "./DriversAuthTokenCreateDriverAuthTokenRequestBody.mjs";
|
|
2
|
-
export type { ListAssociationsRequest } from "./ListAssociationsRequest.mjs";
|
|
3
2
|
export type { LockVehicleRequest } from "./LockVehicleRequest.mjs";
|
|
4
3
|
export { SafetyEventsV2PatchSafetyEventsV2BatchRequestBody } from "./SafetyEventsV2PatchSafetyEventsV2BatchRequestBody.mjs";
|
|
5
4
|
export type { UnlockVehicleRequest } from "./UnlockVehicleRequest.mjs";
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* An association between a
|
|
2
|
+
* An association between a central device (e.g. vehicle gateway) and a peripheral device.
|
|
3
3
|
*/
|
|
4
4
|
export interface AssociationResponseBody {
|
|
5
5
|
/** The time when this association ended, in RFC 3339 format. Null if the association is still active. */
|
|
6
6
|
associationEndTime?: string | undefined;
|
|
7
7
|
/** The time when this association started, in RFC 3339 format. */
|
|
8
8
|
associationStartTime: string;
|
|
9
|
+
/** The Samsara ID of the central device in this association. */
|
|
10
|
+
centralId: string;
|
|
9
11
|
/** The Samsara ID of the peripheral device in this association. */
|
|
10
12
|
peripheralId: string;
|
|
11
13
|
/** The human-readable name of the peripheral device, if available. */
|
|
12
14
|
peripheralName?: string | undefined;
|
|
13
|
-
/** The Samsara ID of the vehicle (central device) in this association. */
|
|
14
|
-
vehicleId: string;
|
|
15
15
|
}
|
package/dist/esm/version.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "
|
|
1
|
+
export declare const SDK_VERSION = "8.0.0";
|
package/dist/esm/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "
|
|
1
|
+
export const SDK_VERSION = "8.0.0";
|
package/package.json
CHANGED
package/reference.md
CHANGED
|
@@ -2638,6 +2638,78 @@ await client.betaApIs.getDevices();
|
|
|
2638
2638
|
</dl>
|
|
2639
2639
|
|
|
2640
2640
|
|
|
2641
|
+
</dd>
|
|
2642
|
+
</dl>
|
|
2643
|
+
</details>
|
|
2644
|
+
|
|
2645
|
+
<details><summary><code>client.betaApIs.<a href="/src/api/resources/betaApIs/client/Client.ts">listAssociations</a>({ ...params }) -> Samsara.AssociationsListAssociationsResponseBody</code></summary>
|
|
2646
|
+
<dl>
|
|
2647
|
+
<dd>
|
|
2648
|
+
|
|
2649
|
+
#### 📝 Description
|
|
2650
|
+
|
|
2651
|
+
<dl>
|
|
2652
|
+
<dd>
|
|
2653
|
+
|
|
2654
|
+
<dl>
|
|
2655
|
+
<dd>
|
|
2656
|
+
|
|
2657
|
+
List associations between vehicles and peripheral devices within a given time range. Associations represent the relationship between a central device (vehicle) and a peripheral device (e.g. asset tag). An association with a null endTime is still active. If no endTime query parameter is provided, all associations from startTime onward are returned, including currently active (open) associations.
|
|
2658
|
+
|
|
2659
|
+
<b>Rate limit:</b> 5 requests/sec (learn more about rate limits <a href="https://developers.samsara.com/docs/rate-limits" target="_blank">here</a>).
|
|
2660
|
+
|
|
2661
|
+
To use this endpoint, select **Read Assets** under the Assets category when creating or editing an API token. <a href="https://developers.samsara.com/docs/authentication#scopes-for-api-tokens" target="_blank">Learn More.</a>
|
|
2662
|
+
|
|
2663
|
+
|
|
2664
|
+
**Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our <a href="https://forms.gle/zkD4NCH7HjKb7mm69" target="_blank">API feedback form</a>. If you encountered an issue or noticed inaccuracies in the API documentation, please <a href="https://www.samsara.com/help" target="_blank">submit a case</a> to our support team.
|
|
2665
|
+
</dd>
|
|
2666
|
+
</dl>
|
|
2667
|
+
</dd>
|
|
2668
|
+
</dl>
|
|
2669
|
+
|
|
2670
|
+
#### 🔌 Usage
|
|
2671
|
+
|
|
2672
|
+
<dl>
|
|
2673
|
+
<dd>
|
|
2674
|
+
|
|
2675
|
+
<dl>
|
|
2676
|
+
<dd>
|
|
2677
|
+
|
|
2678
|
+
```typescript
|
|
2679
|
+
await client.betaApIs.listAssociations({
|
|
2680
|
+
startTime: "startTime"
|
|
2681
|
+
});
|
|
2682
|
+
|
|
2683
|
+
```
|
|
2684
|
+
</dd>
|
|
2685
|
+
</dl>
|
|
2686
|
+
</dd>
|
|
2687
|
+
</dl>
|
|
2688
|
+
|
|
2689
|
+
#### ⚙️ Parameters
|
|
2690
|
+
|
|
2691
|
+
<dl>
|
|
2692
|
+
<dd>
|
|
2693
|
+
|
|
2694
|
+
<dl>
|
|
2695
|
+
<dd>
|
|
2696
|
+
|
|
2697
|
+
**request:** `Samsara.ListAssociationsRequest`
|
|
2698
|
+
|
|
2699
|
+
</dd>
|
|
2700
|
+
</dl>
|
|
2701
|
+
|
|
2702
|
+
<dl>
|
|
2703
|
+
<dd>
|
|
2704
|
+
|
|
2705
|
+
**requestOptions:** `BetaApIsClient.RequestOptions`
|
|
2706
|
+
|
|
2707
|
+
</dd>
|
|
2708
|
+
</dl>
|
|
2709
|
+
</dd>
|
|
2710
|
+
</dl>
|
|
2711
|
+
|
|
2712
|
+
|
|
2641
2713
|
</dd>
|
|
2642
2714
|
</dl>
|
|
2643
2715
|
</details>
|
|
@@ -18092,85 +18164,6 @@ await client.organizationInfo.getOrganizationInfo();
|
|
|
18092
18164
|
</details>
|
|
18093
18165
|
|
|
18094
18166
|
## Preview APIs
|
|
18095
|
-
<details><summary><code>client.previewApIs.<a href="/src/api/resources/previewApIs/client/Client.ts">listAssociations</a>({ ...params }) -> Samsara.AssociationsListAssociationsResponseBody</code></summary>
|
|
18096
|
-
<dl>
|
|
18097
|
-
<dd>
|
|
18098
|
-
|
|
18099
|
-
#### 📝 Description
|
|
18100
|
-
|
|
18101
|
-
<dl>
|
|
18102
|
-
<dd>
|
|
18103
|
-
|
|
18104
|
-
<dl>
|
|
18105
|
-
<dd>
|
|
18106
|
-
|
|
18107
|
-
List associations between vehicles and peripheral devices within a given time range. Associations represent the relationship between a central device (vehicle) and a peripheral device (e.g. asset tag). An association with a null endTime is still active.
|
|
18108
|
-
|
|
18109
|
-
<b>Rate limit:</b> 5 requests/sec (learn more about rate limits <a href="https://developers.samsara.com/docs/rate-limits" target="_blank">here</a>).
|
|
18110
|
-
|
|
18111
|
-
To use this endpoint, select **Read Assets** under the Assets category when creating or editing an API token. <a href="https://developers.samsara.com/docs/authentication#scopes-for-api-tokens" target="_blank">Learn More.</a>
|
|
18112
|
-
|
|
18113
|
-
Endpoints in this section are in Preview. These APIs are not functional and are instead for soliciting feedback from our API users on the intended design of this API. Additionally, it is not guaranteed that we will be releasing an endpoint included in this section to production. This means that developers should **NOT** rely on these APIs to build business critical applications
|
|
18114
|
-
|
|
18115
|
-
- Samsara may change the structure of a preview API's interface without versioning or any notice to API users.
|
|
18116
|
-
|
|
18117
|
-
- When an endpoint becomes generally available, it will be announced in the API [changelog](https://developers.samsara.com/changelog).
|
|
18118
|
-
|
|
18119
|
-
|
|
18120
|
-
**Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our <a href="https://forms.gle/zkD4NCH7HjKb7mm69" target="_blank">API feedback form</a>. If you encountered an issue or noticed inaccuracies in the API documentation, please <a href="https://www.samsara.com/help" target="_blank">submit a case</a> to our support team.
|
|
18121
|
-
</dd>
|
|
18122
|
-
</dl>
|
|
18123
|
-
</dd>
|
|
18124
|
-
</dl>
|
|
18125
|
-
|
|
18126
|
-
#### 🔌 Usage
|
|
18127
|
-
|
|
18128
|
-
<dl>
|
|
18129
|
-
<dd>
|
|
18130
|
-
|
|
18131
|
-
<dl>
|
|
18132
|
-
<dd>
|
|
18133
|
-
|
|
18134
|
-
```typescript
|
|
18135
|
-
await client.previewApIs.listAssociations({
|
|
18136
|
-
startTime: "startTime",
|
|
18137
|
-
endTime: "endTime"
|
|
18138
|
-
});
|
|
18139
|
-
|
|
18140
|
-
```
|
|
18141
|
-
</dd>
|
|
18142
|
-
</dl>
|
|
18143
|
-
</dd>
|
|
18144
|
-
</dl>
|
|
18145
|
-
|
|
18146
|
-
#### ⚙️ Parameters
|
|
18147
|
-
|
|
18148
|
-
<dl>
|
|
18149
|
-
<dd>
|
|
18150
|
-
|
|
18151
|
-
<dl>
|
|
18152
|
-
<dd>
|
|
18153
|
-
|
|
18154
|
-
**request:** `Samsara.ListAssociationsRequest`
|
|
18155
|
-
|
|
18156
|
-
</dd>
|
|
18157
|
-
</dl>
|
|
18158
|
-
|
|
18159
|
-
<dl>
|
|
18160
|
-
<dd>
|
|
18161
|
-
|
|
18162
|
-
**requestOptions:** `PreviewApIsClient.RequestOptions`
|
|
18163
|
-
|
|
18164
|
-
</dd>
|
|
18165
|
-
</dl>
|
|
18166
|
-
</dd>
|
|
18167
|
-
</dl>
|
|
18168
|
-
|
|
18169
|
-
|
|
18170
|
-
</dd>
|
|
18171
|
-
</dl>
|
|
18172
|
-
</details>
|
|
18173
|
-
|
|
18174
18167
|
<details><summary><code>client.previewApIs.<a href="/src/api/resources/previewApIs/client/Client.ts">createDriverAuthToken</a>({ ...params }) -> Samsara.DriversAuthTokenCreateDriverAuthTokenResponseBody</code></summary>
|
|
18175
18168
|
<dl>
|
|
18176
18169
|
<dd>
|
/package/dist/cjs/api/resources/{previewApIs → betaApIs}/client/requests/ListAssociationsRequest.js
RENAMED
|
File without changes
|
/package/dist/esm/api/resources/{previewApIs → betaApIs}/client/requests/ListAssociationsRequest.mjs
RENAMED
|
File without changes
|