@seamapi/http 0.5.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/dist/connect.cjs +142 -22
- package/dist/connect.cjs.map +1 -1
- package/dist/connect.d.cts +46 -10
- package/lib/seam/connect/routes/acs-access-groups.d.ts +0 -9
- package/lib/seam/connect/routes/acs-access-groups.js +0 -22
- package/lib/seam/connect/routes/acs-access-groups.js.map +1 -1
- package/lib/seam/connect/routes/acs-credentials.d.ts +6 -0
- package/lib/seam/connect/routes/acs-credentials.js +14 -0
- package/lib/seam/connect/routes/acs-credentials.js.map +1 -1
- package/lib/seam/connect/routes/client-sessions.d.ts +3 -0
- package/lib/seam/connect/routes/client-sessions.js +7 -0
- package/lib/seam/connect/routes/client-sessions.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/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/seam-http.d.ts +2 -1
- package/lib/seam/connect/seam-http.js +4 -1
- 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/routes/acs-access-groups.ts +0 -48
- package/src/lib/seam/connect/routes/acs-credentials.ts +30 -0
- package/src/lib/seam/connect/routes/client-sessions.ts +15 -0
- package/src/lib/seam/connect/routes/index.ts +1 -0
- package/src/lib/seam/connect/routes/user-identities.ts +261 -0
- package/src/lib/seam/connect/seam-http.ts +5 -0
- package/src/lib/version.ts +1 -1
package/dist/connect.cjs
CHANGED
|
@@ -635,6 +635,13 @@ var SeamHttpClientSessions = class _SeamHttpClientSessions {
|
|
|
635
635
|
});
|
|
636
636
|
return data.client_sessions;
|
|
637
637
|
}
|
|
638
|
+
async revoke(body) {
|
|
639
|
+
await this.client.request({
|
|
640
|
+
url: "/client_sessions/revoke",
|
|
641
|
+
method: "post",
|
|
642
|
+
data: body
|
|
643
|
+
});
|
|
644
|
+
}
|
|
638
645
|
};
|
|
639
646
|
|
|
640
647
|
// src/lib/seam/connect/routes/access-codes-unmanaged.ts
|
|
@@ -919,21 +926,6 @@ var SeamHttpAcsAccessGroups = class _SeamHttpAcsAccessGroups {
|
|
|
919
926
|
data: body
|
|
920
927
|
});
|
|
921
928
|
}
|
|
922
|
-
async create(body) {
|
|
923
|
-
const { data } = await this.client.request({
|
|
924
|
-
url: "/acs/access_groups/create",
|
|
925
|
-
method: "post",
|
|
926
|
-
data: body
|
|
927
|
-
});
|
|
928
|
-
return data.acs_access_group;
|
|
929
|
-
}
|
|
930
|
-
async delete(body) {
|
|
931
|
-
await this.client.request({
|
|
932
|
-
url: "/acs/access_groups/delete",
|
|
933
|
-
method: "post",
|
|
934
|
-
data: body
|
|
935
|
-
});
|
|
936
|
-
}
|
|
937
929
|
async get(body) {
|
|
938
930
|
const { data } = await this.client.request({
|
|
939
931
|
url: "/acs/access_groups/get",
|
|
@@ -965,13 +957,6 @@ var SeamHttpAcsAccessGroups = class _SeamHttpAcsAccessGroups {
|
|
|
965
957
|
data: body
|
|
966
958
|
});
|
|
967
959
|
}
|
|
968
|
-
async update(body) {
|
|
969
|
-
await this.client.request({
|
|
970
|
-
url: "/acs/access_groups/update",
|
|
971
|
-
method: "post",
|
|
972
|
-
data: body
|
|
973
|
-
});
|
|
974
|
-
}
|
|
975
960
|
};
|
|
976
961
|
|
|
977
962
|
// src/lib/seam/connect/routes/acs-credentials.ts
|
|
@@ -1029,6 +1014,13 @@ var SeamHttpAcsCredentials = class _SeamHttpAcsCredentials {
|
|
|
1029
1014
|
}
|
|
1030
1015
|
return new _SeamHttpAcsCredentials(constructorOptions);
|
|
1031
1016
|
}
|
|
1017
|
+
async assign(body) {
|
|
1018
|
+
await this.client.request({
|
|
1019
|
+
url: "/acs/credentials/assign",
|
|
1020
|
+
method: "post",
|
|
1021
|
+
data: body
|
|
1022
|
+
});
|
|
1023
|
+
}
|
|
1032
1024
|
async create(body) {
|
|
1033
1025
|
const { data } = await this.client.request({
|
|
1034
1026
|
url: "/acs/credentials/create",
|
|
@@ -1060,6 +1052,13 @@ var SeamHttpAcsCredentials = class _SeamHttpAcsCredentials {
|
|
|
1060
1052
|
});
|
|
1061
1053
|
return data.acs_credentials;
|
|
1062
1054
|
}
|
|
1055
|
+
async unassign(body) {
|
|
1056
|
+
await this.client.request({
|
|
1057
|
+
url: "/acs/credentials/unassign",
|
|
1058
|
+
method: "post",
|
|
1059
|
+
data: body
|
|
1060
|
+
});
|
|
1061
|
+
}
|
|
1063
1062
|
};
|
|
1064
1063
|
|
|
1065
1064
|
// src/lib/seam/connect/routes/acs-systems.ts
|
|
@@ -2296,6 +2295,123 @@ var SeamHttpThermostats = class _SeamHttpThermostats {
|
|
|
2296
2295
|
}
|
|
2297
2296
|
};
|
|
2298
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
|
+
|
|
2299
2415
|
// src/lib/seam/connect/routes/webhooks.ts
|
|
2300
2416
|
var SeamHttpWebhooks = class _SeamHttpWebhooks {
|
|
2301
2417
|
constructor(apiKeyOrOptions = {}) {
|
|
@@ -2552,6 +2668,9 @@ var SeamHttp = class _SeamHttp {
|
|
|
2552
2668
|
get thermostats() {
|
|
2553
2669
|
return SeamHttpThermostats.fromClient(this.client);
|
|
2554
2670
|
}
|
|
2671
|
+
get userIdentities() {
|
|
2672
|
+
return SeamHttpUserIdentities.fromClient(this.client);
|
|
2673
|
+
}
|
|
2555
2674
|
get webhooks() {
|
|
2556
2675
|
return SeamHttpWebhooks.fromClient(this.client);
|
|
2557
2676
|
}
|
|
@@ -2584,6 +2703,7 @@ exports.SeamHttpNoiseSensorsNoiseThresholds = SeamHttpNoiseSensorsNoiseThreshold
|
|
|
2584
2703
|
exports.SeamHttpThermostats = SeamHttpThermostats;
|
|
2585
2704
|
exports.SeamHttpThermostatsClimateSettingSchedules = SeamHttpThermostatsClimateSettingSchedules;
|
|
2586
2705
|
exports.SeamHttpUnauthorizedError = SeamHttpUnauthorizedError;
|
|
2706
|
+
exports.SeamHttpUserIdentities = SeamHttpUserIdentities;
|
|
2587
2707
|
exports.SeamHttpWebhooks = SeamHttpWebhooks;
|
|
2588
2708
|
exports.SeamHttpWorkspaces = SeamHttpWorkspaces;
|
|
2589
2709
|
exports.UnserializableParamError = UnserializableParamError;
|