@seamapi/http 0.16.2 → 0.17.1

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 +8 -0
  2. package/dist/connect.cjs +478 -0
  3. package/dist/connect.cjs.map +1 -1
  4. package/dist/connect.d.cts +38 -1
  5. package/lib/seam/connect/auth.d.ts +2 -0
  6. package/lib/seam/connect/auth.js +1 -1
  7. package/lib/seam/connect/auth.js.map +1 -1
  8. package/lib/seam/connect/routes/access-codes-unmanaged.d.ts +1 -0
  9. package/lib/seam/connect/routes/access-codes-unmanaged.js +15 -1
  10. package/lib/seam/connect/routes/access-codes-unmanaged.js.map +1 -1
  11. package/lib/seam/connect/routes/access-codes.d.ts +1 -0
  12. package/lib/seam/connect/routes/access-codes.js +15 -1
  13. package/lib/seam/connect/routes/access-codes.js.map +1 -1
  14. package/lib/seam/connect/routes/acs-access-groups.d.ts +1 -0
  15. package/lib/seam/connect/routes/acs-access-groups.js +15 -1
  16. package/lib/seam/connect/routes/acs-access-groups.js.map +1 -1
  17. package/lib/seam/connect/routes/acs-credential-pools.d.ts +1 -0
  18. package/lib/seam/connect/routes/acs-credential-pools.js +15 -1
  19. package/lib/seam/connect/routes/acs-credential-pools.js.map +1 -1
  20. package/lib/seam/connect/routes/acs-credential-provisioning-automations.d.ts +1 -0
  21. package/lib/seam/connect/routes/acs-credential-provisioning-automations.js +15 -1
  22. package/lib/seam/connect/routes/acs-credential-provisioning-automations.js.map +1 -1
  23. package/lib/seam/connect/routes/acs-credentials.d.ts +1 -0
  24. package/lib/seam/connect/routes/acs-credentials.js +15 -1
  25. package/lib/seam/connect/routes/acs-credentials.js.map +1 -1
  26. package/lib/seam/connect/routes/acs-entrances.d.ts +1 -0
  27. package/lib/seam/connect/routes/acs-entrances.js +15 -1
  28. package/lib/seam/connect/routes/acs-entrances.js.map +1 -1
  29. package/lib/seam/connect/routes/acs-systems.d.ts +1 -0
  30. package/lib/seam/connect/routes/acs-systems.js +15 -1
  31. package/lib/seam/connect/routes/acs-systems.js.map +1 -1
  32. package/lib/seam/connect/routes/acs-users.d.ts +5 -0
  33. package/lib/seam/connect/routes/acs-users.js +22 -1
  34. package/lib/seam/connect/routes/acs-users.js.map +1 -1
  35. package/lib/seam/connect/routes/acs.d.ts +1 -0
  36. package/lib/seam/connect/routes/acs.js +15 -1
  37. package/lib/seam/connect/routes/acs.js.map +1 -1
  38. package/lib/seam/connect/routes/action-attempts.d.ts +1 -0
  39. package/lib/seam/connect/routes/action-attempts.js +15 -1
  40. package/lib/seam/connect/routes/action-attempts.js.map +1 -1
  41. package/lib/seam/connect/routes/client-sessions.d.ts +1 -0
  42. package/lib/seam/connect/routes/client-sessions.js +15 -1
  43. package/lib/seam/connect/routes/client-sessions.js.map +1 -1
  44. package/lib/seam/connect/routes/connect-webviews.d.ts +1 -0
  45. package/lib/seam/connect/routes/connect-webviews.js +15 -1
  46. package/lib/seam/connect/routes/connect-webviews.js.map +1 -1
  47. package/lib/seam/connect/routes/connected-accounts.d.ts +1 -0
  48. package/lib/seam/connect/routes/connected-accounts.js +15 -1
  49. package/lib/seam/connect/routes/connected-accounts.js.map +1 -1
  50. package/lib/seam/connect/routes/devices-unmanaged.d.ts +1 -0
  51. package/lib/seam/connect/routes/devices-unmanaged.js +15 -1
  52. package/lib/seam/connect/routes/devices-unmanaged.js.map +1 -1
  53. package/lib/seam/connect/routes/devices.d.ts +1 -0
  54. package/lib/seam/connect/routes/devices.js +15 -1
  55. package/lib/seam/connect/routes/devices.js.map +1 -1
  56. package/lib/seam/connect/routes/events.d.ts +1 -0
  57. package/lib/seam/connect/routes/events.js +15 -1
  58. package/lib/seam/connect/routes/events.js.map +1 -1
  59. package/lib/seam/connect/routes/locks.d.ts +1 -0
  60. package/lib/seam/connect/routes/locks.js +15 -1
  61. package/lib/seam/connect/routes/locks.js.map +1 -1
  62. package/lib/seam/connect/routes/networks.d.ts +1 -0
  63. package/lib/seam/connect/routes/networks.js +15 -1
  64. package/lib/seam/connect/routes/networks.js.map +1 -1
  65. package/lib/seam/connect/routes/noise-sensors-noise-thresholds.d.ts +1 -0
  66. package/lib/seam/connect/routes/noise-sensors-noise-thresholds.js +15 -1
  67. package/lib/seam/connect/routes/noise-sensors-noise-thresholds.js.map +1 -1
  68. package/lib/seam/connect/routes/noise-sensors.d.ts +1 -0
  69. package/lib/seam/connect/routes/noise-sensors.js +15 -1
  70. package/lib/seam/connect/routes/noise-sensors.js.map +1 -1
  71. package/lib/seam/connect/routes/phones.d.ts +1 -0
  72. package/lib/seam/connect/routes/phones.js +15 -1
  73. package/lib/seam/connect/routes/phones.js.map +1 -1
  74. package/lib/seam/connect/routes/thermostats-climate-setting-schedules.d.ts +1 -0
  75. package/lib/seam/connect/routes/thermostats-climate-setting-schedules.js +15 -1
  76. package/lib/seam/connect/routes/thermostats-climate-setting-schedules.js.map +1 -1
  77. package/lib/seam/connect/routes/thermostats.d.ts +1 -0
  78. package/lib/seam/connect/routes/thermostats.js +15 -1
  79. package/lib/seam/connect/routes/thermostats.js.map +1 -1
  80. package/lib/seam/connect/routes/user-identities-enrollment-automations.d.ts +1 -0
  81. package/lib/seam/connect/routes/user-identities-enrollment-automations.js +15 -1
  82. package/lib/seam/connect/routes/user-identities-enrollment-automations.js.map +1 -1
  83. package/lib/seam/connect/routes/user-identities.d.ts +1 -0
  84. package/lib/seam/connect/routes/user-identities.js +15 -1
  85. package/lib/seam/connect/routes/user-identities.js.map +1 -1
  86. package/lib/seam/connect/routes/webhooks.d.ts +5 -0
  87. package/lib/seam/connect/routes/webhooks.js +22 -1
  88. package/lib/seam/connect/routes/webhooks.js.map +1 -1
  89. package/lib/seam/connect/routes/workspaces.d.ts +1 -0
  90. package/lib/seam/connect/routes/workspaces.js +15 -1
  91. package/lib/seam/connect/routes/workspaces.js.map +1 -1
  92. package/lib/seam/connect/seam-http.d.ts +1 -0
  93. package/lib/seam/connect/seam-http.js +15 -1
  94. package/lib/seam/connect/seam-http.js.map +1 -1
  95. package/lib/version.d.ts +1 -1
  96. package/lib/version.js +1 -1
  97. package/package.json +3 -3
  98. package/src/lib/seam/connect/auth.ts +1 -1
  99. package/src/lib/seam/connect/routes/access-codes-unmanaged.ts +23 -1
  100. package/src/lib/seam/connect/routes/access-codes.ts +23 -1
  101. package/src/lib/seam/connect/routes/acs-access-groups.ts +23 -1
  102. package/src/lib/seam/connect/routes/acs-credential-pools.ts +23 -1
  103. package/src/lib/seam/connect/routes/acs-credential-provisioning-automations.ts +23 -1
  104. package/src/lib/seam/connect/routes/acs-credentials.ts +23 -1
  105. package/src/lib/seam/connect/routes/acs-entrances.ts +23 -1
  106. package/src/lib/seam/connect/routes/acs-systems.ts +23 -1
  107. package/src/lib/seam/connect/routes/acs-users.ts +42 -1
  108. package/src/lib/seam/connect/routes/acs.ts +23 -1
  109. package/src/lib/seam/connect/routes/action-attempts.ts +23 -1
  110. package/src/lib/seam/connect/routes/client-sessions.ts +23 -1
  111. package/src/lib/seam/connect/routes/connect-webviews.ts +23 -1
  112. package/src/lib/seam/connect/routes/connected-accounts.ts +23 -1
  113. package/src/lib/seam/connect/routes/devices-unmanaged.ts +23 -1
  114. package/src/lib/seam/connect/routes/devices.ts +23 -1
  115. package/src/lib/seam/connect/routes/events.ts +23 -1
  116. package/src/lib/seam/connect/routes/locks.ts +23 -1
  117. package/src/lib/seam/connect/routes/networks.ts +23 -1
  118. package/src/lib/seam/connect/routes/noise-sensors-noise-thresholds.ts +23 -1
  119. package/src/lib/seam/connect/routes/noise-sensors.ts +23 -1
  120. package/src/lib/seam/connect/routes/phones.ts +23 -1
  121. package/src/lib/seam/connect/routes/thermostats-climate-setting-schedules.ts +23 -1
  122. package/src/lib/seam/connect/routes/thermostats.ts +23 -1
  123. package/src/lib/seam/connect/routes/user-identities-enrollment-automations.ts +23 -1
  124. package/src/lib/seam/connect/routes/user-identities.ts +23 -1
  125. package/src/lib/seam/connect/routes/webhooks.ts +39 -1
  126. package/src/lib/seam/connect/routes/workspaces.ts +23 -1
  127. package/src/lib/seam/connect/seam-http.ts +23 -1
  128. package/src/lib/version.ts +1 -1
@@ -6,7 +6,10 @@
6
6
  import type { RouteRequestBody, RouteResponse } from '@seamapi/types/connect'
7
7
  import type { SetNonNullable } from 'type-fest'
8
8
 
9
- import { warnOnInsecureuserIdentifierKey } from 'lib/seam/connect/auth.js'
9
+ import {
10
+ getAuthHeadersForClientSessionToken,
11
+ warnOnInsecureuserIdentifierKey,
12
+ } from 'lib/seam/connect/auth.js'
10
13
  import { type Client, createClient } from 'lib/seam/connect/client.js'
11
14
  import {
12
15
  isSeamHttpOptionsWithApiKey,
@@ -133,6 +136,25 @@ export class SeamHttpLocks {
133
136
  return new SeamHttpLocks(constructorOptions)
134
137
  }
135
138
 
139
+ async updateClientSessionToken(
140
+ clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
141
+ ): Promise<void> {
142
+ const { headers } = this.client.defaults
143
+ const authHeaders = getAuthHeadersForClientSessionToken({
144
+ clientSessionToken,
145
+ })
146
+ for (const key of Object.keys(authHeaders)) {
147
+ if (headers[key] == null) {
148
+ throw new Error(
149
+ 'Cannot update a clientSessionToken on a client created without a clientSessionToken',
150
+ )
151
+ }
152
+ }
153
+ this.client.defaults.headers = { ...headers, ...authHeaders }
154
+ const clientSessions = SeamHttpClientSessions.fromClient(this.client)
155
+ await clientSessions.get()
156
+ }
157
+
136
158
  async get(body?: LocksGetParams): Promise<LocksGetResponse['device']> {
137
159
  const { data } = await this.client.request<LocksGetResponse>({
138
160
  url: '/locks/get',
@@ -6,7 +6,10 @@
6
6
  import type { RouteRequestBody, RouteResponse } from '@seamapi/types/connect'
7
7
  import type { SetNonNullable } from 'type-fest'
8
8
 
9
- import { warnOnInsecureuserIdentifierKey } from 'lib/seam/connect/auth.js'
9
+ import {
10
+ getAuthHeadersForClientSessionToken,
11
+ warnOnInsecureuserIdentifierKey,
12
+ } from 'lib/seam/connect/auth.js'
10
13
  import { type Client, createClient } from 'lib/seam/connect/client.js'
11
14
  import {
12
15
  isSeamHttpOptionsWithApiKey,
@@ -131,6 +134,25 @@ export class SeamHttpNetworks {
131
134
  return new SeamHttpNetworks(constructorOptions)
132
135
  }
133
136
 
137
+ async updateClientSessionToken(
138
+ clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
139
+ ): Promise<void> {
140
+ const { headers } = this.client.defaults
141
+ const authHeaders = getAuthHeadersForClientSessionToken({
142
+ clientSessionToken,
143
+ })
144
+ for (const key of Object.keys(authHeaders)) {
145
+ if (headers[key] == null) {
146
+ throw new Error(
147
+ 'Cannot update a clientSessionToken on a client created without a clientSessionToken',
148
+ )
149
+ }
150
+ }
151
+ this.client.defaults.headers = { ...headers, ...authHeaders }
152
+ const clientSessions = SeamHttpClientSessions.fromClient(this.client)
153
+ await clientSessions.get()
154
+ }
155
+
134
156
  async get(body?: NetworksGetParams): Promise<NetworksGetResponse['network']> {
135
157
  const { data } = await this.client.request<NetworksGetResponse>({
136
158
  url: '/networks/get',
@@ -6,7 +6,10 @@
6
6
  import type { RouteRequestBody, RouteResponse } from '@seamapi/types/connect'
7
7
  import type { SetNonNullable } from 'type-fest'
8
8
 
9
- import { warnOnInsecureuserIdentifierKey } from 'lib/seam/connect/auth.js'
9
+ import {
10
+ getAuthHeadersForClientSessionToken,
11
+ warnOnInsecureuserIdentifierKey,
12
+ } from 'lib/seam/connect/auth.js'
10
13
  import { type Client, createClient } from 'lib/seam/connect/client.js'
11
14
  import {
12
15
  isSeamHttpOptionsWithApiKey,
@@ -134,6 +137,25 @@ export class SeamHttpNoiseSensorsNoiseThresholds {
134
137
  return new SeamHttpNoiseSensorsNoiseThresholds(constructorOptions)
135
138
  }
136
139
 
140
+ async updateClientSessionToken(
141
+ clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
142
+ ): Promise<void> {
143
+ const { headers } = this.client.defaults
144
+ const authHeaders = getAuthHeadersForClientSessionToken({
145
+ clientSessionToken,
146
+ })
147
+ for (const key of Object.keys(authHeaders)) {
148
+ if (headers[key] == null) {
149
+ throw new Error(
150
+ 'Cannot update a clientSessionToken on a client created without a clientSessionToken',
151
+ )
152
+ }
153
+ }
154
+ this.client.defaults.headers = { ...headers, ...authHeaders }
155
+ const clientSessions = SeamHttpClientSessions.fromClient(this.client)
156
+ await clientSessions.get()
157
+ }
158
+
137
159
  async create(
138
160
  body?: NoiseSensorsNoiseThresholdsCreateBody,
139
161
  ): Promise<NoiseSensorsNoiseThresholdsCreateResponse['noise_threshold']> {
@@ -3,7 +3,10 @@
3
3
  * Do not edit this file or add other files to this directory.
4
4
  */
5
5
 
6
- import { warnOnInsecureuserIdentifierKey } from 'lib/seam/connect/auth.js'
6
+ import {
7
+ getAuthHeadersForClientSessionToken,
8
+ warnOnInsecureuserIdentifierKey,
9
+ } from 'lib/seam/connect/auth.js'
7
10
  import { type Client, createClient } from 'lib/seam/connect/client.js'
8
11
  import {
9
12
  isSeamHttpOptionsWithApiKey,
@@ -129,6 +132,25 @@ export class SeamHttpNoiseSensors {
129
132
  return new SeamHttpNoiseSensors(constructorOptions)
130
133
  }
131
134
 
135
+ async updateClientSessionToken(
136
+ clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
137
+ ): Promise<void> {
138
+ const { headers } = this.client.defaults
139
+ const authHeaders = getAuthHeadersForClientSessionToken({
140
+ clientSessionToken,
141
+ })
142
+ for (const key of Object.keys(authHeaders)) {
143
+ if (headers[key] == null) {
144
+ throw new Error(
145
+ 'Cannot update a clientSessionToken on a client created without a clientSessionToken',
146
+ )
147
+ }
148
+ }
149
+ this.client.defaults.headers = { ...headers, ...authHeaders }
150
+ const clientSessions = SeamHttpClientSessions.fromClient(this.client)
151
+ await clientSessions.get()
152
+ }
153
+
132
154
  get noiseThresholds(): SeamHttpNoiseSensorsNoiseThresholds {
133
155
  return SeamHttpNoiseSensorsNoiseThresholds.fromClient(
134
156
  this.client,
@@ -6,7 +6,10 @@
6
6
  import type { RouteRequestBody, RouteResponse } from '@seamapi/types/connect'
7
7
  import type { SetNonNullable } from 'type-fest'
8
8
 
9
- import { warnOnInsecureuserIdentifierKey } from 'lib/seam/connect/auth.js'
9
+ import {
10
+ getAuthHeadersForClientSessionToken,
11
+ warnOnInsecureuserIdentifierKey,
12
+ } from 'lib/seam/connect/auth.js'
10
13
  import { type Client, createClient } from 'lib/seam/connect/client.js'
11
14
  import {
12
15
  isSeamHttpOptionsWithApiKey,
@@ -131,6 +134,25 @@ export class SeamHttpPhones {
131
134
  return new SeamHttpPhones(constructorOptions)
132
135
  }
133
136
 
137
+ async updateClientSessionToken(
138
+ clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
139
+ ): Promise<void> {
140
+ const { headers } = this.client.defaults
141
+ const authHeaders = getAuthHeadersForClientSessionToken({
142
+ clientSessionToken,
143
+ })
144
+ for (const key of Object.keys(authHeaders)) {
145
+ if (headers[key] == null) {
146
+ throw new Error(
147
+ 'Cannot update a clientSessionToken on a client created without a clientSessionToken',
148
+ )
149
+ }
150
+ }
151
+ this.client.defaults.headers = { ...headers, ...authHeaders }
152
+ const clientSessions = SeamHttpClientSessions.fromClient(this.client)
153
+ await clientSessions.get()
154
+ }
155
+
134
156
  async list(body?: PhonesListParams): Promise<PhonesListResponse['phones']> {
135
157
  const { data } = await this.client.request<PhonesListResponse>({
136
158
  url: '/phones/list',
@@ -6,7 +6,10 @@
6
6
  import type { RouteRequestBody, RouteResponse } from '@seamapi/types/connect'
7
7
  import type { SetNonNullable } from 'type-fest'
8
8
 
9
- import { warnOnInsecureuserIdentifierKey } from 'lib/seam/connect/auth.js'
9
+ import {
10
+ getAuthHeadersForClientSessionToken,
11
+ warnOnInsecureuserIdentifierKey,
12
+ } from 'lib/seam/connect/auth.js'
10
13
  import { type Client, createClient } from 'lib/seam/connect/client.js'
11
14
  import {
12
15
  isSeamHttpOptionsWithApiKey,
@@ -134,6 +137,25 @@ export class SeamHttpThermostatsClimateSettingSchedules {
134
137
  return new SeamHttpThermostatsClimateSettingSchedules(constructorOptions)
135
138
  }
136
139
 
140
+ async updateClientSessionToken(
141
+ clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
142
+ ): Promise<void> {
143
+ const { headers } = this.client.defaults
144
+ const authHeaders = getAuthHeadersForClientSessionToken({
145
+ clientSessionToken,
146
+ })
147
+ for (const key of Object.keys(authHeaders)) {
148
+ if (headers[key] == null) {
149
+ throw new Error(
150
+ 'Cannot update a clientSessionToken on a client created without a clientSessionToken',
151
+ )
152
+ }
153
+ }
154
+ this.client.defaults.headers = { ...headers, ...authHeaders }
155
+ const clientSessions = SeamHttpClientSessions.fromClient(this.client)
156
+ await clientSessions.get()
157
+ }
158
+
137
159
  async create(
138
160
  body?: ThermostatsClimateSettingSchedulesCreateBody,
139
161
  ): Promise<
@@ -6,7 +6,10 @@
6
6
  import type { RouteRequestBody, RouteResponse } from '@seamapi/types/connect'
7
7
  import type { SetNonNullable } from 'type-fest'
8
8
 
9
- import { warnOnInsecureuserIdentifierKey } from 'lib/seam/connect/auth.js'
9
+ import {
10
+ getAuthHeadersForClientSessionToken,
11
+ warnOnInsecureuserIdentifierKey,
12
+ } from 'lib/seam/connect/auth.js'
10
13
  import { type Client, createClient } from 'lib/seam/connect/client.js'
11
14
  import {
12
15
  isSeamHttpOptionsWithApiKey,
@@ -132,6 +135,25 @@ export class SeamHttpThermostats {
132
135
  return new SeamHttpThermostats(constructorOptions)
133
136
  }
134
137
 
138
+ async updateClientSessionToken(
139
+ clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
140
+ ): Promise<void> {
141
+ const { headers } = this.client.defaults
142
+ const authHeaders = getAuthHeadersForClientSessionToken({
143
+ clientSessionToken,
144
+ })
145
+ for (const key of Object.keys(authHeaders)) {
146
+ if (headers[key] == null) {
147
+ throw new Error(
148
+ 'Cannot update a clientSessionToken on a client created without a clientSessionToken',
149
+ )
150
+ }
151
+ }
152
+ this.client.defaults.headers = { ...headers, ...authHeaders }
153
+ const clientSessions = SeamHttpClientSessions.fromClient(this.client)
154
+ await clientSessions.get()
155
+ }
156
+
135
157
  get climateSettingSchedules(): SeamHttpThermostatsClimateSettingSchedules {
136
158
  return SeamHttpThermostatsClimateSettingSchedules.fromClient(
137
159
  this.client,
@@ -6,7 +6,10 @@
6
6
  import type { RouteRequestBody, RouteResponse } from '@seamapi/types/connect'
7
7
  import type { SetNonNullable } from 'type-fest'
8
8
 
9
- import { warnOnInsecureuserIdentifierKey } from 'lib/seam/connect/auth.js'
9
+ import {
10
+ getAuthHeadersForClientSessionToken,
11
+ warnOnInsecureuserIdentifierKey,
12
+ } from 'lib/seam/connect/auth.js'
10
13
  import { type Client, createClient } from 'lib/seam/connect/client.js'
11
14
  import {
12
15
  isSeamHttpOptionsWithApiKey,
@@ -134,6 +137,25 @@ export class SeamHttpUserIdentitiesEnrollmentAutomations {
134
137
  return new SeamHttpUserIdentitiesEnrollmentAutomations(constructorOptions)
135
138
  }
136
139
 
140
+ async updateClientSessionToken(
141
+ clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
142
+ ): Promise<void> {
143
+ const { headers } = this.client.defaults
144
+ const authHeaders = getAuthHeadersForClientSessionToken({
145
+ clientSessionToken,
146
+ })
147
+ for (const key of Object.keys(authHeaders)) {
148
+ if (headers[key] == null) {
149
+ throw new Error(
150
+ 'Cannot update a clientSessionToken on a client created without a clientSessionToken',
151
+ )
152
+ }
153
+ }
154
+ this.client.defaults.headers = { ...headers, ...authHeaders }
155
+ const clientSessions = SeamHttpClientSessions.fromClient(this.client)
156
+ await clientSessions.get()
157
+ }
158
+
137
159
  async get(
138
160
  body?: UserIdentitiesEnrollmentAutomationsGetParams,
139
161
  ): Promise<
@@ -6,7 +6,10 @@
6
6
  import type { RouteRequestBody, RouteResponse } from '@seamapi/types/connect'
7
7
  import type { SetNonNullable } from 'type-fest'
8
8
 
9
- import { warnOnInsecureuserIdentifierKey } from 'lib/seam/connect/auth.js'
9
+ import {
10
+ getAuthHeadersForClientSessionToken,
11
+ warnOnInsecureuserIdentifierKey,
12
+ } from 'lib/seam/connect/auth.js'
10
13
  import { type Client, createClient } from 'lib/seam/connect/client.js'
11
14
  import {
12
15
  isSeamHttpOptionsWithApiKey,
@@ -132,6 +135,25 @@ export class SeamHttpUserIdentities {
132
135
  return new SeamHttpUserIdentities(constructorOptions)
133
136
  }
134
137
 
138
+ async updateClientSessionToken(
139
+ clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
140
+ ): Promise<void> {
141
+ const { headers } = this.client.defaults
142
+ const authHeaders = getAuthHeadersForClientSessionToken({
143
+ clientSessionToken,
144
+ })
145
+ for (const key of Object.keys(authHeaders)) {
146
+ if (headers[key] == null) {
147
+ throw new Error(
148
+ 'Cannot update a clientSessionToken on a client created without a clientSessionToken',
149
+ )
150
+ }
151
+ }
152
+ this.client.defaults.headers = { ...headers, ...authHeaders }
153
+ const clientSessions = SeamHttpClientSessions.fromClient(this.client)
154
+ await clientSessions.get()
155
+ }
156
+
135
157
  get enrollmentAutomations(): SeamHttpUserIdentitiesEnrollmentAutomations {
136
158
  return SeamHttpUserIdentitiesEnrollmentAutomations.fromClient(
137
159
  this.client,
@@ -6,7 +6,10 @@
6
6
  import type { RouteRequestBody, RouteResponse } from '@seamapi/types/connect'
7
7
  import type { SetNonNullable } from 'type-fest'
8
8
 
9
- import { warnOnInsecureuserIdentifierKey } from 'lib/seam/connect/auth.js'
9
+ import {
10
+ getAuthHeadersForClientSessionToken,
11
+ warnOnInsecureuserIdentifierKey,
12
+ } from 'lib/seam/connect/auth.js'
10
13
  import { type Client, createClient } from 'lib/seam/connect/client.js'
11
14
  import {
12
15
  isSeamHttpOptionsWithApiKey,
@@ -131,6 +134,25 @@ export class SeamHttpWebhooks {
131
134
  return new SeamHttpWebhooks(constructorOptions)
132
135
  }
133
136
 
137
+ async updateClientSessionToken(
138
+ clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
139
+ ): Promise<void> {
140
+ const { headers } = this.client.defaults
141
+ const authHeaders = getAuthHeadersForClientSessionToken({
142
+ clientSessionToken,
143
+ })
144
+ for (const key of Object.keys(authHeaders)) {
145
+ if (headers[key] == null) {
146
+ throw new Error(
147
+ 'Cannot update a clientSessionToken on a client created without a clientSessionToken',
148
+ )
149
+ }
150
+ }
151
+ this.client.defaults.headers = { ...headers, ...authHeaders }
152
+ const clientSessions = SeamHttpClientSessions.fromClient(this.client)
153
+ await clientSessions.get()
154
+ }
155
+
134
156
  async create(
135
157
  body?: WebhooksCreateBody,
136
158
  ): Promise<WebhooksCreateResponse['webhook']> {
@@ -172,6 +194,14 @@ export class SeamHttpWebhooks {
172
194
 
173
195
  return data.webhooks
174
196
  }
197
+
198
+ async update(body?: WebhooksUpdateBody): Promise<void> {
199
+ await this.client.request<WebhooksUpdateResponse>({
200
+ url: '/webhooks/update',
201
+ method: 'post',
202
+ data: body,
203
+ })
204
+ }
175
205
  }
176
206
 
177
207
  export type WebhooksCreateBody = RouteRequestBody<'/webhooks/create'>
@@ -205,3 +235,11 @@ export type WebhooksListResponse = SetNonNullable<
205
235
  >
206
236
 
207
237
  export type WebhooksListOptions = never
238
+
239
+ export type WebhooksUpdateBody = RouteRequestBody<'/webhooks/update'>
240
+
241
+ export type WebhooksUpdateResponse = SetNonNullable<
242
+ Required<RouteResponse<'/webhooks/update'>>
243
+ >
244
+
245
+ export type WebhooksUpdateOptions = never
@@ -6,7 +6,10 @@
6
6
  import type { RouteRequestBody, RouteResponse } from '@seamapi/types/connect'
7
7
  import type { SetNonNullable } from 'type-fest'
8
8
 
9
- import { warnOnInsecureuserIdentifierKey } from 'lib/seam/connect/auth.js'
9
+ import {
10
+ getAuthHeadersForClientSessionToken,
11
+ warnOnInsecureuserIdentifierKey,
12
+ } from 'lib/seam/connect/auth.js'
10
13
  import { type Client, createClient } from 'lib/seam/connect/client.js'
11
14
  import {
12
15
  isSeamHttpOptionsWithApiKey,
@@ -131,6 +134,25 @@ export class SeamHttpWorkspaces {
131
134
  return new SeamHttpWorkspaces(constructorOptions)
132
135
  }
133
136
 
137
+ async updateClientSessionToken(
138
+ clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
139
+ ): Promise<void> {
140
+ const { headers } = this.client.defaults
141
+ const authHeaders = getAuthHeadersForClientSessionToken({
142
+ clientSessionToken,
143
+ })
144
+ for (const key of Object.keys(authHeaders)) {
145
+ if (headers[key] == null) {
146
+ throw new Error(
147
+ 'Cannot update a clientSessionToken on a client created without a clientSessionToken',
148
+ )
149
+ }
150
+ }
151
+ this.client.defaults.headers = { ...headers, ...authHeaders }
152
+ const clientSessions = SeamHttpClientSessions.fromClient(this.client)
153
+ await clientSessions.get()
154
+ }
155
+
134
156
  async create(
135
157
  body?: WorkspacesCreateBody,
136
158
  ): Promise<WorkspacesCreateResponse['workspace']> {
@@ -1,4 +1,7 @@
1
- import { warnOnInsecureuserIdentifierKey } from './auth.js'
1
+ import {
2
+ getAuthHeadersForClientSessionToken,
3
+ warnOnInsecureuserIdentifierKey,
4
+ } from './auth.js'
2
5
  import { type Client, createClient } from './client.js'
3
6
  import {
4
7
  isSeamHttpOptionsWithApiKey,
@@ -136,6 +139,25 @@ export class SeamHttp {
136
139
  return new SeamHttp(constructorOptions)
137
140
  }
138
141
 
142
+ async updateClientSessionToken(
143
+ clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
144
+ ): Promise<void> {
145
+ const { headers } = this.client.defaults
146
+ const authHeaders = getAuthHeadersForClientSessionToken({
147
+ clientSessionToken,
148
+ })
149
+ for (const key of Object.keys(authHeaders)) {
150
+ if (headers[key] == null) {
151
+ throw new Error(
152
+ 'Cannot update a clientSessionToken on a client created without a clientSessionToken',
153
+ )
154
+ }
155
+ }
156
+ this.client.defaults.headers = { ...headers, ...authHeaders }
157
+ const clientSessions = SeamHttpClientSessions.fromClient(this.client)
158
+ await clientSessions.get()
159
+ }
160
+
139
161
  get accessCodes(): SeamHttpAccessCodes {
140
162
  return SeamHttpAccessCodes.fromClient(this.client, this.defaults)
141
163
  }
@@ -1,3 +1,3 @@
1
- const seamapiJavascriptHttpVersion = '0.16.2'
1
+ const seamapiJavascriptHttpVersion = '0.17.1'
2
2
 
3
3
  export default seamapiJavascriptHttpVersion