@seamapi/http 0.13.0 → 0.14.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.
Files changed (31) hide show
  1. package/dist/connect.cjs +269 -0
  2. package/dist/connect.cjs.map +1 -1
  3. package/dist/connect.d.cts +68 -1
  4. package/lib/seam/connect/routes/index.d.ts +3 -0
  5. package/lib/seam/connect/routes/index.js +3 -0
  6. package/lib/seam/connect/routes/index.js.map +1 -1
  7. package/lib/seam/connect/routes/networks.d.ts +23 -0
  8. package/lib/seam/connect/routes/networks.js +81 -0
  9. package/lib/seam/connect/routes/networks.js.map +1 -0
  10. package/lib/seam/connect/routes/phones.d.ts +19 -0
  11. package/lib/seam/connect/routes/phones.js +73 -0
  12. package/lib/seam/connect/routes/phones.js.map +1 -0
  13. package/lib/seam/connect/routes/user-identities-enrollment-automations.d.ts +27 -0
  14. package/lib/seam/connect/routes/user-identities-enrollment-automations.js +89 -0
  15. package/lib/seam/connect/routes/user-identities-enrollment-automations.js.map +1 -0
  16. package/lib/seam/connect/routes/user-identities.d.ts +6 -0
  17. package/lib/seam/connect/routes/user-identities.js +12 -0
  18. package/lib/seam/connect/routes/user-identities.js.map +1 -1
  19. package/lib/seam/connect/seam-http.d.ts +3 -1
  20. package/lib/seam/connect/seam-http.js +7 -1
  21. package/lib/seam/connect/seam-http.js.map +1 -1
  22. package/lib/version.d.ts +1 -1
  23. package/lib/version.js +1 -1
  24. package/package.json +3 -3
  25. package/src/lib/seam/connect/routes/index.ts +3 -0
  26. package/src/lib/seam/connect/routes/networks.ts +171 -0
  27. package/src/lib/seam/connect/routes/phones.ts +151 -0
  28. package/src/lib/seam/connect/routes/user-identities-enrollment-automations.ts +214 -0
  29. package/src/lib/seam/connect/routes/user-identities.ts +30 -0
  30. package/src/lib/seam/connect/seam-http.ts +10 -0
  31. package/src/lib/version.ts +1 -1
package/dist/connect.cjs CHANGED
@@ -2398,6 +2398,85 @@ var SeamHttpLocks = class _SeamHttpLocks {
2398
2398
  }
2399
2399
  };
2400
2400
 
2401
+ // src/lib/seam/connect/routes/networks.ts
2402
+ var SeamHttpNetworks = class _SeamHttpNetworks {
2403
+ constructor(apiKeyOrOptions = {}) {
2404
+ const options = parseOptions(apiKeyOrOptions);
2405
+ this.client = "client" in options ? options.client : createClient(options);
2406
+ this.defaults = limitToSeamHttpRequestOptions(options);
2407
+ }
2408
+ static fromClient(client, options = {}) {
2409
+ const constructorOptions = { ...options, client };
2410
+ if (!isSeamHttpOptionsWithClient(constructorOptions)) {
2411
+ throw new SeamHttpInvalidOptionsError("Missing client");
2412
+ }
2413
+ return new _SeamHttpNetworks(constructorOptions);
2414
+ }
2415
+ static fromApiKey(apiKey, options = {}) {
2416
+ const constructorOptions = { ...options, apiKey };
2417
+ if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
2418
+ throw new SeamHttpInvalidOptionsError("Missing apiKey");
2419
+ }
2420
+ return new _SeamHttpNetworks(constructorOptions);
2421
+ }
2422
+ static fromClientSessionToken(clientSessionToken, options = {}) {
2423
+ const constructorOptions = { ...options, clientSessionToken };
2424
+ if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
2425
+ throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
2426
+ }
2427
+ return new _SeamHttpNetworks(constructorOptions);
2428
+ }
2429
+ static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
2430
+ warnOnInsecureuserIdentifierKey(userIdentifierKey);
2431
+ const clientOptions = parseOptions({ ...options, publishableKey });
2432
+ if (isSeamHttpOptionsWithClient(clientOptions)) {
2433
+ throw new SeamHttpInvalidOptionsError(
2434
+ "The client option cannot be used with SeamHttp.fromPublishableKey"
2435
+ );
2436
+ }
2437
+ const client = createClient(clientOptions);
2438
+ const clientSessions = SeamHttpClientSessions.fromClient(client);
2439
+ const { token } = await clientSessions.getOrCreate({
2440
+ user_identifier_key: userIdentifierKey
2441
+ });
2442
+ return _SeamHttpNetworks.fromClientSessionToken(token, options);
2443
+ }
2444
+ static fromConsoleSessionToken(consoleSessionToken, workspaceId, options = {}) {
2445
+ const constructorOptions = { ...options, consoleSessionToken, workspaceId };
2446
+ if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
2447
+ throw new SeamHttpInvalidOptionsError(
2448
+ "Missing consoleSessionToken or workspaceId"
2449
+ );
2450
+ }
2451
+ return new _SeamHttpNetworks(constructorOptions);
2452
+ }
2453
+ static fromPersonalAccessToken(personalAccessToken, workspaceId, options = {}) {
2454
+ const constructorOptions = { ...options, personalAccessToken, workspaceId };
2455
+ if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
2456
+ throw new SeamHttpInvalidOptionsError(
2457
+ "Missing personalAccessToken or workspaceId"
2458
+ );
2459
+ }
2460
+ return new _SeamHttpNetworks(constructorOptions);
2461
+ }
2462
+ async get(body) {
2463
+ const { data } = await this.client.request({
2464
+ url: "/networks/get",
2465
+ method: "post",
2466
+ data: body
2467
+ });
2468
+ return data.network;
2469
+ }
2470
+ async list(body) {
2471
+ const { data } = await this.client.request({
2472
+ url: "/networks/list",
2473
+ method: "post",
2474
+ data: body
2475
+ });
2476
+ return data.networks;
2477
+ }
2478
+ };
2479
+
2401
2480
  // src/lib/seam/connect/routes/noise-sensors-noise-thresholds.ts
2402
2481
  var SeamHttpNoiseSensorsNoiseThresholds = class _SeamHttpNoiseSensorsNoiseThresholds {
2403
2482
  constructor(apiKeyOrOptions = {}) {
@@ -2570,6 +2649,77 @@ var SeamHttpNoiseSensors = class _SeamHttpNoiseSensors {
2570
2649
  }
2571
2650
  };
2572
2651
 
2652
+ // src/lib/seam/connect/routes/phones.ts
2653
+ var SeamHttpPhones = class _SeamHttpPhones {
2654
+ constructor(apiKeyOrOptions = {}) {
2655
+ const options = parseOptions(apiKeyOrOptions);
2656
+ this.client = "client" in options ? options.client : createClient(options);
2657
+ this.defaults = limitToSeamHttpRequestOptions(options);
2658
+ }
2659
+ static fromClient(client, options = {}) {
2660
+ const constructorOptions = { ...options, client };
2661
+ if (!isSeamHttpOptionsWithClient(constructorOptions)) {
2662
+ throw new SeamHttpInvalidOptionsError("Missing client");
2663
+ }
2664
+ return new _SeamHttpPhones(constructorOptions);
2665
+ }
2666
+ static fromApiKey(apiKey, options = {}) {
2667
+ const constructorOptions = { ...options, apiKey };
2668
+ if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
2669
+ throw new SeamHttpInvalidOptionsError("Missing apiKey");
2670
+ }
2671
+ return new _SeamHttpPhones(constructorOptions);
2672
+ }
2673
+ static fromClientSessionToken(clientSessionToken, options = {}) {
2674
+ const constructorOptions = { ...options, clientSessionToken };
2675
+ if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
2676
+ throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
2677
+ }
2678
+ return new _SeamHttpPhones(constructorOptions);
2679
+ }
2680
+ static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
2681
+ warnOnInsecureuserIdentifierKey(userIdentifierKey);
2682
+ const clientOptions = parseOptions({ ...options, publishableKey });
2683
+ if (isSeamHttpOptionsWithClient(clientOptions)) {
2684
+ throw new SeamHttpInvalidOptionsError(
2685
+ "The client option cannot be used with SeamHttp.fromPublishableKey"
2686
+ );
2687
+ }
2688
+ const client = createClient(clientOptions);
2689
+ const clientSessions = SeamHttpClientSessions.fromClient(client);
2690
+ const { token } = await clientSessions.getOrCreate({
2691
+ user_identifier_key: userIdentifierKey
2692
+ });
2693
+ return _SeamHttpPhones.fromClientSessionToken(token, options);
2694
+ }
2695
+ static fromConsoleSessionToken(consoleSessionToken, workspaceId, options = {}) {
2696
+ const constructorOptions = { ...options, consoleSessionToken, workspaceId };
2697
+ if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
2698
+ throw new SeamHttpInvalidOptionsError(
2699
+ "Missing consoleSessionToken or workspaceId"
2700
+ );
2701
+ }
2702
+ return new _SeamHttpPhones(constructorOptions);
2703
+ }
2704
+ static fromPersonalAccessToken(personalAccessToken, workspaceId, options = {}) {
2705
+ const constructorOptions = { ...options, personalAccessToken, workspaceId };
2706
+ if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
2707
+ throw new SeamHttpInvalidOptionsError(
2708
+ "Missing personalAccessToken or workspaceId"
2709
+ );
2710
+ }
2711
+ return new _SeamHttpPhones(constructorOptions);
2712
+ }
2713
+ async list(body) {
2714
+ const { data } = await this.client.request({
2715
+ url: "/phones/list",
2716
+ method: "post",
2717
+ data: body
2718
+ });
2719
+ return data.phones;
2720
+ }
2721
+ };
2722
+
2573
2723
  // src/lib/seam/connect/routes/thermostats-climate-setting-schedules.ts
2574
2724
  var SeamHttpThermostatsClimateSettingSchedules = class _SeamHttpThermostatsClimateSettingSchedules {
2575
2725
  constructor(apiKeyOrOptions = {}) {
@@ -2809,6 +2959,102 @@ var SeamHttpThermostats = class _SeamHttpThermostats {
2809
2959
  }
2810
2960
  };
2811
2961
 
2962
+ // src/lib/seam/connect/routes/user-identities-enrollment-automations.ts
2963
+ var SeamHttpUserIdentitiesEnrollmentAutomations = class _SeamHttpUserIdentitiesEnrollmentAutomations {
2964
+ constructor(apiKeyOrOptions = {}) {
2965
+ const options = parseOptions(apiKeyOrOptions);
2966
+ this.client = "client" in options ? options.client : createClient(options);
2967
+ this.defaults = limitToSeamHttpRequestOptions(options);
2968
+ }
2969
+ static fromClient(client, options = {}) {
2970
+ const constructorOptions = { ...options, client };
2971
+ if (!isSeamHttpOptionsWithClient(constructorOptions)) {
2972
+ throw new SeamHttpInvalidOptionsError("Missing client");
2973
+ }
2974
+ return new _SeamHttpUserIdentitiesEnrollmentAutomations(constructorOptions);
2975
+ }
2976
+ static fromApiKey(apiKey, options = {}) {
2977
+ const constructorOptions = { ...options, apiKey };
2978
+ if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
2979
+ throw new SeamHttpInvalidOptionsError("Missing apiKey");
2980
+ }
2981
+ return new _SeamHttpUserIdentitiesEnrollmentAutomations(constructorOptions);
2982
+ }
2983
+ static fromClientSessionToken(clientSessionToken, options = {}) {
2984
+ const constructorOptions = { ...options, clientSessionToken };
2985
+ if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
2986
+ throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
2987
+ }
2988
+ return new _SeamHttpUserIdentitiesEnrollmentAutomations(constructorOptions);
2989
+ }
2990
+ static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
2991
+ warnOnInsecureuserIdentifierKey(userIdentifierKey);
2992
+ const clientOptions = parseOptions({ ...options, publishableKey });
2993
+ if (isSeamHttpOptionsWithClient(clientOptions)) {
2994
+ throw new SeamHttpInvalidOptionsError(
2995
+ "The client option cannot be used with SeamHttp.fromPublishableKey"
2996
+ );
2997
+ }
2998
+ const client = createClient(clientOptions);
2999
+ const clientSessions = SeamHttpClientSessions.fromClient(client);
3000
+ const { token } = await clientSessions.getOrCreate({
3001
+ user_identifier_key: userIdentifierKey
3002
+ });
3003
+ return _SeamHttpUserIdentitiesEnrollmentAutomations.fromClientSessionToken(
3004
+ token,
3005
+ options
3006
+ );
3007
+ }
3008
+ static fromConsoleSessionToken(consoleSessionToken, workspaceId, options = {}) {
3009
+ const constructorOptions = { ...options, consoleSessionToken, workspaceId };
3010
+ if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
3011
+ throw new SeamHttpInvalidOptionsError(
3012
+ "Missing consoleSessionToken or workspaceId"
3013
+ );
3014
+ }
3015
+ return new _SeamHttpUserIdentitiesEnrollmentAutomations(constructorOptions);
3016
+ }
3017
+ static fromPersonalAccessToken(personalAccessToken, workspaceId, options = {}) {
3018
+ const constructorOptions = { ...options, personalAccessToken, workspaceId };
3019
+ if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
3020
+ throw new SeamHttpInvalidOptionsError(
3021
+ "Missing personalAccessToken or workspaceId"
3022
+ );
3023
+ }
3024
+ return new _SeamHttpUserIdentitiesEnrollmentAutomations(constructorOptions);
3025
+ }
3026
+ async get(body) {
3027
+ const { data } = await this.client.request(
3028
+ {
3029
+ url: "/user_identities/enrollment_automations/get",
3030
+ method: "post",
3031
+ data: body
3032
+ }
3033
+ );
3034
+ return data.enrollment_automation;
3035
+ }
3036
+ async launch(body) {
3037
+ const { data } = await this.client.request(
3038
+ {
3039
+ url: "/user_identities/enrollment_automations/launch",
3040
+ method: "post",
3041
+ data: body
3042
+ }
3043
+ );
3044
+ return data.enrollment_automation;
3045
+ }
3046
+ async list(body) {
3047
+ const { data } = await this.client.request(
3048
+ {
3049
+ url: "/user_identities/enrollment_automations/list",
3050
+ method: "post",
3051
+ data: body
3052
+ }
3053
+ );
3054
+ return data.enrollment_automations;
3055
+ }
3056
+ };
3057
+
2812
3058
  // src/lib/seam/connect/routes/user-identities.ts
2813
3059
  var SeamHttpUserIdentities = class _SeamHttpUserIdentities {
2814
3060
  constructor(apiKeyOrOptions = {}) {
@@ -2870,6 +3116,12 @@ var SeamHttpUserIdentities = class _SeamHttpUserIdentities {
2870
3116
  }
2871
3117
  return new _SeamHttpUserIdentities(constructorOptions);
2872
3118
  }
3119
+ get enrollmentAutomations() {
3120
+ return SeamHttpUserIdentitiesEnrollmentAutomations.fromClient(
3121
+ this.client,
3122
+ this.defaults
3123
+ );
3124
+ }
2873
3125
  async addAcsUser(body) {
2874
3126
  await this.client.request({
2875
3127
  url: "/user_identities/add_acs_user",
@@ -2916,6 +3168,14 @@ var SeamHttpUserIdentities = class _SeamHttpUserIdentities {
2916
3168
  });
2917
3169
  return data.accessible_devices;
2918
3170
  }
3171
+ async listAcsSystems(body) {
3172
+ const { data } = await this.client.request({
3173
+ url: "/user_identities/list_acs_systems",
3174
+ method: "post",
3175
+ data: body
3176
+ });
3177
+ return data.acs_systems;
3178
+ }
2919
3179
  async listAcsUsers(body) {
2920
3180
  const { data } = await this.client.request({
2921
3181
  url: "/user_identities/list_acs_users",
@@ -3216,9 +3476,15 @@ var SeamHttp = class _SeamHttp {
3216
3476
  get locks() {
3217
3477
  return SeamHttpLocks.fromClient(this.client, this.defaults);
3218
3478
  }
3479
+ get networks() {
3480
+ return SeamHttpNetworks.fromClient(this.client, this.defaults);
3481
+ }
3219
3482
  get noiseSensors() {
3220
3483
  return SeamHttpNoiseSensors.fromClient(this.client, this.defaults);
3221
3484
  }
3485
+ get phones() {
3486
+ return SeamHttpPhones.fromClient(this.client, this.defaults);
3487
+ }
3222
3488
  get thermostats() {
3223
3489
  return SeamHttpThermostats.fromClient(this.client, this.defaults);
3224
3490
  }
@@ -3302,12 +3568,15 @@ exports.SeamHttpInvalidTokenError = SeamHttpInvalidTokenError;
3302
3568
  exports.SeamHttpLocks = SeamHttpLocks;
3303
3569
  exports.SeamHttpMultiWorkspace = SeamHttpMultiWorkspace;
3304
3570
  exports.SeamHttpMultiWorkspaceInvalidOptionsError = SeamHttpMultiWorkspaceInvalidOptionsError;
3571
+ exports.SeamHttpNetworks = SeamHttpNetworks;
3305
3572
  exports.SeamHttpNoiseSensors = SeamHttpNoiseSensors;
3306
3573
  exports.SeamHttpNoiseSensorsNoiseThresholds = SeamHttpNoiseSensorsNoiseThresholds;
3574
+ exports.SeamHttpPhones = SeamHttpPhones;
3307
3575
  exports.SeamHttpThermostats = SeamHttpThermostats;
3308
3576
  exports.SeamHttpThermostatsClimateSettingSchedules = SeamHttpThermostatsClimateSettingSchedules;
3309
3577
  exports.SeamHttpUnauthorizedError = SeamHttpUnauthorizedError;
3310
3578
  exports.SeamHttpUserIdentities = SeamHttpUserIdentities;
3579
+ exports.SeamHttpUserIdentitiesEnrollmentAutomations = SeamHttpUserIdentitiesEnrollmentAutomations;
3311
3580
  exports.SeamHttpWebhooks = SeamHttpWebhooks;
3312
3581
  exports.SeamHttpWorkspaces = SeamHttpWorkspaces;
3313
3582
  exports.errorInterceptor = errorInterceptor;