@seamapi/http 0.0.2 → 0.1.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 (115) hide show
  1. package/dist/connect.cjs +1386 -61
  2. package/dist/connect.cjs.map +1 -1
  3. package/dist/connect.d.cts +420 -7
  4. package/lib/seam/connect/auth.d.ts +1 -1
  5. package/lib/seam/connect/auth.js +7 -7
  6. package/lib/seam/connect/auth.js.map +1 -1
  7. package/lib/seam/connect/axios.js +3 -1
  8. package/lib/seam/connect/axios.js.map +1 -1
  9. package/lib/seam/connect/client-options.d.ts +7 -3
  10. package/lib/seam/connect/client-options.js +18 -3
  11. package/lib/seam/connect/client-options.js.map +1 -1
  12. package/lib/seam/connect/client.d.ts +16 -4
  13. package/lib/seam/connect/client.js +55 -28
  14. package/lib/seam/connect/client.js.map +1 -1
  15. package/lib/seam/connect/parse-options.d.ts +1 -1
  16. package/lib/seam/connect/parse-options.js +8 -1
  17. package/lib/seam/connect/parse-options.js.map +1 -1
  18. package/lib/seam/connect/routes/access-codes-unmanaged.d.ts +26 -0
  19. package/lib/seam/connect/routes/access-codes-unmanaged.js +72 -0
  20. package/lib/seam/connect/routes/access-codes-unmanaged.js.map +1 -0
  21. package/lib/seam/connect/routes/access-codes.d.ts +37 -0
  22. package/lib/seam/connect/routes/access-codes.js +101 -0
  23. package/lib/seam/connect/routes/access-codes.js.map +1 -0
  24. package/lib/seam/connect/routes/acs-access-groups.d.ts +35 -0
  25. package/lib/seam/connect/routes/acs-access-groups.js +95 -0
  26. package/lib/seam/connect/routes/acs-access-groups.js.map +1 -0
  27. package/lib/seam/connect/routes/acs-credentials.d.ts +23 -0
  28. package/lib/seam/connect/routes/acs-credentials.js +66 -0
  29. package/lib/seam/connect/routes/acs-credentials.js.map +1 -0
  30. package/lib/seam/connect/routes/acs-systems.d.ts +17 -0
  31. package/lib/seam/connect/routes/acs-systems.js +51 -0
  32. package/lib/seam/connect/routes/acs-systems.js.map +1 -0
  33. package/lib/seam/connect/routes/acs-users.d.ts +32 -0
  34. package/lib/seam/connect/routes/acs-users.js +87 -0
  35. package/lib/seam/connect/routes/acs-users.js.map +1 -0
  36. package/lib/seam/connect/routes/acs.d.ts +17 -0
  37. package/lib/seam/connect/routes/acs.js +51 -0
  38. package/lib/seam/connect/routes/acs.js.map +1 -0
  39. package/lib/seam/connect/routes/action-attempts.d.ts +17 -0
  40. package/lib/seam/connect/routes/action-attempts.js +51 -0
  41. package/lib/seam/connect/routes/action-attempts.js.map +1 -0
  42. package/lib/seam/connect/routes/client-sessions.d.ts +26 -0
  43. package/lib/seam/connect/routes/client-sessions.js +74 -0
  44. package/lib/seam/connect/routes/client-sessions.js.map +1 -0
  45. package/lib/seam/connect/routes/connect-webviews.d.ts +26 -0
  46. package/lib/seam/connect/routes/connect-webviews.js +73 -0
  47. package/lib/seam/connect/routes/connect-webviews.js.map +1 -0
  48. package/lib/seam/connect/routes/connected-accounts.d.ts +20 -0
  49. package/lib/seam/connect/routes/connected-accounts.js +58 -0
  50. package/lib/seam/connect/routes/connected-accounts.js.map +1 -0
  51. package/lib/seam/connect/routes/devices-unmanaged.d.ts +20 -0
  52. package/lib/seam/connect/routes/devices-unmanaged.js +58 -0
  53. package/lib/seam/connect/routes/devices-unmanaged.js.map +1 -0
  54. package/lib/seam/connect/routes/devices.d.ts +28 -0
  55. package/lib/seam/connect/routes/devices.js +77 -0
  56. package/lib/seam/connect/routes/devices.js.map +1 -0
  57. package/lib/seam/connect/routes/events.d.ts +17 -0
  58. package/lib/seam/connect/routes/events.js +51 -0
  59. package/lib/seam/connect/routes/events.js.map +1 -0
  60. package/lib/seam/connect/routes/index.d.ts +21 -0
  61. package/lib/seam/connect/routes/index.js +22 -0
  62. package/lib/seam/connect/routes/index.js.map +1 -0
  63. package/lib/seam/connect/routes/locks.d.ts +23 -0
  64. package/lib/seam/connect/routes/locks.js +67 -0
  65. package/lib/seam/connect/routes/locks.js.map +1 -0
  66. package/lib/seam/connect/routes/noise-sensors-noise-thresholds.d.ts +26 -0
  67. package/lib/seam/connect/routes/noise-sensors-noise-thresholds.js +72 -0
  68. package/lib/seam/connect/routes/noise-sensors-noise-thresholds.js.map +1 -0
  69. package/lib/seam/connect/routes/noise-sensors.d.ts +11 -0
  70. package/lib/seam/connect/routes/noise-sensors.js +39 -0
  71. package/lib/seam/connect/routes/noise-sensors.js.map +1 -0
  72. package/lib/seam/connect/routes/thermostats-climate-setting-schedules.d.ts +26 -0
  73. package/lib/seam/connect/routes/thermostats-climate-setting-schedules.js +73 -0
  74. package/lib/seam/connect/routes/thermostats-climate-setting-schedules.js.map +1 -0
  75. package/lib/seam/connect/routes/thermostats.d.ts +37 -0
  76. package/lib/seam/connect/routes/thermostats.js +97 -0
  77. package/lib/seam/connect/routes/thermostats.js.map +1 -0
  78. package/lib/seam/connect/routes/webhooks.d.ts +23 -0
  79. package/lib/seam/connect/routes/webhooks.js +66 -0
  80. package/lib/seam/connect/routes/webhooks.js.map +1 -0
  81. package/lib/seam/connect/routes/workspaces.d.ts +14 -5
  82. package/lib/seam/connect/routes/workspaces.js +48 -10
  83. package/lib/seam/connect/routes/workspaces.js.map +1 -1
  84. package/package.json +4 -1
  85. package/src/lib/seam/connect/auth.ts +7 -7
  86. package/src/lib/seam/connect/axios.ts +2 -0
  87. package/src/lib/seam/connect/client-options.ts +32 -4
  88. package/src/lib/seam/connect/client.ts +88 -15
  89. package/src/lib/seam/connect/parse-options.ts +16 -2
  90. package/src/lib/seam/connect/routes/access-codes-unmanaged.ts +157 -0
  91. package/src/lib/seam/connect/routes/access-codes.ts +226 -0
  92. package/src/lib/seam/connect/routes/acs-access-groups.ts +207 -0
  93. package/src/lib/seam/connect/routes/acs-credentials.ts +139 -0
  94. package/src/lib/seam/connect/routes/acs-systems.ts +108 -0
  95. package/src/lib/seam/connect/routes/acs-users.ts +187 -0
  96. package/src/lib/seam/connect/routes/acs.ts +85 -0
  97. package/src/lib/seam/connect/routes/action-attempts.ts +104 -0
  98. package/src/lib/seam/connect/routes/client-sessions.ts +159 -0
  99. package/src/lib/seam/connect/routes/connect-webviews.ts +159 -0
  100. package/src/lib/seam/connect/routes/connected-accounts.ts +124 -0
  101. package/src/lib/seam/connect/routes/devices-unmanaged.ts +120 -0
  102. package/src/lib/seam/connect/routes/devices.ts +158 -0
  103. package/src/lib/seam/connect/routes/events.ts +100 -0
  104. package/src/lib/seam/connect/routes/index.ts +21 -0
  105. package/src/lib/seam/connect/routes/locks.ts +138 -0
  106. package/src/lib/seam/connect/routes/noise-sensors-noise-thresholds.ts +154 -0
  107. package/src/lib/seam/connect/routes/noise-sensors.ts +70 -0
  108. package/src/lib/seam/connect/routes/thermostats-climate-setting-schedules.ts +176 -0
  109. package/src/lib/seam/connect/routes/thermostats.ts +206 -0
  110. package/src/lib/seam/connect/routes/webhooks.ts +141 -0
  111. package/src/lib/seam/connect/routes/workspaces.ts +100 -17
  112. package/lib/seam/connect/legacy/workspaces.d.ts +0 -8
  113. package/lib/seam/connect/legacy/workspaces.js +0 -10
  114. package/lib/seam/connect/legacy/workspaces.js.map +0 -1
  115. package/src/lib/seam/connect/legacy/workspaces.ts +0 -26
package/dist/connect.cjs CHANGED
@@ -6,31 +6,33 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
6
6
 
7
7
  var axios__default = /*#__PURE__*/_interopDefault(axios);
8
8
 
9
- var __accessCheck = (obj, member, msg) => {
10
- if (!member.has(obj))
11
- throw TypeError("Cannot " + msg);
12
- };
13
- var __privateGet = (obj, member, getter) => {
14
- __accessCheck(obj, member, "read from private field");
15
- return getter ? getter.call(obj) : member.get(obj);
16
- };
17
- var __privateAdd = (obj, member, value) => {
18
- if (member.has(obj))
19
- throw TypeError("Cannot add the same private member more than once");
20
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
21
- };
22
- var __privateSet = (obj, member, value, setter) => {
23
- __accessCheck(obj, member, "write to private field");
24
- setter ? setter.call(obj, value) : member.set(obj, value);
25
- return value;
26
- };
9
+ // src/lib/seam/connect/axios.ts
27
10
 
28
11
  // src/lib/seam/connect/client-options.ts
12
+ var isSeamHttpOptionsWithClient = (options) => {
13
+ if (!("client" in options))
14
+ return false;
15
+ if (options.client == null)
16
+ return false;
17
+ const keys = Object.keys(options).filter(
18
+ (k) => !["client", "enableLegacyMethodBehaivor"].includes(k)
19
+ );
20
+ if (keys.length > 0) {
21
+ throw new SeamHttpInvalidOptionsError(
22
+ `The client option cannot be used with any other option except enableLegacyMethodBehaivor, but received: ${keys.join(
23
+ ", "
24
+ )}`
25
+ );
26
+ }
27
+ return true;
28
+ };
29
29
  var isSeamHttpOptionsWithApiKey = (options) => {
30
30
  if (!("apiKey" in options))
31
31
  return false;
32
+ if (options.apiKey == null)
33
+ return false;
32
34
  if ("clientSessionToken" in options && options.clientSessionToken != null) {
33
- throw new InvalidSeamHttpOptionsError(
35
+ throw new SeamHttpInvalidOptionsError(
34
36
  "The clientSessionToken option cannot be used with the apiKey option."
35
37
  );
36
38
  }
@@ -39,14 +41,16 @@ var isSeamHttpOptionsWithApiKey = (options) => {
39
41
  var isSeamHttpOptionsWithClientSessionToken = (options) => {
40
42
  if (!("clientSessionToken" in options))
41
43
  return false;
44
+ if (options.clientSessionToken == null)
45
+ return false;
42
46
  if ("apiKey" in options && options.apiKey != null) {
43
- throw new InvalidSeamHttpOptionsError(
47
+ throw new SeamHttpInvalidOptionsError(
44
48
  "The clientSessionToken option cannot be used with the apiKey option."
45
49
  );
46
50
  }
47
51
  return true;
48
52
  };
49
- var InvalidSeamHttpOptionsError = class extends Error {
53
+ var SeamHttpInvalidOptionsError = class extends Error {
50
54
  constructor(message) {
51
55
  super(`SeamHttp received invalid options: ${message}`);
52
56
  this.name = this.constructor.name;
@@ -62,7 +66,7 @@ var getAuthHeaders = (options) => {
62
66
  if (isSeamHttpOptionsWithClientSessionToken(options)) {
63
67
  return getAuthHeadersForClientSessionToken(options);
64
68
  }
65
- throw new InvalidSeamHttpOptionsError(
69
+ throw new SeamHttpInvalidOptionsError(
66
70
  "Must specify an apiKey or clientSessionToken"
67
71
  );
68
72
  };
@@ -70,17 +74,17 @@ var getAuthHeadersForApiKey = ({
70
74
  apiKey
71
75
  }) => {
72
76
  if (isClientSessionToken(apiKey)) {
73
- throw new InvalidSeamTokenError(
77
+ throw new SeamHttpInvalidTokenError(
74
78
  "A Client Session Token cannot be used as an apiKey"
75
79
  );
76
80
  }
77
81
  if (isAccessToken(apiKey)) {
78
- throw new InvalidSeamTokenError(
82
+ throw new SeamHttpInvalidTokenError(
79
83
  "An access token cannot be used as an apiKey"
80
84
  );
81
85
  }
82
86
  if (isJwt(apiKey) || !isSeamToken(apiKey)) {
83
- throw new InvalidSeamTokenError(
87
+ throw new SeamHttpInvalidTokenError(
84
88
  `Unknown or invalid apiKey format, expected token to start with ${tokenPrefix}`
85
89
  );
86
90
  }
@@ -92,7 +96,7 @@ var getAuthHeadersForClientSessionToken = ({
92
96
  clientSessionToken
93
97
  }) => {
94
98
  if (!isClientSessionToken(clientSessionToken)) {
95
- throw new InvalidSeamTokenError(
99
+ throw new SeamHttpInvalidTokenError(
96
100
  `Unknown or invalid clientSessionToken format, expected token to start with ${clientSessionTokenPrefix}`
97
101
  );
98
102
  }
@@ -101,7 +105,7 @@ var getAuthHeadersForClientSessionToken = ({
101
105
  "client-session-token": clientSessionToken
102
106
  };
103
107
  };
104
- var InvalidSeamTokenError = class extends Error {
108
+ var SeamHttpInvalidTokenError = class extends Error {
105
109
  constructor(message) {
106
110
  super(`SeamHttp received an invalid token: ${message}`);
107
111
  this.name = this.constructor.name;
@@ -117,6 +121,8 @@ var isSeamToken = (token) => token.startsWith(tokenPrefix);
117
121
 
118
122
  // src/lib/seam/connect/axios.ts
119
123
  var createAxiosClient = (options) => {
124
+ if (isSeamHttpOptionsWithClient(options))
125
+ return options.client;
120
126
  return axios__default.default.create({
121
127
  baseURL: options.endpoint,
122
128
  withCredentials: isSeamHttpOptionsWithClientSessionToken(options),
@@ -130,8 +136,14 @@ var createAxiosClient = (options) => {
130
136
  };
131
137
 
132
138
  // src/lib/seam/connect/parse-options.ts
139
+ var enableLegacyMethodBehaivorDefault = true;
133
140
  var parseOptions = (apiKeyOrOptions) => {
134
141
  const options = typeof apiKeyOrOptions === "string" ? { apiKey: apiKeyOrOptions } : apiKeyOrOptions;
142
+ if (isSeamHttpOptionsWithClient(options))
143
+ return {
144
+ ...options,
145
+ enableLegacyMethodBehaivor: options.enableLegacyMethodBehaivor ?? enableLegacyMethodBehaivorDefault
146
+ };
135
147
  const endpoint = options.endpoint ?? globalThis.process?.env?.["SEAM_ENDPOINT"] ?? globalThis.process?.env?.["SEAM_API_URL"] ?? "https://connect.getseam.com";
136
148
  const apiKey = "apiKey" in options ? options.apiKey : globalThis.process?.env?.["SEAM_API_KEY"];
137
149
  return {
@@ -139,80 +151,1393 @@ var parseOptions = (apiKeyOrOptions) => {
139
151
  ...apiKey != null ? { apiKey } : {},
140
152
  endpoint,
141
153
  axiosOptions: options.axiosOptions ?? {},
142
- enableLegacyMethodBehaivor: false
154
+ enableLegacyMethodBehaivor: options.enableLegacyMethodBehaivor ?? enableLegacyMethodBehaivorDefault
143
155
  };
144
156
  };
145
157
 
146
- // src/lib/seam/connect/routes/workspaces.ts
147
- var WorkspacesHttp = class {
148
- constructor(apiKeyOrOptionsOrClient) {
149
- if (apiKeyOrOptionsOrClient instanceof axios.Axios) {
150
- this.client = apiKeyOrOptionsOrClient;
151
- return;
158
+ // src/lib/seam/connect/routes/access-codes-unmanaged.ts
159
+ var SeamHttpAccessCodesUnmanaged = class _SeamHttpAccessCodesUnmanaged {
160
+ constructor(apiKeyOrOptions) {
161
+ const options = parseOptions(apiKeyOrOptions);
162
+ this.client = createAxiosClient(options);
163
+ }
164
+ static fromClient(client, options = {}) {
165
+ const opts = { ...options, client };
166
+ if (!isSeamHttpOptionsWithClient(opts)) {
167
+ throw new SeamHttpInvalidOptionsError("Missing client");
168
+ }
169
+ return new _SeamHttpAccessCodesUnmanaged(opts);
170
+ }
171
+ static fromApiKey(apiKey, options = {}) {
172
+ const opts = { ...options, apiKey };
173
+ if (!isSeamHttpOptionsWithApiKey(opts)) {
174
+ throw new SeamHttpInvalidOptionsError("Missing apiKey");
152
175
  }
153
- const options = parseOptions(apiKeyOrOptionsOrClient);
176
+ return new _SeamHttpAccessCodesUnmanaged(opts);
177
+ }
178
+ static fromClientSessionToken(clientSessionToken, options = {}) {
179
+ const opts = { ...options, clientSessionToken };
180
+ if (!isSeamHttpOptionsWithClientSessionToken(opts)) {
181
+ throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
182
+ }
183
+ return new _SeamHttpAccessCodesUnmanaged(opts);
184
+ }
185
+ async convertToManaged(body) {
186
+ await this.client.request({
187
+ url: "/access_codes/unmanaged/convert_to_managed",
188
+ method: "post",
189
+ data: body
190
+ });
191
+ }
192
+ async delete(body) {
193
+ await this.client.request({
194
+ url: "/access_codes/unmanaged/delete",
195
+ method: "post",
196
+ data: body
197
+ });
198
+ }
199
+ async get(body) {
200
+ const { data } = await this.client.request(
201
+ {
202
+ url: "/access_codes/unmanaged/get",
203
+ method: "post",
204
+ data: body
205
+ }
206
+ );
207
+ return data.access_code;
208
+ }
209
+ async list(body) {
210
+ const { data } = await this.client.request({
211
+ url: "/access_codes/unmanaged/list",
212
+ method: "post",
213
+ data: body
214
+ });
215
+ return data.access_codes;
216
+ }
217
+ async update(body) {
218
+ await this.client.request({
219
+ url: "/access_codes/unmanaged/update",
220
+ method: "post",
221
+ data: body
222
+ });
223
+ }
224
+ };
225
+
226
+ // src/lib/seam/connect/routes/access-codes.ts
227
+ var SeamHttpAccessCodes = class _SeamHttpAccessCodes {
228
+ constructor(apiKeyOrOptions) {
229
+ const options = parseOptions(apiKeyOrOptions);
154
230
  this.client = createAxiosClient(options);
155
231
  }
156
- async get(params = {}) {
157
- const { data } = await this.client.get(
158
- "/workspaces/get",
232
+ static fromClient(client, options = {}) {
233
+ const opts = { ...options, client };
234
+ if (!isSeamHttpOptionsWithClient(opts)) {
235
+ throw new SeamHttpInvalidOptionsError("Missing client");
236
+ }
237
+ return new _SeamHttpAccessCodes(opts);
238
+ }
239
+ static fromApiKey(apiKey, options = {}) {
240
+ const opts = { ...options, apiKey };
241
+ if (!isSeamHttpOptionsWithApiKey(opts)) {
242
+ throw new SeamHttpInvalidOptionsError("Missing apiKey");
243
+ }
244
+ return new _SeamHttpAccessCodes(opts);
245
+ }
246
+ static fromClientSessionToken(clientSessionToken, options = {}) {
247
+ const opts = { ...options, clientSessionToken };
248
+ if (!isSeamHttpOptionsWithClientSessionToken(opts)) {
249
+ throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
250
+ }
251
+ return new _SeamHttpAccessCodes(opts);
252
+ }
253
+ get unmanaged() {
254
+ return SeamHttpAccessCodesUnmanaged.fromClient(this.client);
255
+ }
256
+ async create(body) {
257
+ const { data } = await this.client.request({
258
+ url: "/access_codes/create",
259
+ method: "post",
260
+ data: body
261
+ });
262
+ return data.access_code;
263
+ }
264
+ async createMultiple(body) {
265
+ const { data } = await this.client.request({
266
+ url: "/access_codes/create_multiple",
267
+ method: "post",
268
+ data: body
269
+ });
270
+ return data.access_codes;
271
+ }
272
+ async delete(body) {
273
+ await this.client.request({
274
+ url: "/access_codes/delete",
275
+ method: "post",
276
+ data: body
277
+ });
278
+ }
279
+ async generateCode(params) {
280
+ const { data } = await this.client.request(
159
281
  {
282
+ url: "/access_codes/generate_code",
283
+ method: "get",
160
284
  params
161
285
  }
162
286
  );
163
- return data.workspace;
287
+ return data.generated_code;
288
+ }
289
+ async get(body) {
290
+ const { data } = await this.client.request({
291
+ url: "/access_codes/get",
292
+ method: "post",
293
+ data: body
294
+ });
295
+ return data.access_code;
296
+ }
297
+ async list(body) {
298
+ const { data } = await this.client.request({
299
+ url: "/access_codes/list",
300
+ method: "post",
301
+ data: body
302
+ });
303
+ return data.access_codes;
304
+ }
305
+ async pullBackupAccessCode(body) {
306
+ const { data } = await this.client.request({
307
+ url: "/access_codes/pull_backup_access_code",
308
+ method: "post",
309
+ data: body
310
+ });
311
+ return data.backup_access_code;
312
+ }
313
+ async update(body) {
314
+ await this.client.request({
315
+ url: "/access_codes/update",
316
+ method: "post",
317
+ data: body
318
+ });
319
+ }
320
+ };
321
+
322
+ // src/lib/seam/connect/routes/acs-access-groups.ts
323
+ var SeamHttpAcsAccessGroups = class _SeamHttpAcsAccessGroups {
324
+ constructor(apiKeyOrOptions) {
325
+ const options = parseOptions(apiKeyOrOptions);
326
+ this.client = createAxiosClient(options);
327
+ }
328
+ static fromClient(client, options = {}) {
329
+ const opts = { ...options, client };
330
+ if (!isSeamHttpOptionsWithClient(opts)) {
331
+ throw new SeamHttpInvalidOptionsError("Missing client");
332
+ }
333
+ return new _SeamHttpAcsAccessGroups(opts);
334
+ }
335
+ static fromApiKey(apiKey, options = {}) {
336
+ const opts = { ...options, apiKey };
337
+ if (!isSeamHttpOptionsWithApiKey(opts)) {
338
+ throw new SeamHttpInvalidOptionsError("Missing apiKey");
339
+ }
340
+ return new _SeamHttpAcsAccessGroups(opts);
341
+ }
342
+ static fromClientSessionToken(clientSessionToken, options = {}) {
343
+ const opts = { ...options, clientSessionToken };
344
+ if (!isSeamHttpOptionsWithClientSessionToken(opts)) {
345
+ throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
346
+ }
347
+ return new _SeamHttpAcsAccessGroups(opts);
348
+ }
349
+ async addUser(body) {
350
+ await this.client.request({
351
+ url: "/acs/access_groups/add_user",
352
+ method: "post",
353
+ data: body
354
+ });
355
+ }
356
+ async create(body) {
357
+ const { data } = await this.client.request({
358
+ url: "/acs/access_groups/create",
359
+ method: "post",
360
+ data: body
361
+ });
362
+ return data.acs_access_group;
363
+ }
364
+ async delete(body) {
365
+ await this.client.request({
366
+ url: "/acs/access_groups/delete",
367
+ method: "post",
368
+ data: body
369
+ });
370
+ }
371
+ async get(body) {
372
+ const { data } = await this.client.request({
373
+ url: "/acs/access_groups/get",
374
+ method: "post",
375
+ data: body
376
+ });
377
+ return data.acs_access_group;
378
+ }
379
+ async list(body) {
380
+ const { data } = await this.client.request({
381
+ url: "/acs/access_groups/list",
382
+ method: "post",
383
+ data: body
384
+ });
385
+ return data.acs_access_groups;
386
+ }
387
+ async listUsers(body) {
388
+ const { data } = await this.client.request({
389
+ url: "/acs/access_groups/list_users",
390
+ method: "post",
391
+ data: body
392
+ });
393
+ return data.acs_users;
394
+ }
395
+ async removeUser(body) {
396
+ await this.client.request({
397
+ url: "/acs/access_groups/remove_user",
398
+ method: "post",
399
+ data: body
400
+ });
401
+ }
402
+ async update(body) {
403
+ await this.client.request({
404
+ url: "/acs/access_groups/update",
405
+ method: "post",
406
+ data: body
407
+ });
408
+ }
409
+ };
410
+
411
+ // src/lib/seam/connect/routes/acs-credentials.ts
412
+ var SeamHttpAcsCredentials = class _SeamHttpAcsCredentials {
413
+ constructor(apiKeyOrOptions) {
414
+ const options = parseOptions(apiKeyOrOptions);
415
+ this.client = createAxiosClient(options);
416
+ }
417
+ static fromClient(client, options = {}) {
418
+ const opts = { ...options, client };
419
+ if (!isSeamHttpOptionsWithClient(opts)) {
420
+ throw new SeamHttpInvalidOptionsError("Missing client");
421
+ }
422
+ return new _SeamHttpAcsCredentials(opts);
423
+ }
424
+ static fromApiKey(apiKey, options = {}) {
425
+ const opts = { ...options, apiKey };
426
+ if (!isSeamHttpOptionsWithApiKey(opts)) {
427
+ throw new SeamHttpInvalidOptionsError("Missing apiKey");
428
+ }
429
+ return new _SeamHttpAcsCredentials(opts);
430
+ }
431
+ static fromClientSessionToken(clientSessionToken, options = {}) {
432
+ const opts = { ...options, clientSessionToken };
433
+ if (!isSeamHttpOptionsWithClientSessionToken(opts)) {
434
+ throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
435
+ }
436
+ return new _SeamHttpAcsCredentials(opts);
437
+ }
438
+ async create(body) {
439
+ const { data } = await this.client.request({
440
+ url: "/acs/credentials/create",
441
+ method: "post",
442
+ data: body
443
+ });
444
+ return data.acs_credential;
445
+ }
446
+ async delete(body) {
447
+ await this.client.request({
448
+ url: "/acs/credentials/delete",
449
+ method: "post",
450
+ data: body
451
+ });
452
+ }
453
+ async get(body) {
454
+ const { data } = await this.client.request({
455
+ url: "/acs/credentials/get",
456
+ method: "post",
457
+ data: body
458
+ });
459
+ return data.acs_credential;
460
+ }
461
+ async list(body) {
462
+ const { data } = await this.client.request({
463
+ url: "/acs/credentials/list",
464
+ method: "post",
465
+ data: body
466
+ });
467
+ return data.acs_credentials;
468
+ }
469
+ };
470
+
471
+ // src/lib/seam/connect/routes/acs-systems.ts
472
+ var SeamHttpAcsSystems = class _SeamHttpAcsSystems {
473
+ constructor(apiKeyOrOptions) {
474
+ const options = parseOptions(apiKeyOrOptions);
475
+ this.client = createAxiosClient(options);
476
+ }
477
+ static fromClient(client, options = {}) {
478
+ const opts = { ...options, client };
479
+ if (!isSeamHttpOptionsWithClient(opts)) {
480
+ throw new SeamHttpInvalidOptionsError("Missing client");
481
+ }
482
+ return new _SeamHttpAcsSystems(opts);
483
+ }
484
+ static fromApiKey(apiKey, options = {}) {
485
+ const opts = { ...options, apiKey };
486
+ if (!isSeamHttpOptionsWithApiKey(opts)) {
487
+ throw new SeamHttpInvalidOptionsError("Missing apiKey");
488
+ }
489
+ return new _SeamHttpAcsSystems(opts);
490
+ }
491
+ static fromClientSessionToken(clientSessionToken, options = {}) {
492
+ const opts = { ...options, clientSessionToken };
493
+ if (!isSeamHttpOptionsWithClientSessionToken(opts)) {
494
+ throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
495
+ }
496
+ return new _SeamHttpAcsSystems(opts);
497
+ }
498
+ async get(body) {
499
+ const { data } = await this.client.request({
500
+ url: "/acs/systems/get",
501
+ method: "post",
502
+ data: body
503
+ });
504
+ return data.acs_system;
505
+ }
506
+ async list(params) {
507
+ const { data } = await this.client.request({
508
+ url: "/acs/systems/list",
509
+ method: "get",
510
+ params
511
+ });
512
+ return data.acs_systems;
513
+ }
514
+ };
515
+
516
+ // src/lib/seam/connect/routes/acs-users.ts
517
+ var SeamHttpAcsUsers = class _SeamHttpAcsUsers {
518
+ constructor(apiKeyOrOptions) {
519
+ const options = parseOptions(apiKeyOrOptions);
520
+ this.client = createAxiosClient(options);
521
+ }
522
+ static fromClient(client, options = {}) {
523
+ const opts = { ...options, client };
524
+ if (!isSeamHttpOptionsWithClient(opts)) {
525
+ throw new SeamHttpInvalidOptionsError("Missing client");
526
+ }
527
+ return new _SeamHttpAcsUsers(opts);
528
+ }
529
+ static fromApiKey(apiKey, options = {}) {
530
+ const opts = { ...options, apiKey };
531
+ if (!isSeamHttpOptionsWithApiKey(opts)) {
532
+ throw new SeamHttpInvalidOptionsError("Missing apiKey");
533
+ }
534
+ return new _SeamHttpAcsUsers(opts);
535
+ }
536
+ static fromClientSessionToken(clientSessionToken, options = {}) {
537
+ const opts = { ...options, clientSessionToken };
538
+ if (!isSeamHttpOptionsWithClientSessionToken(opts)) {
539
+ throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
540
+ }
541
+ return new _SeamHttpAcsUsers(opts);
542
+ }
543
+ async addToAccessGroup(body) {
544
+ await this.client.request({
545
+ url: "/acs/users/add_to_access_group",
546
+ method: "post",
547
+ data: body
548
+ });
549
+ }
550
+ async create(body) {
551
+ const { data } = await this.client.request({
552
+ url: "/acs/users/create",
553
+ method: "post",
554
+ data: body
555
+ });
556
+ return data.acs_user;
557
+ }
558
+ async delete(body) {
559
+ await this.client.request({
560
+ url: "/acs/users/delete",
561
+ method: "post",
562
+ data: body
563
+ });
564
+ }
565
+ async get(body) {
566
+ const { data } = await this.client.request({
567
+ url: "/acs/users/get",
568
+ method: "post",
569
+ data: body
570
+ });
571
+ return data.acs_user;
572
+ }
573
+ async list(body) {
574
+ const { data } = await this.client.request({
575
+ url: "/acs/users/list",
576
+ method: "post",
577
+ data: body
578
+ });
579
+ return data.acs_users;
580
+ }
581
+ async removeFromAccessGroup(body) {
582
+ await this.client.request({
583
+ url: "/acs/users/remove_from_access_group",
584
+ method: "post",
585
+ data: body
586
+ });
587
+ }
588
+ async update(body) {
589
+ await this.client.request({
590
+ url: "/acs/users/update",
591
+ method: "post",
592
+ data: body
593
+ });
594
+ }
595
+ };
596
+
597
+ // src/lib/seam/connect/routes/acs.ts
598
+ var SeamHttpAcs = class _SeamHttpAcs {
599
+ constructor(apiKeyOrOptions) {
600
+ const options = parseOptions(apiKeyOrOptions);
601
+ this.client = createAxiosClient(options);
602
+ }
603
+ static fromClient(client, options = {}) {
604
+ const opts = { ...options, client };
605
+ if (!isSeamHttpOptionsWithClient(opts)) {
606
+ throw new SeamHttpInvalidOptionsError("Missing client");
607
+ }
608
+ return new _SeamHttpAcs(opts);
609
+ }
610
+ static fromApiKey(apiKey, options = {}) {
611
+ const opts = { ...options, apiKey };
612
+ if (!isSeamHttpOptionsWithApiKey(opts)) {
613
+ throw new SeamHttpInvalidOptionsError("Missing apiKey");
614
+ }
615
+ return new _SeamHttpAcs(opts);
616
+ }
617
+ static fromClientSessionToken(clientSessionToken, options = {}) {
618
+ const opts = { ...options, clientSessionToken };
619
+ if (!isSeamHttpOptionsWithClientSessionToken(opts)) {
620
+ throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
621
+ }
622
+ return new _SeamHttpAcs(opts);
623
+ }
624
+ get accessGroups() {
625
+ return SeamHttpAcsAccessGroups.fromClient(this.client);
626
+ }
627
+ get credentials() {
628
+ return SeamHttpAcsCredentials.fromClient(this.client);
629
+ }
630
+ get systems() {
631
+ return SeamHttpAcsSystems.fromClient(this.client);
632
+ }
633
+ get users() {
634
+ return SeamHttpAcsUsers.fromClient(this.client);
635
+ }
636
+ };
637
+
638
+ // src/lib/seam/connect/routes/action-attempts.ts
639
+ var SeamHttpActionAttempts = class _SeamHttpActionAttempts {
640
+ constructor(apiKeyOrOptions) {
641
+ const options = parseOptions(apiKeyOrOptions);
642
+ this.client = createAxiosClient(options);
643
+ }
644
+ static fromClient(client, options = {}) {
645
+ const opts = { ...options, client };
646
+ if (!isSeamHttpOptionsWithClient(opts)) {
647
+ throw new SeamHttpInvalidOptionsError("Missing client");
648
+ }
649
+ return new _SeamHttpActionAttempts(opts);
650
+ }
651
+ static fromApiKey(apiKey, options = {}) {
652
+ const opts = { ...options, apiKey };
653
+ if (!isSeamHttpOptionsWithApiKey(opts)) {
654
+ throw new SeamHttpInvalidOptionsError("Missing apiKey");
655
+ }
656
+ return new _SeamHttpActionAttempts(opts);
657
+ }
658
+ static fromClientSessionToken(clientSessionToken, options = {}) {
659
+ const opts = { ...options, clientSessionToken };
660
+ if (!isSeamHttpOptionsWithClientSessionToken(opts)) {
661
+ throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
662
+ }
663
+ return new _SeamHttpActionAttempts(opts);
664
+ }
665
+ async get(body) {
666
+ const { data } = await this.client.request({
667
+ url: "/action_attempts/get",
668
+ method: "post",
669
+ data: body
670
+ });
671
+ return data.action_attempt;
672
+ }
673
+ async list(body) {
674
+ const { data } = await this.client.request({
675
+ url: "/action_attempts/list",
676
+ method: "post",
677
+ data: body
678
+ });
679
+ return data.action_attempts;
680
+ }
681
+ };
682
+
683
+ // src/lib/seam/connect/routes/client-sessions.ts
684
+ var SeamHttpClientSessions = class _SeamHttpClientSessions {
685
+ constructor(apiKeyOrOptions) {
686
+ const options = parseOptions(apiKeyOrOptions);
687
+ this.client = createAxiosClient(options);
688
+ }
689
+ static fromClient(client, options = {}) {
690
+ const opts = { ...options, client };
691
+ if (!isSeamHttpOptionsWithClient(opts)) {
692
+ throw new SeamHttpInvalidOptionsError("Missing client");
693
+ }
694
+ return new _SeamHttpClientSessions(opts);
695
+ }
696
+ static fromApiKey(apiKey, options = {}) {
697
+ const opts = { ...options, apiKey };
698
+ if (!isSeamHttpOptionsWithApiKey(opts)) {
699
+ throw new SeamHttpInvalidOptionsError("Missing apiKey");
700
+ }
701
+ return new _SeamHttpClientSessions(opts);
702
+ }
703
+ static fromClientSessionToken(clientSessionToken, options = {}) {
704
+ const opts = { ...options, clientSessionToken };
705
+ if (!isSeamHttpOptionsWithClientSessionToken(opts)) {
706
+ throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
707
+ }
708
+ return new _SeamHttpClientSessions(opts);
709
+ }
710
+ async create(body) {
711
+ const { data } = await this.client.request({
712
+ url: "/client_sessions/create",
713
+ method: "post",
714
+ data: body
715
+ });
716
+ return data.client_session;
717
+ }
718
+ async delete(body) {
719
+ await this.client.request({
720
+ url: "/client_sessions/delete",
721
+ method: "post",
722
+ data: body
723
+ });
724
+ }
725
+ async get(body) {
726
+ const { data } = await this.client.request({
727
+ url: "/client_sessions/get",
728
+ method: "post",
729
+ data: body
730
+ });
731
+ return data.client_session;
732
+ }
733
+ async grantAccess(body) {
734
+ const { data } = await this.client.request({
735
+ url: "/client_sessions/grant_access",
736
+ method: "post",
737
+ data: body
738
+ });
739
+ return data.client_session;
740
+ }
741
+ async list(body) {
742
+ const { data } = await this.client.request({
743
+ url: "/client_sessions/list",
744
+ method: "post",
745
+ data: body
746
+ });
747
+ return data.client_sessions;
748
+ }
749
+ };
750
+
751
+ // src/lib/seam/connect/routes/connect-webviews.ts
752
+ var SeamHttpConnectWebviews = class _SeamHttpConnectWebviews {
753
+ constructor(apiKeyOrOptions) {
754
+ const options = parseOptions(apiKeyOrOptions);
755
+ this.client = createAxiosClient(options);
756
+ }
757
+ static fromClient(client, options = {}) {
758
+ const opts = { ...options, client };
759
+ if (!isSeamHttpOptionsWithClient(opts)) {
760
+ throw new SeamHttpInvalidOptionsError("Missing client");
761
+ }
762
+ return new _SeamHttpConnectWebviews(opts);
763
+ }
764
+ static fromApiKey(apiKey, options = {}) {
765
+ const opts = { ...options, apiKey };
766
+ if (!isSeamHttpOptionsWithApiKey(opts)) {
767
+ throw new SeamHttpInvalidOptionsError("Missing apiKey");
768
+ }
769
+ return new _SeamHttpConnectWebviews(opts);
770
+ }
771
+ static fromClientSessionToken(clientSessionToken, options = {}) {
772
+ const opts = { ...options, clientSessionToken };
773
+ if (!isSeamHttpOptionsWithClientSessionToken(opts)) {
774
+ throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
775
+ }
776
+ return new _SeamHttpConnectWebviews(opts);
777
+ }
778
+ async create(body) {
779
+ const { data } = await this.client.request({
780
+ url: "/connect_webviews/create",
781
+ method: "post",
782
+ data: body
783
+ });
784
+ return data.connect_webview;
785
+ }
786
+ async delete(body) {
787
+ await this.client.request({
788
+ url: "/connect_webviews/delete",
789
+ method: "post",
790
+ data: body
791
+ });
792
+ }
793
+ async get(body) {
794
+ const { data } = await this.client.request({
795
+ url: "/connect_webviews/get",
796
+ method: "post",
797
+ data: body
798
+ });
799
+ return data.connect_webview;
800
+ }
801
+ async list(params) {
802
+ const { data } = await this.client.request({
803
+ url: "/connect_webviews/list",
804
+ method: "get",
805
+ params
806
+ });
807
+ return data.connect_webviews;
808
+ }
809
+ async view(params) {
810
+ await this.client.request({
811
+ url: "/connect_webviews/view",
812
+ method: "get",
813
+ params
814
+ });
815
+ }
816
+ };
817
+
818
+ // src/lib/seam/connect/routes/connected-accounts.ts
819
+ var SeamHttpConnectedAccounts = class _SeamHttpConnectedAccounts {
820
+ constructor(apiKeyOrOptions) {
821
+ const options = parseOptions(apiKeyOrOptions);
822
+ this.client = createAxiosClient(options);
823
+ }
824
+ static fromClient(client, options = {}) {
825
+ const opts = { ...options, client };
826
+ if (!isSeamHttpOptionsWithClient(opts)) {
827
+ throw new SeamHttpInvalidOptionsError("Missing client");
828
+ }
829
+ return new _SeamHttpConnectedAccounts(opts);
830
+ }
831
+ static fromApiKey(apiKey, options = {}) {
832
+ const opts = { ...options, apiKey };
833
+ if (!isSeamHttpOptionsWithApiKey(opts)) {
834
+ throw new SeamHttpInvalidOptionsError("Missing apiKey");
835
+ }
836
+ return new _SeamHttpConnectedAccounts(opts);
837
+ }
838
+ static fromClientSessionToken(clientSessionToken, options = {}) {
839
+ const opts = { ...options, clientSessionToken };
840
+ if (!isSeamHttpOptionsWithClientSessionToken(opts)) {
841
+ throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
842
+ }
843
+ return new _SeamHttpConnectedAccounts(opts);
844
+ }
845
+ async delete(body) {
846
+ await this.client.request({
847
+ url: "/connected_accounts/delete",
848
+ method: "post",
849
+ data: body
850
+ });
851
+ }
852
+ async get(body) {
853
+ const { data } = await this.client.request({
854
+ url: "/connected_accounts/get",
855
+ method: "post",
856
+ data: body
857
+ });
858
+ return data.connected_account;
859
+ }
860
+ async list(params) {
861
+ const { data } = await this.client.request({
862
+ url: "/connected_accounts/list",
863
+ method: "get",
864
+ params
865
+ });
866
+ return data.connected_accounts;
867
+ }
868
+ };
869
+
870
+ // src/lib/seam/connect/routes/devices-unmanaged.ts
871
+ var SeamHttpDevicesUnmanaged = class _SeamHttpDevicesUnmanaged {
872
+ constructor(apiKeyOrOptions) {
873
+ const options = parseOptions(apiKeyOrOptions);
874
+ this.client = createAxiosClient(options);
875
+ }
876
+ static fromClient(client, options = {}) {
877
+ const opts = { ...options, client };
878
+ if (!isSeamHttpOptionsWithClient(opts)) {
879
+ throw new SeamHttpInvalidOptionsError("Missing client");
880
+ }
881
+ return new _SeamHttpDevicesUnmanaged(opts);
882
+ }
883
+ static fromApiKey(apiKey, options = {}) {
884
+ const opts = { ...options, apiKey };
885
+ if (!isSeamHttpOptionsWithApiKey(opts)) {
886
+ throw new SeamHttpInvalidOptionsError("Missing apiKey");
887
+ }
888
+ return new _SeamHttpDevicesUnmanaged(opts);
889
+ }
890
+ static fromClientSessionToken(clientSessionToken, options = {}) {
891
+ const opts = { ...options, clientSessionToken };
892
+ if (!isSeamHttpOptionsWithClientSessionToken(opts)) {
893
+ throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
894
+ }
895
+ return new _SeamHttpDevicesUnmanaged(opts);
896
+ }
897
+ async get(body) {
898
+ const { data } = await this.client.request({
899
+ url: "/devices/unmanaged/get",
900
+ method: "post",
901
+ data: body
902
+ });
903
+ return data.device;
904
+ }
905
+ async list(body) {
906
+ const { data } = await this.client.request({
907
+ url: "/devices/unmanaged/list",
908
+ method: "post",
909
+ data: body
910
+ });
911
+ return data.devices;
912
+ }
913
+ async update(body) {
914
+ await this.client.request({
915
+ url: "/devices/unmanaged/update",
916
+ method: "post",
917
+ data: body
918
+ });
919
+ }
920
+ };
921
+
922
+ // src/lib/seam/connect/routes/devices.ts
923
+ var SeamHttpDevices = class _SeamHttpDevices {
924
+ constructor(apiKeyOrOptions) {
925
+ const options = parseOptions(apiKeyOrOptions);
926
+ this.client = createAxiosClient(options);
927
+ }
928
+ static fromClient(client, options = {}) {
929
+ const opts = { ...options, client };
930
+ if (!isSeamHttpOptionsWithClient(opts)) {
931
+ throw new SeamHttpInvalidOptionsError("Missing client");
932
+ }
933
+ return new _SeamHttpDevices(opts);
934
+ }
935
+ static fromApiKey(apiKey, options = {}) {
936
+ const opts = { ...options, apiKey };
937
+ if (!isSeamHttpOptionsWithApiKey(opts)) {
938
+ throw new SeamHttpInvalidOptionsError("Missing apiKey");
939
+ }
940
+ return new _SeamHttpDevices(opts);
941
+ }
942
+ static fromClientSessionToken(clientSessionToken, options = {}) {
943
+ const opts = { ...options, clientSessionToken };
944
+ if (!isSeamHttpOptionsWithClientSessionToken(opts)) {
945
+ throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
946
+ }
947
+ return new _SeamHttpDevices(opts);
948
+ }
949
+ get unmanaged() {
950
+ return SeamHttpDevicesUnmanaged.fromClient(this.client);
951
+ }
952
+ async delete(body) {
953
+ await this.client.request({
954
+ url: "/devices/delete",
955
+ method: "post",
956
+ data: body
957
+ });
958
+ }
959
+ async get(body) {
960
+ const { data } = await this.client.request({
961
+ url: "/devices/get",
962
+ method: "post",
963
+ data: body
964
+ });
965
+ return data.device;
966
+ }
967
+ async list(body) {
968
+ const { data } = await this.client.request({
969
+ url: "/devices/list",
970
+ method: "post",
971
+ data: body
972
+ });
973
+ return data.devices;
974
+ }
975
+ async listDeviceProviders(body) {
976
+ const { data } = await this.client.request({
977
+ url: "/devices/list_device_providers",
978
+ method: "post",
979
+ data: body
980
+ });
981
+ return data.device_providers;
982
+ }
983
+ async update(body) {
984
+ await this.client.request({
985
+ url: "/devices/update",
986
+ method: "post",
987
+ data: body
988
+ });
989
+ }
990
+ };
991
+
992
+ // src/lib/seam/connect/routes/events.ts
993
+ var SeamHttpEvents = class _SeamHttpEvents {
994
+ constructor(apiKeyOrOptions) {
995
+ const options = parseOptions(apiKeyOrOptions);
996
+ this.client = createAxiosClient(options);
997
+ }
998
+ static fromClient(client, options = {}) {
999
+ const opts = { ...options, client };
1000
+ if (!isSeamHttpOptionsWithClient(opts)) {
1001
+ throw new SeamHttpInvalidOptionsError("Missing client");
1002
+ }
1003
+ return new _SeamHttpEvents(opts);
1004
+ }
1005
+ static fromApiKey(apiKey, options = {}) {
1006
+ const opts = { ...options, apiKey };
1007
+ if (!isSeamHttpOptionsWithApiKey(opts)) {
1008
+ throw new SeamHttpInvalidOptionsError("Missing apiKey");
1009
+ }
1010
+ return new _SeamHttpEvents(opts);
1011
+ }
1012
+ static fromClientSessionToken(clientSessionToken, options = {}) {
1013
+ const opts = { ...options, clientSessionToken };
1014
+ if (!isSeamHttpOptionsWithClientSessionToken(opts)) {
1015
+ throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
1016
+ }
1017
+ return new _SeamHttpEvents(opts);
1018
+ }
1019
+ async get(body) {
1020
+ const { data } = await this.client.request({
1021
+ url: "/events/get",
1022
+ method: "post",
1023
+ data: body
1024
+ });
1025
+ return data.event;
1026
+ }
1027
+ async list(body) {
1028
+ const { data } = await this.client.request({
1029
+ url: "/events/list",
1030
+ method: "post",
1031
+ data: body
1032
+ });
1033
+ return data.events;
1034
+ }
1035
+ };
1036
+
1037
+ // src/lib/seam/connect/routes/locks.ts
1038
+ var SeamHttpLocks = class _SeamHttpLocks {
1039
+ constructor(apiKeyOrOptions) {
1040
+ const options = parseOptions(apiKeyOrOptions);
1041
+ this.client = createAxiosClient(options);
1042
+ }
1043
+ static fromClient(client, options = {}) {
1044
+ const opts = { ...options, client };
1045
+ if (!isSeamHttpOptionsWithClient(opts)) {
1046
+ throw new SeamHttpInvalidOptionsError("Missing client");
1047
+ }
1048
+ return new _SeamHttpLocks(opts);
1049
+ }
1050
+ static fromApiKey(apiKey, options = {}) {
1051
+ const opts = { ...options, apiKey };
1052
+ if (!isSeamHttpOptionsWithApiKey(opts)) {
1053
+ throw new SeamHttpInvalidOptionsError("Missing apiKey");
1054
+ }
1055
+ return new _SeamHttpLocks(opts);
1056
+ }
1057
+ static fromClientSessionToken(clientSessionToken, options = {}) {
1058
+ const opts = { ...options, clientSessionToken };
1059
+ if (!isSeamHttpOptionsWithClientSessionToken(opts)) {
1060
+ throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
1061
+ }
1062
+ return new _SeamHttpLocks(opts);
1063
+ }
1064
+ async get(body) {
1065
+ const { data } = await this.client.request({
1066
+ url: "/locks/get",
1067
+ method: "post",
1068
+ data: body
1069
+ });
1070
+ return data.device;
1071
+ }
1072
+ async list(body) {
1073
+ const { data } = await this.client.request({
1074
+ url: "/locks/list",
1075
+ method: "post",
1076
+ data: body
1077
+ });
1078
+ return data.devices;
1079
+ }
1080
+ async lockDoor(body) {
1081
+ const { data } = await this.client.request({
1082
+ url: "/locks/lock_door",
1083
+ method: "post",
1084
+ data: body
1085
+ });
1086
+ return data.action_attempt;
1087
+ }
1088
+ async unlockDoor(body) {
1089
+ const { data } = await this.client.request({
1090
+ url: "/locks/unlock_door",
1091
+ method: "post",
1092
+ data: body
1093
+ });
1094
+ return data.action_attempt;
1095
+ }
1096
+ };
1097
+
1098
+ // src/lib/seam/connect/routes/noise-sensors-noise-thresholds.ts
1099
+ var SeamHttpNoiseSensorsNoiseThresholds = class _SeamHttpNoiseSensorsNoiseThresholds {
1100
+ constructor(apiKeyOrOptions) {
1101
+ const options = parseOptions(apiKeyOrOptions);
1102
+ this.client = createAxiosClient(options);
1103
+ }
1104
+ static fromClient(client, options = {}) {
1105
+ const opts = { ...options, client };
1106
+ if (!isSeamHttpOptionsWithClient(opts)) {
1107
+ throw new SeamHttpInvalidOptionsError("Missing client");
1108
+ }
1109
+ return new _SeamHttpNoiseSensorsNoiseThresholds(opts);
1110
+ }
1111
+ static fromApiKey(apiKey, options = {}) {
1112
+ const opts = { ...options, apiKey };
1113
+ if (!isSeamHttpOptionsWithApiKey(opts)) {
1114
+ throw new SeamHttpInvalidOptionsError("Missing apiKey");
1115
+ }
1116
+ return new _SeamHttpNoiseSensorsNoiseThresholds(opts);
1117
+ }
1118
+ static fromClientSessionToken(clientSessionToken, options = {}) {
1119
+ const opts = { ...options, clientSessionToken };
1120
+ if (!isSeamHttpOptionsWithClientSessionToken(opts)) {
1121
+ throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
1122
+ }
1123
+ return new _SeamHttpNoiseSensorsNoiseThresholds(opts);
1124
+ }
1125
+ async create(body) {
1126
+ await this.client.request({
1127
+ url: "/noise_sensors/noise_thresholds/create",
1128
+ method: "post",
1129
+ data: body
1130
+ });
1131
+ }
1132
+ async delete(body) {
1133
+ await this.client.request({
1134
+ url: "/noise_sensors/noise_thresholds/delete",
1135
+ method: "post",
1136
+ data: body
1137
+ });
1138
+ }
1139
+ async get(body) {
1140
+ const { data } = await this.client.request({
1141
+ url: "/noise_sensors/noise_thresholds/get",
1142
+ method: "post",
1143
+ data: body
1144
+ });
1145
+ return data.noise_threshold;
1146
+ }
1147
+ async list(body) {
1148
+ const { data } = await this.client.request({
1149
+ url: "/noise_sensors/noise_thresholds/list",
1150
+ method: "post",
1151
+ data: body
1152
+ });
1153
+ return data.noise_thresholds;
1154
+ }
1155
+ async update(body) {
1156
+ await this.client.request({
1157
+ url: "/noise_sensors/noise_thresholds/update",
1158
+ method: "post",
1159
+ data: body
1160
+ });
164
1161
  }
165
1162
  };
166
1163
 
167
- // src/lib/seam/connect/legacy/workspaces.ts
168
- var LegacyWorkspacesHttp = class extends WorkspacesHttp {
169
- async get(params = {}) {
170
- const { data } = await this.client.get(
171
- "/workspaces/get",
1164
+ // src/lib/seam/connect/routes/noise-sensors.ts
1165
+ var SeamHttpNoiseSensors = class _SeamHttpNoiseSensors {
1166
+ constructor(apiKeyOrOptions) {
1167
+ const options = parseOptions(apiKeyOrOptions);
1168
+ this.client = createAxiosClient(options);
1169
+ }
1170
+ static fromClient(client, options = {}) {
1171
+ const opts = { ...options, client };
1172
+ if (!isSeamHttpOptionsWithClient(opts)) {
1173
+ throw new SeamHttpInvalidOptionsError("Missing client");
1174
+ }
1175
+ return new _SeamHttpNoiseSensors(opts);
1176
+ }
1177
+ static fromApiKey(apiKey, options = {}) {
1178
+ const opts = { ...options, apiKey };
1179
+ if (!isSeamHttpOptionsWithApiKey(opts)) {
1180
+ throw new SeamHttpInvalidOptionsError("Missing apiKey");
1181
+ }
1182
+ return new _SeamHttpNoiseSensors(opts);
1183
+ }
1184
+ static fromClientSessionToken(clientSessionToken, options = {}) {
1185
+ const opts = { ...options, clientSessionToken };
1186
+ if (!isSeamHttpOptionsWithClientSessionToken(opts)) {
1187
+ throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
1188
+ }
1189
+ return new _SeamHttpNoiseSensors(opts);
1190
+ }
1191
+ get noiseThresholds() {
1192
+ return SeamHttpNoiseSensorsNoiseThresholds.fromClient(this.client);
1193
+ }
1194
+ };
1195
+
1196
+ // src/lib/seam/connect/routes/thermostats-climate-setting-schedules.ts
1197
+ var SeamHttpThermostatsClimateSettingSchedules = class _SeamHttpThermostatsClimateSettingSchedules {
1198
+ constructor(apiKeyOrOptions) {
1199
+ const options = parseOptions(apiKeyOrOptions);
1200
+ this.client = createAxiosClient(options);
1201
+ }
1202
+ static fromClient(client, options = {}) {
1203
+ const opts = { ...options, client };
1204
+ if (!isSeamHttpOptionsWithClient(opts)) {
1205
+ throw new SeamHttpInvalidOptionsError("Missing client");
1206
+ }
1207
+ return new _SeamHttpThermostatsClimateSettingSchedules(opts);
1208
+ }
1209
+ static fromApiKey(apiKey, options = {}) {
1210
+ const opts = { ...options, apiKey };
1211
+ if (!isSeamHttpOptionsWithApiKey(opts)) {
1212
+ throw new SeamHttpInvalidOptionsError("Missing apiKey");
1213
+ }
1214
+ return new _SeamHttpThermostatsClimateSettingSchedules(opts);
1215
+ }
1216
+ static fromClientSessionToken(clientSessionToken, options = {}) {
1217
+ const opts = { ...options, clientSessionToken };
1218
+ if (!isSeamHttpOptionsWithClientSessionToken(opts)) {
1219
+ throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
1220
+ }
1221
+ return new _SeamHttpThermostatsClimateSettingSchedules(opts);
1222
+ }
1223
+ async create(body) {
1224
+ const { data } = await this.client.request(
172
1225
  {
173
- params
1226
+ url: "/thermostats/climate_setting_schedules/create",
1227
+ method: "post",
1228
+ data: body
1229
+ }
1230
+ );
1231
+ return data.climate_setting_schedule;
1232
+ }
1233
+ async delete(body) {
1234
+ await this.client.request(
1235
+ {
1236
+ url: "/thermostats/climate_setting_schedules/delete",
1237
+ method: "post",
1238
+ data: body
174
1239
  }
175
1240
  );
1241
+ }
1242
+ async get(body) {
1243
+ const { data } = await this.client.request({
1244
+ url: "/thermostats/climate_setting_schedules/get",
1245
+ method: "post",
1246
+ data: body
1247
+ });
1248
+ return data.climate_setting_schedule;
1249
+ }
1250
+ async list(body) {
1251
+ const { data } = await this.client.request(
1252
+ {
1253
+ url: "/thermostats/climate_setting_schedules/list",
1254
+ method: "post",
1255
+ data: body
1256
+ }
1257
+ );
1258
+ return data.climate_setting_schedules;
1259
+ }
1260
+ async update(body) {
1261
+ await this.client.request(
1262
+ {
1263
+ url: "/thermostats/climate_setting_schedules/update",
1264
+ method: "post",
1265
+ data: body
1266
+ }
1267
+ );
1268
+ }
1269
+ };
1270
+
1271
+ // src/lib/seam/connect/routes/thermostats.ts
1272
+ var SeamHttpThermostats = class _SeamHttpThermostats {
1273
+ constructor(apiKeyOrOptions) {
1274
+ const options = parseOptions(apiKeyOrOptions);
1275
+ this.client = createAxiosClient(options);
1276
+ }
1277
+ static fromClient(client, options = {}) {
1278
+ const opts = { ...options, client };
1279
+ if (!isSeamHttpOptionsWithClient(opts)) {
1280
+ throw new SeamHttpInvalidOptionsError("Missing client");
1281
+ }
1282
+ return new _SeamHttpThermostats(opts);
1283
+ }
1284
+ static fromApiKey(apiKey, options = {}) {
1285
+ const opts = { ...options, apiKey };
1286
+ if (!isSeamHttpOptionsWithApiKey(opts)) {
1287
+ throw new SeamHttpInvalidOptionsError("Missing apiKey");
1288
+ }
1289
+ return new _SeamHttpThermostats(opts);
1290
+ }
1291
+ static fromClientSessionToken(clientSessionToken, options = {}) {
1292
+ const opts = { ...options, clientSessionToken };
1293
+ if (!isSeamHttpOptionsWithClientSessionToken(opts)) {
1294
+ throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
1295
+ }
1296
+ return new _SeamHttpThermostats(opts);
1297
+ }
1298
+ get climateSettingSchedules() {
1299
+ return SeamHttpThermostatsClimateSettingSchedules.fromClient(this.client);
1300
+ }
1301
+ async cool(body) {
1302
+ await this.client.request({
1303
+ url: "/thermostats/cool",
1304
+ method: "post",
1305
+ data: body
1306
+ });
1307
+ }
1308
+ async get(body) {
1309
+ const { data } = await this.client.request({
1310
+ url: "/thermostats/get",
1311
+ method: "post",
1312
+ data: body
1313
+ });
1314
+ return data.thermostat;
1315
+ }
1316
+ async heat(body) {
1317
+ await this.client.request({
1318
+ url: "/thermostats/heat",
1319
+ method: "post",
1320
+ data: body
1321
+ });
1322
+ }
1323
+ async heatCool(body) {
1324
+ await this.client.request({
1325
+ url: "/thermostats/heat_cool",
1326
+ method: "post",
1327
+ data: body
1328
+ });
1329
+ }
1330
+ async list(body) {
1331
+ const { data } = await this.client.request({
1332
+ url: "/thermostats/list",
1333
+ method: "post",
1334
+ data: body
1335
+ });
1336
+ return data.thermostats;
1337
+ }
1338
+ async off(body) {
1339
+ await this.client.request({
1340
+ url: "/thermostats/off",
1341
+ method: "post",
1342
+ data: body
1343
+ });
1344
+ }
1345
+ async setFanMode(body) {
1346
+ await this.client.request({
1347
+ url: "/thermostats/set_fan_mode",
1348
+ method: "post",
1349
+ data: body
1350
+ });
1351
+ }
1352
+ async update(body) {
1353
+ await this.client.request({
1354
+ url: "/thermostats/update",
1355
+ method: "post",
1356
+ data: body
1357
+ });
1358
+ }
1359
+ };
1360
+
1361
+ // src/lib/seam/connect/routes/webhooks.ts
1362
+ var SeamHttpWebhooks = class _SeamHttpWebhooks {
1363
+ constructor(apiKeyOrOptions) {
1364
+ const options = parseOptions(apiKeyOrOptions);
1365
+ this.client = createAxiosClient(options);
1366
+ }
1367
+ static fromClient(client, options = {}) {
1368
+ const opts = { ...options, client };
1369
+ if (!isSeamHttpOptionsWithClient(opts)) {
1370
+ throw new SeamHttpInvalidOptionsError("Missing client");
1371
+ }
1372
+ return new _SeamHttpWebhooks(opts);
1373
+ }
1374
+ static fromApiKey(apiKey, options = {}) {
1375
+ const opts = { ...options, apiKey };
1376
+ if (!isSeamHttpOptionsWithApiKey(opts)) {
1377
+ throw new SeamHttpInvalidOptionsError("Missing apiKey");
1378
+ }
1379
+ return new _SeamHttpWebhooks(opts);
1380
+ }
1381
+ static fromClientSessionToken(clientSessionToken, options = {}) {
1382
+ const opts = { ...options, clientSessionToken };
1383
+ if (!isSeamHttpOptionsWithClientSessionToken(opts)) {
1384
+ throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
1385
+ }
1386
+ return new _SeamHttpWebhooks(opts);
1387
+ }
1388
+ async create(body) {
1389
+ const { data } = await this.client.request({
1390
+ url: "/webhooks/create",
1391
+ method: "post",
1392
+ data: body
1393
+ });
1394
+ return data.webhook;
1395
+ }
1396
+ async delete(body) {
1397
+ await this.client.request({
1398
+ url: "/webhooks/delete",
1399
+ method: "post",
1400
+ data: body
1401
+ });
1402
+ }
1403
+ async get(body) {
1404
+ const { data } = await this.client.request({
1405
+ url: "/webhooks/get",
1406
+ method: "post",
1407
+ data: body
1408
+ });
1409
+ return data.webhook;
1410
+ }
1411
+ async list(params) {
1412
+ const { data } = await this.client.request({
1413
+ url: "/webhooks/list",
1414
+ method: "get",
1415
+ params
1416
+ });
1417
+ return data.webhooks;
1418
+ }
1419
+ };
1420
+
1421
+ // src/lib/seam/connect/routes/workspaces.ts
1422
+ var SeamHttpWorkspaces = class _SeamHttpWorkspaces {
1423
+ constructor(apiKeyOrOptions) {
1424
+ const options = parseOptions(apiKeyOrOptions);
1425
+ this.client = createAxiosClient(options);
1426
+ }
1427
+ static fromClient(client, options = {}) {
1428
+ const opts = { ...options, client };
1429
+ if (!isSeamHttpOptionsWithClient(opts)) {
1430
+ throw new SeamHttpInvalidOptionsError("Missing client");
1431
+ }
1432
+ return new _SeamHttpWorkspaces(opts);
1433
+ }
1434
+ static fromApiKey(apiKey, options = {}) {
1435
+ const opts = { ...options, apiKey };
1436
+ if (!isSeamHttpOptionsWithApiKey(opts)) {
1437
+ throw new SeamHttpInvalidOptionsError("Missing apiKey");
1438
+ }
1439
+ return new _SeamHttpWorkspaces(opts);
1440
+ }
1441
+ static fromClientSessionToken(clientSessionToken, options = {}) {
1442
+ const opts = { ...options, clientSessionToken };
1443
+ if (!isSeamHttpOptionsWithClientSessionToken(opts)) {
1444
+ throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
1445
+ }
1446
+ return new _SeamHttpWorkspaces(opts);
1447
+ }
1448
+ async get(params) {
1449
+ const { data } = await this.client.request({
1450
+ url: "/workspaces/get",
1451
+ method: "get",
1452
+ params
1453
+ });
176
1454
  return data.workspace;
177
1455
  }
1456
+ async list(params) {
1457
+ const { data } = await this.client.request({
1458
+ url: "/workspaces/list",
1459
+ method: "get",
1460
+ params
1461
+ });
1462
+ return data.workspaces;
1463
+ }
1464
+ async resetSandbox(body) {
1465
+ await this.client.request({
1466
+ url: "/workspaces/reset_sandbox",
1467
+ method: "post",
1468
+ data: body
1469
+ });
1470
+ }
178
1471
  };
179
1472
 
180
1473
  // src/lib/seam/connect/client.ts
181
- var _legacy;
182
- var _SeamHttp = class _SeamHttp {
1474
+ var SeamHttp = class _SeamHttp {
1475
+ // #legacy: boolean
183
1476
  constructor(apiKeyOrOptions) {
184
- __privateAdd(this, _legacy, void 0);
185
1477
  const options = parseOptions(apiKeyOrOptions);
186
- __privateSet(this, _legacy, options.enableLegacyMethodBehaivor);
187
1478
  this.client = createAxiosClient(options);
188
1479
  }
1480
+ static fromClient(client, options = {}) {
1481
+ const opts = { ...options, client };
1482
+ if (!isSeamHttpOptionsWithClient(opts)) {
1483
+ throw new SeamHttpInvalidOptionsError("Missing client");
1484
+ }
1485
+ return new _SeamHttp(opts);
1486
+ }
189
1487
  static fromApiKey(apiKey, options = {}) {
190
1488
  const opts = { ...options, apiKey };
191
1489
  if (!isSeamHttpOptionsWithApiKey(opts)) {
192
- throw new InvalidSeamHttpOptionsError("Missing apiKey");
1490
+ throw new SeamHttpInvalidOptionsError("Missing apiKey");
193
1491
  }
194
1492
  return new _SeamHttp(opts);
195
1493
  }
196
1494
  static fromClientSessionToken(clientSessionToken, options = {}) {
197
1495
  const opts = { ...options, clientSessionToken };
198
1496
  if (!isSeamHttpOptionsWithClientSessionToken(opts)) {
199
- throw new InvalidSeamHttpOptionsError("Missing clientSessionToken");
1497
+ throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
200
1498
  }
201
1499
  return new _SeamHttp(opts);
202
1500
  }
203
- // TODO
204
- // static fromPublishableKey and deprecate getClientSessionToken
205
- // TODO: Should we keep makeRequest?
206
- // Better to implement error handling and wrapping in an error handler.
207
- // makeRequest
1501
+ get accessCodes() {
1502
+ return SeamHttpAccessCodes.fromClient(this.client);
1503
+ }
1504
+ get acs() {
1505
+ return SeamHttpAcs.fromClient(this.client);
1506
+ }
1507
+ get actionAttempts() {
1508
+ return SeamHttpActionAttempts.fromClient(this.client);
1509
+ }
1510
+ get clientSessions() {
1511
+ return SeamHttpClientSessions.fromClient(this.client);
1512
+ }
1513
+ get connectedAccounts() {
1514
+ return SeamHttpConnectedAccounts.fromClient(this.client);
1515
+ }
1516
+ get connectWebviews() {
1517
+ return SeamHttpConnectWebviews.fromClient(this.client);
1518
+ }
1519
+ get devices() {
1520
+ return SeamHttpDevices.fromClient(this.client);
1521
+ }
1522
+ get events() {
1523
+ return SeamHttpEvents.fromClient(this.client);
1524
+ }
1525
+ get locks() {
1526
+ return SeamHttpLocks.fromClient(this.client);
1527
+ }
1528
+ get noiseSensors() {
1529
+ return SeamHttpNoiseSensors.fromClient(this.client);
1530
+ }
1531
+ get thermostats() {
1532
+ return SeamHttpThermostats.fromClient(this.client);
1533
+ }
1534
+ get webhooks() {
1535
+ return SeamHttpWebhooks.fromClient(this.client);
1536
+ }
208
1537
  get workspaces() {
209
- if (__privateGet(this, _legacy))
210
- return new LegacyWorkspacesHttp(this.client);
211
- return new WorkspacesHttp(this.client);
1538
+ return SeamHttpWorkspaces.fromClient(this.client);
212
1539
  }
213
1540
  };
214
- _legacy = new WeakMap();
215
- var SeamHttp = _SeamHttp;
216
1541
 
217
1542
  exports.SeamHttp = SeamHttp;
218
1543
  //# sourceMappingURL=out.js.map