@seamapi/http 1.31.0 → 1.33.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/connect.cjs +247 -207
- package/dist/connect.cjs.map +1 -1
- package/dist/connect.d.cts +428 -85
- package/lib/seam/connect/client.js +1 -2
- package/lib/seam/connect/client.js.map +1 -1
- package/lib/seam/connect/parse-options.js +4 -5
- package/lib/seam/connect/parse-options.js.map +1 -1
- package/lib/seam/connect/resolve-action-attempt.d.ts +488 -52
- package/lib/seam/connect/routes/access-codes.d.ts +4 -0
- package/lib/seam/connect/routes/access-codes.js +8 -0
- package/lib/seam/connect/routes/access-codes.js.map +1 -1
- package/lib/seam/connect/routes/acs-encoders.d.ts +4 -0
- package/lib/seam/connect/routes/acs-encoders.js +9 -0
- package/lib/seam/connect/routes/acs-encoders.js.map +1 -1
- package/lib/seam/connect/routes/connected-accounts.d.ts +4 -0
- package/lib/seam/connect/routes/connected-accounts.js +8 -0
- package/lib/seam/connect/routes/connected-accounts.js.map +1 -1
- package/lib/seam/connect/routes/index.d.ts +2 -2
- package/lib/seam/connect/routes/index.js +2 -2
- package/lib/seam/connect/routes/index.js.map +1 -1
- package/lib/seam/connect/routes/{networks.d.ts → thermostats-daily-programs.d.ts} +19 -15
- package/lib/seam/connect/routes/{networks.js → thermostats-daily-programs.js} +23 -14
- package/lib/seam/connect/routes/thermostats-daily-programs.js.map +1 -0
- package/lib/seam/connect/routes/thermostats.d.ts +6 -0
- package/lib/seam/connect/routes/thermostats.js +13 -0
- package/lib/seam/connect/routes/thermostats.js.map +1 -1
- package/lib/seam/connect/routes/{bridges.d.ts → unstable-partner.d.ts} +8 -18
- package/lib/seam/connect/routes/{bridges.js → unstable-partner.js} +8 -25
- package/lib/seam/connect/routes/unstable-partner.js.map +1 -0
- package/lib/seam/connect/routes/workspaces.d.ts +4 -0
- package/lib/seam/connect/routes/workspaces.js +8 -0
- package/lib/seam/connect/routes/workspaces.js.map +1 -1
- package/lib/seam/connect/seam-http.d.ts +1 -2
- package/lib/seam/connect/seam-http.js +1 -4
- 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 +7 -8
- package/src/lib/seam/connect/client.ts +1 -3
- package/src/lib/seam/connect/env.d.ts +2 -0
- package/src/lib/seam/connect/parse-options.ts +4 -5
- package/src/lib/seam/connect/routes/access-codes.ts +20 -0
- package/src/lib/seam/connect/routes/acs-encoders.ts +25 -0
- package/src/lib/seam/connect/routes/connected-accounts.ts +18 -0
- package/src/lib/seam/connect/routes/index.ts +2 -2
- package/src/lib/seam/connect/routes/{networks.ts → thermostats-daily-programs.ts} +64 -31
- package/src/lib/seam/connect/routes/thermostats.ts +33 -0
- package/src/lib/seam/connect/routes/{bridges.ts → unstable-partner.ts} +14 -53
- package/src/lib/seam/connect/routes/workspaces.ts +17 -0
- package/src/lib/seam/connect/seam-http.ts +0 -5
- package/src/lib/version.ts +1 -1
- package/lib/seam/connect/routes/bridges.js.map +0 -1
- package/lib/seam/connect/routes/networks.js.map +0 -1
package/dist/connect.cjs
CHANGED
|
@@ -2,13 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
var axios = require('axios');
|
|
4
4
|
var urlSearchParamsSerializer = require('@seamapi/url-search-params-serializer');
|
|
5
|
-
var axiosBetterStacktrace = require('axios-better-stacktrace');
|
|
6
5
|
var axiosRetry = require('axios-retry');
|
|
7
6
|
|
|
8
7
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
8
|
|
|
10
9
|
var axios__default = /*#__PURE__*/_interopDefault(axios);
|
|
11
|
-
var axiosBetterStacktrace__default = /*#__PURE__*/_interopDefault(axiosBetterStacktrace);
|
|
12
10
|
var axiosRetry__default = /*#__PURE__*/_interopDefault(axiosRetry);
|
|
13
11
|
|
|
14
12
|
var __typeError = (msg) => {
|
|
@@ -77,7 +75,8 @@ var getNormalizedOptions = (apiKeyOrOptions) => {
|
|
|
77
75
|
return {
|
|
78
76
|
...options,
|
|
79
77
|
...apiKey != null ? { apiKey } : {},
|
|
80
|
-
...
|
|
78
|
+
...workspaceId != null ? { workspaceId } : {},
|
|
79
|
+
...personalAccessToken != null ? { personalAccessToken } : {},
|
|
81
80
|
...requestOptions
|
|
82
81
|
};
|
|
83
82
|
};
|
|
@@ -103,10 +102,10 @@ var getPersonalAccessTokenFromEnv = (options) => {
|
|
|
103
102
|
if ("consoleSessionToken" in options && options.consoleSessionToken != null) {
|
|
104
103
|
return null;
|
|
105
104
|
}
|
|
106
|
-
return globalThis.process?.env?.
|
|
105
|
+
return globalThis.process?.env?.SEAM_PERSONAL_ACCESS_TOKEN;
|
|
107
106
|
};
|
|
108
107
|
var getWorkspaceIdFromEnv = () => {
|
|
109
|
-
return globalThis.process?.env?.
|
|
108
|
+
return globalThis.process?.env?.SEAM_WORKSPACE_ID;
|
|
110
109
|
};
|
|
111
110
|
var getEndpointFromEnv = () => {
|
|
112
111
|
if (globalThis.process?.env?.SEAM_API_URL != null) {
|
|
@@ -564,9 +563,9 @@ var getRequestId = (err) => {
|
|
|
564
563
|
var createClient = (options) => {
|
|
565
564
|
const client = axios__default.default.create({
|
|
566
565
|
paramsSerializer: urlSearchParamsSerializer.serializeUrlSearchParams,
|
|
566
|
+
adapter: "fetch",
|
|
567
567
|
...options.axiosOptions
|
|
568
568
|
});
|
|
569
|
-
axiosBetterStacktrace__default.default(axios__default.default);
|
|
570
569
|
axiosRetry__default.default(client, {
|
|
571
570
|
retries: 2,
|
|
572
571
|
retryDelay: axiosRetry.exponentialDelay,
|
|
@@ -1337,6 +1336,14 @@ var SeamHttpAccessCodes = class _SeamHttpAccessCodes {
|
|
|
1337
1336
|
responseKey: "access_code"
|
|
1338
1337
|
});
|
|
1339
1338
|
}
|
|
1339
|
+
reportDeviceConstraints(body) {
|
|
1340
|
+
return new SeamHttpRequest(this, {
|
|
1341
|
+
pathname: "/access_codes/report_device_constraints",
|
|
1342
|
+
method: "post",
|
|
1343
|
+
body,
|
|
1344
|
+
responseKey: void 0
|
|
1345
|
+
});
|
|
1346
|
+
}
|
|
1340
1347
|
update(body) {
|
|
1341
1348
|
return new SeamHttpRequest(this, {
|
|
1342
1349
|
pathname: "/access_codes/update",
|
|
@@ -1828,6 +1835,15 @@ var SeamHttpAcsEncoders = class _SeamHttpAcsEncoders {
|
|
|
1828
1835
|
get simulate() {
|
|
1829
1836
|
return SeamHttpAcsEncodersSimulate.fromClient(this.client, this.defaults);
|
|
1830
1837
|
}
|
|
1838
|
+
encodeAccessMethod(body, options = {}) {
|
|
1839
|
+
return new SeamHttpRequest(this, {
|
|
1840
|
+
pathname: "/acs/encoders/encode_access_method",
|
|
1841
|
+
method: "post",
|
|
1842
|
+
body,
|
|
1843
|
+
responseKey: "action_attempt",
|
|
1844
|
+
options
|
|
1845
|
+
});
|
|
1846
|
+
}
|
|
1831
1847
|
encodeCredential(body, options = {}) {
|
|
1832
1848
|
return new SeamHttpRequest(this, {
|
|
1833
1849
|
pathname: "/acs/encoders/encode_credential",
|
|
@@ -2453,104 +2469,6 @@ var SeamHttpActionAttempts = class _SeamHttpActionAttempts {
|
|
|
2453
2469
|
}
|
|
2454
2470
|
};
|
|
2455
2471
|
|
|
2456
|
-
// src/lib/seam/connect/routes/bridges.ts
|
|
2457
|
-
var SeamHttpBridges = class _SeamHttpBridges {
|
|
2458
|
-
constructor(apiKeyOrOptions = {}) {
|
|
2459
|
-
const options = parseOptions(apiKeyOrOptions);
|
|
2460
|
-
this.client = "client" in options ? options.client : createClient(options);
|
|
2461
|
-
this.defaults = limitToSeamHttpRequestOptions(options);
|
|
2462
|
-
}
|
|
2463
|
-
static fromClient(client, options = {}) {
|
|
2464
|
-
const constructorOptions = { ...options, client };
|
|
2465
|
-
if (!isSeamHttpOptionsWithClient(constructorOptions)) {
|
|
2466
|
-
throw new SeamHttpInvalidOptionsError("Missing client");
|
|
2467
|
-
}
|
|
2468
|
-
return new _SeamHttpBridges(constructorOptions);
|
|
2469
|
-
}
|
|
2470
|
-
static fromApiKey(apiKey, options = {}) {
|
|
2471
|
-
const constructorOptions = { ...options, apiKey };
|
|
2472
|
-
if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
|
|
2473
|
-
throw new SeamHttpInvalidOptionsError("Missing apiKey");
|
|
2474
|
-
}
|
|
2475
|
-
return new _SeamHttpBridges(constructorOptions);
|
|
2476
|
-
}
|
|
2477
|
-
static fromClientSessionToken(clientSessionToken, options = {}) {
|
|
2478
|
-
const constructorOptions = { ...options, clientSessionToken };
|
|
2479
|
-
if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
|
|
2480
|
-
throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
|
|
2481
|
-
}
|
|
2482
|
-
return new _SeamHttpBridges(constructorOptions);
|
|
2483
|
-
}
|
|
2484
|
-
static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
|
|
2485
|
-
warnOnInsecureuserIdentifierKey(userIdentifierKey);
|
|
2486
|
-
const clientOptions = parseOptions({ ...options, publishableKey });
|
|
2487
|
-
if (isSeamHttpOptionsWithClient(clientOptions)) {
|
|
2488
|
-
throw new SeamHttpInvalidOptionsError(
|
|
2489
|
-
"The client option cannot be used with SeamHttp.fromPublishableKey"
|
|
2490
|
-
);
|
|
2491
|
-
}
|
|
2492
|
-
const client = createClient(clientOptions);
|
|
2493
|
-
const clientSessions = SeamHttpClientSessions.fromClient(client);
|
|
2494
|
-
const { token } = await clientSessions.getOrCreate({
|
|
2495
|
-
user_identifier_key: userIdentifierKey
|
|
2496
|
-
});
|
|
2497
|
-
return _SeamHttpBridges.fromClientSessionToken(token, options);
|
|
2498
|
-
}
|
|
2499
|
-
static fromConsoleSessionToken(consoleSessionToken, workspaceId, options = {}) {
|
|
2500
|
-
const constructorOptions = { ...options, consoleSessionToken, workspaceId };
|
|
2501
|
-
if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
|
|
2502
|
-
throw new SeamHttpInvalidOptionsError(
|
|
2503
|
-
"Missing consoleSessionToken or workspaceId"
|
|
2504
|
-
);
|
|
2505
|
-
}
|
|
2506
|
-
return new _SeamHttpBridges(constructorOptions);
|
|
2507
|
-
}
|
|
2508
|
-
static fromPersonalAccessToken(personalAccessToken, workspaceId, options = {}) {
|
|
2509
|
-
const constructorOptions = { ...options, personalAccessToken, workspaceId };
|
|
2510
|
-
if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
|
|
2511
|
-
throw new SeamHttpInvalidOptionsError(
|
|
2512
|
-
"Missing personalAccessToken or workspaceId"
|
|
2513
|
-
);
|
|
2514
|
-
}
|
|
2515
|
-
return new _SeamHttpBridges(constructorOptions);
|
|
2516
|
-
}
|
|
2517
|
-
createPaginator(request) {
|
|
2518
|
-
return new SeamPaginator(this, request);
|
|
2519
|
-
}
|
|
2520
|
-
async updateClientSessionToken(clientSessionToken) {
|
|
2521
|
-
const { headers } = this.client.defaults;
|
|
2522
|
-
const authHeaders = getAuthHeadersForClientSessionToken({
|
|
2523
|
-
clientSessionToken
|
|
2524
|
-
});
|
|
2525
|
-
for (const key of Object.keys(authHeaders)) {
|
|
2526
|
-
if (headers[key] == null) {
|
|
2527
|
-
throw new Error(
|
|
2528
|
-
"Cannot update a clientSessionToken on a client created without a clientSessionToken"
|
|
2529
|
-
);
|
|
2530
|
-
}
|
|
2531
|
-
}
|
|
2532
|
-
this.client.defaults.headers = { ...headers, ...authHeaders };
|
|
2533
|
-
const clientSessions = SeamHttpClientSessions.fromClient(this.client);
|
|
2534
|
-
await clientSessions.get();
|
|
2535
|
-
}
|
|
2536
|
-
get(body) {
|
|
2537
|
-
return new SeamHttpRequest(this, {
|
|
2538
|
-
pathname: "/bridges/get",
|
|
2539
|
-
method: "post",
|
|
2540
|
-
body,
|
|
2541
|
-
responseKey: "bridge"
|
|
2542
|
-
});
|
|
2543
|
-
}
|
|
2544
|
-
list(body) {
|
|
2545
|
-
return new SeamHttpRequest(this, {
|
|
2546
|
-
pathname: "/bridges/list",
|
|
2547
|
-
method: "post",
|
|
2548
|
-
body,
|
|
2549
|
-
responseKey: "bridges"
|
|
2550
|
-
});
|
|
2551
|
-
}
|
|
2552
|
-
};
|
|
2553
|
-
|
|
2554
2472
|
// src/lib/seam/connect/routes/connect-webviews.ts
|
|
2555
2473
|
var SeamHttpConnectWebviews = class _SeamHttpConnectWebviews {
|
|
2556
2474
|
constructor(apiKeyOrOptions = {}) {
|
|
@@ -2769,6 +2687,14 @@ var SeamHttpConnectedAccounts = class _SeamHttpConnectedAccounts {
|
|
|
2769
2687
|
responseKey: "connected_accounts"
|
|
2770
2688
|
});
|
|
2771
2689
|
}
|
|
2690
|
+
sync(body) {
|
|
2691
|
+
return new SeamHttpRequest(this, {
|
|
2692
|
+
pathname: "/connected_accounts/sync",
|
|
2693
|
+
method: "post",
|
|
2694
|
+
body,
|
|
2695
|
+
responseKey: void 0
|
|
2696
|
+
});
|
|
2697
|
+
}
|
|
2772
2698
|
update(body) {
|
|
2773
2699
|
return new SeamHttpRequest(this, {
|
|
2774
2700
|
pathname: "/connected_accounts/update",
|
|
@@ -3325,104 +3251,6 @@ var SeamHttpLocks = class _SeamHttpLocks {
|
|
|
3325
3251
|
}
|
|
3326
3252
|
};
|
|
3327
3253
|
|
|
3328
|
-
// src/lib/seam/connect/routes/networks.ts
|
|
3329
|
-
var SeamHttpNetworks = class _SeamHttpNetworks {
|
|
3330
|
-
constructor(apiKeyOrOptions = {}) {
|
|
3331
|
-
const options = parseOptions(apiKeyOrOptions);
|
|
3332
|
-
this.client = "client" in options ? options.client : createClient(options);
|
|
3333
|
-
this.defaults = limitToSeamHttpRequestOptions(options);
|
|
3334
|
-
}
|
|
3335
|
-
static fromClient(client, options = {}) {
|
|
3336
|
-
const constructorOptions = { ...options, client };
|
|
3337
|
-
if (!isSeamHttpOptionsWithClient(constructorOptions)) {
|
|
3338
|
-
throw new SeamHttpInvalidOptionsError("Missing client");
|
|
3339
|
-
}
|
|
3340
|
-
return new _SeamHttpNetworks(constructorOptions);
|
|
3341
|
-
}
|
|
3342
|
-
static fromApiKey(apiKey, options = {}) {
|
|
3343
|
-
const constructorOptions = { ...options, apiKey };
|
|
3344
|
-
if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
|
|
3345
|
-
throw new SeamHttpInvalidOptionsError("Missing apiKey");
|
|
3346
|
-
}
|
|
3347
|
-
return new _SeamHttpNetworks(constructorOptions);
|
|
3348
|
-
}
|
|
3349
|
-
static fromClientSessionToken(clientSessionToken, options = {}) {
|
|
3350
|
-
const constructorOptions = { ...options, clientSessionToken };
|
|
3351
|
-
if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
|
|
3352
|
-
throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
|
|
3353
|
-
}
|
|
3354
|
-
return new _SeamHttpNetworks(constructorOptions);
|
|
3355
|
-
}
|
|
3356
|
-
static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
|
|
3357
|
-
warnOnInsecureuserIdentifierKey(userIdentifierKey);
|
|
3358
|
-
const clientOptions = parseOptions({ ...options, publishableKey });
|
|
3359
|
-
if (isSeamHttpOptionsWithClient(clientOptions)) {
|
|
3360
|
-
throw new SeamHttpInvalidOptionsError(
|
|
3361
|
-
"The client option cannot be used with SeamHttp.fromPublishableKey"
|
|
3362
|
-
);
|
|
3363
|
-
}
|
|
3364
|
-
const client = createClient(clientOptions);
|
|
3365
|
-
const clientSessions = SeamHttpClientSessions.fromClient(client);
|
|
3366
|
-
const { token } = await clientSessions.getOrCreate({
|
|
3367
|
-
user_identifier_key: userIdentifierKey
|
|
3368
|
-
});
|
|
3369
|
-
return _SeamHttpNetworks.fromClientSessionToken(token, options);
|
|
3370
|
-
}
|
|
3371
|
-
static fromConsoleSessionToken(consoleSessionToken, workspaceId, options = {}) {
|
|
3372
|
-
const constructorOptions = { ...options, consoleSessionToken, workspaceId };
|
|
3373
|
-
if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
|
|
3374
|
-
throw new SeamHttpInvalidOptionsError(
|
|
3375
|
-
"Missing consoleSessionToken or workspaceId"
|
|
3376
|
-
);
|
|
3377
|
-
}
|
|
3378
|
-
return new _SeamHttpNetworks(constructorOptions);
|
|
3379
|
-
}
|
|
3380
|
-
static fromPersonalAccessToken(personalAccessToken, workspaceId, options = {}) {
|
|
3381
|
-
const constructorOptions = { ...options, personalAccessToken, workspaceId };
|
|
3382
|
-
if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
|
|
3383
|
-
throw new SeamHttpInvalidOptionsError(
|
|
3384
|
-
"Missing personalAccessToken or workspaceId"
|
|
3385
|
-
);
|
|
3386
|
-
}
|
|
3387
|
-
return new _SeamHttpNetworks(constructorOptions);
|
|
3388
|
-
}
|
|
3389
|
-
createPaginator(request) {
|
|
3390
|
-
return new SeamPaginator(this, request);
|
|
3391
|
-
}
|
|
3392
|
-
async updateClientSessionToken(clientSessionToken) {
|
|
3393
|
-
const { headers } = this.client.defaults;
|
|
3394
|
-
const authHeaders = getAuthHeadersForClientSessionToken({
|
|
3395
|
-
clientSessionToken
|
|
3396
|
-
});
|
|
3397
|
-
for (const key of Object.keys(authHeaders)) {
|
|
3398
|
-
if (headers[key] == null) {
|
|
3399
|
-
throw new Error(
|
|
3400
|
-
"Cannot update a clientSessionToken on a client created without a clientSessionToken"
|
|
3401
|
-
);
|
|
3402
|
-
}
|
|
3403
|
-
}
|
|
3404
|
-
this.client.defaults.headers = { ...headers, ...authHeaders };
|
|
3405
|
-
const clientSessions = SeamHttpClientSessions.fromClient(this.client);
|
|
3406
|
-
await clientSessions.get();
|
|
3407
|
-
}
|
|
3408
|
-
get(body) {
|
|
3409
|
-
return new SeamHttpRequest(this, {
|
|
3410
|
-
pathname: "/networks/get",
|
|
3411
|
-
method: "post",
|
|
3412
|
-
body,
|
|
3413
|
-
responseKey: "network"
|
|
3414
|
-
});
|
|
3415
|
-
}
|
|
3416
|
-
list(body) {
|
|
3417
|
-
return new SeamHttpRequest(this, {
|
|
3418
|
-
pathname: "/networks/list",
|
|
3419
|
-
method: "post",
|
|
3420
|
-
body,
|
|
3421
|
-
responseKey: "networks"
|
|
3422
|
-
});
|
|
3423
|
-
}
|
|
3424
|
-
};
|
|
3425
|
-
|
|
3426
3254
|
// src/lib/seam/connect/routes/noise-sensors-noise-thresholds.ts
|
|
3427
3255
|
var SeamHttpNoiseSensorsNoiseThresholds = class _SeamHttpNoiseSensorsNoiseThresholds {
|
|
3428
3256
|
constructor(apiKeyOrOptions = {}) {
|
|
@@ -3936,6 +3764,116 @@ var SeamHttpPhones = class _SeamHttpPhones {
|
|
|
3936
3764
|
}
|
|
3937
3765
|
};
|
|
3938
3766
|
|
|
3767
|
+
// src/lib/seam/connect/routes/thermostats-daily-programs.ts
|
|
3768
|
+
var SeamHttpThermostatsDailyPrograms = class _SeamHttpThermostatsDailyPrograms {
|
|
3769
|
+
constructor(apiKeyOrOptions = {}) {
|
|
3770
|
+
const options = parseOptions(apiKeyOrOptions);
|
|
3771
|
+
this.client = "client" in options ? options.client : createClient(options);
|
|
3772
|
+
this.defaults = limitToSeamHttpRequestOptions(options);
|
|
3773
|
+
}
|
|
3774
|
+
static fromClient(client, options = {}) {
|
|
3775
|
+
const constructorOptions = { ...options, client };
|
|
3776
|
+
if (!isSeamHttpOptionsWithClient(constructorOptions)) {
|
|
3777
|
+
throw new SeamHttpInvalidOptionsError("Missing client");
|
|
3778
|
+
}
|
|
3779
|
+
return new _SeamHttpThermostatsDailyPrograms(constructorOptions);
|
|
3780
|
+
}
|
|
3781
|
+
static fromApiKey(apiKey, options = {}) {
|
|
3782
|
+
const constructorOptions = { ...options, apiKey };
|
|
3783
|
+
if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
|
|
3784
|
+
throw new SeamHttpInvalidOptionsError("Missing apiKey");
|
|
3785
|
+
}
|
|
3786
|
+
return new _SeamHttpThermostatsDailyPrograms(constructorOptions);
|
|
3787
|
+
}
|
|
3788
|
+
static fromClientSessionToken(clientSessionToken, options = {}) {
|
|
3789
|
+
const constructorOptions = { ...options, clientSessionToken };
|
|
3790
|
+
if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
|
|
3791
|
+
throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
|
|
3792
|
+
}
|
|
3793
|
+
return new _SeamHttpThermostatsDailyPrograms(constructorOptions);
|
|
3794
|
+
}
|
|
3795
|
+
static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
|
|
3796
|
+
warnOnInsecureuserIdentifierKey(userIdentifierKey);
|
|
3797
|
+
const clientOptions = parseOptions({ ...options, publishableKey });
|
|
3798
|
+
if (isSeamHttpOptionsWithClient(clientOptions)) {
|
|
3799
|
+
throw new SeamHttpInvalidOptionsError(
|
|
3800
|
+
"The client option cannot be used with SeamHttp.fromPublishableKey"
|
|
3801
|
+
);
|
|
3802
|
+
}
|
|
3803
|
+
const client = createClient(clientOptions);
|
|
3804
|
+
const clientSessions = SeamHttpClientSessions.fromClient(client);
|
|
3805
|
+
const { token } = await clientSessions.getOrCreate({
|
|
3806
|
+
user_identifier_key: userIdentifierKey
|
|
3807
|
+
});
|
|
3808
|
+
return _SeamHttpThermostatsDailyPrograms.fromClientSessionToken(
|
|
3809
|
+
token,
|
|
3810
|
+
options
|
|
3811
|
+
);
|
|
3812
|
+
}
|
|
3813
|
+
static fromConsoleSessionToken(consoleSessionToken, workspaceId, options = {}) {
|
|
3814
|
+
const constructorOptions = { ...options, consoleSessionToken, workspaceId };
|
|
3815
|
+
if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
|
|
3816
|
+
throw new SeamHttpInvalidOptionsError(
|
|
3817
|
+
"Missing consoleSessionToken or workspaceId"
|
|
3818
|
+
);
|
|
3819
|
+
}
|
|
3820
|
+
return new _SeamHttpThermostatsDailyPrograms(constructorOptions);
|
|
3821
|
+
}
|
|
3822
|
+
static fromPersonalAccessToken(personalAccessToken, workspaceId, options = {}) {
|
|
3823
|
+
const constructorOptions = { ...options, personalAccessToken, workspaceId };
|
|
3824
|
+
if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
|
|
3825
|
+
throw new SeamHttpInvalidOptionsError(
|
|
3826
|
+
"Missing personalAccessToken or workspaceId"
|
|
3827
|
+
);
|
|
3828
|
+
}
|
|
3829
|
+
return new _SeamHttpThermostatsDailyPrograms(constructorOptions);
|
|
3830
|
+
}
|
|
3831
|
+
createPaginator(request) {
|
|
3832
|
+
return new SeamPaginator(this, request);
|
|
3833
|
+
}
|
|
3834
|
+
async updateClientSessionToken(clientSessionToken) {
|
|
3835
|
+
const { headers } = this.client.defaults;
|
|
3836
|
+
const authHeaders = getAuthHeadersForClientSessionToken({
|
|
3837
|
+
clientSessionToken
|
|
3838
|
+
});
|
|
3839
|
+
for (const key of Object.keys(authHeaders)) {
|
|
3840
|
+
if (headers[key] == null) {
|
|
3841
|
+
throw new Error(
|
|
3842
|
+
"Cannot update a clientSessionToken on a client created without a clientSessionToken"
|
|
3843
|
+
);
|
|
3844
|
+
}
|
|
3845
|
+
}
|
|
3846
|
+
this.client.defaults.headers = { ...headers, ...authHeaders };
|
|
3847
|
+
const clientSessions = SeamHttpClientSessions.fromClient(this.client);
|
|
3848
|
+
await clientSessions.get();
|
|
3849
|
+
}
|
|
3850
|
+
create(body) {
|
|
3851
|
+
return new SeamHttpRequest(this, {
|
|
3852
|
+
pathname: "/thermostats/daily_programs/create",
|
|
3853
|
+
method: "post",
|
|
3854
|
+
body,
|
|
3855
|
+
responseKey: "thermostat_daily_program"
|
|
3856
|
+
});
|
|
3857
|
+
}
|
|
3858
|
+
delete(body) {
|
|
3859
|
+
return new SeamHttpRequest(this, {
|
|
3860
|
+
pathname: "/thermostats/daily_programs/delete",
|
|
3861
|
+
method: "post",
|
|
3862
|
+
body,
|
|
3863
|
+
responseKey: void 0
|
|
3864
|
+
});
|
|
3865
|
+
}
|
|
3866
|
+
update(body, options = {}) {
|
|
3867
|
+
return new SeamHttpRequest(this, {
|
|
3868
|
+
pathname: "/thermostats/daily_programs/update",
|
|
3869
|
+
method: "post",
|
|
3870
|
+
body,
|
|
3871
|
+
responseKey: "action_attempt",
|
|
3872
|
+
options
|
|
3873
|
+
});
|
|
3874
|
+
}
|
|
3875
|
+
};
|
|
3876
|
+
|
|
3939
3877
|
// src/lib/seam/connect/routes/thermostats-schedules.ts
|
|
3940
3878
|
var SeamHttpThermostatsSchedules = class _SeamHttpThermostatsSchedules {
|
|
3941
3879
|
constructor(apiKeyOrOptions = {}) {
|
|
@@ -4242,6 +4180,12 @@ var SeamHttpThermostats = class _SeamHttpThermostats {
|
|
|
4242
4180
|
get simulate() {
|
|
4243
4181
|
return SeamHttpThermostatsSimulate.fromClient(this.client, this.defaults);
|
|
4244
4182
|
}
|
|
4183
|
+
get dailyPrograms() {
|
|
4184
|
+
return SeamHttpThermostatsDailyPrograms.fromClient(
|
|
4185
|
+
this.client,
|
|
4186
|
+
this.defaults
|
|
4187
|
+
);
|
|
4188
|
+
}
|
|
4245
4189
|
activateClimatePreset(body, options = {}) {
|
|
4246
4190
|
return new SeamHttpRequest(this, {
|
|
4247
4191
|
pathname: "/thermostats/activate_climate_preset",
|
|
@@ -4353,6 +4297,97 @@ var SeamHttpThermostats = class _SeamHttpThermostats {
|
|
|
4353
4297
|
responseKey: void 0
|
|
4354
4298
|
});
|
|
4355
4299
|
}
|
|
4300
|
+
updateWeeklyProgram(body, options = {}) {
|
|
4301
|
+
return new SeamHttpRequest(this, {
|
|
4302
|
+
pathname: "/thermostats/update_weekly_program",
|
|
4303
|
+
method: "post",
|
|
4304
|
+
body,
|
|
4305
|
+
responseKey: "action_attempt",
|
|
4306
|
+
options
|
|
4307
|
+
});
|
|
4308
|
+
}
|
|
4309
|
+
};
|
|
4310
|
+
|
|
4311
|
+
// src/lib/seam/connect/routes/unstable-partner.ts
|
|
4312
|
+
var SeamHttpUnstablePartner = class _SeamHttpUnstablePartner {
|
|
4313
|
+
constructor(apiKeyOrOptions = {}) {
|
|
4314
|
+
const options = parseOptions(apiKeyOrOptions);
|
|
4315
|
+
this.client = "client" in options ? options.client : createClient(options);
|
|
4316
|
+
this.defaults = limitToSeamHttpRequestOptions(options);
|
|
4317
|
+
}
|
|
4318
|
+
static fromClient(client, options = {}) {
|
|
4319
|
+
const constructorOptions = { ...options, client };
|
|
4320
|
+
if (!isSeamHttpOptionsWithClient(constructorOptions)) {
|
|
4321
|
+
throw new SeamHttpInvalidOptionsError("Missing client");
|
|
4322
|
+
}
|
|
4323
|
+
return new _SeamHttpUnstablePartner(constructorOptions);
|
|
4324
|
+
}
|
|
4325
|
+
static fromApiKey(apiKey, options = {}) {
|
|
4326
|
+
const constructorOptions = { ...options, apiKey };
|
|
4327
|
+
if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
|
|
4328
|
+
throw new SeamHttpInvalidOptionsError("Missing apiKey");
|
|
4329
|
+
}
|
|
4330
|
+
return new _SeamHttpUnstablePartner(constructorOptions);
|
|
4331
|
+
}
|
|
4332
|
+
static fromClientSessionToken(clientSessionToken, options = {}) {
|
|
4333
|
+
const constructorOptions = { ...options, clientSessionToken };
|
|
4334
|
+
if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
|
|
4335
|
+
throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
|
|
4336
|
+
}
|
|
4337
|
+
return new _SeamHttpUnstablePartner(constructorOptions);
|
|
4338
|
+
}
|
|
4339
|
+
static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
|
|
4340
|
+
warnOnInsecureuserIdentifierKey(userIdentifierKey);
|
|
4341
|
+
const clientOptions = parseOptions({ ...options, publishableKey });
|
|
4342
|
+
if (isSeamHttpOptionsWithClient(clientOptions)) {
|
|
4343
|
+
throw new SeamHttpInvalidOptionsError(
|
|
4344
|
+
"The client option cannot be used with SeamHttp.fromPublishableKey"
|
|
4345
|
+
);
|
|
4346
|
+
}
|
|
4347
|
+
const client = createClient(clientOptions);
|
|
4348
|
+
const clientSessions = SeamHttpClientSessions.fromClient(client);
|
|
4349
|
+
const { token } = await clientSessions.getOrCreate({
|
|
4350
|
+
user_identifier_key: userIdentifierKey
|
|
4351
|
+
});
|
|
4352
|
+
return _SeamHttpUnstablePartner.fromClientSessionToken(token, options);
|
|
4353
|
+
}
|
|
4354
|
+
static fromConsoleSessionToken(consoleSessionToken, workspaceId, options = {}) {
|
|
4355
|
+
const constructorOptions = { ...options, consoleSessionToken, workspaceId };
|
|
4356
|
+
if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
|
|
4357
|
+
throw new SeamHttpInvalidOptionsError(
|
|
4358
|
+
"Missing consoleSessionToken or workspaceId"
|
|
4359
|
+
);
|
|
4360
|
+
}
|
|
4361
|
+
return new _SeamHttpUnstablePartner(constructorOptions);
|
|
4362
|
+
}
|
|
4363
|
+
static fromPersonalAccessToken(personalAccessToken, workspaceId, options = {}) {
|
|
4364
|
+
const constructorOptions = { ...options, personalAccessToken, workspaceId };
|
|
4365
|
+
if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
|
|
4366
|
+
throw new SeamHttpInvalidOptionsError(
|
|
4367
|
+
"Missing personalAccessToken or workspaceId"
|
|
4368
|
+
);
|
|
4369
|
+
}
|
|
4370
|
+
return new _SeamHttpUnstablePartner(constructorOptions);
|
|
4371
|
+
}
|
|
4372
|
+
createPaginator(request) {
|
|
4373
|
+
return new SeamPaginator(this, request);
|
|
4374
|
+
}
|
|
4375
|
+
async updateClientSessionToken(clientSessionToken) {
|
|
4376
|
+
const { headers } = this.client.defaults;
|
|
4377
|
+
const authHeaders = getAuthHeadersForClientSessionToken({
|
|
4378
|
+
clientSessionToken
|
|
4379
|
+
});
|
|
4380
|
+
for (const key of Object.keys(authHeaders)) {
|
|
4381
|
+
if (headers[key] == null) {
|
|
4382
|
+
throw new Error(
|
|
4383
|
+
"Cannot update a clientSessionToken on a client created without a clientSessionToken"
|
|
4384
|
+
);
|
|
4385
|
+
}
|
|
4386
|
+
}
|
|
4387
|
+
this.client.defaults.headers = { ...headers, ...authHeaders };
|
|
4388
|
+
const clientSessions = SeamHttpClientSessions.fromClient(this.client);
|
|
4389
|
+
await clientSessions.get();
|
|
4390
|
+
}
|
|
4356
4391
|
};
|
|
4357
4392
|
|
|
4358
4393
|
// src/lib/seam/connect/routes/user-identities-enrollment-automations.ts
|
|
@@ -4899,6 +4934,14 @@ var SeamHttpWorkspaces = class _SeamHttpWorkspaces {
|
|
|
4899
4934
|
options
|
|
4900
4935
|
});
|
|
4901
4936
|
}
|
|
4937
|
+
update(body) {
|
|
4938
|
+
return new SeamHttpRequest(this, {
|
|
4939
|
+
pathname: "/workspaces/update",
|
|
4940
|
+
method: "post",
|
|
4941
|
+
body,
|
|
4942
|
+
responseKey: void 0
|
|
4943
|
+
});
|
|
4944
|
+
}
|
|
4902
4945
|
};
|
|
4903
4946
|
|
|
4904
4947
|
// src/lib/seam/connect/seam-http.ts
|
|
@@ -5009,9 +5052,6 @@ var _SeamHttp = class _SeamHttp {
|
|
|
5009
5052
|
get locks() {
|
|
5010
5053
|
return SeamHttpLocks.fromClient(this.client, this.defaults);
|
|
5011
5054
|
}
|
|
5012
|
-
get networks() {
|
|
5013
|
-
return SeamHttpNetworks.fromClient(this.client, this.defaults);
|
|
5014
|
-
}
|
|
5015
5055
|
get noiseSensors() {
|
|
5016
5056
|
return SeamHttpNoiseSensors.fromClient(this.client, this.defaults);
|
|
5017
5057
|
}
|
|
@@ -5092,7 +5132,6 @@ exports.SeamHttpAcsSystems = SeamHttpAcsSystems;
|
|
|
5092
5132
|
exports.SeamHttpAcsUsers = SeamHttpAcsUsers;
|
|
5093
5133
|
exports.SeamHttpActionAttempts = SeamHttpActionAttempts;
|
|
5094
5134
|
exports.SeamHttpApiError = SeamHttpApiError;
|
|
5095
|
-
exports.SeamHttpBridges = SeamHttpBridges;
|
|
5096
5135
|
exports.SeamHttpClientSessions = SeamHttpClientSessions;
|
|
5097
5136
|
exports.SeamHttpConnectWebviews = SeamHttpConnectWebviews;
|
|
5098
5137
|
exports.SeamHttpConnectedAccounts = SeamHttpConnectedAccounts;
|
|
@@ -5106,7 +5145,6 @@ exports.SeamHttpInvalidTokenError = SeamHttpInvalidTokenError;
|
|
|
5106
5145
|
exports.SeamHttpLocks = SeamHttpLocks;
|
|
5107
5146
|
exports.SeamHttpMultiWorkspace = SeamHttpMultiWorkspace;
|
|
5108
5147
|
exports.SeamHttpMultiWorkspaceInvalidOptionsError = SeamHttpMultiWorkspaceInvalidOptionsError;
|
|
5109
|
-
exports.SeamHttpNetworks = SeamHttpNetworks;
|
|
5110
5148
|
exports.SeamHttpNoiseSensors = SeamHttpNoiseSensors;
|
|
5111
5149
|
exports.SeamHttpNoiseSensorsNoiseThresholds = SeamHttpNoiseSensorsNoiseThresholds;
|
|
5112
5150
|
exports.SeamHttpNoiseSensorsSimulate = SeamHttpNoiseSensorsSimulate;
|
|
@@ -5114,9 +5152,11 @@ exports.SeamHttpPhones = SeamHttpPhones;
|
|
|
5114
5152
|
exports.SeamHttpPhonesSimulate = SeamHttpPhonesSimulate;
|
|
5115
5153
|
exports.SeamHttpRequest = SeamHttpRequest;
|
|
5116
5154
|
exports.SeamHttpThermostats = SeamHttpThermostats;
|
|
5155
|
+
exports.SeamHttpThermostatsDailyPrograms = SeamHttpThermostatsDailyPrograms;
|
|
5117
5156
|
exports.SeamHttpThermostatsSchedules = SeamHttpThermostatsSchedules;
|
|
5118
5157
|
exports.SeamHttpThermostatsSimulate = SeamHttpThermostatsSimulate;
|
|
5119
5158
|
exports.SeamHttpUnauthorizedError = SeamHttpUnauthorizedError;
|
|
5159
|
+
exports.SeamHttpUnstablePartner = SeamHttpUnstablePartner;
|
|
5120
5160
|
exports.SeamHttpUserIdentities = SeamHttpUserIdentities;
|
|
5121
5161
|
exports.SeamHttpUserIdentitiesEnrollmentAutomations = SeamHttpUserIdentitiesEnrollmentAutomations;
|
|
5122
5162
|
exports.SeamHttpWebhooks = SeamHttpWebhooks;
|