@samsarahq/samsara 6.3.0 → 7.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 +91 -0
- package/dist/cjs/api/resources/betaApIs/client/Client.js +265 -0
- package/dist/cjs/api/resources/betaApIs/client/requests/ListMaintenanceVendorsRequest.d.ts +1 -1
- package/dist/cjs/api/resources/betaApIs/client/requests/index.d.ts +3 -0
- package/dist/cjs/api/resources/betaApIs/client/requests/index.js +3 -1
- package/dist/cjs/api/resources/previewApIs/client/Client.d.ts +0 -109
- package/dist/cjs/api/resources/previewApIs/client/Client.js +0 -294
- package/dist/cjs/api/resources/previewApIs/client/requests/index.d.ts +0 -3
- package/dist/cjs/api/resources/previewApIs/client/requests/index.js +0 -3
- package/dist/cjs/api/types/MissingStateResponseBody.d.ts +1 -1
- package/dist/cjs/api/types/NotificationRecipientResponseResponseBody.d.ts +23 -0
- package/dist/cjs/api/types/NotificationRecipientResponseResponseBody.js +14 -0
- package/dist/cjs/api/types/RecoveryStateResponseBody.d.ts +1 -1
- package/dist/cjs/api/types/VendorObjectResponseBody.d.ts +2 -0
- package/dist/cjs/api/types/index.d.ts +1 -1
- package/dist/cjs/api/types/index.js +1 -1
- 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 +91 -0
- package/dist/esm/api/resources/betaApIs/client/Client.mjs +265 -0
- package/dist/esm/api/resources/betaApIs/client/requests/ListMaintenanceVendorsRequest.d.mts +1 -1
- package/dist/esm/api/resources/betaApIs/client/requests/index.d.mts +3 -0
- package/dist/esm/api/resources/betaApIs/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/previewApIs/client/Client.d.mts +0 -109
- package/dist/esm/api/resources/previewApIs/client/Client.mjs +0 -294
- package/dist/esm/api/resources/previewApIs/client/requests/index.d.mts +0 -3
- package/dist/esm/api/resources/previewApIs/client/requests/index.mjs +1 -1
- package/dist/esm/api/types/MissingStateResponseBody.d.mts +1 -1
- package/dist/esm/api/types/NotificationRecipientResponseResponseBody.d.mts +23 -0
- package/dist/esm/api/types/NotificationRecipientResponseResponseBody.mjs +11 -0
- package/dist/esm/api/types/RecoveryStateResponseBody.d.mts +1 -1
- package/dist/esm/api/types/VendorObjectResponseBody.d.mts +2 -0
- package/dist/esm/api/types/index.d.mts +1 -1
- package/dist/esm/api/types/index.mjs +1 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +217 -235
- package/dist/cjs/api/types/NotificationRecipientResponseBody.d.ts +0 -19
- package/dist/cjs/api/types/NotificationRecipientResponseBody.js +0 -14
- package/dist/esm/api/types/NotificationRecipientResponseBody.d.mts +0 -19
- package/dist/esm/api/types/NotificationRecipientResponseBody.mjs +0 -11
- /package/dist/cjs/api/resources/{previewApIs → betaApIs}/client/requests/DeviceRecoveryMarkAssetMissingRequestBody.d.ts +0 -0
- /package/dist/cjs/api/resources/{previewApIs → betaApIs}/client/requests/DeviceRecoveryMarkAssetMissingRequestBody.js +0 -0
- /package/dist/cjs/api/resources/{previewApIs → betaApIs}/client/requests/DeviceRecoveryRecoverAssetRequestBody.d.ts +0 -0
- /package/dist/cjs/api/resources/{previewApIs → betaApIs}/client/requests/DeviceRecoveryRecoverAssetRequestBody.js +0 -0
- /package/dist/cjs/api/resources/{previewApIs → betaApIs}/client/requests/ListDeviceRecoveryMissingAssetsRequest.d.ts +0 -0
- /package/dist/cjs/api/resources/{previewApIs → betaApIs}/client/requests/ListDeviceRecoveryMissingAssetsRequest.js +0 -0
- /package/dist/esm/api/resources/{previewApIs → betaApIs}/client/requests/DeviceRecoveryMarkAssetMissingRequestBody.d.mts +0 -0
- /package/dist/esm/api/resources/{previewApIs → betaApIs}/client/requests/DeviceRecoveryMarkAssetMissingRequestBody.mjs +0 -0
- /package/dist/esm/api/resources/{previewApIs → betaApIs}/client/requests/DeviceRecoveryRecoverAssetRequestBody.d.mts +0 -0
- /package/dist/esm/api/resources/{previewApIs → betaApIs}/client/requests/DeviceRecoveryRecoverAssetRequestBody.mjs +0 -0
- /package/dist/esm/api/resources/{previewApIs → betaApIs}/client/requests/ListDeviceRecoveryMissingAssetsRequest.d.mts +0 -0
- /package/dist/esm/api/resources/{previewApIs → betaApIs}/client/requests/ListDeviceRecoveryMissingAssetsRequest.mjs +0 -0
|
@@ -42,17 +42,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
42
42
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
43
43
|
});
|
|
44
44
|
};
|
|
45
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
46
|
-
var t = {};
|
|
47
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
48
|
-
t[p] = s[p];
|
|
49
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
50
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
51
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
52
|
-
t[p[i]] = s[p[i]];
|
|
53
|
-
}
|
|
54
|
-
return t;
|
|
55
|
-
};
|
|
56
45
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
57
46
|
exports.PreviewApIsClient = void 0;
|
|
58
47
|
const BaseClient_js_1 = require("../../../../BaseClient.js");
|
|
@@ -66,289 +55,6 @@ class PreviewApIsClient {
|
|
|
66
55
|
constructor(options = {}) {
|
|
67
56
|
this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
|
|
68
57
|
}
|
|
69
|
-
/**
|
|
70
|
-
* List all assets that are currently marked as missing for the organization.
|
|
71
|
-
*
|
|
72
|
-
* <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>).
|
|
73
|
-
*
|
|
74
|
-
* 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>
|
|
75
|
-
*
|
|
76
|
-
* 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
|
|
77
|
-
*
|
|
78
|
-
* - Samsara may change the structure of a preview API's interface without versioning or any notice to API users.
|
|
79
|
-
*
|
|
80
|
-
* - When an endpoint becomes generally available, it will be announced in the API [changelog](https://developers.samsara.com/changelog).
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
* **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.
|
|
84
|
-
*
|
|
85
|
-
* @param {Samsara.ListDeviceRecoveryMissingAssetsRequest} request
|
|
86
|
-
* @param {PreviewApIsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
87
|
-
*
|
|
88
|
-
* @throws {@link Samsara.UnauthorizedError}
|
|
89
|
-
* @throws {@link Samsara.NotFoundError}
|
|
90
|
-
* @throws {@link Samsara.MethodNotAllowedError}
|
|
91
|
-
* @throws {@link Samsara.TooManyRequestsError}
|
|
92
|
-
* @throws {@link Samsara.InternalServerError}
|
|
93
|
-
* @throws {@link Samsara.NotImplementedError}
|
|
94
|
-
* @throws {@link Samsara.BadGatewayError}
|
|
95
|
-
* @throws {@link Samsara.ServiceUnavailableError}
|
|
96
|
-
* @throws {@link Samsara.GatewayTimeoutError}
|
|
97
|
-
*
|
|
98
|
-
* @example
|
|
99
|
-
* await client.previewApIs.listDeviceRecoveryMissingAssets()
|
|
100
|
-
*/
|
|
101
|
-
listDeviceRecoveryMissingAssets(request = {}, requestOptions) {
|
|
102
|
-
return core.HttpResponsePromise.fromPromise(this.__listDeviceRecoveryMissingAssets(request, requestOptions));
|
|
103
|
-
}
|
|
104
|
-
__listDeviceRecoveryMissingAssets() {
|
|
105
|
-
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
106
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
107
|
-
const { after } = request;
|
|
108
|
-
const _queryParams = {
|
|
109
|
-
after,
|
|
110
|
-
};
|
|
111
|
-
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
112
|
-
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);
|
|
113
|
-
const _response = yield core.fetcher({
|
|
114
|
-
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.SamsaraEnvironment.ProductionApi, "preview/fleet/assets/device-recovery-missing"),
|
|
115
|
-
method: "GET",
|
|
116
|
-
headers: _headers,
|
|
117
|
-
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
118
|
-
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,
|
|
119
|
-
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,
|
|
120
|
-
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
121
|
-
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
122
|
-
logging: this._options.logging,
|
|
123
|
-
});
|
|
124
|
-
if (_response.ok) {
|
|
125
|
-
return {
|
|
126
|
-
data: _response.body,
|
|
127
|
-
rawResponse: _response.rawResponse,
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
if (_response.error.reason === "status-code") {
|
|
131
|
-
switch (_response.error.statusCode) {
|
|
132
|
-
case 401:
|
|
133
|
-
throw new Samsara.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
134
|
-
case 404:
|
|
135
|
-
throw new Samsara.NotFoundError(_response.error.body, _response.rawResponse);
|
|
136
|
-
case 405:
|
|
137
|
-
throw new Samsara.MethodNotAllowedError(_response.error.body, _response.rawResponse);
|
|
138
|
-
case 429:
|
|
139
|
-
throw new Samsara.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
140
|
-
case 500:
|
|
141
|
-
throw new Samsara.InternalServerError(_response.error.body, _response.rawResponse);
|
|
142
|
-
case 501:
|
|
143
|
-
throw new Samsara.NotImplementedError(_response.error.body, _response.rawResponse);
|
|
144
|
-
case 502:
|
|
145
|
-
throw new Samsara.BadGatewayError(_response.error.body, _response.rawResponse);
|
|
146
|
-
case 503:
|
|
147
|
-
throw new Samsara.ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
148
|
-
case 504:
|
|
149
|
-
throw new Samsara.GatewayTimeoutError(_response.error.body, _response.rawResponse);
|
|
150
|
-
default:
|
|
151
|
-
throw new errors.SamsaraError({
|
|
152
|
-
statusCode: _response.error.statusCode,
|
|
153
|
-
body: _response.error.body,
|
|
154
|
-
rawResponse: _response.rawResponse,
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/preview/fleet/assets/device-recovery-missing");
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
/**
|
|
162
|
-
* Mark an asset as missing. Optionally specify a note and notification recipients who will receive email updates.
|
|
163
|
-
*
|
|
164
|
-
* <b>Rate limit:</b> 100 requests/min (learn more about rate limits <a href="https://developers.samsara.com/docs/rate-limits" target="_blank">here</a>).
|
|
165
|
-
*
|
|
166
|
-
* To use this endpoint, select **Write 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>
|
|
167
|
-
*
|
|
168
|
-
* 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
|
|
169
|
-
*
|
|
170
|
-
* - Samsara may change the structure of a preview API's interface without versioning or any notice to API users.
|
|
171
|
-
*
|
|
172
|
-
* - When an endpoint becomes generally available, it will be announced in the API [changelog](https://developers.samsara.com/changelog).
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
* **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.
|
|
176
|
-
*
|
|
177
|
-
* @param {Samsara.DeviceRecoveryMarkAssetMissingRequestBody} request
|
|
178
|
-
* @param {PreviewApIsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
179
|
-
*
|
|
180
|
-
* @throws {@link Samsara.UnauthorizedError}
|
|
181
|
-
* @throws {@link Samsara.NotFoundError}
|
|
182
|
-
* @throws {@link Samsara.MethodNotAllowedError}
|
|
183
|
-
* @throws {@link Samsara.TooManyRequestsError}
|
|
184
|
-
* @throws {@link Samsara.InternalServerError}
|
|
185
|
-
* @throws {@link Samsara.NotImplementedError}
|
|
186
|
-
* @throws {@link Samsara.BadGatewayError}
|
|
187
|
-
* @throws {@link Samsara.ServiceUnavailableError}
|
|
188
|
-
* @throws {@link Samsara.GatewayTimeoutError}
|
|
189
|
-
*
|
|
190
|
-
* @example
|
|
191
|
-
* await client.previewApIs.markAssetMissing({
|
|
192
|
-
* id: "id"
|
|
193
|
-
* })
|
|
194
|
-
*/
|
|
195
|
-
markAssetMissing(request, requestOptions) {
|
|
196
|
-
return core.HttpResponsePromise.fromPromise(this.__markAssetMissing(request, requestOptions));
|
|
197
|
-
}
|
|
198
|
-
__markAssetMissing(request, requestOptions) {
|
|
199
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
200
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
201
|
-
const { id } = request, _body = __rest(request, ["id"]);
|
|
202
|
-
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
203
|
-
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);
|
|
204
|
-
const _response = yield core.fetcher({
|
|
205
|
-
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/device-recovery/${core.url.encodePathParam(id)}/missing`),
|
|
206
|
-
method: "POST",
|
|
207
|
-
headers: _headers,
|
|
208
|
-
contentType: "application/json",
|
|
209
|
-
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
210
|
-
requestType: "json",
|
|
211
|
-
body: _body,
|
|
212
|
-
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,
|
|
213
|
-
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,
|
|
214
|
-
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
215
|
-
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
216
|
-
logging: this._options.logging,
|
|
217
|
-
});
|
|
218
|
-
if (_response.ok) {
|
|
219
|
-
return {
|
|
220
|
-
data: _response.body,
|
|
221
|
-
rawResponse: _response.rawResponse,
|
|
222
|
-
};
|
|
223
|
-
}
|
|
224
|
-
if (_response.error.reason === "status-code") {
|
|
225
|
-
switch (_response.error.statusCode) {
|
|
226
|
-
case 401:
|
|
227
|
-
throw new Samsara.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
228
|
-
case 404:
|
|
229
|
-
throw new Samsara.NotFoundError(_response.error.body, _response.rawResponse);
|
|
230
|
-
case 405:
|
|
231
|
-
throw new Samsara.MethodNotAllowedError(_response.error.body, _response.rawResponse);
|
|
232
|
-
case 429:
|
|
233
|
-
throw new Samsara.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
234
|
-
case 500:
|
|
235
|
-
throw new Samsara.InternalServerError(_response.error.body, _response.rawResponse);
|
|
236
|
-
case 501:
|
|
237
|
-
throw new Samsara.NotImplementedError(_response.error.body, _response.rawResponse);
|
|
238
|
-
case 502:
|
|
239
|
-
throw new Samsara.BadGatewayError(_response.error.body, _response.rawResponse);
|
|
240
|
-
case 503:
|
|
241
|
-
throw new Samsara.ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
242
|
-
case 504:
|
|
243
|
-
throw new Samsara.GatewayTimeoutError(_response.error.body, _response.rawResponse);
|
|
244
|
-
default:
|
|
245
|
-
throw new errors.SamsaraError({
|
|
246
|
-
statusCode: _response.error.statusCode,
|
|
247
|
-
body: _response.error.body,
|
|
248
|
-
rawResponse: _response.rawResponse,
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/preview/fleet/assets/device-recovery/{id}/missing");
|
|
253
|
-
});
|
|
254
|
-
}
|
|
255
|
-
/**
|
|
256
|
-
* Mark a missing asset as recovered. Provide the recovery status, reason for being missing, and optional additional details.
|
|
257
|
-
*
|
|
258
|
-
* <b>Rate limit:</b> 100 requests/min (learn more about rate limits <a href="https://developers.samsara.com/docs/rate-limits" target="_blank">here</a>).
|
|
259
|
-
*
|
|
260
|
-
* To use this endpoint, select **Write 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>
|
|
261
|
-
*
|
|
262
|
-
* 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
|
|
263
|
-
*
|
|
264
|
-
* - Samsara may change the structure of a preview API's interface without versioning or any notice to API users.
|
|
265
|
-
*
|
|
266
|
-
* - When an endpoint becomes generally available, it will be announced in the API [changelog](https://developers.samsara.com/changelog).
|
|
267
|
-
*
|
|
268
|
-
*
|
|
269
|
-
* **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.
|
|
270
|
-
*
|
|
271
|
-
* @param {Samsara.DeviceRecoveryRecoverAssetRequestBody} request
|
|
272
|
-
* @param {PreviewApIsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
273
|
-
*
|
|
274
|
-
* @throws {@link Samsara.UnauthorizedError}
|
|
275
|
-
* @throws {@link Samsara.NotFoundError}
|
|
276
|
-
* @throws {@link Samsara.MethodNotAllowedError}
|
|
277
|
-
* @throws {@link Samsara.TooManyRequestsError}
|
|
278
|
-
* @throws {@link Samsara.InternalServerError}
|
|
279
|
-
* @throws {@link Samsara.NotImplementedError}
|
|
280
|
-
* @throws {@link Samsara.BadGatewayError}
|
|
281
|
-
* @throws {@link Samsara.ServiceUnavailableError}
|
|
282
|
-
* @throws {@link Samsara.GatewayTimeoutError}
|
|
283
|
-
*
|
|
284
|
-
* @example
|
|
285
|
-
* await client.previewApIs.recoverAsset({
|
|
286
|
-
* id: "id",
|
|
287
|
-
* missing_reason: "MISPLACED",
|
|
288
|
-
* recovery_status: "YES",
|
|
289
|
-
* status: "RECOVERED"
|
|
290
|
-
* })
|
|
291
|
-
*/
|
|
292
|
-
recoverAsset(request, requestOptions) {
|
|
293
|
-
return core.HttpResponsePromise.fromPromise(this.__recoverAsset(request, requestOptions));
|
|
294
|
-
}
|
|
295
|
-
__recoverAsset(request, requestOptions) {
|
|
296
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
297
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
298
|
-
const { id } = request, _body = __rest(request, ["id"]);
|
|
299
|
-
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
300
|
-
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);
|
|
301
|
-
const _response = yield core.fetcher({
|
|
302
|
-
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/device-recovery/${core.url.encodePathParam(id)}/recovered`),
|
|
303
|
-
method: "POST",
|
|
304
|
-
headers: _headers,
|
|
305
|
-
contentType: "application/json",
|
|
306
|
-
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
307
|
-
requestType: "json",
|
|
308
|
-
body: _body,
|
|
309
|
-
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,
|
|
310
|
-
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,
|
|
311
|
-
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
312
|
-
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
313
|
-
logging: this._options.logging,
|
|
314
|
-
});
|
|
315
|
-
if (_response.ok) {
|
|
316
|
-
return {
|
|
317
|
-
data: _response.body,
|
|
318
|
-
rawResponse: _response.rawResponse,
|
|
319
|
-
};
|
|
320
|
-
}
|
|
321
|
-
if (_response.error.reason === "status-code") {
|
|
322
|
-
switch (_response.error.statusCode) {
|
|
323
|
-
case 401:
|
|
324
|
-
throw new Samsara.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
325
|
-
case 404:
|
|
326
|
-
throw new Samsara.NotFoundError(_response.error.body, _response.rawResponse);
|
|
327
|
-
case 405:
|
|
328
|
-
throw new Samsara.MethodNotAllowedError(_response.error.body, _response.rawResponse);
|
|
329
|
-
case 429:
|
|
330
|
-
throw new Samsara.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
331
|
-
case 500:
|
|
332
|
-
throw new Samsara.InternalServerError(_response.error.body, _response.rawResponse);
|
|
333
|
-
case 501:
|
|
334
|
-
throw new Samsara.NotImplementedError(_response.error.body, _response.rawResponse);
|
|
335
|
-
case 502:
|
|
336
|
-
throw new Samsara.BadGatewayError(_response.error.body, _response.rawResponse);
|
|
337
|
-
case 503:
|
|
338
|
-
throw new Samsara.ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
339
|
-
case 504:
|
|
340
|
-
throw new Samsara.GatewayTimeoutError(_response.error.body, _response.rawResponse);
|
|
341
|
-
default:
|
|
342
|
-
throw new errors.SamsaraError({
|
|
343
|
-
statusCode: _response.error.statusCode,
|
|
344
|
-
body: _response.error.body,
|
|
345
|
-
rawResponse: _response.rawResponse,
|
|
346
|
-
});
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/preview/fleet/assets/device-recovery/{id}/recovered");
|
|
350
|
-
});
|
|
351
|
-
}
|
|
352
58
|
/**
|
|
353
59
|
* Creates a short-lived auth token for a driver.
|
|
354
60
|
*
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
export type { DeviceRecoveryMarkAssetMissingRequestBody } from "./DeviceRecoveryMarkAssetMissingRequestBody.js";
|
|
2
|
-
export { DeviceRecoveryRecoverAssetRequestBody } from "./DeviceRecoveryRecoverAssetRequestBody.js";
|
|
3
1
|
export type { DriversAuthTokenCreateDriverAuthTokenRequestBody } from "./DriversAuthTokenCreateDriverAuthTokenRequestBody.js";
|
|
4
|
-
export type { ListDeviceRecoveryMissingAssetsRequest } from "./ListDeviceRecoveryMissingAssetsRequest.js";
|
|
5
2
|
export type { LockVehicleRequest } from "./LockVehicleRequest.js";
|
|
6
3
|
export type { UnlockVehicleRequest } from "./UnlockVehicleRequest.js";
|
|
@@ -1,5 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DeviceRecoveryRecoverAssetRequestBody = void 0;
|
|
4
|
-
var DeviceRecoveryRecoverAssetRequestBody_js_1 = require("./DeviceRecoveryRecoverAssetRequestBody.js");
|
|
5
|
-
Object.defineProperty(exports, "DeviceRecoveryRecoverAssetRequestBody", { enumerable: true, get: function () { return DeviceRecoveryRecoverAssetRequestBody_js_1.DeviceRecoveryRecoverAssetRequestBody; } });
|
|
@@ -10,7 +10,7 @@ export interface MissingStateResponseBody {
|
|
|
10
10
|
/** A note associated with the missing asset. */
|
|
11
11
|
note?: string | undefined;
|
|
12
12
|
/** Users subscribed to location update notifications for this asset. */
|
|
13
|
-
notification_recipients?: Samsara.
|
|
13
|
+
notification_recipients?: Samsara.NotificationRecipientResponseResponseBody[] | undefined;
|
|
14
14
|
/** Timestamp when the asset was marked as missing, in milliseconds since epoch. */
|
|
15
15
|
updated_at_ms: number;
|
|
16
16
|
/** The ID of the user who marked the asset as missing. */
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A user subscribed to recovery state change notifications, including their name and email.
|
|
3
|
+
*/
|
|
4
|
+
export interface NotificationRecipientResponseResponseBody {
|
|
5
|
+
/** The email address of the user. */
|
|
6
|
+
email: string;
|
|
7
|
+
/** The display name of the user. */
|
|
8
|
+
name: string;
|
|
9
|
+
/** How the user is notified. */
|
|
10
|
+
notification_types: NotificationRecipientResponseResponseBody.NotificationTypes.Item[];
|
|
11
|
+
/** The ID of the user. */
|
|
12
|
+
user_id: number;
|
|
13
|
+
}
|
|
14
|
+
export declare namespace NotificationRecipientResponseResponseBody {
|
|
15
|
+
type NotificationTypes = NotificationTypes.Item[];
|
|
16
|
+
namespace NotificationTypes {
|
|
17
|
+
/** The type of notification. Valid values: `email` */
|
|
18
|
+
const Item: {
|
|
19
|
+
readonly Email: "email";
|
|
20
|
+
};
|
|
21
|
+
type Item = (typeof Item)[keyof typeof Item];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.NotificationRecipientResponseResponseBody = void 0;
|
|
5
|
+
var NotificationRecipientResponseResponseBody;
|
|
6
|
+
(function (NotificationRecipientResponseResponseBody) {
|
|
7
|
+
let NotificationTypes;
|
|
8
|
+
(function (NotificationTypes) {
|
|
9
|
+
/** The type of notification. Valid values: `email` */
|
|
10
|
+
NotificationTypes.Item = {
|
|
11
|
+
Email: "email",
|
|
12
|
+
};
|
|
13
|
+
})(NotificationTypes = NotificationRecipientResponseResponseBody.NotificationTypes || (NotificationRecipientResponseResponseBody.NotificationTypes = {}));
|
|
14
|
+
})(NotificationRecipientResponseResponseBody || (exports.NotificationRecipientResponseResponseBody = NotificationRecipientResponseResponseBody = {}));
|
|
@@ -10,7 +10,7 @@ export interface RecoveryStateResponseBody {
|
|
|
10
10
|
/** A note associated with the recovery. */
|
|
11
11
|
note?: string | undefined;
|
|
12
12
|
/** Users subscribed to location update notifications for this asset. */
|
|
13
|
-
notification_recipients?: Samsara.
|
|
13
|
+
notification_recipients?: Samsara.NotificationRecipientResponseResponseBody[] | undefined;
|
|
14
14
|
/** Photos associated with the recovery event. URLs are temporary and expire at url_expires_at_ms. */
|
|
15
15
|
recovery_photos?: Samsara.RecoveryPhotoResponseBody[] | undefined;
|
|
16
16
|
/** Timestamp when the recovery state was last updated, in milliseconds since epoch. */
|
|
@@ -12,4 +12,6 @@ export interface VendorObjectResponseBody {
|
|
|
12
12
|
id: string;
|
|
13
13
|
/** Description of services provided by the vendor. */
|
|
14
14
|
servicesProvided?: string | undefined;
|
|
15
|
+
/** The vendor's legacy vendor ID from the source system. Multiple vendor locations may share the same vendorId if they belong to the same parent company. */
|
|
16
|
+
vendorId?: string | undefined;
|
|
15
17
|
}
|
|
@@ -1592,7 +1592,7 @@ export * from "./MultipleChoiceFieldTypeMetaDataObjectResponseBody.js";
|
|
|
1592
1592
|
export * from "./MultipleChoiceValueObjectRequestBody.js";
|
|
1593
1593
|
export * from "./MultipleChoiceValueObjectResponseBody.js";
|
|
1594
1594
|
export * from "./NotificationRecipientRequestBody.js";
|
|
1595
|
-
export * from "./
|
|
1595
|
+
export * from "./NotificationRecipientResponseResponseBody.js";
|
|
1596
1596
|
export * from "./NumberDataPoint.js";
|
|
1597
1597
|
export * from "./NumberFieldTypeMetaDataObjectResponseBody.js";
|
|
1598
1598
|
export * from "./OperationalSettingsObjectRequestBody.js";
|
|
@@ -1608,7 +1608,7 @@ __exportStar(require("./MultipleChoiceFieldTypeMetaDataObjectResponseBody.js"),
|
|
|
1608
1608
|
__exportStar(require("./MultipleChoiceValueObjectRequestBody.js"), exports);
|
|
1609
1609
|
__exportStar(require("./MultipleChoiceValueObjectResponseBody.js"), exports);
|
|
1610
1610
|
__exportStar(require("./NotificationRecipientRequestBody.js"), exports);
|
|
1611
|
-
__exportStar(require("./
|
|
1611
|
+
__exportStar(require("./NotificationRecipientResponseResponseBody.js"), exports);
|
|
1612
1612
|
__exportStar(require("./NumberDataPoint.js"), exports);
|
|
1613
1613
|
__exportStar(require("./NumberFieldTypeMetaDataObjectResponseBody.js"), exports);
|
|
1614
1614
|
__exportStar(require("./OperationalSettingsObjectRequestBody.js"), exports);
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "
|
|
1
|
+
export declare const SDK_VERSION = "7.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": "7.0.0",
|
|
11
|
+
"User-Agent": "@samsarahq/samsara/7.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,97 @@ 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 all assets that are currently marked as missing for the organization.
|
|
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.ListDeviceRecoveryMissingAssetsRequest} 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.listDeviceRecoveryMissingAssets()
|
|
519
|
+
*/
|
|
520
|
+
listDeviceRecoveryMissingAssets(request?: Samsara.ListDeviceRecoveryMissingAssetsRequest, requestOptions?: BetaApIsClient.RequestOptions): core.HttpResponsePromise<Samsara.DeviceRecoveryListDeviceRecoveryMissingAssetsResponseBody>;
|
|
521
|
+
private __listDeviceRecoveryMissingAssets;
|
|
522
|
+
/**
|
|
523
|
+
* Mark an asset as missing. Optionally specify a note and notification recipients who will receive email updates.
|
|
524
|
+
*
|
|
525
|
+
* <b>Rate limit:</b> 100 requests/min (learn more about rate limits <a href="https://developers.samsara.com/docs/rate-limits" target="_blank">here</a>).
|
|
526
|
+
*
|
|
527
|
+
* To use this endpoint, select **Write 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>
|
|
528
|
+
*
|
|
529
|
+
*
|
|
530
|
+
* **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.
|
|
531
|
+
*
|
|
532
|
+
* @param {Samsara.DeviceRecoveryMarkAssetMissingRequestBody} request
|
|
533
|
+
* @param {BetaApIsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
534
|
+
*
|
|
535
|
+
* @throws {@link Samsara.UnauthorizedError}
|
|
536
|
+
* @throws {@link Samsara.NotFoundError}
|
|
537
|
+
* @throws {@link Samsara.MethodNotAllowedError}
|
|
538
|
+
* @throws {@link Samsara.TooManyRequestsError}
|
|
539
|
+
* @throws {@link Samsara.InternalServerError}
|
|
540
|
+
* @throws {@link Samsara.NotImplementedError}
|
|
541
|
+
* @throws {@link Samsara.BadGatewayError}
|
|
542
|
+
* @throws {@link Samsara.ServiceUnavailableError}
|
|
543
|
+
* @throws {@link Samsara.GatewayTimeoutError}
|
|
544
|
+
*
|
|
545
|
+
* @example
|
|
546
|
+
* await client.betaApIs.markAssetMissing({
|
|
547
|
+
* id: "id"
|
|
548
|
+
* })
|
|
549
|
+
*/
|
|
550
|
+
markAssetMissing(request: Samsara.DeviceRecoveryMarkAssetMissingRequestBody, requestOptions?: BetaApIsClient.RequestOptions): core.HttpResponsePromise<Samsara.DeviceRecoveryMarkAssetMissingResponseBody>;
|
|
551
|
+
private __markAssetMissing;
|
|
552
|
+
/**
|
|
553
|
+
* Mark a missing asset as recovered. Provide the recovery status, reason for being missing, and optional additional details.
|
|
554
|
+
*
|
|
555
|
+
* <b>Rate limit:</b> 100 requests/min (learn more about rate limits <a href="https://developers.samsara.com/docs/rate-limits" target="_blank">here</a>).
|
|
556
|
+
*
|
|
557
|
+
* To use this endpoint, select **Write 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>
|
|
558
|
+
*
|
|
559
|
+
*
|
|
560
|
+
* **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.
|
|
561
|
+
*
|
|
562
|
+
* @param {Samsara.DeviceRecoveryRecoverAssetRequestBody} request
|
|
563
|
+
* @param {BetaApIsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
564
|
+
*
|
|
565
|
+
* @throws {@link Samsara.UnauthorizedError}
|
|
566
|
+
* @throws {@link Samsara.NotFoundError}
|
|
567
|
+
* @throws {@link Samsara.MethodNotAllowedError}
|
|
568
|
+
* @throws {@link Samsara.TooManyRequestsError}
|
|
569
|
+
* @throws {@link Samsara.InternalServerError}
|
|
570
|
+
* @throws {@link Samsara.NotImplementedError}
|
|
571
|
+
* @throws {@link Samsara.BadGatewayError}
|
|
572
|
+
* @throws {@link Samsara.ServiceUnavailableError}
|
|
573
|
+
* @throws {@link Samsara.GatewayTimeoutError}
|
|
574
|
+
*
|
|
575
|
+
* @example
|
|
576
|
+
* await client.betaApIs.recoverAsset({
|
|
577
|
+
* id: "id",
|
|
578
|
+
* missing_reason: "MISPLACED",
|
|
579
|
+
* recovery_status: "YES",
|
|
580
|
+
* status: "RECOVERED"
|
|
581
|
+
* })
|
|
582
|
+
*/
|
|
583
|
+
recoverAsset(request: Samsara.DeviceRecoveryRecoverAssetRequestBody, requestOptions?: BetaApIsClient.RequestOptions): core.HttpResponsePromise<Samsara.DeviceRecoveryRecoverAssetResponseBody>;
|
|
584
|
+
private __recoverAsset;
|
|
494
585
|
/**
|
|
495
586
|
* Returns a paginated list of vehicles enrolled in the CARB CTC program with their latest compliance status. Results can be filtered by tag IDs and test status.
|
|
496
587
|
*
|