@seamapi/http 1.19.0 → 1.21.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 +187 -0
- package/dist/connect.cjs.map +1 -1
- package/dist/connect.d.cts +40 -1
- package/lib/seam/connect/routes/bridges.d.ts +21 -0
- package/lib/seam/connect/routes/bridges.js +88 -0
- package/lib/seam/connect/routes/bridges.js.map +1 -0
- package/lib/seam/connect/routes/index.d.ts +2 -0
- package/lib/seam/connect/routes/index.js +2 -0
- package/lib/seam/connect/routes/index.js.map +1 -1
- package/lib/seam/connect/routes/thermostats-simulate.d.ts +25 -0
- package/lib/seam/connect/routes/thermostats-simulate.js +96 -0
- package/lib/seam/connect/routes/thermostats-simulate.js.map +1 -0
- package/lib/seam/connect/routes/thermostats.d.ts +2 -0
- package/lib/seam/connect/routes/thermostats.js +4 -0
- package/lib/seam/connect/routes/thermostats.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +3 -3
- package/src/lib/seam/connect/routes/bridges.ts +173 -0
- package/src/lib/seam/connect/routes/index.ts +2 -0
- package/src/lib/seam/connect/routes/thermostats-simulate.ts +196 -0
- package/src/lib/seam/connect/routes/thermostats.ts +5 -0
- package/src/lib/version.ts +1 -1
package/dist/connect.cjs
CHANGED
|
@@ -2784,6 +2784,93 @@ var SeamHttpActionAttempts = class _SeamHttpActionAttempts {
|
|
|
2784
2784
|
}
|
|
2785
2785
|
};
|
|
2786
2786
|
|
|
2787
|
+
// src/lib/seam/connect/routes/bridges.ts
|
|
2788
|
+
var SeamHttpBridges = class _SeamHttpBridges {
|
|
2789
|
+
constructor(apiKeyOrOptions = {}) {
|
|
2790
|
+
const options = parseOptions(apiKeyOrOptions);
|
|
2791
|
+
this.client = "client" in options ? options.client : createClient(options);
|
|
2792
|
+
this.defaults = limitToSeamHttpRequestOptions(options);
|
|
2793
|
+
}
|
|
2794
|
+
static fromClient(client, options = {}) {
|
|
2795
|
+
const constructorOptions = { ...options, client };
|
|
2796
|
+
if (!isSeamHttpOptionsWithClient(constructorOptions)) {
|
|
2797
|
+
throw new SeamHttpInvalidOptionsError("Missing client");
|
|
2798
|
+
}
|
|
2799
|
+
return new _SeamHttpBridges(constructorOptions);
|
|
2800
|
+
}
|
|
2801
|
+
static fromApiKey(apiKey, options = {}) {
|
|
2802
|
+
const constructorOptions = { ...options, apiKey };
|
|
2803
|
+
if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
|
|
2804
|
+
throw new SeamHttpInvalidOptionsError("Missing apiKey");
|
|
2805
|
+
}
|
|
2806
|
+
return new _SeamHttpBridges(constructorOptions);
|
|
2807
|
+
}
|
|
2808
|
+
static fromClientSessionToken(clientSessionToken, options = {}) {
|
|
2809
|
+
const constructorOptions = { ...options, clientSessionToken };
|
|
2810
|
+
if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
|
|
2811
|
+
throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
|
|
2812
|
+
}
|
|
2813
|
+
return new _SeamHttpBridges(constructorOptions);
|
|
2814
|
+
}
|
|
2815
|
+
static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
|
|
2816
|
+
warnOnInsecureuserIdentifierKey(userIdentifierKey);
|
|
2817
|
+
const clientOptions = parseOptions({ ...options, publishableKey });
|
|
2818
|
+
if (isSeamHttpOptionsWithClient(clientOptions)) {
|
|
2819
|
+
throw new SeamHttpInvalidOptionsError(
|
|
2820
|
+
"The client option cannot be used with SeamHttp.fromPublishableKey"
|
|
2821
|
+
);
|
|
2822
|
+
}
|
|
2823
|
+
const client = createClient(clientOptions);
|
|
2824
|
+
const clientSessions = SeamHttpClientSessions.fromClient(client);
|
|
2825
|
+
const { token } = await clientSessions.getOrCreate({
|
|
2826
|
+
user_identifier_key: userIdentifierKey
|
|
2827
|
+
});
|
|
2828
|
+
return _SeamHttpBridges.fromClientSessionToken(token, options);
|
|
2829
|
+
}
|
|
2830
|
+
static fromConsoleSessionToken(consoleSessionToken, workspaceId, options = {}) {
|
|
2831
|
+
const constructorOptions = { ...options, consoleSessionToken, workspaceId };
|
|
2832
|
+
if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
|
|
2833
|
+
throw new SeamHttpInvalidOptionsError(
|
|
2834
|
+
"Missing consoleSessionToken or workspaceId"
|
|
2835
|
+
);
|
|
2836
|
+
}
|
|
2837
|
+
return new _SeamHttpBridges(constructorOptions);
|
|
2838
|
+
}
|
|
2839
|
+
static fromPersonalAccessToken(personalAccessToken, workspaceId, options = {}) {
|
|
2840
|
+
const constructorOptions = { ...options, personalAccessToken, workspaceId };
|
|
2841
|
+
if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
|
|
2842
|
+
throw new SeamHttpInvalidOptionsError(
|
|
2843
|
+
"Missing personalAccessToken or workspaceId"
|
|
2844
|
+
);
|
|
2845
|
+
}
|
|
2846
|
+
return new _SeamHttpBridges(constructorOptions);
|
|
2847
|
+
}
|
|
2848
|
+
async updateClientSessionToken(clientSessionToken) {
|
|
2849
|
+
const { headers } = this.client.defaults;
|
|
2850
|
+
const authHeaders = getAuthHeadersForClientSessionToken({
|
|
2851
|
+
clientSessionToken
|
|
2852
|
+
});
|
|
2853
|
+
for (const key of Object.keys(authHeaders)) {
|
|
2854
|
+
if (headers[key] == null) {
|
|
2855
|
+
throw new Error(
|
|
2856
|
+
"Cannot update a clientSessionToken on a client created without a clientSessionToken"
|
|
2857
|
+
);
|
|
2858
|
+
}
|
|
2859
|
+
}
|
|
2860
|
+
this.client.defaults.headers = { ...headers, ...authHeaders };
|
|
2861
|
+
const clientSessions = SeamHttpClientSessions.fromClient(this.client);
|
|
2862
|
+
await clientSessions.get();
|
|
2863
|
+
}
|
|
2864
|
+
get(body) {
|
|
2865
|
+
return new SeamHttpRequest(this, {
|
|
2866
|
+
path: "/bridges/get",
|
|
2867
|
+
method: "post",
|
|
2868
|
+
body,
|
|
2869
|
+
responseKey: "bridge"
|
|
2870
|
+
});
|
|
2871
|
+
}
|
|
2872
|
+
};
|
|
2873
|
+
|
|
2787
2874
|
// src/lib/seam/connect/routes/connect-webviews.ts
|
|
2788
2875
|
var SeamHttpConnectWebviews = class _SeamHttpConnectWebviews {
|
|
2789
2876
|
constructor(apiKeyOrOptions = {}) {
|
|
@@ -4249,6 +4336,101 @@ var SeamHttpThermostatsSchedules = class _SeamHttpThermostatsSchedules {
|
|
|
4249
4336
|
}
|
|
4250
4337
|
};
|
|
4251
4338
|
|
|
4339
|
+
// src/lib/seam/connect/routes/thermostats-simulate.ts
|
|
4340
|
+
var SeamHttpThermostatsSimulate = class _SeamHttpThermostatsSimulate {
|
|
4341
|
+
constructor(apiKeyOrOptions = {}) {
|
|
4342
|
+
const options = parseOptions(apiKeyOrOptions);
|
|
4343
|
+
this.client = "client" in options ? options.client : createClient(options);
|
|
4344
|
+
this.defaults = limitToSeamHttpRequestOptions(options);
|
|
4345
|
+
}
|
|
4346
|
+
static fromClient(client, options = {}) {
|
|
4347
|
+
const constructorOptions = { ...options, client };
|
|
4348
|
+
if (!isSeamHttpOptionsWithClient(constructorOptions)) {
|
|
4349
|
+
throw new SeamHttpInvalidOptionsError("Missing client");
|
|
4350
|
+
}
|
|
4351
|
+
return new _SeamHttpThermostatsSimulate(constructorOptions);
|
|
4352
|
+
}
|
|
4353
|
+
static fromApiKey(apiKey, options = {}) {
|
|
4354
|
+
const constructorOptions = { ...options, apiKey };
|
|
4355
|
+
if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
|
|
4356
|
+
throw new SeamHttpInvalidOptionsError("Missing apiKey");
|
|
4357
|
+
}
|
|
4358
|
+
return new _SeamHttpThermostatsSimulate(constructorOptions);
|
|
4359
|
+
}
|
|
4360
|
+
static fromClientSessionToken(clientSessionToken, options = {}) {
|
|
4361
|
+
const constructorOptions = { ...options, clientSessionToken };
|
|
4362
|
+
if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
|
|
4363
|
+
throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
|
|
4364
|
+
}
|
|
4365
|
+
return new _SeamHttpThermostatsSimulate(constructorOptions);
|
|
4366
|
+
}
|
|
4367
|
+
static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
|
|
4368
|
+
warnOnInsecureuserIdentifierKey(userIdentifierKey);
|
|
4369
|
+
const clientOptions = parseOptions({ ...options, publishableKey });
|
|
4370
|
+
if (isSeamHttpOptionsWithClient(clientOptions)) {
|
|
4371
|
+
throw new SeamHttpInvalidOptionsError(
|
|
4372
|
+
"The client option cannot be used with SeamHttp.fromPublishableKey"
|
|
4373
|
+
);
|
|
4374
|
+
}
|
|
4375
|
+
const client = createClient(clientOptions);
|
|
4376
|
+
const clientSessions = SeamHttpClientSessions.fromClient(client);
|
|
4377
|
+
const { token } = await clientSessions.getOrCreate({
|
|
4378
|
+
user_identifier_key: userIdentifierKey
|
|
4379
|
+
});
|
|
4380
|
+
return _SeamHttpThermostatsSimulate.fromClientSessionToken(token, options);
|
|
4381
|
+
}
|
|
4382
|
+
static fromConsoleSessionToken(consoleSessionToken, workspaceId, options = {}) {
|
|
4383
|
+
const constructorOptions = { ...options, consoleSessionToken, workspaceId };
|
|
4384
|
+
if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
|
|
4385
|
+
throw new SeamHttpInvalidOptionsError(
|
|
4386
|
+
"Missing consoleSessionToken or workspaceId"
|
|
4387
|
+
);
|
|
4388
|
+
}
|
|
4389
|
+
return new _SeamHttpThermostatsSimulate(constructorOptions);
|
|
4390
|
+
}
|
|
4391
|
+
static fromPersonalAccessToken(personalAccessToken, workspaceId, options = {}) {
|
|
4392
|
+
const constructorOptions = { ...options, personalAccessToken, workspaceId };
|
|
4393
|
+
if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
|
|
4394
|
+
throw new SeamHttpInvalidOptionsError(
|
|
4395
|
+
"Missing personalAccessToken or workspaceId"
|
|
4396
|
+
);
|
|
4397
|
+
}
|
|
4398
|
+
return new _SeamHttpThermostatsSimulate(constructorOptions);
|
|
4399
|
+
}
|
|
4400
|
+
async updateClientSessionToken(clientSessionToken) {
|
|
4401
|
+
const { headers } = this.client.defaults;
|
|
4402
|
+
const authHeaders = getAuthHeadersForClientSessionToken({
|
|
4403
|
+
clientSessionToken
|
|
4404
|
+
});
|
|
4405
|
+
for (const key of Object.keys(authHeaders)) {
|
|
4406
|
+
if (headers[key] == null) {
|
|
4407
|
+
throw new Error(
|
|
4408
|
+
"Cannot update a clientSessionToken on a client created without a clientSessionToken"
|
|
4409
|
+
);
|
|
4410
|
+
}
|
|
4411
|
+
}
|
|
4412
|
+
this.client.defaults.headers = { ...headers, ...authHeaders };
|
|
4413
|
+
const clientSessions = SeamHttpClientSessions.fromClient(this.client);
|
|
4414
|
+
await clientSessions.get();
|
|
4415
|
+
}
|
|
4416
|
+
hvacModeAdjusted(body) {
|
|
4417
|
+
return new SeamHttpRequest(this, {
|
|
4418
|
+
path: "/thermostats/simulate/hvac_mode_adjusted",
|
|
4419
|
+
method: "post",
|
|
4420
|
+
body,
|
|
4421
|
+
responseKey: void 0
|
|
4422
|
+
});
|
|
4423
|
+
}
|
|
4424
|
+
temperatureReached(body) {
|
|
4425
|
+
return new SeamHttpRequest(this, {
|
|
4426
|
+
path: "/thermostats/simulate/temperature_reached",
|
|
4427
|
+
method: "post",
|
|
4428
|
+
body,
|
|
4429
|
+
responseKey: void 0
|
|
4430
|
+
});
|
|
4431
|
+
}
|
|
4432
|
+
};
|
|
4433
|
+
|
|
4252
4434
|
// src/lib/seam/connect/routes/thermostats.ts
|
|
4253
4435
|
var SeamHttpThermostats = class _SeamHttpThermostats {
|
|
4254
4436
|
constructor(apiKeyOrOptions = {}) {
|
|
@@ -4329,6 +4511,9 @@ var SeamHttpThermostats = class _SeamHttpThermostats {
|
|
|
4329
4511
|
get schedules() {
|
|
4330
4512
|
return SeamHttpThermostatsSchedules.fromClient(this.client, this.defaults);
|
|
4331
4513
|
}
|
|
4514
|
+
get simulate() {
|
|
4515
|
+
return SeamHttpThermostatsSimulate.fromClient(this.client, this.defaults);
|
|
4516
|
+
}
|
|
4332
4517
|
activateClimatePreset(body, options = {}) {
|
|
4333
4518
|
return new SeamHttpRequest(this, {
|
|
4334
4519
|
path: "/thermostats/activate_climate_preset",
|
|
@@ -5169,6 +5354,7 @@ exports.SeamHttpAcsUsers = SeamHttpAcsUsers;
|
|
|
5169
5354
|
exports.SeamHttpAcsUsersUnmanaged = SeamHttpAcsUsersUnmanaged;
|
|
5170
5355
|
exports.SeamHttpActionAttempts = SeamHttpActionAttempts;
|
|
5171
5356
|
exports.SeamHttpApiError = SeamHttpApiError;
|
|
5357
|
+
exports.SeamHttpBridges = SeamHttpBridges;
|
|
5172
5358
|
exports.SeamHttpClientSessions = SeamHttpClientSessions;
|
|
5173
5359
|
exports.SeamHttpConnectWebviews = SeamHttpConnectWebviews;
|
|
5174
5360
|
exports.SeamHttpConnectedAccounts = SeamHttpConnectedAccounts;
|
|
@@ -5191,6 +5377,7 @@ exports.SeamHttpPhonesSimulate = SeamHttpPhonesSimulate;
|
|
|
5191
5377
|
exports.SeamHttpRequest = SeamHttpRequest;
|
|
5192
5378
|
exports.SeamHttpThermostats = SeamHttpThermostats;
|
|
5193
5379
|
exports.SeamHttpThermostatsSchedules = SeamHttpThermostatsSchedules;
|
|
5380
|
+
exports.SeamHttpThermostatsSimulate = SeamHttpThermostatsSimulate;
|
|
5194
5381
|
exports.SeamHttpUnauthorizedError = SeamHttpUnauthorizedError;
|
|
5195
5382
|
exports.SeamHttpUserIdentities = SeamHttpUserIdentities;
|
|
5196
5383
|
exports.SeamHttpUserIdentitiesEnrollmentAutomations = SeamHttpUserIdentitiesEnrollmentAutomations;
|