@samsarahq/samsara 11.5.0 → 11.6.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/Client.d.ts +3 -0
- package/dist/cjs/Client.js +45 -40
- package/dist/cjs/api/resources/betaApIs/client/Client.d.ts +1 -97
- package/dist/cjs/api/resources/betaApIs/client/Client.js +1 -287
- package/dist/cjs/api/resources/betaApIs/client/requests/index.d.ts +0 -3
- package/dist/cjs/api/resources/drivers/client/requests/CreateDriverRequest.d.ts +2 -0
- package/dist/cjs/api/resources/drivers/client/requests/UpdateDriverRequest.d.ts +2 -0
- package/dist/cjs/api/resources/index.d.ts +2 -0
- package/dist/cjs/api/resources/index.js +4 -2
- package/dist/cjs/api/resources/readings/client/Client.d.ts +109 -0
- package/dist/cjs/api/resources/readings/client/Client.js +345 -0
- package/dist/cjs/api/resources/readings/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/readings/client/index.js +17 -0
- package/dist/cjs/api/resources/readings/client/requests/index.d.ts +3 -0
- package/dist/cjs/api/resources/readings/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/readings/index.d.ts +1 -0
- package/dist/cjs/api/resources/readings/index.js +17 -0
- package/dist/cjs/api/types/Driver.d.ts +1 -0
- package/dist/cjs/api/types/DriverTrailerGroupTag.d.ts +11 -0
- package/dist/cjs/api/types/DriverTrailerGroupTag.js +3 -0
- package/dist/cjs/api/types/index.d.ts +1 -0
- package/dist/cjs/api/types/index.js +1 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/Client.d.mts +3 -0
- package/dist/esm/Client.mjs +5 -0
- package/dist/esm/api/resources/betaApIs/client/Client.d.mts +1 -97
- package/dist/esm/api/resources/betaApIs/client/Client.mjs +1 -287
- package/dist/esm/api/resources/betaApIs/client/requests/index.d.mts +0 -3
- package/dist/esm/api/resources/drivers/client/requests/CreateDriverRequest.d.mts +2 -0
- package/dist/esm/api/resources/drivers/client/requests/UpdateDriverRequest.d.mts +2 -0
- package/dist/esm/api/resources/index.d.mts +2 -0
- package/dist/esm/api/resources/index.mjs +2 -0
- package/dist/esm/api/resources/readings/client/Client.d.mts +109 -0
- package/dist/esm/api/resources/readings/client/Client.mjs +308 -0
- package/dist/esm/api/resources/readings/client/index.d.mts +1 -0
- package/dist/esm/api/resources/readings/client/index.mjs +1 -0
- package/dist/esm/api/resources/readings/client/requests/index.d.mts +3 -0
- package/dist/esm/api/resources/readings/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/readings/index.d.mts +1 -0
- package/dist/esm/api/resources/readings/index.mjs +1 -0
- package/dist/esm/api/types/Driver.d.mts +1 -0
- package/dist/esm/api/types/DriverTrailerGroupTag.d.mts +11 -0
- package/dist/esm/api/types/DriverTrailerGroupTag.mjs +2 -0
- package/dist/esm/api/types/index.d.mts +1 -0
- package/dist/esm/api/types/index.mjs +1 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +224 -223
- /package/dist/cjs/api/resources/{betaApIs → readings}/client/requests/GetReadingsHistoryRequest.d.ts +0 -0
- /package/dist/cjs/api/resources/{betaApIs → readings}/client/requests/GetReadingsHistoryRequest.js +0 -0
- /package/dist/cjs/api/resources/{betaApIs → readings}/client/requests/GetReadingsSnapshotRequest.d.ts +0 -0
- /package/dist/cjs/api/resources/{betaApIs → readings}/client/requests/GetReadingsSnapshotRequest.js +0 -0
- /package/dist/cjs/api/resources/{betaApIs → readings}/client/requests/ListReadingsDefinitionsRequest.d.ts +0 -0
- /package/dist/cjs/api/resources/{betaApIs → readings}/client/requests/ListReadingsDefinitionsRequest.js +0 -0
- /package/dist/esm/api/resources/{betaApIs → readings}/client/requests/GetReadingsHistoryRequest.d.mts +0 -0
- /package/dist/esm/api/resources/{betaApIs → readings}/client/requests/GetReadingsHistoryRequest.mjs +0 -0
- /package/dist/esm/api/resources/{betaApIs → readings}/client/requests/GetReadingsSnapshotRequest.d.mts +0 -0
- /package/dist/esm/api/resources/{betaApIs → readings}/client/requests/GetReadingsSnapshotRequest.mjs +0 -0
- /package/dist/esm/api/resources/{betaApIs → readings}/client/requests/ListReadingsDefinitionsRequest.d.mts +0 -0
- /package/dist/esm/api/resources/{betaApIs → readings}/client/requests/ListReadingsDefinitionsRequest.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": "11.
|
|
48
|
-
"User-Agent": "@samsarahq/samsara/11.
|
|
47
|
+
"X-Fern-SDK-Version": "11.6.0",
|
|
48
|
+
"User-Agent": "@samsarahq/samsara/11.6.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",
|
package/dist/cjs/Client.d.ts
CHANGED
|
@@ -34,6 +34,7 @@ import { MessagesClient } from "./api/resources/messages/client/Client.js";
|
|
|
34
34
|
import { OrganizationInfoClient } from "./api/resources/organizationInfo/client/Client.js";
|
|
35
35
|
import { PlansClient } from "./api/resources/plans/client/Client.js";
|
|
36
36
|
import { PreviewApIsClient } from "./api/resources/previewApIs/client/Client.js";
|
|
37
|
+
import { ReadingsClient } from "./api/resources/readings/client/Client.js";
|
|
37
38
|
import { RouteEventsClient } from "./api/resources/routeEvents/client/Client.js";
|
|
38
39
|
import { RoutesClient } from "./api/resources/routes/client/Client.js";
|
|
39
40
|
import { SafetyClient } from "./api/resources/safety/client/Client.js";
|
|
@@ -104,6 +105,7 @@ export declare class SamsaraClient {
|
|
|
104
105
|
protected _workOrders: WorkOrdersClient | undefined;
|
|
105
106
|
protected _organizationInfo: OrganizationInfoClient | undefined;
|
|
106
107
|
protected _previewApIs: PreviewApIsClient | undefined;
|
|
108
|
+
protected _readings: ReadingsClient | undefined;
|
|
107
109
|
protected _routeEvents: RouteEventsClient | undefined;
|
|
108
110
|
protected _safety: SafetyClient | undefined;
|
|
109
111
|
protected _safetyScores: SafetyScoresClient | undefined;
|
|
@@ -161,6 +163,7 @@ export declare class SamsaraClient {
|
|
|
161
163
|
get workOrders(): WorkOrdersClient;
|
|
162
164
|
get organizationInfo(): OrganizationInfoClient;
|
|
163
165
|
get previewApIs(): PreviewApIsClient;
|
|
166
|
+
get readings(): ReadingsClient;
|
|
164
167
|
get routeEvents(): RouteEventsClient;
|
|
165
168
|
get safety(): SafetyClient;
|
|
166
169
|
get safetyScores(): SafetyScoresClient;
|
package/dist/cjs/Client.js
CHANGED
|
@@ -38,26 +38,27 @@ const Client_js_33 = require("./api/resources/messages/client/Client.js");
|
|
|
38
38
|
const Client_js_34 = require("./api/resources/organizationInfo/client/Client.js");
|
|
39
39
|
const Client_js_35 = require("./api/resources/plans/client/Client.js");
|
|
40
40
|
const Client_js_36 = require("./api/resources/previewApIs/client/Client.js");
|
|
41
|
-
const Client_js_37 = require("./api/resources/
|
|
42
|
-
const Client_js_38 = require("./api/resources/
|
|
43
|
-
const Client_js_39 = require("./api/resources/
|
|
44
|
-
const Client_js_40 = require("./api/resources/
|
|
45
|
-
const Client_js_41 = require("./api/resources/
|
|
46
|
-
const Client_js_42 = require("./api/resources/
|
|
47
|
-
const Client_js_43 = require("./api/resources/
|
|
48
|
-
const Client_js_44 = require("./api/resources/
|
|
49
|
-
const Client_js_45 = require("./api/resources/
|
|
50
|
-
const Client_js_46 = require("./api/resources/
|
|
51
|
-
const Client_js_47 = require("./api/resources/
|
|
52
|
-
const Client_js_48 = require("./api/resources/
|
|
53
|
-
const Client_js_49 = require("./api/resources/
|
|
54
|
-
const Client_js_50 = require("./api/resources/
|
|
55
|
-
const Client_js_51 = require("./api/resources/
|
|
56
|
-
const Client_js_52 = require("./api/resources/
|
|
57
|
-
const Client_js_53 = require("./api/resources/
|
|
58
|
-
const Client_js_54 = require("./api/resources/
|
|
59
|
-
const Client_js_55 = require("./api/resources/
|
|
60
|
-
const Client_js_56 = require("./api/resources/
|
|
41
|
+
const Client_js_37 = require("./api/resources/readings/client/Client.js");
|
|
42
|
+
const Client_js_38 = require("./api/resources/routeEvents/client/Client.js");
|
|
43
|
+
const Client_js_39 = require("./api/resources/routes/client/Client.js");
|
|
44
|
+
const Client_js_40 = require("./api/resources/safety/client/Client.js");
|
|
45
|
+
const Client_js_41 = require("./api/resources/safetyScores/client/Client.js");
|
|
46
|
+
const Client_js_42 = require("./api/resources/sensors/client/Client.js");
|
|
47
|
+
const Client_js_43 = require("./api/resources/settings/client/Client.js");
|
|
48
|
+
const Client_js_44 = require("./api/resources/speedingIntervals/client/Client.js");
|
|
49
|
+
const Client_js_45 = require("./api/resources/tachographEuOnly/client/Client.js");
|
|
50
|
+
const Client_js_46 = require("./api/resources/tags/client/Client.js");
|
|
51
|
+
const Client_js_47 = require("./api/resources/trailerAssignments/client/Client.js");
|
|
52
|
+
const Client_js_48 = require("./api/resources/trailers/client/Client.js");
|
|
53
|
+
const Client_js_49 = require("./api/resources/trainingAssignments/client/Client.js");
|
|
54
|
+
const Client_js_50 = require("./api/resources/trainingCourses/client/Client.js");
|
|
55
|
+
const Client_js_51 = require("./api/resources/trips/client/Client.js");
|
|
56
|
+
const Client_js_52 = require("./api/resources/users/client/Client.js");
|
|
57
|
+
const Client_js_53 = require("./api/resources/vehicleLocations/client/Client.js");
|
|
58
|
+
const Client_js_54 = require("./api/resources/vehicleStats/client/Client.js");
|
|
59
|
+
const Client_js_55 = require("./api/resources/vehicles/client/Client.js");
|
|
60
|
+
const Client_js_56 = require("./api/resources/webhooks/client/Client.js");
|
|
61
|
+
const Client_js_57 = require("./api/resources/workOrders/client/Client.js");
|
|
61
62
|
const BaseClient_js_1 = require("./BaseClient.js");
|
|
62
63
|
class SamsaraClient {
|
|
63
64
|
constructor(options = {}) {
|
|
@@ -145,7 +146,7 @@ class SamsaraClient {
|
|
|
145
146
|
}
|
|
146
147
|
get tachographEuOnly() {
|
|
147
148
|
var _a;
|
|
148
|
-
return ((_a = this._tachographEuOnly) !== null && _a !== void 0 ? _a : (this._tachographEuOnly = new
|
|
149
|
+
return ((_a = this._tachographEuOnly) !== null && _a !== void 0 ? _a : (this._tachographEuOnly = new Client_js_45.TachographEuOnlyClient(this._options)));
|
|
149
150
|
}
|
|
150
151
|
get equipment() {
|
|
151
152
|
var _a;
|
|
@@ -161,27 +162,27 @@ class SamsaraClient {
|
|
|
161
162
|
}
|
|
162
163
|
get routes() {
|
|
163
164
|
var _a;
|
|
164
|
-
return ((_a = this._routes) !== null && _a !== void 0 ? _a : (this._routes = new
|
|
165
|
+
return ((_a = this._routes) !== null && _a !== void 0 ? _a : (this._routes = new Client_js_39.RoutesClient(this._options)));
|
|
165
166
|
}
|
|
166
167
|
get settings() {
|
|
167
168
|
var _a;
|
|
168
|
-
return ((_a = this._settings) !== null && _a !== void 0 ? _a : (this._settings = new
|
|
169
|
+
return ((_a = this._settings) !== null && _a !== void 0 ? _a : (this._settings = new Client_js_43.SettingsClient(this._options)));
|
|
169
170
|
}
|
|
170
171
|
get trailers() {
|
|
171
172
|
var _a;
|
|
172
|
-
return ((_a = this._trailers) !== null && _a !== void 0 ? _a : (this._trailers = new
|
|
173
|
+
return ((_a = this._trailers) !== null && _a !== void 0 ? _a : (this._trailers = new Client_js_48.TrailersClient(this._options)));
|
|
173
174
|
}
|
|
174
175
|
get vehicles() {
|
|
175
176
|
var _a;
|
|
176
|
-
return ((_a = this._vehicles) !== null && _a !== void 0 ? _a : (this._vehicles = new
|
|
177
|
+
return ((_a = this._vehicles) !== null && _a !== void 0 ? _a : (this._vehicles = new Client_js_55.VehiclesClient(this._options)));
|
|
177
178
|
}
|
|
178
179
|
get vehicleLocations() {
|
|
179
180
|
var _a;
|
|
180
|
-
return ((_a = this._vehicleLocations) !== null && _a !== void 0 ? _a : (this._vehicleLocations = new
|
|
181
|
+
return ((_a = this._vehicleLocations) !== null && _a !== void 0 ? _a : (this._vehicleLocations = new Client_js_53.VehicleLocationsClient(this._options)));
|
|
181
182
|
}
|
|
182
183
|
get vehicleStats() {
|
|
183
184
|
var _a;
|
|
184
|
-
return ((_a = this._vehicleStats) !== null && _a !== void 0 ? _a : (this._vehicleStats = new
|
|
185
|
+
return ((_a = this._vehicleStats) !== null && _a !== void 0 ? _a : (this._vehicleStats = new Client_js_54.VehicleStatsClient(this._options)));
|
|
185
186
|
}
|
|
186
187
|
get forms() {
|
|
187
188
|
var _a;
|
|
@@ -217,7 +218,7 @@ class SamsaraClient {
|
|
|
217
218
|
}
|
|
218
219
|
get workOrders() {
|
|
219
220
|
var _a;
|
|
220
|
-
return ((_a = this._workOrders) !== null && _a !== void 0 ? _a : (this._workOrders = new
|
|
221
|
+
return ((_a = this._workOrders) !== null && _a !== void 0 ? _a : (this._workOrders = new Client_js_57.WorkOrdersClient(this._options)));
|
|
221
222
|
}
|
|
222
223
|
get organizationInfo() {
|
|
223
224
|
var _a;
|
|
@@ -227,41 +228,45 @@ class SamsaraClient {
|
|
|
227
228
|
var _a;
|
|
228
229
|
return ((_a = this._previewApIs) !== null && _a !== void 0 ? _a : (this._previewApIs = new Client_js_36.PreviewApIsClient(this._options)));
|
|
229
230
|
}
|
|
231
|
+
get readings() {
|
|
232
|
+
var _a;
|
|
233
|
+
return ((_a = this._readings) !== null && _a !== void 0 ? _a : (this._readings = new Client_js_37.ReadingsClient(this._options)));
|
|
234
|
+
}
|
|
230
235
|
get routeEvents() {
|
|
231
236
|
var _a;
|
|
232
|
-
return ((_a = this._routeEvents) !== null && _a !== void 0 ? _a : (this._routeEvents = new
|
|
237
|
+
return ((_a = this._routeEvents) !== null && _a !== void 0 ? _a : (this._routeEvents = new Client_js_38.RouteEventsClient(this._options)));
|
|
233
238
|
}
|
|
234
239
|
get safety() {
|
|
235
240
|
var _a;
|
|
236
|
-
return ((_a = this._safety) !== null && _a !== void 0 ? _a : (this._safety = new
|
|
241
|
+
return ((_a = this._safety) !== null && _a !== void 0 ? _a : (this._safety = new Client_js_40.SafetyClient(this._options)));
|
|
237
242
|
}
|
|
238
243
|
get safetyScores() {
|
|
239
244
|
var _a;
|
|
240
|
-
return ((_a = this._safetyScores) !== null && _a !== void 0 ? _a : (this._safetyScores = new
|
|
245
|
+
return ((_a = this._safetyScores) !== null && _a !== void 0 ? _a : (this._safetyScores = new Client_js_41.SafetyScoresClient(this._options)));
|
|
241
246
|
}
|
|
242
247
|
get speedingIntervals() {
|
|
243
248
|
var _a;
|
|
244
|
-
return ((_a = this._speedingIntervals) !== null && _a !== void 0 ? _a : (this._speedingIntervals = new
|
|
249
|
+
return ((_a = this._speedingIntervals) !== null && _a !== void 0 ? _a : (this._speedingIntervals = new Client_js_44.SpeedingIntervalsClient(this._options)));
|
|
245
250
|
}
|
|
246
251
|
get tags() {
|
|
247
252
|
var _a;
|
|
248
|
-
return ((_a = this._tags) !== null && _a !== void 0 ? _a : (this._tags = new
|
|
253
|
+
return ((_a = this._tags) !== null && _a !== void 0 ? _a : (this._tags = new Client_js_46.TagsClient(this._options)));
|
|
249
254
|
}
|
|
250
255
|
get trainingAssignments() {
|
|
251
256
|
var _a;
|
|
252
|
-
return ((_a = this._trainingAssignments) !== null && _a !== void 0 ? _a : (this._trainingAssignments = new
|
|
257
|
+
return ((_a = this._trainingAssignments) !== null && _a !== void 0 ? _a : (this._trainingAssignments = new Client_js_49.TrainingAssignmentsClient(this._options)));
|
|
253
258
|
}
|
|
254
259
|
get trainingCourses() {
|
|
255
260
|
var _a;
|
|
256
|
-
return ((_a = this._trainingCourses) !== null && _a !== void 0 ? _a : (this._trainingCourses = new
|
|
261
|
+
return ((_a = this._trainingCourses) !== null && _a !== void 0 ? _a : (this._trainingCourses = new Client_js_50.TrainingCoursesClient(this._options)));
|
|
257
262
|
}
|
|
258
263
|
get trips() {
|
|
259
264
|
var _a;
|
|
260
|
-
return ((_a = this._trips) !== null && _a !== void 0 ? _a : (this._trips = new
|
|
265
|
+
return ((_a = this._trips) !== null && _a !== void 0 ? _a : (this._trips = new Client_js_51.TripsClient(this._options)));
|
|
261
266
|
}
|
|
262
267
|
get users() {
|
|
263
268
|
var _a;
|
|
264
|
-
return ((_a = this._users) !== null && _a !== void 0 ? _a : (this._users = new
|
|
269
|
+
return ((_a = this._users) !== null && _a !== void 0 ? _a : (this._users = new Client_js_52.UsersClient(this._options)));
|
|
265
270
|
}
|
|
266
271
|
get legacy() {
|
|
267
272
|
var _a;
|
|
@@ -273,15 +278,15 @@ class SamsaraClient {
|
|
|
273
278
|
}
|
|
274
279
|
get trailerAssignments() {
|
|
275
280
|
var _a;
|
|
276
|
-
return ((_a = this._trailerAssignments) !== null && _a !== void 0 ? _a : (this._trailerAssignments = new
|
|
281
|
+
return ((_a = this._trailerAssignments) !== null && _a !== void 0 ? _a : (this._trailerAssignments = new Client_js_47.TrailerAssignmentsClient(this._options)));
|
|
277
282
|
}
|
|
278
283
|
get sensors() {
|
|
279
284
|
var _a;
|
|
280
|
-
return ((_a = this._sensors) !== null && _a !== void 0 ? _a : (this._sensors = new
|
|
285
|
+
return ((_a = this._sensors) !== null && _a !== void 0 ? _a : (this._sensors = new Client_js_42.SensorsClient(this._options)));
|
|
281
286
|
}
|
|
282
287
|
get webhooks() {
|
|
283
288
|
var _a;
|
|
284
|
-
return ((_a = this._webhooks) !== null && _a !== void 0 ? _a : (this._webhooks = new
|
|
289
|
+
return ((_a = this._webhooks) !== null && _a !== void 0 ? _a : (this._webhooks = new Client_js_56.WebhooksClient(this._options)));
|
|
285
290
|
}
|
|
286
291
|
get fleet() {
|
|
287
292
|
var _a;
|
|
@@ -1366,7 +1366,7 @@ export declare class BetaApIsClient {
|
|
|
1366
1366
|
*
|
|
1367
1367
|
* <b>Rate limit:</b> 10 requests/sec (learn more about rate limits <a href="https://developers.samsara.com/docs/rate-limits" target="_blank">here</a>).
|
|
1368
1368
|
*
|
|
1369
|
-
* To use this endpoint, select **Write Readings** under the
|
|
1369
|
+
* To use this endpoint, select **Write Readings** under the Readings 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>
|
|
1370
1370
|
*
|
|
1371
1371
|
*
|
|
1372
1372
|
* **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.
|
|
@@ -1398,102 +1398,6 @@ export declare class BetaApIsClient {
|
|
|
1398
1398
|
*/
|
|
1399
1399
|
postReadings(request: Samsara.ReadingsPostReadingsRequestBody, requestOptions?: BetaApIsClient.RequestOptions): core.HttpResponsePromise<void>;
|
|
1400
1400
|
private __postReadings;
|
|
1401
|
-
/**
|
|
1402
|
-
* An introspection endpoint for discovering the set of readings including their name, description, data type, unit, and other metadata.
|
|
1403
|
-
*
|
|
1404
|
-
* Related guide: [Readings](https://developers.samsara.com/docs/readings).
|
|
1405
|
-
*
|
|
1406
|
-
* <b>Rate limit:</b> 10 requests/sec (learn more about rate limits <a href="https://developers.samsara.com/docs/rate-limits" target="_blank">here</a>).
|
|
1407
|
-
*
|
|
1408
|
-
* To use this endpoint, select **Read Readings** under the Closed Beta 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>
|
|
1409
|
-
*
|
|
1410
|
-
*
|
|
1411
|
-
* **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.
|
|
1412
|
-
*
|
|
1413
|
-
* @param {Samsara.ListReadingsDefinitionsRequest} request
|
|
1414
|
-
* @param {BetaApIsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
1415
|
-
*
|
|
1416
|
-
* @throws {@link Samsara.UnauthorizedError}
|
|
1417
|
-
* @throws {@link Samsara.NotFoundError}
|
|
1418
|
-
* @throws {@link Samsara.MethodNotAllowedError}
|
|
1419
|
-
* @throws {@link Samsara.TooManyRequestsError}
|
|
1420
|
-
* @throws {@link Samsara.InternalServerError}
|
|
1421
|
-
* @throws {@link Samsara.NotImplementedError}
|
|
1422
|
-
* @throws {@link Samsara.BadGatewayError}
|
|
1423
|
-
* @throws {@link Samsara.ServiceUnavailableError}
|
|
1424
|
-
* @throws {@link Samsara.GatewayTimeoutError}
|
|
1425
|
-
*
|
|
1426
|
-
* @example
|
|
1427
|
-
* await client.betaApIs.listReadingsDefinitions()
|
|
1428
|
-
*/
|
|
1429
|
-
listReadingsDefinitions(request?: Samsara.ListReadingsDefinitionsRequest, requestOptions?: BetaApIsClient.RequestOptions): core.HttpResponsePromise<Samsara.ReadingsListReadingsDefinitionsResponseBody>;
|
|
1430
|
-
private __listReadingsDefinitions;
|
|
1431
|
-
/**
|
|
1432
|
-
* Get the values of a reading for a set of entities within the specified time range. Returns a paginated response with data for the specified resource IDs where startTime <= happenedAtTime < endTime. If endTime is not set, the time of the request is used as the endTime.
|
|
1433
|
-
*
|
|
1434
|
-
* Related guide: [Readings](https://developers.samsara.com/docs/readings).
|
|
1435
|
-
*
|
|
1436
|
-
* <b>Rate limit:</b> 10 requests/sec (learn more about rate limits <a href="https://developers.samsara.com/docs/rate-limits" target="_blank">here</a>).
|
|
1437
|
-
*
|
|
1438
|
-
* To use this endpoint, select **Read Readings** under the Closed Beta 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>
|
|
1439
|
-
*
|
|
1440
|
-
*
|
|
1441
|
-
* **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.
|
|
1442
|
-
*
|
|
1443
|
-
* @param {Samsara.GetReadingsHistoryRequest} request
|
|
1444
|
-
* @param {BetaApIsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
1445
|
-
*
|
|
1446
|
-
* @throws {@link Samsara.UnauthorizedError}
|
|
1447
|
-
* @throws {@link Samsara.NotFoundError}
|
|
1448
|
-
* @throws {@link Samsara.MethodNotAllowedError}
|
|
1449
|
-
* @throws {@link Samsara.TooManyRequestsError}
|
|
1450
|
-
* @throws {@link Samsara.InternalServerError}
|
|
1451
|
-
* @throws {@link Samsara.NotImplementedError}
|
|
1452
|
-
* @throws {@link Samsara.BadGatewayError}
|
|
1453
|
-
* @throws {@link Samsara.ServiceUnavailableError}
|
|
1454
|
-
* @throws {@link Samsara.GatewayTimeoutError}
|
|
1455
|
-
*
|
|
1456
|
-
* @example
|
|
1457
|
-
* await client.betaApIs.getReadingsHistory({
|
|
1458
|
-
* readingId: "readingId",
|
|
1459
|
-
* entityType: "entityType"
|
|
1460
|
-
* })
|
|
1461
|
-
*/
|
|
1462
|
-
getReadingsHistory(request: Samsara.GetReadingsHistoryRequest, requestOptions?: BetaApIsClient.RequestOptions): core.HttpResponsePromise<Samsara.ReadingsGetReadingsHistoryResponseBody>;
|
|
1463
|
-
private __getReadingsHistory;
|
|
1464
|
-
/**
|
|
1465
|
-
* An endpoint to get the last value of a reading for a set of entities at the specified time.
|
|
1466
|
-
*
|
|
1467
|
-
* Related guide: [Readings](https://developers.samsara.com/docs/readings).
|
|
1468
|
-
*
|
|
1469
|
-
* <b>Rate limit:</b> 10 requests/sec (learn more about rate limits <a href="https://developers.samsara.com/docs/rate-limits" target="_blank">here</a>).
|
|
1470
|
-
*
|
|
1471
|
-
* To use this endpoint, select **Read Readings** under the Closed Beta 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>
|
|
1472
|
-
*
|
|
1473
|
-
*
|
|
1474
|
-
* **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.
|
|
1475
|
-
*
|
|
1476
|
-
* @param {Samsara.GetReadingsSnapshotRequest} request
|
|
1477
|
-
* @param {BetaApIsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
1478
|
-
*
|
|
1479
|
-
* @throws {@link Samsara.UnauthorizedError}
|
|
1480
|
-
* @throws {@link Samsara.NotFoundError}
|
|
1481
|
-
* @throws {@link Samsara.MethodNotAllowedError}
|
|
1482
|
-
* @throws {@link Samsara.TooManyRequestsError}
|
|
1483
|
-
* @throws {@link Samsara.InternalServerError}
|
|
1484
|
-
* @throws {@link Samsara.NotImplementedError}
|
|
1485
|
-
* @throws {@link Samsara.BadGatewayError}
|
|
1486
|
-
* @throws {@link Samsara.ServiceUnavailableError}
|
|
1487
|
-
* @throws {@link Samsara.GatewayTimeoutError}
|
|
1488
|
-
*
|
|
1489
|
-
* @example
|
|
1490
|
-
* await client.betaApIs.getReadingsSnapshot({
|
|
1491
|
-
* readingIds: "readingIds",
|
|
1492
|
-
* entityType: "entityType"
|
|
1493
|
-
* })
|
|
1494
|
-
*/
|
|
1495
|
-
getReadingsSnapshot(request: Samsara.GetReadingsSnapshotRequest, requestOptions?: BetaApIsClient.RequestOptions): core.HttpResponsePromise<Samsara.ReadingsGetReadingsSnapshotResponseBody>;
|
|
1496
|
-
private __getReadingsSnapshot;
|
|
1497
1401
|
/**
|
|
1498
1402
|
* Get report configs created in the organization.
|
|
1499
1403
|
*
|
|
@@ -3987,7 +3987,7 @@ class BetaApIsClient {
|
|
|
3987
3987
|
*
|
|
3988
3988
|
* <b>Rate limit:</b> 10 requests/sec (learn more about rate limits <a href="https://developers.samsara.com/docs/rate-limits" target="_blank">here</a>).
|
|
3989
3989
|
*
|
|
3990
|
-
* To use this endpoint, select **Write Readings** under the
|
|
3990
|
+
* To use this endpoint, select **Write Readings** under the Readings 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>
|
|
3991
3991
|
*
|
|
3992
3992
|
*
|
|
3993
3993
|
* **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.
|
|
@@ -4073,292 +4073,6 @@ class BetaApIsClient {
|
|
|
4073
4073
|
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/readings");
|
|
4074
4074
|
});
|
|
4075
4075
|
}
|
|
4076
|
-
/**
|
|
4077
|
-
* An introspection endpoint for discovering the set of readings including their name, description, data type, unit, and other metadata.
|
|
4078
|
-
*
|
|
4079
|
-
* Related guide: [Readings](https://developers.samsara.com/docs/readings).
|
|
4080
|
-
*
|
|
4081
|
-
* <b>Rate limit:</b> 10 requests/sec (learn more about rate limits <a href="https://developers.samsara.com/docs/rate-limits" target="_blank">here</a>).
|
|
4082
|
-
*
|
|
4083
|
-
* To use this endpoint, select **Read Readings** under the Closed Beta 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>
|
|
4084
|
-
*
|
|
4085
|
-
*
|
|
4086
|
-
* **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.
|
|
4087
|
-
*
|
|
4088
|
-
* @param {Samsara.ListReadingsDefinitionsRequest} request
|
|
4089
|
-
* @param {BetaApIsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
4090
|
-
*
|
|
4091
|
-
* @throws {@link Samsara.UnauthorizedError}
|
|
4092
|
-
* @throws {@link Samsara.NotFoundError}
|
|
4093
|
-
* @throws {@link Samsara.MethodNotAllowedError}
|
|
4094
|
-
* @throws {@link Samsara.TooManyRequestsError}
|
|
4095
|
-
* @throws {@link Samsara.InternalServerError}
|
|
4096
|
-
* @throws {@link Samsara.NotImplementedError}
|
|
4097
|
-
* @throws {@link Samsara.BadGatewayError}
|
|
4098
|
-
* @throws {@link Samsara.ServiceUnavailableError}
|
|
4099
|
-
* @throws {@link Samsara.GatewayTimeoutError}
|
|
4100
|
-
*
|
|
4101
|
-
* @example
|
|
4102
|
-
* await client.betaApIs.listReadingsDefinitions()
|
|
4103
|
-
*/
|
|
4104
|
-
listReadingsDefinitions(request = {}, requestOptions) {
|
|
4105
|
-
return core.HttpResponsePromise.fromPromise(this.__listReadingsDefinitions(request, requestOptions));
|
|
4106
|
-
}
|
|
4107
|
-
__listReadingsDefinitions() {
|
|
4108
|
-
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
4109
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
4110
|
-
const { after, ids, entityTypes } = request;
|
|
4111
|
-
const _queryParams = {
|
|
4112
|
-
after,
|
|
4113
|
-
ids,
|
|
4114
|
-
entityTypes,
|
|
4115
|
-
};
|
|
4116
|
-
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
4117
|
-
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);
|
|
4118
|
-
const _response = yield core.fetcher({
|
|
4119
|
-
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, "readings/definitions"),
|
|
4120
|
-
method: "GET",
|
|
4121
|
-
headers: _headers,
|
|
4122
|
-
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
4123
|
-
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,
|
|
4124
|
-
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,
|
|
4125
|
-
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
4126
|
-
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
4127
|
-
logging: this._options.logging,
|
|
4128
|
-
});
|
|
4129
|
-
if (_response.ok) {
|
|
4130
|
-
return {
|
|
4131
|
-
data: _response.body,
|
|
4132
|
-
rawResponse: _response.rawResponse,
|
|
4133
|
-
};
|
|
4134
|
-
}
|
|
4135
|
-
if (_response.error.reason === "status-code") {
|
|
4136
|
-
switch (_response.error.statusCode) {
|
|
4137
|
-
case 401:
|
|
4138
|
-
throw new Samsara.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
4139
|
-
case 404:
|
|
4140
|
-
throw new Samsara.NotFoundError(_response.error.body, _response.rawResponse);
|
|
4141
|
-
case 405:
|
|
4142
|
-
throw new Samsara.MethodNotAllowedError(_response.error.body, _response.rawResponse);
|
|
4143
|
-
case 429:
|
|
4144
|
-
throw new Samsara.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
4145
|
-
case 500:
|
|
4146
|
-
throw new Samsara.InternalServerError(_response.error.body, _response.rawResponse);
|
|
4147
|
-
case 501:
|
|
4148
|
-
throw new Samsara.NotImplementedError(_response.error.body, _response.rawResponse);
|
|
4149
|
-
case 502:
|
|
4150
|
-
throw new Samsara.BadGatewayError(_response.error.body, _response.rawResponse);
|
|
4151
|
-
case 503:
|
|
4152
|
-
throw new Samsara.ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
4153
|
-
case 504:
|
|
4154
|
-
throw new Samsara.GatewayTimeoutError(_response.error.body, _response.rawResponse);
|
|
4155
|
-
default:
|
|
4156
|
-
throw new errors.SamsaraError({
|
|
4157
|
-
statusCode: _response.error.statusCode,
|
|
4158
|
-
body: _response.error.body,
|
|
4159
|
-
rawResponse: _response.rawResponse,
|
|
4160
|
-
});
|
|
4161
|
-
}
|
|
4162
|
-
}
|
|
4163
|
-
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/readings/definitions");
|
|
4164
|
-
});
|
|
4165
|
-
}
|
|
4166
|
-
/**
|
|
4167
|
-
* Get the values of a reading for a set of entities within the specified time range. Returns a paginated response with data for the specified resource IDs where startTime <= happenedAtTime < endTime. If endTime is not set, the time of the request is used as the endTime.
|
|
4168
|
-
*
|
|
4169
|
-
* Related guide: [Readings](https://developers.samsara.com/docs/readings).
|
|
4170
|
-
*
|
|
4171
|
-
* <b>Rate limit:</b> 10 requests/sec (learn more about rate limits <a href="https://developers.samsara.com/docs/rate-limits" target="_blank">here</a>).
|
|
4172
|
-
*
|
|
4173
|
-
* To use this endpoint, select **Read Readings** under the Closed Beta 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>
|
|
4174
|
-
*
|
|
4175
|
-
*
|
|
4176
|
-
* **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.
|
|
4177
|
-
*
|
|
4178
|
-
* @param {Samsara.GetReadingsHistoryRequest} request
|
|
4179
|
-
* @param {BetaApIsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
4180
|
-
*
|
|
4181
|
-
* @throws {@link Samsara.UnauthorizedError}
|
|
4182
|
-
* @throws {@link Samsara.NotFoundError}
|
|
4183
|
-
* @throws {@link Samsara.MethodNotAllowedError}
|
|
4184
|
-
* @throws {@link Samsara.TooManyRequestsError}
|
|
4185
|
-
* @throws {@link Samsara.InternalServerError}
|
|
4186
|
-
* @throws {@link Samsara.NotImplementedError}
|
|
4187
|
-
* @throws {@link Samsara.BadGatewayError}
|
|
4188
|
-
* @throws {@link Samsara.ServiceUnavailableError}
|
|
4189
|
-
* @throws {@link Samsara.GatewayTimeoutError}
|
|
4190
|
-
*
|
|
4191
|
-
* @example
|
|
4192
|
-
* await client.betaApIs.getReadingsHistory({
|
|
4193
|
-
* readingId: "readingId",
|
|
4194
|
-
* entityType: "entityType"
|
|
4195
|
-
* })
|
|
4196
|
-
*/
|
|
4197
|
-
getReadingsHistory(request, requestOptions) {
|
|
4198
|
-
return core.HttpResponsePromise.fromPromise(this.__getReadingsHistory(request, requestOptions));
|
|
4199
|
-
}
|
|
4200
|
-
__getReadingsHistory(request, requestOptions) {
|
|
4201
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
4202
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
4203
|
-
const { after, readingId, entityIds, entityType, externalIds, startTime, endTime, feed, includeExternalIds } = request;
|
|
4204
|
-
const _queryParams = {
|
|
4205
|
-
after,
|
|
4206
|
-
readingId,
|
|
4207
|
-
entityIds,
|
|
4208
|
-
entityType,
|
|
4209
|
-
externalIds,
|
|
4210
|
-
startTime,
|
|
4211
|
-
endTime,
|
|
4212
|
-
feed,
|
|
4213
|
-
includeExternalIds,
|
|
4214
|
-
};
|
|
4215
|
-
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
4216
|
-
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);
|
|
4217
|
-
const _response = yield core.fetcher({
|
|
4218
|
-
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, "readings/history"),
|
|
4219
|
-
method: "GET",
|
|
4220
|
-
headers: _headers,
|
|
4221
|
-
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
4222
|
-
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,
|
|
4223
|
-
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,
|
|
4224
|
-
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
4225
|
-
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
4226
|
-
logging: this._options.logging,
|
|
4227
|
-
});
|
|
4228
|
-
if (_response.ok) {
|
|
4229
|
-
return {
|
|
4230
|
-
data: _response.body,
|
|
4231
|
-
rawResponse: _response.rawResponse,
|
|
4232
|
-
};
|
|
4233
|
-
}
|
|
4234
|
-
if (_response.error.reason === "status-code") {
|
|
4235
|
-
switch (_response.error.statusCode) {
|
|
4236
|
-
case 401:
|
|
4237
|
-
throw new Samsara.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
4238
|
-
case 404:
|
|
4239
|
-
throw new Samsara.NotFoundError(_response.error.body, _response.rawResponse);
|
|
4240
|
-
case 405:
|
|
4241
|
-
throw new Samsara.MethodNotAllowedError(_response.error.body, _response.rawResponse);
|
|
4242
|
-
case 429:
|
|
4243
|
-
throw new Samsara.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
4244
|
-
case 500:
|
|
4245
|
-
throw new Samsara.InternalServerError(_response.error.body, _response.rawResponse);
|
|
4246
|
-
case 501:
|
|
4247
|
-
throw new Samsara.NotImplementedError(_response.error.body, _response.rawResponse);
|
|
4248
|
-
case 502:
|
|
4249
|
-
throw new Samsara.BadGatewayError(_response.error.body, _response.rawResponse);
|
|
4250
|
-
case 503:
|
|
4251
|
-
throw new Samsara.ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
4252
|
-
case 504:
|
|
4253
|
-
throw new Samsara.GatewayTimeoutError(_response.error.body, _response.rawResponse);
|
|
4254
|
-
default:
|
|
4255
|
-
throw new errors.SamsaraError({
|
|
4256
|
-
statusCode: _response.error.statusCode,
|
|
4257
|
-
body: _response.error.body,
|
|
4258
|
-
rawResponse: _response.rawResponse,
|
|
4259
|
-
});
|
|
4260
|
-
}
|
|
4261
|
-
}
|
|
4262
|
-
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/readings/history");
|
|
4263
|
-
});
|
|
4264
|
-
}
|
|
4265
|
-
/**
|
|
4266
|
-
* An endpoint to get the last value of a reading for a set of entities at the specified time.
|
|
4267
|
-
*
|
|
4268
|
-
* Related guide: [Readings](https://developers.samsara.com/docs/readings).
|
|
4269
|
-
*
|
|
4270
|
-
* <b>Rate limit:</b> 10 requests/sec (learn more about rate limits <a href="https://developers.samsara.com/docs/rate-limits" target="_blank">here</a>).
|
|
4271
|
-
*
|
|
4272
|
-
* To use this endpoint, select **Read Readings** under the Closed Beta 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>
|
|
4273
|
-
*
|
|
4274
|
-
*
|
|
4275
|
-
* **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.
|
|
4276
|
-
*
|
|
4277
|
-
* @param {Samsara.GetReadingsSnapshotRequest} request
|
|
4278
|
-
* @param {BetaApIsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
4279
|
-
*
|
|
4280
|
-
* @throws {@link Samsara.UnauthorizedError}
|
|
4281
|
-
* @throws {@link Samsara.NotFoundError}
|
|
4282
|
-
* @throws {@link Samsara.MethodNotAllowedError}
|
|
4283
|
-
* @throws {@link Samsara.TooManyRequestsError}
|
|
4284
|
-
* @throws {@link Samsara.InternalServerError}
|
|
4285
|
-
* @throws {@link Samsara.NotImplementedError}
|
|
4286
|
-
* @throws {@link Samsara.BadGatewayError}
|
|
4287
|
-
* @throws {@link Samsara.ServiceUnavailableError}
|
|
4288
|
-
* @throws {@link Samsara.GatewayTimeoutError}
|
|
4289
|
-
*
|
|
4290
|
-
* @example
|
|
4291
|
-
* await client.betaApIs.getReadingsSnapshot({
|
|
4292
|
-
* readingIds: "readingIds",
|
|
4293
|
-
* entityType: "entityType"
|
|
4294
|
-
* })
|
|
4295
|
-
*/
|
|
4296
|
-
getReadingsSnapshot(request, requestOptions) {
|
|
4297
|
-
return core.HttpResponsePromise.fromPromise(this.__getReadingsSnapshot(request, requestOptions));
|
|
4298
|
-
}
|
|
4299
|
-
__getReadingsSnapshot(request, requestOptions) {
|
|
4300
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
4301
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
4302
|
-
const { after, readingIds, entityIds, externalIds, asOfTime, entityType, includeExternalIds } = request;
|
|
4303
|
-
const _queryParams = {
|
|
4304
|
-
after,
|
|
4305
|
-
readingIds,
|
|
4306
|
-
entityIds,
|
|
4307
|
-
externalIds,
|
|
4308
|
-
asOfTime,
|
|
4309
|
-
entityType,
|
|
4310
|
-
includeExternalIds,
|
|
4311
|
-
};
|
|
4312
|
-
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
4313
|
-
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);
|
|
4314
|
-
const _response = yield core.fetcher({
|
|
4315
|
-
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, "readings/latest"),
|
|
4316
|
-
method: "GET",
|
|
4317
|
-
headers: _headers,
|
|
4318
|
-
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
4319
|
-
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,
|
|
4320
|
-
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,
|
|
4321
|
-
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
4322
|
-
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
4323
|
-
logging: this._options.logging,
|
|
4324
|
-
});
|
|
4325
|
-
if (_response.ok) {
|
|
4326
|
-
return {
|
|
4327
|
-
data: _response.body,
|
|
4328
|
-
rawResponse: _response.rawResponse,
|
|
4329
|
-
};
|
|
4330
|
-
}
|
|
4331
|
-
if (_response.error.reason === "status-code") {
|
|
4332
|
-
switch (_response.error.statusCode) {
|
|
4333
|
-
case 401:
|
|
4334
|
-
throw new Samsara.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
4335
|
-
case 404:
|
|
4336
|
-
throw new Samsara.NotFoundError(_response.error.body, _response.rawResponse);
|
|
4337
|
-
case 405:
|
|
4338
|
-
throw new Samsara.MethodNotAllowedError(_response.error.body, _response.rawResponse);
|
|
4339
|
-
case 429:
|
|
4340
|
-
throw new Samsara.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
4341
|
-
case 500:
|
|
4342
|
-
throw new Samsara.InternalServerError(_response.error.body, _response.rawResponse);
|
|
4343
|
-
case 501:
|
|
4344
|
-
throw new Samsara.NotImplementedError(_response.error.body, _response.rawResponse);
|
|
4345
|
-
case 502:
|
|
4346
|
-
throw new Samsara.BadGatewayError(_response.error.body, _response.rawResponse);
|
|
4347
|
-
case 503:
|
|
4348
|
-
throw new Samsara.ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
4349
|
-
case 504:
|
|
4350
|
-
throw new Samsara.GatewayTimeoutError(_response.error.body, _response.rawResponse);
|
|
4351
|
-
default:
|
|
4352
|
-
throw new errors.SamsaraError({
|
|
4353
|
-
statusCode: _response.error.statusCode,
|
|
4354
|
-
body: _response.error.body,
|
|
4355
|
-
rawResponse: _response.rawResponse,
|
|
4356
|
-
});
|
|
4357
|
-
}
|
|
4358
|
-
}
|
|
4359
|
-
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/readings/latest");
|
|
4360
|
-
});
|
|
4361
|
-
}
|
|
4362
4076
|
/**
|
|
4363
4077
|
* Get report configs created in the organization.
|
|
4364
4078
|
*
|