@seamapi/http 0.4.0 → 0.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/README.md +212 -1
- package/dist/connect.cjs +691 -26
- package/dist/connect.cjs.map +1 -1
- package/dist/connect.d.cts +101 -11
- package/lib/seam/connect/auth.js +55 -4
- package/lib/seam/connect/auth.js.map +1 -1
- package/lib/seam/connect/options.d.ts +11 -1
- package/lib/seam/connect/options.js +51 -1
- package/lib/seam/connect/options.js.map +1 -1
- package/lib/seam/connect/routes/access-codes-unmanaged.d.ts +3 -1
- package/lib/seam/connect/routes/access-codes-unmanaged.js +15 -1
- package/lib/seam/connect/routes/access-codes-unmanaged.js.map +1 -1
- package/lib/seam/connect/routes/access-codes.d.ts +3 -1
- package/lib/seam/connect/routes/access-codes.js +15 -1
- package/lib/seam/connect/routes/access-codes.js.map +1 -1
- package/lib/seam/connect/routes/acs-access-groups.d.ts +3 -10
- package/lib/seam/connect/routes/acs-access-groups.js +15 -23
- package/lib/seam/connect/routes/acs-access-groups.js.map +1 -1
- package/lib/seam/connect/routes/acs-credentials.d.ts +9 -1
- package/lib/seam/connect/routes/acs-credentials.js +29 -1
- package/lib/seam/connect/routes/acs-credentials.js.map +1 -1
- package/lib/seam/connect/routes/acs-systems.d.ts +3 -1
- package/lib/seam/connect/routes/acs-systems.js +15 -1
- package/lib/seam/connect/routes/acs-systems.js.map +1 -1
- package/lib/seam/connect/routes/acs-users.d.ts +3 -1
- package/lib/seam/connect/routes/acs-users.js +15 -1
- package/lib/seam/connect/routes/acs-users.js.map +1 -1
- package/lib/seam/connect/routes/acs.d.ts +3 -1
- package/lib/seam/connect/routes/acs.js +15 -1
- package/lib/seam/connect/routes/acs.js.map +1 -1
- package/lib/seam/connect/routes/action-attempts.d.ts +3 -1
- package/lib/seam/connect/routes/action-attempts.js +15 -1
- package/lib/seam/connect/routes/action-attempts.js.map +1 -1
- package/lib/seam/connect/routes/client-sessions.d.ts +6 -1
- package/lib/seam/connect/routes/client-sessions.js +22 -1
- package/lib/seam/connect/routes/client-sessions.js.map +1 -1
- package/lib/seam/connect/routes/connect-webviews.d.ts +3 -1
- package/lib/seam/connect/routes/connect-webviews.js +15 -1
- package/lib/seam/connect/routes/connect-webviews.js.map +1 -1
- package/lib/seam/connect/routes/connected-accounts.d.ts +3 -1
- package/lib/seam/connect/routes/connected-accounts.js +15 -1
- package/lib/seam/connect/routes/connected-accounts.js.map +1 -1
- package/lib/seam/connect/routes/devices-unmanaged.d.ts +3 -1
- package/lib/seam/connect/routes/devices-unmanaged.js +15 -1
- package/lib/seam/connect/routes/devices-unmanaged.js.map +1 -1
- package/lib/seam/connect/routes/devices.d.ts +3 -1
- package/lib/seam/connect/routes/devices.js +15 -1
- package/lib/seam/connect/routes/devices.js.map +1 -1
- package/lib/seam/connect/routes/events.d.ts +3 -1
- package/lib/seam/connect/routes/events.js +15 -1
- package/lib/seam/connect/routes/events.js.map +1 -1
- package/lib/seam/connect/routes/index.d.ts +1 -0
- package/lib/seam/connect/routes/index.js +1 -0
- package/lib/seam/connect/routes/index.js.map +1 -1
- package/lib/seam/connect/routes/locks.d.ts +3 -1
- package/lib/seam/connect/routes/locks.js +15 -1
- package/lib/seam/connect/routes/locks.js.map +1 -1
- package/lib/seam/connect/routes/noise-sensors-noise-thresholds.d.ts +3 -1
- package/lib/seam/connect/routes/noise-sensors-noise-thresholds.js +15 -1
- package/lib/seam/connect/routes/noise-sensors-noise-thresholds.js.map +1 -1
- package/lib/seam/connect/routes/noise-sensors.d.ts +3 -1
- package/lib/seam/connect/routes/noise-sensors.js +15 -1
- package/lib/seam/connect/routes/noise-sensors.js.map +1 -1
- package/lib/seam/connect/routes/thermostats-climate-setting-schedules.d.ts +3 -1
- package/lib/seam/connect/routes/thermostats-climate-setting-schedules.js +15 -1
- package/lib/seam/connect/routes/thermostats-climate-setting-schedules.js.map +1 -1
- package/lib/seam/connect/routes/thermostats.d.ts +3 -1
- package/lib/seam/connect/routes/thermostats.js +15 -1
- package/lib/seam/connect/routes/thermostats.js.map +1 -1
- package/lib/seam/connect/routes/user-identities.d.ts +38 -0
- package/lib/seam/connect/routes/user-identities.js +121 -0
- package/lib/seam/connect/routes/user-identities.js.map +1 -0
- package/lib/seam/connect/routes/webhooks.d.ts +3 -1
- package/lib/seam/connect/routes/webhooks.js +15 -1
- package/lib/seam/connect/routes/webhooks.js.map +1 -1
- package/lib/seam/connect/routes/workspaces.d.ts +3 -1
- package/lib/seam/connect/routes/workspaces.js +15 -1
- package/lib/seam/connect/routes/workspaces.js.map +1 -1
- package/lib/seam/connect/seam-http.d.ts +5 -2
- package/lib/seam/connect/seam-http.js +19 -2
- package/lib/seam/connect/seam-http.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +2 -2
- package/src/lib/seam/connect/auth.ts +95 -3
- package/src/lib/seam/connect/options.ts +105 -1
- package/src/lib/seam/connect/routes/access-codes-unmanaged.ts +38 -0
- package/src/lib/seam/connect/routes/access-codes.ts +38 -0
- package/src/lib/seam/connect/routes/acs-access-groups.ts +37 -47
- package/src/lib/seam/connect/routes/acs-credentials.ts +68 -0
- package/src/lib/seam/connect/routes/acs-systems.ts +38 -0
- package/src/lib/seam/connect/routes/acs-users.ts +38 -0
- package/src/lib/seam/connect/routes/acs.ts +38 -0
- package/src/lib/seam/connect/routes/action-attempts.ts +38 -0
- package/src/lib/seam/connect/routes/client-sessions.ts +53 -0
- package/src/lib/seam/connect/routes/connect-webviews.ts +38 -0
- package/src/lib/seam/connect/routes/connected-accounts.ts +38 -0
- package/src/lib/seam/connect/routes/devices-unmanaged.ts +38 -0
- package/src/lib/seam/connect/routes/devices.ts +38 -0
- package/src/lib/seam/connect/routes/events.ts +38 -0
- package/src/lib/seam/connect/routes/index.ts +1 -0
- package/src/lib/seam/connect/routes/locks.ts +38 -0
- package/src/lib/seam/connect/routes/noise-sensors-noise-thresholds.ts +38 -0
- package/src/lib/seam/connect/routes/noise-sensors.ts +38 -0
- package/src/lib/seam/connect/routes/thermostats-climate-setting-schedules.ts +38 -0
- package/src/lib/seam/connect/routes/thermostats.ts +38 -0
- package/src/lib/seam/connect/routes/user-identities.ts +261 -0
- package/src/lib/seam/connect/routes/webhooks.ts +38 -0
- package/src/lib/seam/connect/routes/workspaces.ts +38 -0
- package/src/lib/seam/connect/seam-http.ts +43 -0
- package/src/lib/version.ts +1 -1
package/dist/connect.cjs
CHANGED
|
@@ -119,6 +119,16 @@ var isSeamHttpOptionsWithApiKey = (options) => {
|
|
|
119
119
|
"The clientSessionToken option cannot be used with the apiKey option"
|
|
120
120
|
);
|
|
121
121
|
}
|
|
122
|
+
if ("consoleSessionToken" in options && options.consoleSessionToken != null) {
|
|
123
|
+
throw new SeamHttpInvalidOptionsError(
|
|
124
|
+
"The consoleSessionToken option cannot be used with the apiKey option"
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
if ("personalAccessToken" in options && options.personalAccessToken != null) {
|
|
128
|
+
throw new SeamHttpInvalidOptionsError(
|
|
129
|
+
"The personalAccessToken option cannot be used with the apiKey option"
|
|
130
|
+
);
|
|
131
|
+
}
|
|
122
132
|
return true;
|
|
123
133
|
};
|
|
124
134
|
var isSeamHttpOptionsWithClientSessionToken = (options) => {
|
|
@@ -128,7 +138,71 @@ var isSeamHttpOptionsWithClientSessionToken = (options) => {
|
|
|
128
138
|
return false;
|
|
129
139
|
if ("apiKey" in options && options.apiKey != null) {
|
|
130
140
|
throw new SeamHttpInvalidOptionsError(
|
|
131
|
-
"The
|
|
141
|
+
"The apiKey option cannot be used with the clientSessionToken option"
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
if ("consoleSessionToken" in options && options.consoleSessionToken != null) {
|
|
145
|
+
throw new SeamHttpInvalidOptionsError(
|
|
146
|
+
"The consoleSessionToken option cannot be used with the clientSessionToken option"
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
if ("personalAccessToken" in options && options.personalAccessToken != null) {
|
|
150
|
+
throw new SeamHttpInvalidOptionsError(
|
|
151
|
+
"The personalAccessToken option cannot be used with the clientSessionToken option"
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
return true;
|
|
155
|
+
};
|
|
156
|
+
var isSeamHttpOptionsWithConsoleSessionToken = (options) => {
|
|
157
|
+
if (!("consoleSessionToken" in options))
|
|
158
|
+
return false;
|
|
159
|
+
if (options.consoleSessionToken == null)
|
|
160
|
+
return false;
|
|
161
|
+
if (!("workspaceId" in options) || options.workspaceId == null) {
|
|
162
|
+
throw new SeamHttpInvalidOptionsError(
|
|
163
|
+
"Must pass a workspaceId when using a consoleSessionToken"
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
if ("apiKey" in options && options.apiKey != null) {
|
|
167
|
+
throw new SeamHttpInvalidOptionsError(
|
|
168
|
+
"The apiKey option cannot be used with the consoleSessionToken option"
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
if ("clientSessionToken" in options && options.clientSessionToken != null) {
|
|
172
|
+
throw new SeamHttpInvalidOptionsError(
|
|
173
|
+
"The clientSessionToken option cannot be used with the consoleSessionToken option"
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
if ("personalAccessToken" in options && options.personalAccessToken != null) {
|
|
177
|
+
throw new SeamHttpInvalidOptionsError(
|
|
178
|
+
"The personalAccessToken option cannot be used with the consoleSessionToken option"
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
return true;
|
|
182
|
+
};
|
|
183
|
+
var isSeamHttpOptionsWithPersonalAccessToken = (options) => {
|
|
184
|
+
if (!("personalAccessToken" in options))
|
|
185
|
+
return false;
|
|
186
|
+
if (options.personalAccessToken == null)
|
|
187
|
+
return false;
|
|
188
|
+
if (!("workspaceId" in options) || options.workspaceId == null) {
|
|
189
|
+
throw new SeamHttpInvalidOptionsError(
|
|
190
|
+
"Must pass a workspaceId when using a personalAccessToken"
|
|
191
|
+
);
|
|
192
|
+
}
|
|
193
|
+
if ("apiKey" in options && options.apiKey != null) {
|
|
194
|
+
throw new SeamHttpInvalidOptionsError(
|
|
195
|
+
"The apiKey option cannot be used with the personalAccessToken option"
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
if ("clientSessionToken" in options && options.clientSessionToken != null) {
|
|
199
|
+
throw new SeamHttpInvalidOptionsError(
|
|
200
|
+
"The clientSessionToken option cannot be used with the personalAccessToken option"
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
if ("consoleSessionToken" in options && options.consoleSessionToken != null) {
|
|
204
|
+
throw new SeamHttpInvalidOptionsError(
|
|
205
|
+
"The consoleSessionToken option cannot be used with the personalAccessToken option"
|
|
132
206
|
);
|
|
133
207
|
}
|
|
134
208
|
return true;
|
|
@@ -152,8 +226,21 @@ var getAuthHeaders = (options) => {
|
|
|
152
226
|
if (isSeamHttpOptionsWithClientSessionToken(options)) {
|
|
153
227
|
return getAuthHeadersForClientSessionToken(options);
|
|
154
228
|
}
|
|
229
|
+
if (isSeamHttpOptionsWithConsoleSessionToken(options)) {
|
|
230
|
+
return getAuthHeadersForConsoleSessionToken(options);
|
|
231
|
+
}
|
|
232
|
+
if (isSeamHttpOptionsWithPersonalAccessToken(options)) {
|
|
233
|
+
return getAuthHeadersForPersonalAccessToken(options);
|
|
234
|
+
}
|
|
155
235
|
throw new SeamHttpInvalidOptionsError(
|
|
156
|
-
|
|
236
|
+
[
|
|
237
|
+
"Must specify",
|
|
238
|
+
"an apiKey,",
|
|
239
|
+
"clientSessionToken,",
|
|
240
|
+
"publishableKey,",
|
|
241
|
+
"consoleSessionToken with a workspaceId",
|
|
242
|
+
"or personalAccessToken with a workspaceId"
|
|
243
|
+
].join(" ")
|
|
157
244
|
);
|
|
158
245
|
};
|
|
159
246
|
var getAuthHeadersForApiKey = ({
|
|
@@ -214,6 +301,64 @@ var getAuthHeadersForClientSessionToken = ({
|
|
|
214
301
|
"client-session-token": clientSessionToken
|
|
215
302
|
};
|
|
216
303
|
};
|
|
304
|
+
var getAuthHeadersForConsoleSessionToken = ({
|
|
305
|
+
consoleSessionToken,
|
|
306
|
+
workspaceId
|
|
307
|
+
}) => {
|
|
308
|
+
if (isAccessToken(consoleSessionToken)) {
|
|
309
|
+
throw new SeamHttpInvalidTokenError(
|
|
310
|
+
"An Access Token cannot be used as a consoleSessionToken"
|
|
311
|
+
);
|
|
312
|
+
}
|
|
313
|
+
if (isClientSessionToken(consoleSessionToken)) {
|
|
314
|
+
throw new SeamHttpInvalidTokenError(
|
|
315
|
+
"A Client Session Token cannot be used as a consoleSessionToken"
|
|
316
|
+
);
|
|
317
|
+
}
|
|
318
|
+
if (isPublishableKey(consoleSessionToken)) {
|
|
319
|
+
throw new SeamHttpInvalidTokenError(
|
|
320
|
+
"A Publishable Key cannot be used as a consoleSessionToken"
|
|
321
|
+
);
|
|
322
|
+
}
|
|
323
|
+
if (!isJwt(consoleSessionToken)) {
|
|
324
|
+
throw new SeamHttpInvalidTokenError(
|
|
325
|
+
`Unknown or invalid consoleSessionToken format, expected a JWT which starts with ${jwtPrefix}`
|
|
326
|
+
);
|
|
327
|
+
}
|
|
328
|
+
return {
|
|
329
|
+
authorization: `Bearer ${consoleSessionToken}`,
|
|
330
|
+
"seam-workspace-id": workspaceId
|
|
331
|
+
};
|
|
332
|
+
};
|
|
333
|
+
var getAuthHeadersForPersonalAccessToken = ({
|
|
334
|
+
personalAccessToken,
|
|
335
|
+
workspaceId
|
|
336
|
+
}) => {
|
|
337
|
+
if (isJwt(personalAccessToken)) {
|
|
338
|
+
throw new SeamHttpInvalidTokenError(
|
|
339
|
+
"A JWT cannot be used as a personalAccessToken"
|
|
340
|
+
);
|
|
341
|
+
}
|
|
342
|
+
if (isClientSessionToken(personalAccessToken)) {
|
|
343
|
+
throw new SeamHttpInvalidTokenError(
|
|
344
|
+
"A Client Session Token cannot be used as a personalAccessToken"
|
|
345
|
+
);
|
|
346
|
+
}
|
|
347
|
+
if (isPublishableKey(personalAccessToken)) {
|
|
348
|
+
throw new SeamHttpInvalidTokenError(
|
|
349
|
+
"A Publishable Key cannot be used as a personalAccessToken"
|
|
350
|
+
);
|
|
351
|
+
}
|
|
352
|
+
if (!isAccessToken(personalAccessToken)) {
|
|
353
|
+
throw new SeamHttpInvalidTokenError(
|
|
354
|
+
`Unknown or invalid personalAccessToken format, expected token to start with ${accessTokenPrefix}`
|
|
355
|
+
);
|
|
356
|
+
}
|
|
357
|
+
return {
|
|
358
|
+
authorization: `Bearer ${personalAccessToken}`,
|
|
359
|
+
"seam-workspace-id": workspaceId
|
|
360
|
+
};
|
|
361
|
+
};
|
|
217
362
|
var getAuthHeadersForPublishableKey = (publishableKey) => {
|
|
218
363
|
if (isJwt(publishableKey)) {
|
|
219
364
|
throw new SeamHttpInvalidTokenError(
|
|
@@ -260,11 +405,13 @@ var warnOnInsecureuserIdentifierKey = (userIdentifierKey) => {
|
|
|
260
405
|
}
|
|
261
406
|
};
|
|
262
407
|
var tokenPrefix = "seam_";
|
|
408
|
+
var accessTokenPrefix = "seam_at";
|
|
409
|
+
var jwtPrefix = "ey";
|
|
263
410
|
var clientSessionTokenPrefix = "seam_cst";
|
|
264
411
|
var publishableKeyTokenPrefix = "seam_pk";
|
|
265
412
|
var isClientSessionToken = (token) => token.startsWith(clientSessionTokenPrefix);
|
|
266
|
-
var isAccessToken = (token) => token.startsWith(
|
|
267
|
-
var isJwt = (token) => token.startsWith(
|
|
413
|
+
var isAccessToken = (token) => token.startsWith(accessTokenPrefix);
|
|
414
|
+
var isJwt = (token) => token.startsWith(jwtPrefix);
|
|
268
415
|
var isSeamToken = (token) => token.startsWith(tokenPrefix);
|
|
269
416
|
var isPublishableKey = (token) => token.startsWith(publishableKeyTokenPrefix);
|
|
270
417
|
var isEmail = (value) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value);
|
|
@@ -423,6 +570,24 @@ var SeamHttpClientSessions = class _SeamHttpClientSessions {
|
|
|
423
570
|
});
|
|
424
571
|
return _SeamHttpClientSessions.fromClientSessionToken(token, options);
|
|
425
572
|
}
|
|
573
|
+
static fromConsoleSessionToken(consoleSessionToken, workspaceId, options = {}) {
|
|
574
|
+
const constructorOptions = { ...options, consoleSessionToken, workspaceId };
|
|
575
|
+
if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
|
|
576
|
+
throw new SeamHttpInvalidOptionsError(
|
|
577
|
+
"Missing consoleSessionToken or workspaceId"
|
|
578
|
+
);
|
|
579
|
+
}
|
|
580
|
+
return new _SeamHttpClientSessions(constructorOptions);
|
|
581
|
+
}
|
|
582
|
+
static fromPersonalAccessToken(personalAccessToken, workspaceId, options = {}) {
|
|
583
|
+
const constructorOptions = { ...options, personalAccessToken, workspaceId };
|
|
584
|
+
if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
|
|
585
|
+
throw new SeamHttpInvalidOptionsError(
|
|
586
|
+
"Missing personalAccessToken or workspaceId"
|
|
587
|
+
);
|
|
588
|
+
}
|
|
589
|
+
return new _SeamHttpClientSessions(constructorOptions);
|
|
590
|
+
}
|
|
426
591
|
async create(body) {
|
|
427
592
|
const { data } = await this.client.request({
|
|
428
593
|
url: "/client_sessions/create",
|
|
@@ -470,6 +635,13 @@ var SeamHttpClientSessions = class _SeamHttpClientSessions {
|
|
|
470
635
|
});
|
|
471
636
|
return data.client_sessions;
|
|
472
637
|
}
|
|
638
|
+
async revoke(body) {
|
|
639
|
+
await this.client.request({
|
|
640
|
+
url: "/client_sessions/revoke",
|
|
641
|
+
method: "post",
|
|
642
|
+
data: body
|
|
643
|
+
});
|
|
644
|
+
}
|
|
473
645
|
};
|
|
474
646
|
|
|
475
647
|
// src/lib/seam/connect/routes/access-codes-unmanaged.ts
|
|
@@ -509,6 +681,24 @@ var SeamHttpAccessCodesUnmanaged = class _SeamHttpAccessCodesUnmanaged {
|
|
|
509
681
|
});
|
|
510
682
|
return _SeamHttpAccessCodesUnmanaged.fromClientSessionToken(token, options);
|
|
511
683
|
}
|
|
684
|
+
static fromConsoleSessionToken(consoleSessionToken, workspaceId, options = {}) {
|
|
685
|
+
const constructorOptions = { ...options, consoleSessionToken, workspaceId };
|
|
686
|
+
if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
|
|
687
|
+
throw new SeamHttpInvalidOptionsError(
|
|
688
|
+
"Missing consoleSessionToken or workspaceId"
|
|
689
|
+
);
|
|
690
|
+
}
|
|
691
|
+
return new _SeamHttpAccessCodesUnmanaged(constructorOptions);
|
|
692
|
+
}
|
|
693
|
+
static fromPersonalAccessToken(personalAccessToken, workspaceId, options = {}) {
|
|
694
|
+
const constructorOptions = { ...options, personalAccessToken, workspaceId };
|
|
695
|
+
if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
|
|
696
|
+
throw new SeamHttpInvalidOptionsError(
|
|
697
|
+
"Missing personalAccessToken or workspaceId"
|
|
698
|
+
);
|
|
699
|
+
}
|
|
700
|
+
return new _SeamHttpAccessCodesUnmanaged(constructorOptions);
|
|
701
|
+
}
|
|
512
702
|
async convertToManaged(body) {
|
|
513
703
|
await this.client.request({
|
|
514
704
|
url: "/access_codes/unmanaged/convert_to_managed",
|
|
@@ -587,6 +777,24 @@ var SeamHttpAccessCodes = class _SeamHttpAccessCodes {
|
|
|
587
777
|
});
|
|
588
778
|
return _SeamHttpAccessCodes.fromClientSessionToken(token, options);
|
|
589
779
|
}
|
|
780
|
+
static fromConsoleSessionToken(consoleSessionToken, workspaceId, options = {}) {
|
|
781
|
+
const constructorOptions = { ...options, consoleSessionToken, workspaceId };
|
|
782
|
+
if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
|
|
783
|
+
throw new SeamHttpInvalidOptionsError(
|
|
784
|
+
"Missing consoleSessionToken or workspaceId"
|
|
785
|
+
);
|
|
786
|
+
}
|
|
787
|
+
return new _SeamHttpAccessCodes(constructorOptions);
|
|
788
|
+
}
|
|
789
|
+
static fromPersonalAccessToken(personalAccessToken, workspaceId, options = {}) {
|
|
790
|
+
const constructorOptions = { ...options, personalAccessToken, workspaceId };
|
|
791
|
+
if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
|
|
792
|
+
throw new SeamHttpInvalidOptionsError(
|
|
793
|
+
"Missing personalAccessToken or workspaceId"
|
|
794
|
+
);
|
|
795
|
+
}
|
|
796
|
+
return new _SeamHttpAccessCodes(constructorOptions);
|
|
797
|
+
}
|
|
590
798
|
get unmanaged() {
|
|
591
799
|
return SeamHttpAccessCodesUnmanaged.fromClient(this.client);
|
|
592
800
|
}
|
|
@@ -693,24 +901,27 @@ var SeamHttpAcsAccessGroups = class _SeamHttpAcsAccessGroups {
|
|
|
693
901
|
});
|
|
694
902
|
return _SeamHttpAcsAccessGroups.fromClientSessionToken(token, options);
|
|
695
903
|
}
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
904
|
+
static fromConsoleSessionToken(consoleSessionToken, workspaceId, options = {}) {
|
|
905
|
+
const constructorOptions = { ...options, consoleSessionToken, workspaceId };
|
|
906
|
+
if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
|
|
907
|
+
throw new SeamHttpInvalidOptionsError(
|
|
908
|
+
"Missing consoleSessionToken or workspaceId"
|
|
909
|
+
);
|
|
910
|
+
}
|
|
911
|
+
return new _SeamHttpAcsAccessGroups(constructorOptions);
|
|
702
912
|
}
|
|
703
|
-
|
|
704
|
-
const {
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
913
|
+
static fromPersonalAccessToken(personalAccessToken, workspaceId, options = {}) {
|
|
914
|
+
const constructorOptions = { ...options, personalAccessToken, workspaceId };
|
|
915
|
+
if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
|
|
916
|
+
throw new SeamHttpInvalidOptionsError(
|
|
917
|
+
"Missing personalAccessToken or workspaceId"
|
|
918
|
+
);
|
|
919
|
+
}
|
|
920
|
+
return new _SeamHttpAcsAccessGroups(constructorOptions);
|
|
710
921
|
}
|
|
711
|
-
async
|
|
922
|
+
async addUser(body) {
|
|
712
923
|
await this.client.request({
|
|
713
|
-
url: "/acs/access_groups/
|
|
924
|
+
url: "/acs/access_groups/add_user",
|
|
714
925
|
method: "post",
|
|
715
926
|
data: body
|
|
716
927
|
});
|
|
@@ -746,13 +957,6 @@ var SeamHttpAcsAccessGroups = class _SeamHttpAcsAccessGroups {
|
|
|
746
957
|
data: body
|
|
747
958
|
});
|
|
748
959
|
}
|
|
749
|
-
async update(body) {
|
|
750
|
-
await this.client.request({
|
|
751
|
-
url: "/acs/access_groups/update",
|
|
752
|
-
method: "post",
|
|
753
|
-
data: body
|
|
754
|
-
});
|
|
755
|
-
}
|
|
756
960
|
};
|
|
757
961
|
|
|
758
962
|
// src/lib/seam/connect/routes/acs-credentials.ts
|
|
@@ -792,6 +996,31 @@ var SeamHttpAcsCredentials = class _SeamHttpAcsCredentials {
|
|
|
792
996
|
});
|
|
793
997
|
return _SeamHttpAcsCredentials.fromClientSessionToken(token, options);
|
|
794
998
|
}
|
|
999
|
+
static fromConsoleSessionToken(consoleSessionToken, workspaceId, options = {}) {
|
|
1000
|
+
const constructorOptions = { ...options, consoleSessionToken, workspaceId };
|
|
1001
|
+
if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
|
|
1002
|
+
throw new SeamHttpInvalidOptionsError(
|
|
1003
|
+
"Missing consoleSessionToken or workspaceId"
|
|
1004
|
+
);
|
|
1005
|
+
}
|
|
1006
|
+
return new _SeamHttpAcsCredentials(constructorOptions);
|
|
1007
|
+
}
|
|
1008
|
+
static fromPersonalAccessToken(personalAccessToken, workspaceId, options = {}) {
|
|
1009
|
+
const constructorOptions = { ...options, personalAccessToken, workspaceId };
|
|
1010
|
+
if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
|
|
1011
|
+
throw new SeamHttpInvalidOptionsError(
|
|
1012
|
+
"Missing personalAccessToken or workspaceId"
|
|
1013
|
+
);
|
|
1014
|
+
}
|
|
1015
|
+
return new _SeamHttpAcsCredentials(constructorOptions);
|
|
1016
|
+
}
|
|
1017
|
+
async assign(body) {
|
|
1018
|
+
await this.client.request({
|
|
1019
|
+
url: "/acs/credentials/assign",
|
|
1020
|
+
method: "post",
|
|
1021
|
+
data: body
|
|
1022
|
+
});
|
|
1023
|
+
}
|
|
795
1024
|
async create(body) {
|
|
796
1025
|
const { data } = await this.client.request({
|
|
797
1026
|
url: "/acs/credentials/create",
|
|
@@ -823,6 +1052,13 @@ var SeamHttpAcsCredentials = class _SeamHttpAcsCredentials {
|
|
|
823
1052
|
});
|
|
824
1053
|
return data.acs_credentials;
|
|
825
1054
|
}
|
|
1055
|
+
async unassign(body) {
|
|
1056
|
+
await this.client.request({
|
|
1057
|
+
url: "/acs/credentials/unassign",
|
|
1058
|
+
method: "post",
|
|
1059
|
+
data: body
|
|
1060
|
+
});
|
|
1061
|
+
}
|
|
826
1062
|
};
|
|
827
1063
|
|
|
828
1064
|
// src/lib/seam/connect/routes/acs-systems.ts
|
|
@@ -862,6 +1098,24 @@ var SeamHttpAcsSystems = class _SeamHttpAcsSystems {
|
|
|
862
1098
|
});
|
|
863
1099
|
return _SeamHttpAcsSystems.fromClientSessionToken(token, options);
|
|
864
1100
|
}
|
|
1101
|
+
static fromConsoleSessionToken(consoleSessionToken, workspaceId, options = {}) {
|
|
1102
|
+
const constructorOptions = { ...options, consoleSessionToken, workspaceId };
|
|
1103
|
+
if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
|
|
1104
|
+
throw new SeamHttpInvalidOptionsError(
|
|
1105
|
+
"Missing consoleSessionToken or workspaceId"
|
|
1106
|
+
);
|
|
1107
|
+
}
|
|
1108
|
+
return new _SeamHttpAcsSystems(constructorOptions);
|
|
1109
|
+
}
|
|
1110
|
+
static fromPersonalAccessToken(personalAccessToken, workspaceId, options = {}) {
|
|
1111
|
+
const constructorOptions = { ...options, personalAccessToken, workspaceId };
|
|
1112
|
+
if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
|
|
1113
|
+
throw new SeamHttpInvalidOptionsError(
|
|
1114
|
+
"Missing personalAccessToken or workspaceId"
|
|
1115
|
+
);
|
|
1116
|
+
}
|
|
1117
|
+
return new _SeamHttpAcsSystems(constructorOptions);
|
|
1118
|
+
}
|
|
865
1119
|
async get(body) {
|
|
866
1120
|
const { data } = await this.client.request({
|
|
867
1121
|
url: "/acs/systems/get",
|
|
@@ -917,6 +1171,24 @@ var SeamHttpAcsUsers = class _SeamHttpAcsUsers {
|
|
|
917
1171
|
});
|
|
918
1172
|
return _SeamHttpAcsUsers.fromClientSessionToken(token, options);
|
|
919
1173
|
}
|
|
1174
|
+
static fromConsoleSessionToken(consoleSessionToken, workspaceId, options = {}) {
|
|
1175
|
+
const constructorOptions = { ...options, consoleSessionToken, workspaceId };
|
|
1176
|
+
if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
|
|
1177
|
+
throw new SeamHttpInvalidOptionsError(
|
|
1178
|
+
"Missing consoleSessionToken or workspaceId"
|
|
1179
|
+
);
|
|
1180
|
+
}
|
|
1181
|
+
return new _SeamHttpAcsUsers(constructorOptions);
|
|
1182
|
+
}
|
|
1183
|
+
static fromPersonalAccessToken(personalAccessToken, workspaceId, options = {}) {
|
|
1184
|
+
const constructorOptions = { ...options, personalAccessToken, workspaceId };
|
|
1185
|
+
if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
|
|
1186
|
+
throw new SeamHttpInvalidOptionsError(
|
|
1187
|
+
"Missing personalAccessToken or workspaceId"
|
|
1188
|
+
);
|
|
1189
|
+
}
|
|
1190
|
+
return new _SeamHttpAcsUsers(constructorOptions);
|
|
1191
|
+
}
|
|
920
1192
|
async addToAccessGroup(body) {
|
|
921
1193
|
await this.client.request({
|
|
922
1194
|
url: "/acs/users/add_to_access_group",
|
|
@@ -1022,6 +1294,24 @@ var SeamHttpAcs = class _SeamHttpAcs {
|
|
|
1022
1294
|
});
|
|
1023
1295
|
return _SeamHttpAcs.fromClientSessionToken(token, options);
|
|
1024
1296
|
}
|
|
1297
|
+
static fromConsoleSessionToken(consoleSessionToken, workspaceId, options = {}) {
|
|
1298
|
+
const constructorOptions = { ...options, consoleSessionToken, workspaceId };
|
|
1299
|
+
if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
|
|
1300
|
+
throw new SeamHttpInvalidOptionsError(
|
|
1301
|
+
"Missing consoleSessionToken or workspaceId"
|
|
1302
|
+
);
|
|
1303
|
+
}
|
|
1304
|
+
return new _SeamHttpAcs(constructorOptions);
|
|
1305
|
+
}
|
|
1306
|
+
static fromPersonalAccessToken(personalAccessToken, workspaceId, options = {}) {
|
|
1307
|
+
const constructorOptions = { ...options, personalAccessToken, workspaceId };
|
|
1308
|
+
if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
|
|
1309
|
+
throw new SeamHttpInvalidOptionsError(
|
|
1310
|
+
"Missing personalAccessToken or workspaceId"
|
|
1311
|
+
);
|
|
1312
|
+
}
|
|
1313
|
+
return new _SeamHttpAcs(constructorOptions);
|
|
1314
|
+
}
|
|
1025
1315
|
get accessGroups() {
|
|
1026
1316
|
return SeamHttpAcsAccessGroups.fromClient(this.client);
|
|
1027
1317
|
}
|
|
@@ -1073,6 +1363,24 @@ var SeamHttpActionAttempts = class _SeamHttpActionAttempts {
|
|
|
1073
1363
|
});
|
|
1074
1364
|
return _SeamHttpActionAttempts.fromClientSessionToken(token, options);
|
|
1075
1365
|
}
|
|
1366
|
+
static fromConsoleSessionToken(consoleSessionToken, workspaceId, options = {}) {
|
|
1367
|
+
const constructorOptions = { ...options, consoleSessionToken, workspaceId };
|
|
1368
|
+
if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
|
|
1369
|
+
throw new SeamHttpInvalidOptionsError(
|
|
1370
|
+
"Missing consoleSessionToken or workspaceId"
|
|
1371
|
+
);
|
|
1372
|
+
}
|
|
1373
|
+
return new _SeamHttpActionAttempts(constructorOptions);
|
|
1374
|
+
}
|
|
1375
|
+
static fromPersonalAccessToken(personalAccessToken, workspaceId, options = {}) {
|
|
1376
|
+
const constructorOptions = { ...options, personalAccessToken, workspaceId };
|
|
1377
|
+
if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
|
|
1378
|
+
throw new SeamHttpInvalidOptionsError(
|
|
1379
|
+
"Missing personalAccessToken or workspaceId"
|
|
1380
|
+
);
|
|
1381
|
+
}
|
|
1382
|
+
return new _SeamHttpActionAttempts(constructorOptions);
|
|
1383
|
+
}
|
|
1076
1384
|
async get(body) {
|
|
1077
1385
|
const { data } = await this.client.request({
|
|
1078
1386
|
url: "/action_attempts/get",
|
|
@@ -1128,6 +1436,24 @@ var SeamHttpConnectWebviews = class _SeamHttpConnectWebviews {
|
|
|
1128
1436
|
});
|
|
1129
1437
|
return _SeamHttpConnectWebviews.fromClientSessionToken(token, options);
|
|
1130
1438
|
}
|
|
1439
|
+
static fromConsoleSessionToken(consoleSessionToken, workspaceId, options = {}) {
|
|
1440
|
+
const constructorOptions = { ...options, consoleSessionToken, workspaceId };
|
|
1441
|
+
if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
|
|
1442
|
+
throw new SeamHttpInvalidOptionsError(
|
|
1443
|
+
"Missing consoleSessionToken or workspaceId"
|
|
1444
|
+
);
|
|
1445
|
+
}
|
|
1446
|
+
return new _SeamHttpConnectWebviews(constructorOptions);
|
|
1447
|
+
}
|
|
1448
|
+
static fromPersonalAccessToken(personalAccessToken, workspaceId, options = {}) {
|
|
1449
|
+
const constructorOptions = { ...options, personalAccessToken, workspaceId };
|
|
1450
|
+
if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
|
|
1451
|
+
throw new SeamHttpInvalidOptionsError(
|
|
1452
|
+
"Missing personalAccessToken or workspaceId"
|
|
1453
|
+
);
|
|
1454
|
+
}
|
|
1455
|
+
return new _SeamHttpConnectWebviews(constructorOptions);
|
|
1456
|
+
}
|
|
1131
1457
|
async create(body) {
|
|
1132
1458
|
const { data } = await this.client.request({
|
|
1133
1459
|
url: "/connect_webviews/create",
|
|
@@ -1205,6 +1531,24 @@ var SeamHttpConnectedAccounts = class _SeamHttpConnectedAccounts {
|
|
|
1205
1531
|
});
|
|
1206
1532
|
return _SeamHttpConnectedAccounts.fromClientSessionToken(token, options);
|
|
1207
1533
|
}
|
|
1534
|
+
static fromConsoleSessionToken(consoleSessionToken, workspaceId, options = {}) {
|
|
1535
|
+
const constructorOptions = { ...options, consoleSessionToken, workspaceId };
|
|
1536
|
+
if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
|
|
1537
|
+
throw new SeamHttpInvalidOptionsError(
|
|
1538
|
+
"Missing consoleSessionToken or workspaceId"
|
|
1539
|
+
);
|
|
1540
|
+
}
|
|
1541
|
+
return new _SeamHttpConnectedAccounts(constructorOptions);
|
|
1542
|
+
}
|
|
1543
|
+
static fromPersonalAccessToken(personalAccessToken, workspaceId, options = {}) {
|
|
1544
|
+
const constructorOptions = { ...options, personalAccessToken, workspaceId };
|
|
1545
|
+
if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
|
|
1546
|
+
throw new SeamHttpInvalidOptionsError(
|
|
1547
|
+
"Missing personalAccessToken or workspaceId"
|
|
1548
|
+
);
|
|
1549
|
+
}
|
|
1550
|
+
return new _SeamHttpConnectedAccounts(constructorOptions);
|
|
1551
|
+
}
|
|
1208
1552
|
async delete(body) {
|
|
1209
1553
|
await this.client.request({
|
|
1210
1554
|
url: "/connected_accounts/delete",
|
|
@@ -1267,6 +1611,24 @@ var SeamHttpDevicesUnmanaged = class _SeamHttpDevicesUnmanaged {
|
|
|
1267
1611
|
});
|
|
1268
1612
|
return _SeamHttpDevicesUnmanaged.fromClientSessionToken(token, options);
|
|
1269
1613
|
}
|
|
1614
|
+
static fromConsoleSessionToken(consoleSessionToken, workspaceId, options = {}) {
|
|
1615
|
+
const constructorOptions = { ...options, consoleSessionToken, workspaceId };
|
|
1616
|
+
if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
|
|
1617
|
+
throw new SeamHttpInvalidOptionsError(
|
|
1618
|
+
"Missing consoleSessionToken or workspaceId"
|
|
1619
|
+
);
|
|
1620
|
+
}
|
|
1621
|
+
return new _SeamHttpDevicesUnmanaged(constructorOptions);
|
|
1622
|
+
}
|
|
1623
|
+
static fromPersonalAccessToken(personalAccessToken, workspaceId, options = {}) {
|
|
1624
|
+
const constructorOptions = { ...options, personalAccessToken, workspaceId };
|
|
1625
|
+
if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
|
|
1626
|
+
throw new SeamHttpInvalidOptionsError(
|
|
1627
|
+
"Missing personalAccessToken or workspaceId"
|
|
1628
|
+
);
|
|
1629
|
+
}
|
|
1630
|
+
return new _SeamHttpDevicesUnmanaged(constructorOptions);
|
|
1631
|
+
}
|
|
1270
1632
|
async get(body) {
|
|
1271
1633
|
const { data } = await this.client.request({
|
|
1272
1634
|
url: "/devices/unmanaged/get",
|
|
@@ -1329,6 +1691,24 @@ var SeamHttpDevices = class _SeamHttpDevices {
|
|
|
1329
1691
|
});
|
|
1330
1692
|
return _SeamHttpDevices.fromClientSessionToken(token, options);
|
|
1331
1693
|
}
|
|
1694
|
+
static fromConsoleSessionToken(consoleSessionToken, workspaceId, options = {}) {
|
|
1695
|
+
const constructorOptions = { ...options, consoleSessionToken, workspaceId };
|
|
1696
|
+
if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
|
|
1697
|
+
throw new SeamHttpInvalidOptionsError(
|
|
1698
|
+
"Missing consoleSessionToken or workspaceId"
|
|
1699
|
+
);
|
|
1700
|
+
}
|
|
1701
|
+
return new _SeamHttpDevices(constructorOptions);
|
|
1702
|
+
}
|
|
1703
|
+
static fromPersonalAccessToken(personalAccessToken, workspaceId, options = {}) {
|
|
1704
|
+
const constructorOptions = { ...options, personalAccessToken, workspaceId };
|
|
1705
|
+
if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
|
|
1706
|
+
throw new SeamHttpInvalidOptionsError(
|
|
1707
|
+
"Missing personalAccessToken or workspaceId"
|
|
1708
|
+
);
|
|
1709
|
+
}
|
|
1710
|
+
return new _SeamHttpDevices(constructorOptions);
|
|
1711
|
+
}
|
|
1332
1712
|
get unmanaged() {
|
|
1333
1713
|
return SeamHttpDevicesUnmanaged.fromClient(this.client);
|
|
1334
1714
|
}
|
|
@@ -1409,6 +1789,24 @@ var SeamHttpEvents = class _SeamHttpEvents {
|
|
|
1409
1789
|
});
|
|
1410
1790
|
return _SeamHttpEvents.fromClientSessionToken(token, options);
|
|
1411
1791
|
}
|
|
1792
|
+
static fromConsoleSessionToken(consoleSessionToken, workspaceId, options = {}) {
|
|
1793
|
+
const constructorOptions = { ...options, consoleSessionToken, workspaceId };
|
|
1794
|
+
if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
|
|
1795
|
+
throw new SeamHttpInvalidOptionsError(
|
|
1796
|
+
"Missing consoleSessionToken or workspaceId"
|
|
1797
|
+
);
|
|
1798
|
+
}
|
|
1799
|
+
return new _SeamHttpEvents(constructorOptions);
|
|
1800
|
+
}
|
|
1801
|
+
static fromPersonalAccessToken(personalAccessToken, workspaceId, options = {}) {
|
|
1802
|
+
const constructorOptions = { ...options, personalAccessToken, workspaceId };
|
|
1803
|
+
if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
|
|
1804
|
+
throw new SeamHttpInvalidOptionsError(
|
|
1805
|
+
"Missing personalAccessToken or workspaceId"
|
|
1806
|
+
);
|
|
1807
|
+
}
|
|
1808
|
+
return new _SeamHttpEvents(constructorOptions);
|
|
1809
|
+
}
|
|
1412
1810
|
async get(body) {
|
|
1413
1811
|
const { data } = await this.client.request({
|
|
1414
1812
|
url: "/events/get",
|
|
@@ -1464,6 +1862,24 @@ var SeamHttpLocks = class _SeamHttpLocks {
|
|
|
1464
1862
|
});
|
|
1465
1863
|
return _SeamHttpLocks.fromClientSessionToken(token, options);
|
|
1466
1864
|
}
|
|
1865
|
+
static fromConsoleSessionToken(consoleSessionToken, workspaceId, options = {}) {
|
|
1866
|
+
const constructorOptions = { ...options, consoleSessionToken, workspaceId };
|
|
1867
|
+
if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
|
|
1868
|
+
throw new SeamHttpInvalidOptionsError(
|
|
1869
|
+
"Missing consoleSessionToken or workspaceId"
|
|
1870
|
+
);
|
|
1871
|
+
}
|
|
1872
|
+
return new _SeamHttpLocks(constructorOptions);
|
|
1873
|
+
}
|
|
1874
|
+
static fromPersonalAccessToken(personalAccessToken, workspaceId, options = {}) {
|
|
1875
|
+
const constructorOptions = { ...options, personalAccessToken, workspaceId };
|
|
1876
|
+
if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
|
|
1877
|
+
throw new SeamHttpInvalidOptionsError(
|
|
1878
|
+
"Missing personalAccessToken or workspaceId"
|
|
1879
|
+
);
|
|
1880
|
+
}
|
|
1881
|
+
return new _SeamHttpLocks(constructorOptions);
|
|
1882
|
+
}
|
|
1467
1883
|
async get(body) {
|
|
1468
1884
|
const { data } = await this.client.request({
|
|
1469
1885
|
url: "/locks/get",
|
|
@@ -1538,6 +1954,24 @@ var SeamHttpNoiseSensorsNoiseThresholds = class _SeamHttpNoiseSensorsNoiseThresh
|
|
|
1538
1954
|
options
|
|
1539
1955
|
);
|
|
1540
1956
|
}
|
|
1957
|
+
static fromConsoleSessionToken(consoleSessionToken, workspaceId, options = {}) {
|
|
1958
|
+
const constructorOptions = { ...options, consoleSessionToken, workspaceId };
|
|
1959
|
+
if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
|
|
1960
|
+
throw new SeamHttpInvalidOptionsError(
|
|
1961
|
+
"Missing consoleSessionToken or workspaceId"
|
|
1962
|
+
);
|
|
1963
|
+
}
|
|
1964
|
+
return new _SeamHttpNoiseSensorsNoiseThresholds(constructorOptions);
|
|
1965
|
+
}
|
|
1966
|
+
static fromPersonalAccessToken(personalAccessToken, workspaceId, options = {}) {
|
|
1967
|
+
const constructorOptions = { ...options, personalAccessToken, workspaceId };
|
|
1968
|
+
if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
|
|
1969
|
+
throw new SeamHttpInvalidOptionsError(
|
|
1970
|
+
"Missing personalAccessToken or workspaceId"
|
|
1971
|
+
);
|
|
1972
|
+
}
|
|
1973
|
+
return new _SeamHttpNoiseSensorsNoiseThresholds(constructorOptions);
|
|
1974
|
+
}
|
|
1541
1975
|
async create(body) {
|
|
1542
1976
|
await this.client.request({
|
|
1543
1977
|
url: "/noise_sensors/noise_thresholds/create",
|
|
@@ -1614,6 +2048,24 @@ var SeamHttpNoiseSensors = class _SeamHttpNoiseSensors {
|
|
|
1614
2048
|
});
|
|
1615
2049
|
return _SeamHttpNoiseSensors.fromClientSessionToken(token, options);
|
|
1616
2050
|
}
|
|
2051
|
+
static fromConsoleSessionToken(consoleSessionToken, workspaceId, options = {}) {
|
|
2052
|
+
const constructorOptions = { ...options, consoleSessionToken, workspaceId };
|
|
2053
|
+
if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
|
|
2054
|
+
throw new SeamHttpInvalidOptionsError(
|
|
2055
|
+
"Missing consoleSessionToken or workspaceId"
|
|
2056
|
+
);
|
|
2057
|
+
}
|
|
2058
|
+
return new _SeamHttpNoiseSensors(constructorOptions);
|
|
2059
|
+
}
|
|
2060
|
+
static fromPersonalAccessToken(personalAccessToken, workspaceId, options = {}) {
|
|
2061
|
+
const constructorOptions = { ...options, personalAccessToken, workspaceId };
|
|
2062
|
+
if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
|
|
2063
|
+
throw new SeamHttpInvalidOptionsError(
|
|
2064
|
+
"Missing personalAccessToken or workspaceId"
|
|
2065
|
+
);
|
|
2066
|
+
}
|
|
2067
|
+
return new _SeamHttpNoiseSensors(constructorOptions);
|
|
2068
|
+
}
|
|
1617
2069
|
get noiseThresholds() {
|
|
1618
2070
|
return SeamHttpNoiseSensorsNoiseThresholds.fromClient(this.client);
|
|
1619
2071
|
}
|
|
@@ -1659,6 +2111,24 @@ var SeamHttpThermostatsClimateSettingSchedules = class _SeamHttpThermostatsClima
|
|
|
1659
2111
|
options
|
|
1660
2112
|
);
|
|
1661
2113
|
}
|
|
2114
|
+
static fromConsoleSessionToken(consoleSessionToken, workspaceId, options = {}) {
|
|
2115
|
+
const constructorOptions = { ...options, consoleSessionToken, workspaceId };
|
|
2116
|
+
if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
|
|
2117
|
+
throw new SeamHttpInvalidOptionsError(
|
|
2118
|
+
"Missing consoleSessionToken or workspaceId"
|
|
2119
|
+
);
|
|
2120
|
+
}
|
|
2121
|
+
return new _SeamHttpThermostatsClimateSettingSchedules(constructorOptions);
|
|
2122
|
+
}
|
|
2123
|
+
static fromPersonalAccessToken(personalAccessToken, workspaceId, options = {}) {
|
|
2124
|
+
const constructorOptions = { ...options, personalAccessToken, workspaceId };
|
|
2125
|
+
if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
|
|
2126
|
+
throw new SeamHttpInvalidOptionsError(
|
|
2127
|
+
"Missing personalAccessToken or workspaceId"
|
|
2128
|
+
);
|
|
2129
|
+
}
|
|
2130
|
+
return new _SeamHttpThermostatsClimateSettingSchedules(constructorOptions);
|
|
2131
|
+
}
|
|
1662
2132
|
async create(body) {
|
|
1663
2133
|
const { data } = await this.client.request(
|
|
1664
2134
|
{
|
|
@@ -1744,6 +2214,24 @@ var SeamHttpThermostats = class _SeamHttpThermostats {
|
|
|
1744
2214
|
});
|
|
1745
2215
|
return _SeamHttpThermostats.fromClientSessionToken(token, options);
|
|
1746
2216
|
}
|
|
2217
|
+
static fromConsoleSessionToken(consoleSessionToken, workspaceId, options = {}) {
|
|
2218
|
+
const constructorOptions = { ...options, consoleSessionToken, workspaceId };
|
|
2219
|
+
if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
|
|
2220
|
+
throw new SeamHttpInvalidOptionsError(
|
|
2221
|
+
"Missing consoleSessionToken or workspaceId"
|
|
2222
|
+
);
|
|
2223
|
+
}
|
|
2224
|
+
return new _SeamHttpThermostats(constructorOptions);
|
|
2225
|
+
}
|
|
2226
|
+
static fromPersonalAccessToken(personalAccessToken, workspaceId, options = {}) {
|
|
2227
|
+
const constructorOptions = { ...options, personalAccessToken, workspaceId };
|
|
2228
|
+
if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
|
|
2229
|
+
throw new SeamHttpInvalidOptionsError(
|
|
2230
|
+
"Missing personalAccessToken or workspaceId"
|
|
2231
|
+
);
|
|
2232
|
+
}
|
|
2233
|
+
return new _SeamHttpThermostats(constructorOptions);
|
|
2234
|
+
}
|
|
1747
2235
|
get climateSettingSchedules() {
|
|
1748
2236
|
return SeamHttpThermostatsClimateSettingSchedules.fromClient(this.client);
|
|
1749
2237
|
}
|
|
@@ -1807,6 +2295,123 @@ var SeamHttpThermostats = class _SeamHttpThermostats {
|
|
|
1807
2295
|
}
|
|
1808
2296
|
};
|
|
1809
2297
|
|
|
2298
|
+
// src/lib/seam/connect/routes/user-identities.ts
|
|
2299
|
+
var SeamHttpUserIdentities = class _SeamHttpUserIdentities {
|
|
2300
|
+
constructor(apiKeyOrOptions = {}) {
|
|
2301
|
+
const clientOptions = parseOptions(apiKeyOrOptions);
|
|
2302
|
+
this.client = createClient(clientOptions);
|
|
2303
|
+
}
|
|
2304
|
+
static fromClient(client, options = {}) {
|
|
2305
|
+
const constructorOptions = { ...options, client };
|
|
2306
|
+
if (!isSeamHttpOptionsWithClient(constructorOptions)) {
|
|
2307
|
+
throw new SeamHttpInvalidOptionsError("Missing client");
|
|
2308
|
+
}
|
|
2309
|
+
return new _SeamHttpUserIdentities(constructorOptions);
|
|
2310
|
+
}
|
|
2311
|
+
static fromApiKey(apiKey, options = {}) {
|
|
2312
|
+
const constructorOptions = { ...options, apiKey };
|
|
2313
|
+
if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
|
|
2314
|
+
throw new SeamHttpInvalidOptionsError("Missing apiKey");
|
|
2315
|
+
}
|
|
2316
|
+
return new _SeamHttpUserIdentities(constructorOptions);
|
|
2317
|
+
}
|
|
2318
|
+
static fromClientSessionToken(clientSessionToken, options = {}) {
|
|
2319
|
+
const constructorOptions = { ...options, clientSessionToken };
|
|
2320
|
+
if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
|
|
2321
|
+
throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
|
|
2322
|
+
}
|
|
2323
|
+
return new _SeamHttpUserIdentities(constructorOptions);
|
|
2324
|
+
}
|
|
2325
|
+
static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
|
|
2326
|
+
warnOnInsecureuserIdentifierKey(userIdentifierKey);
|
|
2327
|
+
const clientOptions = parseOptions({ ...options, publishableKey });
|
|
2328
|
+
const client = createClient(clientOptions);
|
|
2329
|
+
const clientSessions = SeamHttpClientSessions.fromClient(client);
|
|
2330
|
+
const { token } = await clientSessions.getOrCreate({
|
|
2331
|
+
user_identifier_key: userIdentifierKey
|
|
2332
|
+
});
|
|
2333
|
+
return _SeamHttpUserIdentities.fromClientSessionToken(token, options);
|
|
2334
|
+
}
|
|
2335
|
+
static fromConsoleSessionToken(consoleSessionToken, workspaceId, options = {}) {
|
|
2336
|
+
const constructorOptions = { ...options, consoleSessionToken, workspaceId };
|
|
2337
|
+
if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
|
|
2338
|
+
throw new SeamHttpInvalidOptionsError(
|
|
2339
|
+
"Missing consoleSessionToken or workspaceId"
|
|
2340
|
+
);
|
|
2341
|
+
}
|
|
2342
|
+
return new _SeamHttpUserIdentities(constructorOptions);
|
|
2343
|
+
}
|
|
2344
|
+
static fromPersonalAccessToken(personalAccessToken, workspaceId, options = {}) {
|
|
2345
|
+
const constructorOptions = { ...options, personalAccessToken, workspaceId };
|
|
2346
|
+
if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
|
|
2347
|
+
throw new SeamHttpInvalidOptionsError(
|
|
2348
|
+
"Missing personalAccessToken or workspaceId"
|
|
2349
|
+
);
|
|
2350
|
+
}
|
|
2351
|
+
return new _SeamHttpUserIdentities(constructorOptions);
|
|
2352
|
+
}
|
|
2353
|
+
async addAcsUser(body) {
|
|
2354
|
+
await this.client.request({
|
|
2355
|
+
url: "/user_identities/add_acs_user",
|
|
2356
|
+
method: "post",
|
|
2357
|
+
data: body
|
|
2358
|
+
});
|
|
2359
|
+
}
|
|
2360
|
+
async create(body) {
|
|
2361
|
+
const { data } = await this.client.request({
|
|
2362
|
+
url: "/user_identities/create",
|
|
2363
|
+
method: "post",
|
|
2364
|
+
data: body
|
|
2365
|
+
});
|
|
2366
|
+
return data.user_identity;
|
|
2367
|
+
}
|
|
2368
|
+
async get(body) {
|
|
2369
|
+
const { data } = await this.client.request({
|
|
2370
|
+
url: "/user_identities/get",
|
|
2371
|
+
method: "post",
|
|
2372
|
+
data: body
|
|
2373
|
+
});
|
|
2374
|
+
return data.user_identity;
|
|
2375
|
+
}
|
|
2376
|
+
async grantAccessToDevice(body) {
|
|
2377
|
+
await this.client.request({
|
|
2378
|
+
url: "/user_identities/grant_access_to_device",
|
|
2379
|
+
method: "post",
|
|
2380
|
+
data: body
|
|
2381
|
+
});
|
|
2382
|
+
}
|
|
2383
|
+
async listAccessibleDevices(body) {
|
|
2384
|
+
const { data } = await this.client.request({
|
|
2385
|
+
url: "/user_identities/list_accessible_devices",
|
|
2386
|
+
method: "post",
|
|
2387
|
+
data: body
|
|
2388
|
+
});
|
|
2389
|
+
return data.accessible_devices;
|
|
2390
|
+
}
|
|
2391
|
+
async listAcsUsers(body) {
|
|
2392
|
+
const { data } = await this.client.request({
|
|
2393
|
+
url: "/user_identities/list_acs_users",
|
|
2394
|
+
method: "post",
|
|
2395
|
+
data: body
|
|
2396
|
+
});
|
|
2397
|
+
return data.acs_users;
|
|
2398
|
+
}
|
|
2399
|
+
async removeAcsUser(body) {
|
|
2400
|
+
await this.client.request({
|
|
2401
|
+
url: "/user_identities/remove_acs_user",
|
|
2402
|
+
method: "post",
|
|
2403
|
+
data: body
|
|
2404
|
+
});
|
|
2405
|
+
}
|
|
2406
|
+
async revokeAccessToDevice(body) {
|
|
2407
|
+
await this.client.request({
|
|
2408
|
+
url: "/user_identities/revoke_access_to_device",
|
|
2409
|
+
method: "post",
|
|
2410
|
+
data: body
|
|
2411
|
+
});
|
|
2412
|
+
}
|
|
2413
|
+
};
|
|
2414
|
+
|
|
1810
2415
|
// src/lib/seam/connect/routes/webhooks.ts
|
|
1811
2416
|
var SeamHttpWebhooks = class _SeamHttpWebhooks {
|
|
1812
2417
|
constructor(apiKeyOrOptions = {}) {
|
|
@@ -1844,6 +2449,24 @@ var SeamHttpWebhooks = class _SeamHttpWebhooks {
|
|
|
1844
2449
|
});
|
|
1845
2450
|
return _SeamHttpWebhooks.fromClientSessionToken(token, options);
|
|
1846
2451
|
}
|
|
2452
|
+
static fromConsoleSessionToken(consoleSessionToken, workspaceId, options = {}) {
|
|
2453
|
+
const constructorOptions = { ...options, consoleSessionToken, workspaceId };
|
|
2454
|
+
if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
|
|
2455
|
+
throw new SeamHttpInvalidOptionsError(
|
|
2456
|
+
"Missing consoleSessionToken or workspaceId"
|
|
2457
|
+
);
|
|
2458
|
+
}
|
|
2459
|
+
return new _SeamHttpWebhooks(constructorOptions);
|
|
2460
|
+
}
|
|
2461
|
+
static fromPersonalAccessToken(personalAccessToken, workspaceId, options = {}) {
|
|
2462
|
+
const constructorOptions = { ...options, personalAccessToken, workspaceId };
|
|
2463
|
+
if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
|
|
2464
|
+
throw new SeamHttpInvalidOptionsError(
|
|
2465
|
+
"Missing personalAccessToken or workspaceId"
|
|
2466
|
+
);
|
|
2467
|
+
}
|
|
2468
|
+
return new _SeamHttpWebhooks(constructorOptions);
|
|
2469
|
+
}
|
|
1847
2470
|
async create(body) {
|
|
1848
2471
|
const { data } = await this.client.request({
|
|
1849
2472
|
url: "/webhooks/create",
|
|
@@ -1914,6 +2537,24 @@ var SeamHttpWorkspaces = class _SeamHttpWorkspaces {
|
|
|
1914
2537
|
});
|
|
1915
2538
|
return _SeamHttpWorkspaces.fromClientSessionToken(token, options);
|
|
1916
2539
|
}
|
|
2540
|
+
static fromConsoleSessionToken(consoleSessionToken, workspaceId, options = {}) {
|
|
2541
|
+
const constructorOptions = { ...options, consoleSessionToken, workspaceId };
|
|
2542
|
+
if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
|
|
2543
|
+
throw new SeamHttpInvalidOptionsError(
|
|
2544
|
+
"Missing consoleSessionToken or workspaceId"
|
|
2545
|
+
);
|
|
2546
|
+
}
|
|
2547
|
+
return new _SeamHttpWorkspaces(constructorOptions);
|
|
2548
|
+
}
|
|
2549
|
+
static fromPersonalAccessToken(personalAccessToken, workspaceId, options = {}) {
|
|
2550
|
+
const constructorOptions = { ...options, personalAccessToken, workspaceId };
|
|
2551
|
+
if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
|
|
2552
|
+
throw new SeamHttpInvalidOptionsError(
|
|
2553
|
+
"Missing personalAccessToken or workspaceId"
|
|
2554
|
+
);
|
|
2555
|
+
}
|
|
2556
|
+
return new _SeamHttpWorkspaces(constructorOptions);
|
|
2557
|
+
}
|
|
1917
2558
|
async get(params) {
|
|
1918
2559
|
const { data } = await this.client.request({
|
|
1919
2560
|
url: "/workspaces/get",
|
|
@@ -1976,6 +2617,24 @@ var SeamHttp = class _SeamHttp {
|
|
|
1976
2617
|
});
|
|
1977
2618
|
return _SeamHttp.fromClientSessionToken(token, options);
|
|
1978
2619
|
}
|
|
2620
|
+
static fromConsoleSessionToken(consoleSessionToken, workspaceId, options = {}) {
|
|
2621
|
+
const constructorOptions = { ...options, consoleSessionToken, workspaceId };
|
|
2622
|
+
if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
|
|
2623
|
+
throw new SeamHttpInvalidOptionsError(
|
|
2624
|
+
"Missing consoleSessionToken or workspaceId"
|
|
2625
|
+
);
|
|
2626
|
+
}
|
|
2627
|
+
return new _SeamHttp(constructorOptions);
|
|
2628
|
+
}
|
|
2629
|
+
static fromPersonalAccessToken(personalAccessToken, workspaceId, options = {}) {
|
|
2630
|
+
const constructorOptions = { ...options, personalAccessToken, workspaceId };
|
|
2631
|
+
if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
|
|
2632
|
+
throw new SeamHttpInvalidOptionsError(
|
|
2633
|
+
"Missing personalAccessToken or workspaceId"
|
|
2634
|
+
);
|
|
2635
|
+
}
|
|
2636
|
+
return new _SeamHttp(constructorOptions);
|
|
2637
|
+
}
|
|
1979
2638
|
get accessCodes() {
|
|
1980
2639
|
return SeamHttpAccessCodes.fromClient(this.client);
|
|
1981
2640
|
}
|
|
@@ -2009,6 +2668,9 @@ var SeamHttp = class _SeamHttp {
|
|
|
2009
2668
|
get thermostats() {
|
|
2010
2669
|
return SeamHttpThermostats.fromClient(this.client);
|
|
2011
2670
|
}
|
|
2671
|
+
get userIdentities() {
|
|
2672
|
+
return SeamHttpUserIdentities.fromClient(this.client);
|
|
2673
|
+
}
|
|
2012
2674
|
get webhooks() {
|
|
2013
2675
|
return SeamHttpWebhooks.fromClient(this.client);
|
|
2014
2676
|
}
|
|
@@ -2041,6 +2703,7 @@ exports.SeamHttpNoiseSensorsNoiseThresholds = SeamHttpNoiseSensorsNoiseThreshold
|
|
|
2041
2703
|
exports.SeamHttpThermostats = SeamHttpThermostats;
|
|
2042
2704
|
exports.SeamHttpThermostatsClimateSettingSchedules = SeamHttpThermostatsClimateSettingSchedules;
|
|
2043
2705
|
exports.SeamHttpUnauthorizedError = SeamHttpUnauthorizedError;
|
|
2706
|
+
exports.SeamHttpUserIdentities = SeamHttpUserIdentities;
|
|
2044
2707
|
exports.SeamHttpWebhooks = SeamHttpWebhooks;
|
|
2045
2708
|
exports.SeamHttpWorkspaces = SeamHttpWorkspaces;
|
|
2046
2709
|
exports.UnserializableParamError = UnserializableParamError;
|
|
@@ -2050,6 +2713,8 @@ exports.isSeamHttpInvalidInputError = isSeamHttpInvalidInputError;
|
|
|
2050
2713
|
exports.isSeamHttpOptionsWithApiKey = isSeamHttpOptionsWithApiKey;
|
|
2051
2714
|
exports.isSeamHttpOptionsWithClient = isSeamHttpOptionsWithClient;
|
|
2052
2715
|
exports.isSeamHttpOptionsWithClientSessionToken = isSeamHttpOptionsWithClientSessionToken;
|
|
2716
|
+
exports.isSeamHttpOptionsWithConsoleSessionToken = isSeamHttpOptionsWithConsoleSessionToken;
|
|
2717
|
+
exports.isSeamHttpOptionsWithPersonalAccessToken = isSeamHttpOptionsWithPersonalAccessToken;
|
|
2053
2718
|
exports.isSeamHttpUnauthorizedError = isSeamHttpUnauthorizedError;
|
|
2054
2719
|
exports.paramsSerializer = paramsSerializer;
|
|
2055
2720
|
//# sourceMappingURL=out.js.map
|