@seamapi/http 0.23.0 → 0.25.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 (128) hide show
  1. package/README.md +15 -0
  2. package/dist/connect.cjs +847 -727
  3. package/dist/connect.cjs.map +1 -1
  4. package/dist/connect.d.cts +167 -126
  5. package/lib/seam/connect/routes/access-codes-unmanaged.d.ts +6 -5
  6. package/lib/seam/connect/routes/access-codes-unmanaged.js +26 -22
  7. package/lib/seam/connect/routes/access-codes-unmanaged.js.map +1 -1
  8. package/lib/seam/connect/routes/access-codes.d.ts +9 -8
  9. package/lib/seam/connect/routes/access-codes.js +41 -38
  10. package/lib/seam/connect/routes/access-codes.js.map +1 -1
  11. package/lib/seam/connect/routes/acs-access-groups.d.ts +6 -5
  12. package/lib/seam/connect/routes/acs-access-groups.js +26 -23
  13. package/lib/seam/connect/routes/acs-access-groups.js.map +1 -1
  14. package/lib/seam/connect/routes/acs-credential-pools.d.ts +2 -1
  15. package/lib/seam/connect/routes/acs-credential-pools.js +6 -5
  16. package/lib/seam/connect/routes/acs-credential-pools.js.map +1 -1
  17. package/lib/seam/connect/routes/acs-credential-provisioning-automations.d.ts +2 -1
  18. package/lib/seam/connect/routes/acs-credential-provisioning-automations.js +6 -5
  19. package/lib/seam/connect/routes/acs-credential-provisioning-automations.js.map +1 -1
  20. package/lib/seam/connect/routes/acs-credentials.d.ts +8 -7
  21. package/lib/seam/connect/routes/acs-credentials.js +36 -34
  22. package/lib/seam/connect/routes/acs-credentials.js.map +1 -1
  23. package/lib/seam/connect/routes/acs-entrances.d.ts +5 -4
  24. package/lib/seam/connect/routes/acs-entrances.js +21 -19
  25. package/lib/seam/connect/routes/acs-entrances.js.map +1 -1
  26. package/lib/seam/connect/routes/acs-systems.d.ts +3 -2
  27. package/lib/seam/connect/routes/acs-systems.js +11 -10
  28. package/lib/seam/connect/routes/acs-systems.js.map +1 -1
  29. package/lib/seam/connect/routes/acs-users.d.ts +12 -11
  30. package/lib/seam/connect/routes/acs-users.js +56 -48
  31. package/lib/seam/connect/routes/acs-users.js.map +1 -1
  32. package/lib/seam/connect/routes/action-attempts.d.ts +3 -2
  33. package/lib/seam/connect/routes/action-attempts.js +12 -18
  34. package/lib/seam/connect/routes/action-attempts.js.map +1 -1
  35. package/lib/seam/connect/routes/client-sessions.d.ts +8 -7
  36. package/lib/seam/connect/routes/client-sessions.js +36 -33
  37. package/lib/seam/connect/routes/client-sessions.js.map +1 -1
  38. package/lib/seam/connect/routes/connect-webviews.d.ts +6 -5
  39. package/lib/seam/connect/routes/connect-webviews.js +25 -22
  40. package/lib/seam/connect/routes/connect-webviews.js.map +1 -1
  41. package/lib/seam/connect/routes/connected-accounts.d.ts +5 -4
  42. package/lib/seam/connect/routes/connected-accounts.js +21 -19
  43. package/lib/seam/connect/routes/connected-accounts.js.map +1 -1
  44. package/lib/seam/connect/routes/devices-simulate.d.ts +21 -0
  45. package/lib/seam/connect/routes/devices-simulate.js +88 -0
  46. package/lib/seam/connect/routes/devices-simulate.js.map +1 -0
  47. package/lib/seam/connect/routes/devices-unmanaged.d.ts +4 -3
  48. package/lib/seam/connect/routes/devices-unmanaged.js +16 -14
  49. package/lib/seam/connect/routes/devices-unmanaged.js.map +1 -1
  50. package/lib/seam/connect/routes/devices.d.ts +8 -5
  51. package/lib/seam/connect/routes/devices.js +30 -23
  52. package/lib/seam/connect/routes/devices.js.map +1 -1
  53. package/lib/seam/connect/routes/events.d.ts +3 -2
  54. package/lib/seam/connect/routes/events.js +11 -10
  55. package/lib/seam/connect/routes/events.js.map +1 -1
  56. package/lib/seam/connect/routes/index.d.ts +1 -0
  57. package/lib/seam/connect/routes/index.js +1 -0
  58. package/lib/seam/connect/routes/index.js.map +1 -1
  59. package/lib/seam/connect/routes/locks.d.ts +5 -4
  60. package/lib/seam/connect/routes/locks.js +23 -36
  61. package/lib/seam/connect/routes/locks.js.map +1 -1
  62. package/lib/seam/connect/routes/networks.d.ts +3 -2
  63. package/lib/seam/connect/routes/networks.js +11 -10
  64. package/lib/seam/connect/routes/networks.js.map +1 -1
  65. package/lib/seam/connect/routes/noise-sensors-noise-thresholds.d.ts +6 -5
  66. package/lib/seam/connect/routes/noise-sensors-noise-thresholds.js +26 -23
  67. package/lib/seam/connect/routes/noise-sensors-noise-thresholds.js.map +1 -1
  68. package/lib/seam/connect/routes/phones-simulate.d.ts +2 -1
  69. package/lib/seam/connect/routes/phones-simulate.js +6 -5
  70. package/lib/seam/connect/routes/phones-simulate.js.map +1 -1
  71. package/lib/seam/connect/routes/phones.d.ts +3 -2
  72. package/lib/seam/connect/routes/phones.js +11 -9
  73. package/lib/seam/connect/routes/phones.js.map +1 -1
  74. package/lib/seam/connect/routes/thermostats-climate-setting-schedules.d.ts +6 -5
  75. package/lib/seam/connect/routes/thermostats-climate-setting-schedules.js +26 -23
  76. package/lib/seam/connect/routes/thermostats-climate-setting-schedules.js.map +1 -1
  77. package/lib/seam/connect/routes/thermostats.d.ts +9 -8
  78. package/lib/seam/connect/routes/thermostats.js +46 -76
  79. package/lib/seam/connect/routes/thermostats.js.map +1 -1
  80. package/lib/seam/connect/routes/user-identities-enrollment-automations.d.ts +5 -4
  81. package/lib/seam/connect/routes/user-identities-enrollment-automations.js +21 -19
  82. package/lib/seam/connect/routes/user-identities-enrollment-automations.js.map +1 -1
  83. package/lib/seam/connect/routes/user-identities.d.ts +13 -12
  84. package/lib/seam/connect/routes/user-identities.js +61 -54
  85. package/lib/seam/connect/routes/user-identities.js.map +1 -1
  86. package/lib/seam/connect/routes/webhooks.d.ts +6 -5
  87. package/lib/seam/connect/routes/webhooks.js +26 -23
  88. package/lib/seam/connect/routes/webhooks.js.map +1 -1
  89. package/lib/seam/connect/routes/workspaces.d.ts +5 -4
  90. package/lib/seam/connect/routes/workspaces.js +21 -19
  91. package/lib/seam/connect/routes/workspaces.js.map +1 -1
  92. package/lib/seam/connect/seam-http-request.d.ts +26 -0
  93. package/lib/seam/connect/seam-http-request.js +87 -0
  94. package/lib/seam/connect/seam-http-request.js.map +1 -0
  95. package/lib/version.d.ts +1 -1
  96. package/lib/version.js +1 -1
  97. package/package.json +4 -4
  98. package/src/lib/seam/connect/routes/access-codes-unmanaged.ts +37 -34
  99. package/src/lib/seam/connect/routes/access-codes.ts +56 -60
  100. package/src/lib/seam/connect/routes/acs-access-groups.ts +33 -32
  101. package/src/lib/seam/connect/routes/acs-credential-pools.ts +7 -7
  102. package/src/lib/seam/connect/routes/acs-credential-provisioning-automations.ts +11 -13
  103. package/src/lib/seam/connect/routes/acs-credentials.ts +42 -46
  104. package/src/lib/seam/connect/routes/acs-entrances.ts +31 -28
  105. package/src/lib/seam/connect/routes/acs-systems.ts +13 -14
  106. package/src/lib/seam/connect/routes/acs-users.ts +66 -61
  107. package/src/lib/seam/connect/routes/action-attempts.ts +14 -26
  108. package/src/lib/seam/connect/routes/client-sessions.ts +45 -49
  109. package/src/lib/seam/connect/routes/connect-webviews.ts +28 -28
  110. package/src/lib/seam/connect/routes/connected-accounts.ts +26 -29
  111. package/src/lib/seam/connect/routes/devices-simulate.ts +174 -0
  112. package/src/lib/seam/connect/routes/devices-unmanaged.ts +18 -18
  113. package/src/lib/seam/connect/routes/devices.ts +35 -31
  114. package/src/lib/seam/connect/routes/events.ts +11 -12
  115. package/src/lib/seam/connect/routes/index.ts +1 -0
  116. package/src/lib/seam/connect/routes/locks.ts +25 -50
  117. package/src/lib/seam/connect/routes/networks.ts +14 -13
  118. package/src/lib/seam/connect/routes/noise-sensors-noise-thresholds.ts +48 -38
  119. package/src/lib/seam/connect/routes/phones-simulate.ts +9 -10
  120. package/src/lib/seam/connect/routes/phones.ts +11 -10
  121. package/src/lib/seam/connect/routes/thermostats-climate-setting-schedules.ts +47 -55
  122. package/src/lib/seam/connect/routes/thermostats.ts +53 -110
  123. package/src/lib/seam/connect/routes/user-identities-enrollment-automations.ts +39 -48
  124. package/src/lib/seam/connect/routes/user-identities.ts +81 -78
  125. package/src/lib/seam/connect/routes/webhooks.ts +30 -28
  126. package/src/lib/seam/connect/routes/workspaces.ts +26 -25
  127. package/src/lib/seam/connect/seam-http-request.ts +144 -0
  128. package/src/lib/version.ts +1 -1
@@ -31,6 +31,7 @@ import {
31
31
  limitToSeamHttpRequestOptions,
32
32
  parseOptions,
33
33
  } from 'lib/seam/connect/parse-options.js'
34
+ import { SeamHttpRequest } from 'lib/seam/connect/seam-http-request.js'
34
35
 
35
36
  import { SeamHttpClientSessions } from './client-sessions.js'
36
37
 
@@ -153,84 +154,79 @@ export class SeamHttpAcsCredentials {
153
154
  await clientSessions.get()
154
155
  }
155
156
 
156
- async assign(
157
+ assign(
157
158
  body?: AcsCredentialsAssignBody,
158
- ): Promise<AcsCredentialsAssignResponse['acs_credential']> {
159
- const { data } = await this.client.request<AcsCredentialsAssignResponse>({
160
- url: '/acs/credentials/assign',
159
+ ): SeamHttpRequest<AcsCredentialsAssignResponse, 'acs_credential'> {
160
+ return new SeamHttpRequest(this, {
161
+ path: '/acs/credentials/assign',
161
162
  method: 'post',
162
- data: body,
163
+ body,
164
+ responseKey: 'acs_credential',
163
165
  })
164
-
165
- return data.acs_credential
166
166
  }
167
167
 
168
- async create(
168
+ create(
169
169
  body?: AcsCredentialsCreateBody,
170
- ): Promise<AcsCredentialsCreateResponse['acs_credential']> {
171
- const { data } = await this.client.request<AcsCredentialsCreateResponse>({
172
- url: '/acs/credentials/create',
170
+ ): SeamHttpRequest<AcsCredentialsCreateResponse, 'acs_credential'> {
171
+ return new SeamHttpRequest(this, {
172
+ path: '/acs/credentials/create',
173
173
  method: 'post',
174
- data: body,
174
+ body,
175
+ responseKey: 'acs_credential',
175
176
  })
176
-
177
- return data.acs_credential
178
177
  }
179
178
 
180
- async delete(body?: AcsCredentialsDeleteBody): Promise<void> {
181
- await this.client.request<AcsCredentialsDeleteResponse>({
182
- url: '/acs/credentials/delete',
179
+ delete(body?: AcsCredentialsDeleteBody): SeamHttpRequest<void, undefined> {
180
+ return new SeamHttpRequest(this, {
181
+ path: '/acs/credentials/delete',
183
182
  method: 'post',
184
- data: body,
183
+ body,
184
+ responseKey: undefined,
185
185
  })
186
186
  }
187
187
 
188
- async get(
188
+ get(
189
189
  body?: AcsCredentialsGetParams,
190
- ): Promise<AcsCredentialsGetResponse['acs_credential']> {
191
- const { data } = await this.client.request<AcsCredentialsGetResponse>({
192
- url: '/acs/credentials/get',
190
+ ): SeamHttpRequest<AcsCredentialsGetResponse, 'acs_credential'> {
191
+ return new SeamHttpRequest(this, {
192
+ path: '/acs/credentials/get',
193
193
  method: 'post',
194
- data: body,
194
+ body,
195
+ responseKey: 'acs_credential',
195
196
  })
196
-
197
- return data.acs_credential
198
197
  }
199
198
 
200
- async list(
199
+ list(
201
200
  body?: AcsCredentialsListParams,
202
- ): Promise<AcsCredentialsListResponse['acs_credentials']> {
203
- const { data } = await this.client.request<AcsCredentialsListResponse>({
204
- url: '/acs/credentials/list',
201
+ ): SeamHttpRequest<AcsCredentialsListResponse, 'acs_credentials'> {
202
+ return new SeamHttpRequest(this, {
203
+ path: '/acs/credentials/list',
205
204
  method: 'post',
206
- data: body,
205
+ body,
206
+ responseKey: 'acs_credentials',
207
207
  })
208
-
209
- return data.acs_credentials
210
208
  }
211
209
 
212
- async unassign(
210
+ unassign(
213
211
  body?: AcsCredentialsUnassignBody,
214
- ): Promise<AcsCredentialsUnassignResponse['acs_credential']> {
215
- const { data } = await this.client.request<AcsCredentialsUnassignResponse>({
216
- url: '/acs/credentials/unassign',
212
+ ): SeamHttpRequest<AcsCredentialsUnassignResponse, 'acs_credential'> {
213
+ return new SeamHttpRequest(this, {
214
+ path: '/acs/credentials/unassign',
217
215
  method: 'post',
218
- data: body,
216
+ body,
217
+ responseKey: 'acs_credential',
219
218
  })
220
-
221
- return data.acs_credential
222
219
  }
223
220
 
224
- async update(
221
+ update(
225
222
  body?: AcsCredentialsUpdateBody,
226
- ): Promise<AcsCredentialsUpdateResponse['acs_credential']> {
227
- const { data } = await this.client.request<AcsCredentialsUpdateResponse>({
228
- url: '/acs/credentials/update',
223
+ ): SeamHttpRequest<AcsCredentialsUpdateResponse, 'acs_credential'> {
224
+ return new SeamHttpRequest(this, {
225
+ path: '/acs/credentials/update',
229
226
  method: 'post',
230
- data: body,
227
+ body,
228
+ responseKey: 'acs_credential',
231
229
  })
232
-
233
- return data.acs_credential
234
230
  }
235
231
  }
236
232
 
@@ -31,6 +31,7 @@ import {
31
31
  limitToSeamHttpRequestOptions,
32
32
  parseOptions,
33
33
  } from 'lib/seam/connect/parse-options.js'
34
+ import { SeamHttpRequest } from 'lib/seam/connect/seam-http-request.js'
34
35
 
35
36
  import { SeamHttpClientSessions } from './client-sessions.js'
36
37
 
@@ -153,49 +154,51 @@ export class SeamHttpAcsEntrances {
153
154
  await clientSessions.get()
154
155
  }
155
156
 
156
- async get(
157
+ get(
157
158
  body?: AcsEntrancesGetParams,
158
- ): Promise<AcsEntrancesGetResponse['acs_entrance']> {
159
- const { data } = await this.client.request<AcsEntrancesGetResponse>({
160
- url: '/acs/entrances/get',
159
+ ): SeamHttpRequest<AcsEntrancesGetResponse, 'acs_entrance'> {
160
+ return new SeamHttpRequest(this, {
161
+ path: '/acs/entrances/get',
161
162
  method: 'post',
162
- data: body,
163
+ body,
164
+ responseKey: 'acs_entrance',
163
165
  })
164
-
165
- return data.acs_entrance
166
166
  }
167
167
 
168
- async grantAccess(body?: AcsEntrancesGrantAccessBody): Promise<void> {
169
- await this.client.request<AcsEntrancesGrantAccessResponse>({
170
- url: '/acs/entrances/grant_access',
168
+ grantAccess(
169
+ body?: AcsEntrancesGrantAccessBody,
170
+ ): SeamHttpRequest<void, undefined> {
171
+ return new SeamHttpRequest(this, {
172
+ path: '/acs/entrances/grant_access',
171
173
  method: 'post',
172
- data: body,
174
+ body,
175
+ responseKey: undefined,
173
176
  })
174
177
  }
175
178
 
176
- async list(
179
+ list(
177
180
  body?: AcsEntrancesListParams,
178
- ): Promise<AcsEntrancesListResponse['acs_entrances']> {
179
- const { data } = await this.client.request<AcsEntrancesListResponse>({
180
- url: '/acs/entrances/list',
181
+ ): SeamHttpRequest<AcsEntrancesListResponse, 'acs_entrances'> {
182
+ return new SeamHttpRequest(this, {
183
+ path: '/acs/entrances/list',
181
184
  method: 'post',
182
- data: body,
185
+ body,
186
+ responseKey: 'acs_entrances',
183
187
  })
184
-
185
- return data.acs_entrances
186
188
  }
187
189
 
188
- async listCredentialsWithAccess(
190
+ listCredentialsWithAccess(
189
191
  body?: AcsEntrancesListCredentialsWithAccessParams,
190
- ): Promise<AcsEntrancesListCredentialsWithAccessResponse['acs_credentials']> {
191
- const { data } =
192
- await this.client.request<AcsEntrancesListCredentialsWithAccessResponse>({
193
- url: '/acs/entrances/list_credentials_with_access',
194
- method: 'post',
195
- data: body,
196
- })
197
-
198
- return data.acs_credentials
192
+ ): SeamHttpRequest<
193
+ AcsEntrancesListCredentialsWithAccessResponse,
194
+ 'acs_credentials'
195
+ > {
196
+ return new SeamHttpRequest(this, {
197
+ path: '/acs/entrances/list_credentials_with_access',
198
+ method: 'post',
199
+ body,
200
+ responseKey: 'acs_credentials',
201
+ })
199
202
  }
200
203
  }
201
204
 
@@ -31,6 +31,7 @@ import {
31
31
  limitToSeamHttpRequestOptions,
32
32
  parseOptions,
33
33
  } from 'lib/seam/connect/parse-options.js'
34
+ import { SeamHttpRequest } from 'lib/seam/connect/seam-http-request.js'
34
35
 
35
36
  import { SeamHttpClientSessions } from './client-sessions.js'
36
37
 
@@ -153,28 +154,26 @@ export class SeamHttpAcsSystems {
153
154
  await clientSessions.get()
154
155
  }
155
156
 
156
- async get(
157
+ get(
157
158
  body?: AcsSystemsGetParams,
158
- ): Promise<AcsSystemsGetResponse['acs_system']> {
159
- const { data } = await this.client.request<AcsSystemsGetResponse>({
160
- url: '/acs/systems/get',
159
+ ): SeamHttpRequest<AcsSystemsGetResponse, 'acs_system'> {
160
+ return new SeamHttpRequest(this, {
161
+ path: '/acs/systems/get',
161
162
  method: 'post',
162
- data: body,
163
+ body,
164
+ responseKey: 'acs_system',
163
165
  })
164
-
165
- return data.acs_system
166
166
  }
167
167
 
168
- async list(
168
+ list(
169
169
  body?: AcsSystemsListParams,
170
- ): Promise<AcsSystemsListResponse['acs_systems']> {
171
- const { data } = await this.client.request<AcsSystemsListResponse>({
172
- url: '/acs/systems/list',
170
+ ): SeamHttpRequest<AcsSystemsListResponse, 'acs_systems'> {
171
+ return new SeamHttpRequest(this, {
172
+ path: '/acs/systems/list',
173
173
  method: 'post',
174
- data: body,
174
+ body,
175
+ responseKey: 'acs_systems',
175
176
  })
176
-
177
- return data.acs_systems
178
177
  }
179
178
  }
180
179
 
@@ -31,6 +31,7 @@ import {
31
31
  limitToSeamHttpRequestOptions,
32
32
  parseOptions,
33
33
  } from 'lib/seam/connect/parse-options.js'
34
+ import { SeamHttpRequest } from 'lib/seam/connect/seam-http-request.js'
34
35
 
35
36
  import { SeamHttpClientSessions } from './client-sessions.js'
36
37
 
@@ -153,112 +154,116 @@ export class SeamHttpAcsUsers {
153
154
  await clientSessions.get()
154
155
  }
155
156
 
156
- async addToAccessGroup(body?: AcsUsersAddToAccessGroupBody): Promise<void> {
157
- await this.client.request<AcsUsersAddToAccessGroupResponse>({
158
- url: '/acs/users/add_to_access_group',
157
+ addToAccessGroup(
158
+ body?: AcsUsersAddToAccessGroupBody,
159
+ ): SeamHttpRequest<void, undefined> {
160
+ return new SeamHttpRequest(this, {
161
+ path: '/acs/users/add_to_access_group',
159
162
  method: 'post',
160
- data: body,
163
+ body,
164
+ responseKey: undefined,
161
165
  })
162
166
  }
163
167
 
164
- async create(
168
+ create(
165
169
  body?: AcsUsersCreateBody,
166
- ): Promise<AcsUsersCreateResponse['acs_user']> {
167
- const { data } = await this.client.request<AcsUsersCreateResponse>({
168
- url: '/acs/users/create',
170
+ ): SeamHttpRequest<AcsUsersCreateResponse, 'acs_user'> {
171
+ return new SeamHttpRequest(this, {
172
+ path: '/acs/users/create',
169
173
  method: 'post',
170
- data: body,
174
+ body,
175
+ responseKey: 'acs_user',
171
176
  })
172
-
173
- return data.acs_user
174
177
  }
175
178
 
176
- async delete(body?: AcsUsersDeleteBody): Promise<void> {
177
- await this.client.request<AcsUsersDeleteResponse>({
178
- url: '/acs/users/delete',
179
+ delete(body?: AcsUsersDeleteBody): SeamHttpRequest<void, undefined> {
180
+ return new SeamHttpRequest(this, {
181
+ path: '/acs/users/delete',
179
182
  method: 'post',
180
- data: body,
183
+ body,
184
+ responseKey: undefined,
181
185
  })
182
186
  }
183
187
 
184
- async get(
188
+ get(
185
189
  body?: AcsUsersGetParams,
186
- ): Promise<AcsUsersGetResponse['acs_user']> {
187
- const { data } = await this.client.request<AcsUsersGetResponse>({
188
- url: '/acs/users/get',
190
+ ): SeamHttpRequest<AcsUsersGetResponse, 'acs_user'> {
191
+ return new SeamHttpRequest(this, {
192
+ path: '/acs/users/get',
189
193
  method: 'post',
190
- data: body,
194
+ body,
195
+ responseKey: 'acs_user',
191
196
  })
192
-
193
- return data.acs_user
194
197
  }
195
198
 
196
- async list(
199
+ list(
197
200
  body?: AcsUsersListParams,
198
- ): Promise<AcsUsersListResponse['acs_users']> {
199
- const { data } = await this.client.request<AcsUsersListResponse>({
200
- url: '/acs/users/list',
201
+ ): SeamHttpRequest<AcsUsersListResponse, 'acs_users'> {
202
+ return new SeamHttpRequest(this, {
203
+ path: '/acs/users/list',
201
204
  method: 'post',
202
- data: body,
205
+ body,
206
+ responseKey: 'acs_users',
203
207
  })
204
-
205
- return data.acs_users
206
208
  }
207
209
 
208
- async listAccessibleEntrances(
210
+ listAccessibleEntrances(
209
211
  body?: AcsUsersListAccessibleEntrancesParams,
210
- ): Promise<AcsUsersListAccessibleEntrancesResponse['acs_entrances']> {
211
- const { data } =
212
- await this.client.request<AcsUsersListAccessibleEntrancesResponse>({
213
- url: '/acs/users/list_accessible_entrances',
214
- method: 'post',
215
- data: body,
216
- })
217
-
218
- return data.acs_entrances
212
+ ): SeamHttpRequest<AcsUsersListAccessibleEntrancesResponse, 'acs_entrances'> {
213
+ return new SeamHttpRequest(this, {
214
+ path: '/acs/users/list_accessible_entrances',
215
+ method: 'post',
216
+ body,
217
+ responseKey: 'acs_entrances',
218
+ })
219
219
  }
220
220
 
221
- async removeFromAccessGroup(
221
+ removeFromAccessGroup(
222
222
  body?: AcsUsersRemoveFromAccessGroupBody,
223
- ): Promise<void> {
224
- await this.client.request<AcsUsersRemoveFromAccessGroupResponse>({
225
- url: '/acs/users/remove_from_access_group',
223
+ ): SeamHttpRequest<void, undefined> {
224
+ return new SeamHttpRequest(this, {
225
+ path: '/acs/users/remove_from_access_group',
226
226
  method: 'post',
227
- data: body,
227
+ body,
228
+ responseKey: undefined,
228
229
  })
229
230
  }
230
231
 
231
- async revokeAccessToAllEntrances(
232
+ revokeAccessToAllEntrances(
232
233
  body?: AcsUsersRevokeAccessToAllEntrancesBody,
233
- ): Promise<void> {
234
- await this.client.request<AcsUsersRevokeAccessToAllEntrancesResponse>({
235
- url: '/acs/users/revoke_access_to_all_entrances',
234
+ ): SeamHttpRequest<void, undefined> {
235
+ return new SeamHttpRequest(this, {
236
+ path: '/acs/users/revoke_access_to_all_entrances',
236
237
  method: 'post',
237
- data: body,
238
+ body,
239
+ responseKey: undefined,
238
240
  })
239
241
  }
240
242
 
241
- async suspend(body?: AcsUsersSuspendBody): Promise<void> {
242
- await this.client.request<AcsUsersSuspendResponse>({
243
- url: '/acs/users/suspend',
243
+ suspend(body?: AcsUsersSuspendBody): SeamHttpRequest<void, undefined> {
244
+ return new SeamHttpRequest(this, {
245
+ path: '/acs/users/suspend',
244
246
  method: 'post',
245
- data: body,
247
+ body,
248
+ responseKey: undefined,
246
249
  })
247
250
  }
248
251
 
249
- async unsuspend(body?: AcsUsersUnsuspendBody): Promise<void> {
250
- await this.client.request<AcsUsersUnsuspendResponse>({
251
- url: '/acs/users/unsuspend',
252
+ unsuspend(body?: AcsUsersUnsuspendBody): SeamHttpRequest<void, undefined> {
253
+ return new SeamHttpRequest(this, {
254
+ path: '/acs/users/unsuspend',
252
255
  method: 'post',
253
- data: body,
256
+ body,
257
+ responseKey: undefined,
254
258
  })
255
259
  }
256
260
 
257
- async update(body?: AcsUsersUpdateBody): Promise<void> {
258
- await this.client.request<AcsUsersUpdateResponse>({
259
- url: '/acs/users/update',
261
+ update(body?: AcsUsersUpdateBody): SeamHttpRequest<void, undefined> {
262
+ return new SeamHttpRequest(this, {
263
+ path: '/acs/users/update',
260
264
  method: 'post',
261
- data: body,
265
+ body,
266
+ responseKey: undefined,
262
267
  })
263
268
  }
264
269
  }
@@ -31,7 +31,7 @@ import {
31
31
  limitToSeamHttpRequestOptions,
32
32
  parseOptions,
33
33
  } from 'lib/seam/connect/parse-options.js'
34
- import { resolveActionAttempt } from 'lib/seam/connect/resolve-action-attempt.js'
34
+ import { SeamHttpRequest } from 'lib/seam/connect/seam-http-request.js'
35
35
 
36
36
  import { SeamHttpClientSessions } from './client-sessions.js'
37
37
 
@@ -154,40 +154,28 @@ export class SeamHttpActionAttempts {
154
154
  await clientSessions.get()
155
155
  }
156
156
 
157
- async get(
157
+ get(
158
158
  body?: ActionAttemptsGetParams,
159
159
  options: Pick<SeamHttpRequestOptions, 'waitForActionAttempt'> = {},
160
- ): Promise<ActionAttemptsGetResponse['action_attempt']> {
161
- const { data } = await this.client.request<ActionAttemptsGetResponse>({
162
- url: '/action_attempts/get',
160
+ ): SeamHttpRequest<ActionAttemptsGetResponse, 'action_attempt'> {
161
+ return new SeamHttpRequest(this, {
162
+ path: '/action_attempts/get',
163
163
  method: 'post',
164
- data: body,
164
+ body,
165
+ responseKey: 'action_attempt',
166
+ options,
165
167
  })
166
- const waitForActionAttempt =
167
- options.waitForActionAttempt ?? this.defaults.waitForActionAttempt
168
- if (waitForActionAttempt !== false) {
169
- return await resolveActionAttempt(
170
- data.action_attempt,
171
- SeamHttpActionAttempts.fromClient(this.client, {
172
- ...this.defaults,
173
- waitForActionAttempt: false,
174
- }),
175
- typeof waitForActionAttempt === 'boolean' ? {} : waitForActionAttempt,
176
- )
177
- }
178
- return data.action_attempt
179
168
  }
180
169
 
181
- async list(
170
+ list(
182
171
  body?: ActionAttemptsListParams,
183
- ): Promise<ActionAttemptsListResponse['action_attempts']> {
184
- const { data } = await this.client.request<ActionAttemptsListResponse>({
185
- url: '/action_attempts/list',
172
+ ): SeamHttpRequest<ActionAttemptsListResponse, 'action_attempts'> {
173
+ return new SeamHttpRequest(this, {
174
+ path: '/action_attempts/list',
186
175
  method: 'post',
187
- data: body,
176
+ body,
177
+ responseKey: 'action_attempts',
188
178
  })
189
-
190
- return data.action_attempts
191
179
  }
192
180
  }
193
181
 
@@ -31,6 +31,7 @@ import {
31
31
  limitToSeamHttpRequestOptions,
32
32
  parseOptions,
33
33
  } from 'lib/seam/connect/parse-options.js'
34
+ import { SeamHttpRequest } from 'lib/seam/connect/seam-http-request.js'
34
35
 
35
36
  export class SeamHttpClientSessions {
36
37
  client: Client
@@ -151,81 +152,76 @@ export class SeamHttpClientSessions {
151
152
  await clientSessions.get()
152
153
  }
153
154
 
154
- async create(
155
+ create(
155
156
  body?: ClientSessionsCreateBody,
156
- ): Promise<ClientSessionsCreateResponse['client_session']> {
157
- const { data } = await this.client.request<ClientSessionsCreateResponse>({
158
- url: '/client_sessions/create',
157
+ ): SeamHttpRequest<ClientSessionsCreateResponse, 'client_session'> {
158
+ return new SeamHttpRequest(this, {
159
+ path: '/client_sessions/create',
159
160
  method: 'post',
160
- data: body,
161
+ body,
162
+ responseKey: 'client_session',
161
163
  })
162
-
163
- return data.client_session
164
164
  }
165
165
 
166
- async delete(body?: ClientSessionsDeleteBody): Promise<void> {
167
- await this.client.request<ClientSessionsDeleteResponse>({
168
- url: '/client_sessions/delete',
166
+ delete(body?: ClientSessionsDeleteBody): SeamHttpRequest<void, undefined> {
167
+ return new SeamHttpRequest(this, {
168
+ path: '/client_sessions/delete',
169
169
  method: 'post',
170
- data: body,
170
+ body,
171
+ responseKey: undefined,
171
172
  })
172
173
  }
173
174
 
174
- async get(
175
+ get(
175
176
  body?: ClientSessionsGetParams,
176
- ): Promise<ClientSessionsGetResponse['client_session']> {
177
- const { data } = await this.client.request<ClientSessionsGetResponse>({
178
- url: '/client_sessions/get',
177
+ ): SeamHttpRequest<ClientSessionsGetResponse, 'client_session'> {
178
+ return new SeamHttpRequest(this, {
179
+ path: '/client_sessions/get',
179
180
  method: 'post',
180
- data: body,
181
+ body,
182
+ responseKey: 'client_session',
181
183
  })
182
-
183
- return data.client_session
184
184
  }
185
185
 
186
- async getOrCreate(
186
+ getOrCreate(
187
187
  body?: ClientSessionsGetOrCreateBody,
188
- ): Promise<ClientSessionsGetOrCreateResponse['client_session']> {
189
- const { data } =
190
- await this.client.request<ClientSessionsGetOrCreateResponse>({
191
- url: '/client_sessions/get_or_create',
192
- method: 'post',
193
- data: body,
194
- })
195
-
196
- return data.client_session
188
+ ): SeamHttpRequest<ClientSessionsGetOrCreateResponse, 'client_session'> {
189
+ return new SeamHttpRequest(this, {
190
+ path: '/client_sessions/get_or_create',
191
+ method: 'post',
192
+ body,
193
+ responseKey: 'client_session',
194
+ })
197
195
  }
198
196
 
199
- async grantAccess(
197
+ grantAccess(
200
198
  body?: ClientSessionsGrantAccessBody,
201
- ): Promise<ClientSessionsGrantAccessResponse['client_session']> {
202
- const { data } =
203
- await this.client.request<ClientSessionsGrantAccessResponse>({
204
- url: '/client_sessions/grant_access',
205
- method: 'post',
206
- data: body,
207
- })
208
-
209
- return data.client_session
199
+ ): SeamHttpRequest<ClientSessionsGrantAccessResponse, 'client_session'> {
200
+ return new SeamHttpRequest(this, {
201
+ path: '/client_sessions/grant_access',
202
+ method: 'post',
203
+ body,
204
+ responseKey: 'client_session',
205
+ })
210
206
  }
211
207
 
212
- async list(
208
+ list(
213
209
  body?: ClientSessionsListParams,
214
- ): Promise<ClientSessionsListResponse['client_sessions']> {
215
- const { data } = await this.client.request<ClientSessionsListResponse>({
216
- url: '/client_sessions/list',
210
+ ): SeamHttpRequest<ClientSessionsListResponse, 'client_sessions'> {
211
+ return new SeamHttpRequest(this, {
212
+ path: '/client_sessions/list',
217
213
  method: 'post',
218
- data: body,
214
+ body,
215
+ responseKey: 'client_sessions',
219
216
  })
220
-
221
- return data.client_sessions
222
217
  }
223
218
 
224
- async revoke(body?: ClientSessionsRevokeBody): Promise<void> {
225
- await this.client.request<ClientSessionsRevokeResponse>({
226
- url: '/client_sessions/revoke',
219
+ revoke(body?: ClientSessionsRevokeBody): SeamHttpRequest<void, undefined> {
220
+ return new SeamHttpRequest(this, {
221
+ path: '/client_sessions/revoke',
227
222
  method: 'post',
228
- data: body,
223
+ body,
224
+ responseKey: undefined,
229
225
  })
230
226
  }
231
227
  }