@seamapi/http 1.19.0 → 1.20.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 +99 -0
- package/dist/connect.cjs.map +1 -1
- package/dist/connect.d.cts +23 -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/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/index.ts +1 -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
|
@@ -4249,6 +4249,101 @@ var SeamHttpThermostatsSchedules = class _SeamHttpThermostatsSchedules {
|
|
|
4249
4249
|
}
|
|
4250
4250
|
};
|
|
4251
4251
|
|
|
4252
|
+
// src/lib/seam/connect/routes/thermostats-simulate.ts
|
|
4253
|
+
var SeamHttpThermostatsSimulate = class _SeamHttpThermostatsSimulate {
|
|
4254
|
+
constructor(apiKeyOrOptions = {}) {
|
|
4255
|
+
const options = parseOptions(apiKeyOrOptions);
|
|
4256
|
+
this.client = "client" in options ? options.client : createClient(options);
|
|
4257
|
+
this.defaults = limitToSeamHttpRequestOptions(options);
|
|
4258
|
+
}
|
|
4259
|
+
static fromClient(client, options = {}) {
|
|
4260
|
+
const constructorOptions = { ...options, client };
|
|
4261
|
+
if (!isSeamHttpOptionsWithClient(constructorOptions)) {
|
|
4262
|
+
throw new SeamHttpInvalidOptionsError("Missing client");
|
|
4263
|
+
}
|
|
4264
|
+
return new _SeamHttpThermostatsSimulate(constructorOptions);
|
|
4265
|
+
}
|
|
4266
|
+
static fromApiKey(apiKey, options = {}) {
|
|
4267
|
+
const constructorOptions = { ...options, apiKey };
|
|
4268
|
+
if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
|
|
4269
|
+
throw new SeamHttpInvalidOptionsError("Missing apiKey");
|
|
4270
|
+
}
|
|
4271
|
+
return new _SeamHttpThermostatsSimulate(constructorOptions);
|
|
4272
|
+
}
|
|
4273
|
+
static fromClientSessionToken(clientSessionToken, options = {}) {
|
|
4274
|
+
const constructorOptions = { ...options, clientSessionToken };
|
|
4275
|
+
if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
|
|
4276
|
+
throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
|
|
4277
|
+
}
|
|
4278
|
+
return new _SeamHttpThermostatsSimulate(constructorOptions);
|
|
4279
|
+
}
|
|
4280
|
+
static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
|
|
4281
|
+
warnOnInsecureuserIdentifierKey(userIdentifierKey);
|
|
4282
|
+
const clientOptions = parseOptions({ ...options, publishableKey });
|
|
4283
|
+
if (isSeamHttpOptionsWithClient(clientOptions)) {
|
|
4284
|
+
throw new SeamHttpInvalidOptionsError(
|
|
4285
|
+
"The client option cannot be used with SeamHttp.fromPublishableKey"
|
|
4286
|
+
);
|
|
4287
|
+
}
|
|
4288
|
+
const client = createClient(clientOptions);
|
|
4289
|
+
const clientSessions = SeamHttpClientSessions.fromClient(client);
|
|
4290
|
+
const { token } = await clientSessions.getOrCreate({
|
|
4291
|
+
user_identifier_key: userIdentifierKey
|
|
4292
|
+
});
|
|
4293
|
+
return _SeamHttpThermostatsSimulate.fromClientSessionToken(token, options);
|
|
4294
|
+
}
|
|
4295
|
+
static fromConsoleSessionToken(consoleSessionToken, workspaceId, options = {}) {
|
|
4296
|
+
const constructorOptions = { ...options, consoleSessionToken, workspaceId };
|
|
4297
|
+
if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
|
|
4298
|
+
throw new SeamHttpInvalidOptionsError(
|
|
4299
|
+
"Missing consoleSessionToken or workspaceId"
|
|
4300
|
+
);
|
|
4301
|
+
}
|
|
4302
|
+
return new _SeamHttpThermostatsSimulate(constructorOptions);
|
|
4303
|
+
}
|
|
4304
|
+
static fromPersonalAccessToken(personalAccessToken, workspaceId, options = {}) {
|
|
4305
|
+
const constructorOptions = { ...options, personalAccessToken, workspaceId };
|
|
4306
|
+
if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
|
|
4307
|
+
throw new SeamHttpInvalidOptionsError(
|
|
4308
|
+
"Missing personalAccessToken or workspaceId"
|
|
4309
|
+
);
|
|
4310
|
+
}
|
|
4311
|
+
return new _SeamHttpThermostatsSimulate(constructorOptions);
|
|
4312
|
+
}
|
|
4313
|
+
async updateClientSessionToken(clientSessionToken) {
|
|
4314
|
+
const { headers } = this.client.defaults;
|
|
4315
|
+
const authHeaders = getAuthHeadersForClientSessionToken({
|
|
4316
|
+
clientSessionToken
|
|
4317
|
+
});
|
|
4318
|
+
for (const key of Object.keys(authHeaders)) {
|
|
4319
|
+
if (headers[key] == null) {
|
|
4320
|
+
throw new Error(
|
|
4321
|
+
"Cannot update a clientSessionToken on a client created without a clientSessionToken"
|
|
4322
|
+
);
|
|
4323
|
+
}
|
|
4324
|
+
}
|
|
4325
|
+
this.client.defaults.headers = { ...headers, ...authHeaders };
|
|
4326
|
+
const clientSessions = SeamHttpClientSessions.fromClient(this.client);
|
|
4327
|
+
await clientSessions.get();
|
|
4328
|
+
}
|
|
4329
|
+
hvacModeAdjusted(body) {
|
|
4330
|
+
return new SeamHttpRequest(this, {
|
|
4331
|
+
path: "/thermostats/simulate/hvac_mode_adjusted",
|
|
4332
|
+
method: "post",
|
|
4333
|
+
body,
|
|
4334
|
+
responseKey: void 0
|
|
4335
|
+
});
|
|
4336
|
+
}
|
|
4337
|
+
temperatureReached(body) {
|
|
4338
|
+
return new SeamHttpRequest(this, {
|
|
4339
|
+
path: "/thermostats/simulate/temperature_reached",
|
|
4340
|
+
method: "post",
|
|
4341
|
+
body,
|
|
4342
|
+
responseKey: void 0
|
|
4343
|
+
});
|
|
4344
|
+
}
|
|
4345
|
+
};
|
|
4346
|
+
|
|
4252
4347
|
// src/lib/seam/connect/routes/thermostats.ts
|
|
4253
4348
|
var SeamHttpThermostats = class _SeamHttpThermostats {
|
|
4254
4349
|
constructor(apiKeyOrOptions = {}) {
|
|
@@ -4329,6 +4424,9 @@ var SeamHttpThermostats = class _SeamHttpThermostats {
|
|
|
4329
4424
|
get schedules() {
|
|
4330
4425
|
return SeamHttpThermostatsSchedules.fromClient(this.client, this.defaults);
|
|
4331
4426
|
}
|
|
4427
|
+
get simulate() {
|
|
4428
|
+
return SeamHttpThermostatsSimulate.fromClient(this.client, this.defaults);
|
|
4429
|
+
}
|
|
4332
4430
|
activateClimatePreset(body, options = {}) {
|
|
4333
4431
|
return new SeamHttpRequest(this, {
|
|
4334
4432
|
path: "/thermostats/activate_climate_preset",
|
|
@@ -5191,6 +5289,7 @@ exports.SeamHttpPhonesSimulate = SeamHttpPhonesSimulate;
|
|
|
5191
5289
|
exports.SeamHttpRequest = SeamHttpRequest;
|
|
5192
5290
|
exports.SeamHttpThermostats = SeamHttpThermostats;
|
|
5193
5291
|
exports.SeamHttpThermostatsSchedules = SeamHttpThermostatsSchedules;
|
|
5292
|
+
exports.SeamHttpThermostatsSimulate = SeamHttpThermostatsSimulate;
|
|
5194
5293
|
exports.SeamHttpUnauthorizedError = SeamHttpUnauthorizedError;
|
|
5195
5294
|
exports.SeamHttpUserIdentities = SeamHttpUserIdentities;
|
|
5196
5295
|
exports.SeamHttpUserIdentitiesEnrollmentAutomations = SeamHttpUserIdentitiesEnrollmentAutomations;
|