@seamapi/http 2.23.6 → 2.24.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 (194) hide show
  1. package/README.md +5 -0
  2. package/lib/request-parameters.d.ts +1 -1
  3. package/lib/request-parameters.js +3 -3
  4. package/lib/request-parameters.js.map +1 -1
  5. package/lib/resolve-action-attempt.d.ts +2 -0
  6. package/lib/resolve-action-attempt.js +25 -27
  7. package/lib/resolve-action-attempt.js.map +1 -1
  8. package/lib/routes/access-codes/access-codes.d.ts +5 -5
  9. package/lib/routes/access-codes/access-codes.js +20 -1
  10. package/lib/routes/access-codes/access-codes.js.map +1 -1
  11. package/lib/routes/access-codes/simulate/simulate.d.ts +2 -2
  12. package/lib/routes/access-codes/simulate/simulate.js +2 -1
  13. package/lib/routes/access-codes/simulate/simulate.js.map +1 -1
  14. package/lib/routes/access-codes/unmanaged/unmanaged.d.ts +4 -4
  15. package/lib/routes/access-codes/unmanaged/unmanaged.js +6 -1
  16. package/lib/routes/access-codes/unmanaged/unmanaged.js.map +1 -1
  17. package/lib/routes/access-grants/access-grants.d.ts +6 -6
  18. package/lib/routes/access-grants/access-grants.js +19 -1
  19. package/lib/routes/access-grants/access-grants.js.map +1 -1
  20. package/lib/routes/access-grants/unmanaged/unmanaged.d.ts +3 -3
  21. package/lib/routes/access-grants/unmanaged/unmanaged.js +4 -1
  22. package/lib/routes/access-grants/unmanaged/unmanaged.js.map +1 -1
  23. package/lib/routes/access-methods/access-methods.d.ts +5 -5
  24. package/lib/routes/access-methods/access-methods.js +22 -4
  25. package/lib/routes/access-methods/access-methods.js.map +1 -1
  26. package/lib/routes/access-methods/unmanaged/unmanaged.d.ts +2 -2
  27. package/lib/routes/access-methods/unmanaged/unmanaged.js +3 -1
  28. package/lib/routes/access-methods/unmanaged/unmanaged.js.map +1 -1
  29. package/lib/routes/acs/access-groups/access-groups.d.ts +2 -2
  30. package/lib/routes/acs/access-groups/access-groups.js +8 -1
  31. package/lib/routes/acs/access-groups/access-groups.js.map +1 -1
  32. package/lib/routes/acs/acs.d.ts +2 -2
  33. package/lib/routes/acs/acs.js.map +1 -1
  34. package/lib/routes/acs/credentials/credentials.d.ts +3 -3
  35. package/lib/routes/acs/credentials/credentials.js +9 -1
  36. package/lib/routes/acs/credentials/credentials.js.map +1 -1
  37. package/lib/routes/acs/encoders/encoders.d.ts +3 -3
  38. package/lib/routes/acs/encoders/encoders.js +9 -4
  39. package/lib/routes/acs/encoders/encoders.js.map +1 -1
  40. package/lib/routes/acs/encoders/simulate/simulate.d.ts +2 -2
  41. package/lib/routes/acs/encoders/simulate/simulate.js +5 -1
  42. package/lib/routes/acs/encoders/simulate/simulate.js.map +1 -1
  43. package/lib/routes/acs/entrances/entrances.d.ts +3 -3
  44. package/lib/routes/acs/entrances/entrances.js +7 -2
  45. package/lib/routes/acs/entrances/entrances.js.map +1 -1
  46. package/lib/routes/acs/systems/systems.d.ts +2 -2
  47. package/lib/routes/acs/systems/systems.js +5 -1
  48. package/lib/routes/acs/systems/systems.js.map +1 -1
  49. package/lib/routes/acs/users/users.d.ts +10 -10
  50. package/lib/routes/acs/users/users.js +46 -1
  51. package/lib/routes/acs/users/users.js.map +1 -1
  52. package/lib/routes/action-attempts/action-attempts.d.ts +3 -3
  53. package/lib/routes/action-attempts/action-attempts.js +4 -2
  54. package/lib/routes/action-attempts/action-attempts.js.map +1 -1
  55. package/lib/routes/client-sessions/client-sessions.d.ts +3 -3
  56. package/lib/routes/client-sessions/client-sessions.js +15 -1
  57. package/lib/routes/client-sessions/client-sessions.js.map +1 -1
  58. package/lib/routes/connect-webviews/connect-webviews.d.ts +3 -3
  59. package/lib/routes/connect-webviews/connect-webviews.js +5 -1
  60. package/lib/routes/connect-webviews/connect-webviews.js.map +1 -1
  61. package/lib/routes/connected-accounts/connected-accounts.d.ts +4 -4
  62. package/lib/routes/connected-accounts/connected-accounts.js +6 -1
  63. package/lib/routes/connected-accounts/connected-accounts.js.map +1 -1
  64. package/lib/routes/connected-accounts/simulate/simulate.d.ts +2 -2
  65. package/lib/routes/connected-accounts/simulate/simulate.js +2 -1
  66. package/lib/routes/connected-accounts/simulate/simulate.js.map +1 -1
  67. package/lib/routes/customers/customers.d.ts +2 -2
  68. package/lib/routes/customers/customers.js +4 -1
  69. package/lib/routes/customers/customers.js.map +1 -1
  70. package/lib/routes/devices/devices.d.ts +4 -4
  71. package/lib/routes/devices/devices.js +6 -1
  72. package/lib/routes/devices/devices.js.map +1 -1
  73. package/lib/routes/devices/simulate/simulate.d.ts +2 -2
  74. package/lib/routes/devices/simulate/simulate.js +7 -1
  75. package/lib/routes/devices/simulate/simulate.js.map +1 -1
  76. package/lib/routes/devices/unmanaged/unmanaged.d.ts +4 -4
  77. package/lib/routes/devices/unmanaged/unmanaged.js +4 -1
  78. package/lib/routes/devices/unmanaged/unmanaged.js.map +1 -1
  79. package/lib/routes/events/events.d.ts +4 -4
  80. package/lib/routes/events/events.js +31 -1
  81. package/lib/routes/events/events.js.map +1 -1
  82. package/lib/routes/instant-keys/instant-keys.d.ts +3 -3
  83. package/lib/routes/instant-keys/instant-keys.js +4 -1
  84. package/lib/routes/instant-keys/instant-keys.js.map +1 -1
  85. package/lib/routes/locks/locks.d.ts +3 -3
  86. package/lib/routes/locks/locks.js +9 -4
  87. package/lib/routes/locks/locks.js.map +1 -1
  88. package/lib/routes/locks/simulate/simulate.d.ts +2 -2
  89. package/lib/routes/locks/simulate/simulate.js +5 -3
  90. package/lib/routes/locks/simulate/simulate.js.map +1 -1
  91. package/lib/routes/noise-sensors/noise-sensors.d.ts +2 -2
  92. package/lib/routes/noise-sensors/noise-sensors.js +2 -1
  93. package/lib/routes/noise-sensors/noise-sensors.js.map +1 -1
  94. package/lib/routes/noise-sensors/noise-thresholds/noise-thresholds.d.ts +2 -2
  95. package/lib/routes/noise-sensors/noise-thresholds/noise-thresholds.js +6 -1
  96. package/lib/routes/noise-sensors/noise-thresholds/noise-thresholds.js.map +1 -1
  97. package/lib/routes/noise-sensors/simulate/simulate.d.ts +2 -2
  98. package/lib/routes/noise-sensors/simulate/simulate.js +2 -1
  99. package/lib/routes/noise-sensors/simulate/simulate.js.map +1 -1
  100. package/lib/routes/phones/phones.d.ts +2 -2
  101. package/lib/routes/phones/phones.js +4 -1
  102. package/lib/routes/phones/phones.js.map +1 -1
  103. package/lib/routes/phones/simulate/simulate.d.ts +2 -2
  104. package/lib/routes/phones/simulate/simulate.js +2 -1
  105. package/lib/routes/phones/simulate/simulate.js.map +1 -1
  106. package/lib/routes/seam-http-endpoints.d.ts +2 -2
  107. package/lib/routes/seam-http-endpoints.js.map +1 -1
  108. package/lib/routes/seam-http.d.ts +2 -2
  109. package/lib/routes/seam-http.js.map +1 -1
  110. package/lib/routes/spaces/spaces.d.ts +5 -5
  111. package/lib/routes/spaces/spaces.js +18 -1
  112. package/lib/routes/spaces/spaces.js.map +1 -1
  113. package/lib/routes/thermostats/daily-programs/daily-programs.d.ts +2 -2
  114. package/lib/routes/thermostats/daily-programs/daily-programs.js +5 -2
  115. package/lib/routes/thermostats/daily-programs/daily-programs.js.map +1 -1
  116. package/lib/routes/thermostats/schedules/schedules.d.ts +2 -2
  117. package/lib/routes/thermostats/schedules/schedules.js +6 -1
  118. package/lib/routes/thermostats/schedules/schedules.js.map +1 -1
  119. package/lib/routes/thermostats/simulate/simulate.d.ts +2 -2
  120. package/lib/routes/thermostats/simulate/simulate.js +3 -1
  121. package/lib/routes/thermostats/simulate/simulate.js.map +1 -1
  122. package/lib/routes/thermostats/thermostats.d.ts +2 -2
  123. package/lib/routes/thermostats/thermostats.js +23 -9
  124. package/lib/routes/thermostats/thermostats.js.map +1 -1
  125. package/lib/routes/user-identities/unmanaged/unmanaged.d.ts +3 -3
  126. package/lib/routes/user-identities/unmanaged/unmanaged.js +4 -1
  127. package/lib/routes/user-identities/unmanaged/unmanaged.js.map +1 -1
  128. package/lib/routes/user-identities/user-identities.d.ts +5 -5
  129. package/lib/routes/user-identities/user-identities.js +21 -1
  130. package/lib/routes/user-identities/user-identities.js.map +1 -1
  131. package/lib/routes/webhooks/webhooks.d.ts +2 -2
  132. package/lib/routes/webhooks/webhooks.js +6 -1
  133. package/lib/routes/webhooks/webhooks.js.map +1 -1
  134. package/lib/routes/workspaces/workspaces.d.ts +2 -2
  135. package/lib/routes/workspaces/workspaces.js +7 -2
  136. package/lib/routes/workspaces/workspaces.js.map +1 -1
  137. package/lib/seam-http-request.d.ts +8 -3
  138. package/lib/seam-http-request.js +15 -6
  139. package/lib/seam-http-request.js.map +1 -1
  140. package/lib/seam-paginator.d.ts +2 -2
  141. package/lib/seam-paginator.js +12 -8
  142. package/lib/seam-paginator.js.map +1 -1
  143. package/lib/version.d.ts +1 -1
  144. package/lib/version.js +1 -1
  145. package/package.json +1 -1
  146. package/src/lib/request-parameters.ts +5 -2
  147. package/src/lib/resolve-action-attempt.ts +34 -37
  148. package/src/lib/routes/access-codes/access-codes.ts +94 -59
  149. package/src/lib/routes/access-codes/simulate/simulate.ts +6 -2
  150. package/src/lib/routes/access-codes/unmanaged/unmanaged.ts +28 -17
  151. package/src/lib/routes/access-grants/access-grants.ts +101 -71
  152. package/src/lib/routes/access-grants/unmanaged/unmanaged.ts +9 -3
  153. package/src/lib/routes/access-methods/access-methods.ts +98 -63
  154. package/src/lib/routes/access-methods/unmanaged/unmanaged.ts +7 -2
  155. package/src/lib/routes/acs/access-groups/access-groups.ts +12 -2
  156. package/src/lib/routes/acs/acs.ts +2 -2
  157. package/src/lib/routes/acs/credentials/credentials.ts +14 -3
  158. package/src/lib/routes/acs/encoders/encoders.ts +26 -15
  159. package/src/lib/routes/acs/encoders/simulate/simulate.ts +9 -2
  160. package/src/lib/routes/acs/entrances/entrances.ts +16 -7
  161. package/src/lib/routes/acs/systems/systems.ts +9 -2
  162. package/src/lib/routes/acs/users/users.ts +214 -137
  163. package/src/lib/routes/action-attempts/action-attempts.ts +13 -7
  164. package/src/lib/routes/client-sessions/client-sessions.ts +54 -29
  165. package/src/lib/routes/connect-webviews/connect-webviews.ts +10 -3
  166. package/src/lib/routes/connected-accounts/connected-accounts.ts +24 -13
  167. package/src/lib/routes/connected-accounts/simulate/simulate.ts +6 -2
  168. package/src/lib/routes/customers/customers.ts +8 -2
  169. package/src/lib/routes/devices/devices.ts +27 -13
  170. package/src/lib/routes/devices/simulate/simulate.ts +11 -2
  171. package/src/lib/routes/devices/unmanaged/unmanaged.ts +22 -13
  172. package/src/lib/routes/events/events.ts +427 -362
  173. package/src/lib/routes/instant-keys/instant-keys.ts +21 -12
  174. package/src/lib/routes/locks/locks.ts +38 -24
  175. package/src/lib/routes/locks/simulate/simulate.ts +17 -10
  176. package/src/lib/routes/noise-sensors/noise-sensors.ts +6 -2
  177. package/src/lib/routes/noise-sensors/noise-thresholds/noise-thresholds.ts +10 -2
  178. package/src/lib/routes/noise-sensors/simulate/simulate.ts +6 -2
  179. package/src/lib/routes/phones/phones.ts +8 -2
  180. package/src/lib/routes/phones/simulate/simulate.ts +6 -2
  181. package/src/lib/routes/seam-http-endpoints.ts +2 -2
  182. package/src/lib/routes/seam-http.ts +2 -2
  183. package/src/lib/routes/spaces/spaces.ts +73 -44
  184. package/src/lib/routes/thermostats/daily-programs/daily-programs.ts +13 -6
  185. package/src/lib/routes/thermostats/schedules/schedules.ts +10 -2
  186. package/src/lib/routes/thermostats/simulate/simulate.ts +7 -2
  187. package/src/lib/routes/thermostats/thermostats.ts +59 -34
  188. package/src/lib/routes/user-identities/unmanaged/unmanaged.ts +9 -3
  189. package/src/lib/routes/user-identities/user-identities.ts +60 -28
  190. package/src/lib/routes/webhooks/webhooks.ts +10 -2
  191. package/src/lib/routes/workspaces/workspaces.ts +15 -6
  192. package/src/lib/seam-http-request.ts +30 -8
  193. package/src/lib/seam-paginator.ts +22 -12
  194. package/src/lib/version.ts +1 -1
@@ -1,3 +1,4 @@
1
+ import { SeamHttpInvalidOptionsError } from './options.js'
1
2
  import type { ActionAttempt } from './resources/action-attempt.js'
2
3
 
3
4
  /**
@@ -29,55 +30,51 @@ export interface ResolveActionAttemptOptions {
29
30
  * @throws {@link SeamActionAttemptFailedError} if the action attempt fails.
30
31
  * @throws {@link SeamActionAttemptTimeoutError} if the action attempt
31
32
  * does not resolve within the timeout.
33
+ * @throws {@link SeamHttpInvalidOptionsError} if the timeout is negative
34
+ * or the pollingInterval is not greater than zero.
32
35
  */
33
36
  export const resolveActionAttempt = async <T extends ActionAttempt>(
34
37
  actionAttempt: T,
35
38
  actionAttempts: ActionAttemptsClient,
36
39
  { timeout = 10_000, pollingInterval = 1_000 }: ResolveActionAttemptOptions,
37
40
  ): Promise<SucceededActionAttempt<T>> => {
38
- let timeoutRef
39
- const timeoutPromise = new Promise<SucceededActionAttempt<T>>(
40
- (_resolve, reject) => {
41
- timeoutRef = globalThis.setTimeout(() => {
42
- reject(new SeamActionAttemptTimeoutError<T>(actionAttempt, timeout))
43
- }, timeout)
44
- },
45
- )
46
-
47
- try {
48
- return await Promise.race([
49
- pollActionAttempt<T>(actionAttempt, actionAttempts, { pollingInterval }),
50
- timeoutPromise,
51
- ])
52
- } finally {
53
- if (timeoutRef != null) globalThis.clearTimeout(timeoutRef)
41
+ if (Number.isNaN(timeout) || timeout < 0) {
42
+ throw new SeamHttpInvalidOptionsError(
43
+ `The timeout option must not be negative, got ${timeout}`,
44
+ )
54
45
  }
55
- }
56
46
 
57
- const pollActionAttempt = async <T extends ActionAttempt>(
58
- actionAttempt: T,
59
- actionAttempts: ActionAttemptsClient,
60
- options: Pick<ResolveActionAttemptOptions, 'pollingInterval'>,
61
- ): Promise<SucceededActionAttempt<T>> => {
62
- if (isSuccessfulActionAttempt(actionAttempt)) {
63
- return actionAttempt
47
+ if (Number.isNaN(pollingInterval) || pollingInterval <= 0) {
48
+ throw new SeamHttpInvalidOptionsError(
49
+ `The pollingInterval option must be greater than zero, got ${pollingInterval}`,
50
+ )
64
51
  }
65
52
 
66
- if (isFailedActionAttempt(actionAttempt)) {
67
- throw new SeamActionAttemptFailedError(actionAttempt)
68
- }
53
+ const deadline = Date.now() + timeout
54
+ let currentActionAttempt = actionAttempt
55
+
56
+ while (true) {
57
+ if (isSuccessfulActionAttempt(currentActionAttempt)) {
58
+ return currentActionAttempt
59
+ }
69
60
 
70
- await new Promise((resolve) => setTimeout(resolve, options.pollingInterval))
61
+ if (isFailedActionAttempt(currentActionAttempt)) {
62
+ throw new SeamActionAttemptFailedError(currentActionAttempt)
63
+ }
71
64
 
72
- const nextActionAttempt = await actionAttempts.get({
73
- action_attempt_id: actionAttempt.action_attempt_id,
74
- })
65
+ const remaining = deadline - Date.now()
66
+ if (remaining <= 0) {
67
+ throw new SeamActionAttemptTimeoutError<T>(currentActionAttempt, timeout)
68
+ }
75
69
 
76
- return await pollActionAttempt(
77
- nextActionAttempt as unknown as T,
78
- actionAttempts,
79
- options,
80
- )
70
+ await new Promise((resolve) =>
71
+ setTimeout(resolve, Math.min(pollingInterval, remaining)),
72
+ )
73
+
74
+ currentActionAttempt = (await actionAttempts.get({
75
+ action_attempt_id: currentActionAttempt.action_attempt_id,
76
+ })) as unknown as T
77
+ }
81
78
  }
82
79
 
83
80
  /**
@@ -146,7 +143,7 @@ export class SeamActionAttemptTimeoutError<
146
143
  > extends SeamActionAttemptError<T> {
147
144
  constructor(actionAttempt: T, timeout: number) {
148
145
  super(
149
- `Timed out waiting for action action attempt after ${timeout}ms`,
146
+ `Timed out waiting for action attempt after ${timeout}ms`,
150
147
  actionAttempt,
151
148
  )
152
149
  this.name = this.constructor.name
@@ -31,7 +31,10 @@ import {
31
31
  import type { RequireAtLeastOne } from 'lib/request-parameters.js'
32
32
  import type { AccessCode } from 'lib/resources/access-code.js'
33
33
  import { SeamHttpClientSessions } from 'lib/routes/client-sessions/index.js'
34
- import { SeamHttpRequest } from 'lib/seam-http-request.js'
34
+ import {
35
+ SeamHttpRequest,
36
+ type SeamPaginatedRequest,
37
+ } from 'lib/seam-http-request.js'
35
38
  import { SeamPaginator } from 'lib/seam-paginator.js'
36
39
 
37
40
  import { SeamHttpAccessCodesSimulate } from './simulate/index.js'
@@ -138,7 +141,7 @@ export class SeamHttpAccessCodes {
138
141
  }
139
142
 
140
143
  createPaginator<const TResponse, const TResponseKey extends keyof TResponse>(
141
- request: SeamHttpRequest<TResponse, TResponseKey>,
144
+ request: SeamPaginatedRequest<TResponse, TResponseKey>,
142
145
  ): SeamPaginator<TResponse, TResponseKey> {
143
146
  return new SeamPaginator<TResponse, TResponseKey>(this, request)
144
147
  }
@@ -184,6 +187,7 @@ export class SeamHttpAccessCodes {
184
187
  parameters,
185
188
  hasRequiredParameters: true,
186
189
  requiredParameterNames: ['device_id'],
190
+ atLeastOneParameterNames: [],
187
191
  responseKey: 'access_code',
188
192
  options,
189
193
  })
@@ -213,6 +217,7 @@ export class SeamHttpAccessCodes {
213
217
  parameters,
214
218
  hasRequiredParameters: true,
215
219
  requiredParameterNames: ['device_ids'],
220
+ atLeastOneParameterNames: [],
216
221
  responseKey: 'access_codes',
217
222
  options,
218
223
  })
@@ -232,6 +237,7 @@ export class SeamHttpAccessCodes {
232
237
  parameters,
233
238
  hasRequiredParameters: true,
234
239
  requiredParameterNames: ['access_code_id'],
240
+ atLeastOneParameterNames: [],
235
241
  responseKey: undefined,
236
242
  options,
237
243
  })
@@ -251,6 +257,7 @@ export class SeamHttpAccessCodes {
251
257
  parameters,
252
258
  hasRequiredParameters: true,
253
259
  requiredParameterNames: ['device_id'],
260
+ atLeastOneParameterNames: [],
254
261
  responseKey: 'generated_code',
255
262
  options,
256
263
  })
@@ -272,6 +279,7 @@ export class SeamHttpAccessCodes {
272
279
  parameters,
273
280
  hasRequiredParameters: true,
274
281
  requiredParameterNames: [],
282
+ atLeastOneParameterNames: ['access_code_id', 'code', 'device_id'],
275
283
  responseKey: 'access_code',
276
284
  options,
277
285
  })
@@ -293,6 +301,16 @@ export class SeamHttpAccessCodes {
293
301
  parameters,
294
302
  hasRequiredParameters: true,
295
303
  requiredParameterNames: [],
304
+ atLeastOneParameterNames: [
305
+ 'access_code_ids',
306
+ 'access_grant_id',
307
+ 'access_grant_key',
308
+ 'access_method_id',
309
+ 'customer_key',
310
+ 'device_id',
311
+ 'search',
312
+ 'user_identifier_key',
313
+ ],
296
314
  responseKey: 'access_codes',
297
315
  hasPagination: true,
298
316
  options,
@@ -321,6 +339,7 @@ export class SeamHttpAccessCodes {
321
339
  parameters,
322
340
  hasRequiredParameters: true,
323
341
  requiredParameterNames: ['access_code_id'],
342
+ atLeastOneParameterNames: [],
324
343
  responseKey: 'access_code',
325
344
  options,
326
345
  })
@@ -342,6 +361,7 @@ export class SeamHttpAccessCodes {
342
361
  parameters,
343
362
  hasRequiredParameters: true,
344
363
  requiredParameterNames: ['device_id'],
364
+ atLeastOneParameterNames: [],
345
365
  responseKey: undefined,
346
366
  options,
347
367
  })
@@ -363,6 +383,7 @@ export class SeamHttpAccessCodes {
363
383
  parameters,
364
384
  hasRequiredParameters: true,
365
385
  requiredParameterNames: ['access_code_id'],
386
+ atLeastOneParameterNames: [],
366
387
  responseKey: undefined,
367
388
  options,
368
389
  })
@@ -386,6 +407,7 @@ export class SeamHttpAccessCodes {
386
407
  parameters,
387
408
  hasRequiredParameters: true,
388
409
  requiredParameterNames: ['common_code_key'],
410
+ atLeastOneParameterNames: [],
389
411
  responseKey: undefined,
390
412
  options,
391
413
  })
@@ -587,20 +609,23 @@ export type AccessCodesGenerateCodeRequest = SeamHttpRequest<
587
609
 
588
610
  export interface AccessCodesGenerateCodeOptions {}
589
611
 
590
- export type AccessCodesGetParameters = RequireAtLeastOne<{
591
- /**
592
- * ID of the access code that you want to get. You must specify either `access_code_id` or both `device_id` and `code`.
593
- */
594
- access_code_id?: string | undefined
595
- /**
596
- * Code of the access code that you want to get. You must specify either `access_code_id` or both `device_id` and `code`.
597
- */
598
- code?: string | undefined
599
- /**
600
- * ID of the device containing the access code that you want to get. You must specify either `access_code_id` or both `device_id` and `code`.
601
- */
602
- device_id?: string | undefined
603
- }>
612
+ export type AccessCodesGetParameters = RequireAtLeastOne<
613
+ {
614
+ /**
615
+ * ID of the access code that you want to get. You must specify either `access_code_id` or both `device_id` and `code`.
616
+ */
617
+ access_code_id?: string | undefined
618
+ /**
619
+ * Code of the access code that you want to get. You must specify either `access_code_id` or both `device_id` and `code`.
620
+ */
621
+ code?: string | undefined
622
+ /**
623
+ * ID of the device containing the access code that you want to get. You must specify either `access_code_id` or both `device_id` and `code`.
624
+ */
625
+ device_id?: string | undefined
626
+ },
627
+ 'access_code_id' | 'code' | 'device_id'
628
+ >
604
629
 
605
630
  /**
606
631
  * @deprecated Use AccessCodesGetRequest instead.
@@ -614,55 +639,65 @@ export type AccessCodesGetRequest = SeamHttpRequest<
614
639
 
615
640
  export interface AccessCodesGetOptions {}
616
641
 
617
- export type AccessCodesListParameters = RequireAtLeastOne<{
618
- /**
619
- * IDs of the access codes that you want to retrieve. Specify `device_id`, `access_code_ids`, `access_method_id`, `access_grant_id`, or `access_grant_key`.
620
- */
621
- access_code_ids?: Array<string> | undefined
622
- /**
623
- * ID of the access grant for which you want to list access codes. Specify `device_id`, `access_code_ids`, `access_method_id`, `access_grant_id`, or `access_grant_key`.
624
- */
625
- access_grant_id?: string | undefined
626
- /**
627
- * Key of the access grant for which you want to list access codes. Specify `device_id`, `access_code_ids`, `access_method_id`, `access_grant_id`, or `access_grant_key`.
628
- */
629
- access_grant_key?: string | undefined
630
- /**
631
- * ID of the access method for which you want to list access codes. Specify `device_id`, `access_code_ids`, `access_method_id`, `access_grant_id`, or `access_grant_key`.
632
- */
633
- access_method_id?: string | undefined
634
- /**
635
- * Customer key for which you want to list access codes.
636
- */
637
- customer_key?: string | undefined
638
- /**
639
- * ID of the device for which you want to list access codes. Specify `device_id`, `access_code_ids`, `access_method_id`, `access_grant_id`, or `access_grant_key`.
640
- */
641
- device_id?: string | undefined
642
- /**
643
- * Numerical limit on the number of access codes to return.
644
- */
645
- limit?: number | undefined
646
- /**
647
- * Identifies the specific page of results to return, obtained from the previous page's `next_page_cursor`.
648
- */
649
- page_cursor?: string | null | undefined
650
- /**
651
- * String for which to search. Filters returned access codes to include all records that satisfy a partial match using `name`, `code` or `access_code_id`.
652
- */
653
- search?: string | undefined
654
- /**
655
- * Your user ID for the user by which to filter access codes.
656
- */
657
- user_identifier_key?: string | undefined
658
- }>
642
+ export type AccessCodesListParameters = RequireAtLeastOne<
643
+ {
644
+ /**
645
+ * IDs of the access codes that you want to retrieve. Specify `device_id`, `access_code_ids`, `access_method_id`, `access_grant_id`, or `access_grant_key`.
646
+ */
647
+ access_code_ids?: Array<string> | undefined
648
+ /**
649
+ * ID of the access grant for which you want to list access codes. Specify `device_id`, `access_code_ids`, `access_method_id`, `access_grant_id`, or `access_grant_key`.
650
+ */
651
+ access_grant_id?: string | undefined
652
+ /**
653
+ * Key of the access grant for which you want to list access codes. Specify `device_id`, `access_code_ids`, `access_method_id`, `access_grant_id`, or `access_grant_key`.
654
+ */
655
+ access_grant_key?: string | undefined
656
+ /**
657
+ * ID of the access method for which you want to list access codes. Specify `device_id`, `access_code_ids`, `access_method_id`, `access_grant_id`, or `access_grant_key`.
658
+ */
659
+ access_method_id?: string | undefined
660
+ /**
661
+ * Customer key for which you want to list access codes.
662
+ */
663
+ customer_key?: string | undefined
664
+ /**
665
+ * ID of the device for which you want to list access codes. Specify `device_id`, `access_code_ids`, `access_method_id`, `access_grant_id`, or `access_grant_key`.
666
+ */
667
+ device_id?: string | undefined
668
+ /**
669
+ * Numerical limit on the number of access codes to return.
670
+ */
671
+ limit?: number | undefined
672
+ /**
673
+ * Identifies the specific page of results to return, obtained from the previous page's `next_page_cursor`.
674
+ */
675
+ page_cursor?: string | null | undefined
676
+ /**
677
+ * String for which to search. Filters returned access codes to include all records that satisfy a partial match using `name`, `code` or `access_code_id`.
678
+ */
679
+ search?: string | undefined
680
+ /**
681
+ * Your user ID for the user by which to filter access codes.
682
+ */
683
+ user_identifier_key?: string | undefined
684
+ },
685
+ | 'access_code_ids'
686
+ | 'access_grant_id'
687
+ | 'access_grant_key'
688
+ | 'access_method_id'
689
+ | 'customer_key'
690
+ | 'device_id'
691
+ | 'search'
692
+ | 'user_identifier_key'
693
+ >
659
694
 
660
695
  /**
661
696
  * @deprecated Use AccessCodesListRequest instead.
662
697
  */
663
698
  export type AccessCodesListResponse = { access_codes: Array<AccessCode> }
664
699
 
665
- export type AccessCodesListRequest = SeamHttpRequest<
700
+ export type AccessCodesListRequest = SeamPaginatedRequest<
666
701
  AccessCodesListResponse,
667
702
  'access_codes'
668
703
  >
@@ -30,7 +30,10 @@ import {
30
30
  } from 'lib/parse-options.js'
31
31
  import type { UnmanagedAccessCode } from 'lib/resources/unmanaged-access-code.js'
32
32
  import { SeamHttpClientSessions } from 'lib/routes/client-sessions/index.js'
33
- import { SeamHttpRequest } from 'lib/seam-http-request.js'
33
+ import {
34
+ SeamHttpRequest,
35
+ type SeamPaginatedRequest,
36
+ } from 'lib/seam-http-request.js'
34
37
  import { SeamPaginator } from 'lib/seam-paginator.js'
35
38
 
36
39
  export class SeamHttpAccessCodesSimulate {
@@ -134,7 +137,7 @@ export class SeamHttpAccessCodesSimulate {
134
137
  }
135
138
 
136
139
  createPaginator<const TResponse, const TResponseKey extends keyof TResponse>(
137
- request: SeamHttpRequest<TResponse, TResponseKey>,
140
+ request: SeamPaginatedRequest<TResponse, TResponseKey>,
138
141
  ): SeamPaginator<TResponse, TResponseKey> {
139
142
  return new SeamPaginator<TResponse, TResponseKey>(this, request)
140
143
  }
@@ -172,6 +175,7 @@ export class SeamHttpAccessCodesSimulate {
172
175
  parameters,
173
176
  hasRequiredParameters: true,
174
177
  requiredParameterNames: ['code', 'device_id', 'name'],
178
+ atLeastOneParameterNames: [],
175
179
  responseKey: 'access_code',
176
180
  options,
177
181
  })
@@ -31,7 +31,10 @@ import {
31
31
  import type { RequireAtLeastOne } from 'lib/request-parameters.js'
32
32
  import type { UnmanagedAccessCode } from 'lib/resources/unmanaged-access-code.js'
33
33
  import { SeamHttpClientSessions } from 'lib/routes/client-sessions/index.js'
34
- import { SeamHttpRequest } from 'lib/seam-http-request.js'
34
+ import {
35
+ SeamHttpRequest,
36
+ type SeamPaginatedRequest,
37
+ } from 'lib/seam-http-request.js'
35
38
  import { SeamPaginator } from 'lib/seam-paginator.js'
36
39
 
37
40
  export class SeamHttpAccessCodesUnmanaged {
@@ -135,7 +138,7 @@ export class SeamHttpAccessCodesUnmanaged {
135
138
  }
136
139
 
137
140
  createPaginator<const TResponse, const TResponseKey extends keyof TResponse>(
138
- request: SeamHttpRequest<TResponse, TResponseKey>,
141
+ request: SeamPaginatedRequest<TResponse, TResponseKey>,
139
142
  ): SeamPaginator<TResponse, TResponseKey> {
140
143
  return new SeamPaginator<TResponse, TResponseKey>(this, request)
141
144
  }
@@ -177,6 +180,7 @@ export class SeamHttpAccessCodesUnmanaged {
177
180
  parameters,
178
181
  hasRequiredParameters: true,
179
182
  requiredParameterNames: ['access_code_id'],
183
+ atLeastOneParameterNames: [],
180
184
  responseKey: undefined,
181
185
  options,
182
186
  })
@@ -196,6 +200,7 @@ export class SeamHttpAccessCodesUnmanaged {
196
200
  parameters,
197
201
  hasRequiredParameters: true,
198
202
  requiredParameterNames: ['access_code_id'],
203
+ atLeastOneParameterNames: [],
199
204
  responseKey: undefined,
200
205
  options,
201
206
  })
@@ -217,6 +222,7 @@ export class SeamHttpAccessCodesUnmanaged {
217
222
  parameters,
218
223
  hasRequiredParameters: true,
219
224
  requiredParameterNames: [],
225
+ atLeastOneParameterNames: ['access_code_id', 'code', 'device_id'],
220
226
  responseKey: 'access_code',
221
227
  options,
222
228
  })
@@ -236,6 +242,7 @@ export class SeamHttpAccessCodesUnmanaged {
236
242
  parameters,
237
243
  hasRequiredParameters: true,
238
244
  requiredParameterNames: ['device_id'],
245
+ atLeastOneParameterNames: [],
239
246
  responseKey: 'access_codes',
240
247
  hasPagination: true,
241
248
  options,
@@ -256,6 +263,7 @@ export class SeamHttpAccessCodesUnmanaged {
256
263
  parameters,
257
264
  hasRequiredParameters: true,
258
265
  requiredParameterNames: ['access_code_id', 'is_managed'],
266
+ atLeastOneParameterNames: [],
259
267
  responseKey: undefined,
260
268
  options,
261
269
  })
@@ -310,20 +318,23 @@ export type AccessCodesUnmanagedDeleteRequest = SeamHttpRequest<void, undefined>
310
318
 
311
319
  export interface AccessCodesUnmanagedDeleteOptions {}
312
320
 
313
- export type AccessCodesUnmanagedGetParameters = RequireAtLeastOne<{
314
- /**
315
- * ID of the unmanaged access code that you want to get. You must specify either `access_code_id` or both `device_id` and `code`.
316
- */
317
- access_code_id?: string | undefined
318
- /**
319
- * Code of the unmanaged access code that you want to get. You must specify either `access_code_id` or both `device_id` and `code`.
320
- */
321
- code?: string | undefined
322
- /**
323
- * ID of the device containing the unmanaged access code that you want to get. You must specify either `access_code_id` or both `device_id` and `code`.
324
- */
325
- device_id?: string | undefined
326
- }>
321
+ export type AccessCodesUnmanagedGetParameters = RequireAtLeastOne<
322
+ {
323
+ /**
324
+ * ID of the unmanaged access code that you want to get. You must specify either `access_code_id` or both `device_id` and `code`.
325
+ */
326
+ access_code_id?: string | undefined
327
+ /**
328
+ * Code of the unmanaged access code that you want to get. You must specify either `access_code_id` or both `device_id` and `code`.
329
+ */
330
+ code?: string | undefined
331
+ /**
332
+ * ID of the device containing the unmanaged access code that you want to get. You must specify either `access_code_id` or both `device_id` and `code`.
333
+ */
334
+ device_id?: string | undefined
335
+ },
336
+ 'access_code_id' | 'code' | 'device_id'
337
+ >
327
338
 
328
339
  /**
329
340
  * @deprecated Use AccessCodesUnmanagedGetRequest instead.
@@ -370,7 +381,7 @@ export type AccessCodesUnmanagedListResponse = {
370
381
  access_codes: Array<UnmanagedAccessCode>
371
382
  }
372
383
 
373
- export type AccessCodesUnmanagedListRequest = SeamHttpRequest<
384
+ export type AccessCodesUnmanagedListRequest = SeamPaginatedRequest<
374
385
  AccessCodesUnmanagedListResponse,
375
386
  'access_codes'
376
387
  >