@seamapi/http 0.16.1 → 0.17.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.
- package/README.md +8 -0
- package/dist/connect.cjs +464 -0
- package/dist/connect.cjs.map +1 -1
- package/dist/connect.d.cts +29 -0
- package/lib/seam/connect/auth.d.ts +2 -0
- package/lib/seam/connect/auth.js +1 -1
- package/lib/seam/connect/auth.js.map +1 -1
- package/lib/seam/connect/routes/access-codes-unmanaged.d.ts +1 -0
- package/lib/seam/connect/routes/access-codes-unmanaged.js +15 -1
- package/lib/seam/connect/routes/access-codes-unmanaged.js.map +1 -1
- package/lib/seam/connect/routes/access-codes.d.ts +1 -0
- package/lib/seam/connect/routes/access-codes.js +15 -1
- package/lib/seam/connect/routes/access-codes.js.map +1 -1
- package/lib/seam/connect/routes/acs-access-groups.d.ts +1 -0
- package/lib/seam/connect/routes/acs-access-groups.js +15 -1
- package/lib/seam/connect/routes/acs-access-groups.js.map +1 -1
- package/lib/seam/connect/routes/acs-credential-pools.d.ts +1 -0
- package/lib/seam/connect/routes/acs-credential-pools.js +15 -1
- package/lib/seam/connect/routes/acs-credential-pools.js.map +1 -1
- package/lib/seam/connect/routes/acs-credential-provisioning-automations.d.ts +1 -0
- package/lib/seam/connect/routes/acs-credential-provisioning-automations.js +15 -1
- package/lib/seam/connect/routes/acs-credential-provisioning-automations.js.map +1 -1
- package/lib/seam/connect/routes/acs-credentials.d.ts +1 -0
- package/lib/seam/connect/routes/acs-credentials.js +15 -1
- package/lib/seam/connect/routes/acs-credentials.js.map +1 -1
- package/lib/seam/connect/routes/acs-entrances.d.ts +1 -0
- package/lib/seam/connect/routes/acs-entrances.js +15 -1
- package/lib/seam/connect/routes/acs-entrances.js.map +1 -1
- package/lib/seam/connect/routes/acs-systems.d.ts +1 -0
- package/lib/seam/connect/routes/acs-systems.js +15 -1
- package/lib/seam/connect/routes/acs-systems.js.map +1 -1
- package/lib/seam/connect/routes/acs-users.d.ts +1 -0
- package/lib/seam/connect/routes/acs-users.js +15 -1
- package/lib/seam/connect/routes/acs-users.js.map +1 -1
- package/lib/seam/connect/routes/acs.d.ts +1 -0
- package/lib/seam/connect/routes/acs.js +15 -1
- package/lib/seam/connect/routes/acs.js.map +1 -1
- package/lib/seam/connect/routes/action-attempts.d.ts +1 -0
- package/lib/seam/connect/routes/action-attempts.js +15 -1
- package/lib/seam/connect/routes/action-attempts.js.map +1 -1
- package/lib/seam/connect/routes/client-sessions.d.ts +1 -0
- package/lib/seam/connect/routes/client-sessions.js +15 -1
- package/lib/seam/connect/routes/client-sessions.js.map +1 -1
- package/lib/seam/connect/routes/connect-webviews.d.ts +1 -0
- package/lib/seam/connect/routes/connect-webviews.js +15 -1
- package/lib/seam/connect/routes/connect-webviews.js.map +1 -1
- package/lib/seam/connect/routes/connected-accounts.d.ts +1 -0
- package/lib/seam/connect/routes/connected-accounts.js +15 -1
- package/lib/seam/connect/routes/connected-accounts.js.map +1 -1
- package/lib/seam/connect/routes/devices-unmanaged.d.ts +1 -0
- package/lib/seam/connect/routes/devices-unmanaged.js +15 -1
- package/lib/seam/connect/routes/devices-unmanaged.js.map +1 -1
- package/lib/seam/connect/routes/devices.d.ts +1 -0
- package/lib/seam/connect/routes/devices.js +15 -1
- package/lib/seam/connect/routes/devices.js.map +1 -1
- package/lib/seam/connect/routes/events.d.ts +1 -0
- package/lib/seam/connect/routes/events.js +15 -1
- package/lib/seam/connect/routes/events.js.map +1 -1
- package/lib/seam/connect/routes/locks.d.ts +1 -0
- package/lib/seam/connect/routes/locks.js +15 -1
- package/lib/seam/connect/routes/locks.js.map +1 -1
- package/lib/seam/connect/routes/networks.d.ts +1 -0
- package/lib/seam/connect/routes/networks.js +15 -1
- package/lib/seam/connect/routes/networks.js.map +1 -1
- package/lib/seam/connect/routes/noise-sensors-noise-thresholds.d.ts +1 -0
- package/lib/seam/connect/routes/noise-sensors-noise-thresholds.js +15 -1
- package/lib/seam/connect/routes/noise-sensors-noise-thresholds.js.map +1 -1
- package/lib/seam/connect/routes/noise-sensors.d.ts +1 -0
- package/lib/seam/connect/routes/noise-sensors.js +15 -1
- package/lib/seam/connect/routes/noise-sensors.js.map +1 -1
- package/lib/seam/connect/routes/phones.d.ts +1 -0
- package/lib/seam/connect/routes/phones.js +15 -1
- package/lib/seam/connect/routes/phones.js.map +1 -1
- package/lib/seam/connect/routes/thermostats-climate-setting-schedules.d.ts +1 -0
- package/lib/seam/connect/routes/thermostats-climate-setting-schedules.js +15 -1
- package/lib/seam/connect/routes/thermostats-climate-setting-schedules.js.map +1 -1
- package/lib/seam/connect/routes/thermostats.d.ts +1 -0
- package/lib/seam/connect/routes/thermostats.js +15 -1
- package/lib/seam/connect/routes/thermostats.js.map +1 -1
- package/lib/seam/connect/routes/user-identities-enrollment-automations.d.ts +1 -0
- package/lib/seam/connect/routes/user-identities-enrollment-automations.js +15 -1
- package/lib/seam/connect/routes/user-identities-enrollment-automations.js.map +1 -1
- package/lib/seam/connect/routes/user-identities.d.ts +1 -0
- package/lib/seam/connect/routes/user-identities.js +15 -1
- package/lib/seam/connect/routes/user-identities.js.map +1 -1
- package/lib/seam/connect/routes/webhooks.d.ts +1 -0
- package/lib/seam/connect/routes/webhooks.js +15 -1
- package/lib/seam/connect/routes/webhooks.js.map +1 -1
- package/lib/seam/connect/routes/workspaces.d.ts +1 -0
- package/lib/seam/connect/routes/workspaces.js +15 -1
- package/lib/seam/connect/routes/workspaces.js.map +1 -1
- package/lib/seam/connect/seam-http.d.ts +1 -0
- package/lib/seam/connect/seam-http.js +15 -1
- package/lib/seam/connect/seam-http.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +2 -2
- package/src/lib/seam/connect/auth.ts +1 -1
- package/src/lib/seam/connect/routes/access-codes-unmanaged.ts +23 -1
- package/src/lib/seam/connect/routes/access-codes.ts +23 -1
- package/src/lib/seam/connect/routes/acs-access-groups.ts +23 -1
- package/src/lib/seam/connect/routes/acs-credential-pools.ts +23 -1
- package/src/lib/seam/connect/routes/acs-credential-provisioning-automations.ts +23 -1
- package/src/lib/seam/connect/routes/acs-credentials.ts +23 -1
- package/src/lib/seam/connect/routes/acs-entrances.ts +23 -1
- package/src/lib/seam/connect/routes/acs-systems.ts +23 -1
- package/src/lib/seam/connect/routes/acs-users.ts +23 -1
- package/src/lib/seam/connect/routes/acs.ts +23 -1
- package/src/lib/seam/connect/routes/action-attempts.ts +23 -1
- package/src/lib/seam/connect/routes/client-sessions.ts +23 -1
- package/src/lib/seam/connect/routes/connect-webviews.ts +23 -1
- package/src/lib/seam/connect/routes/connected-accounts.ts +23 -1
- package/src/lib/seam/connect/routes/devices-unmanaged.ts +23 -1
- package/src/lib/seam/connect/routes/devices.ts +23 -1
- package/src/lib/seam/connect/routes/events.ts +23 -1
- package/src/lib/seam/connect/routes/locks.ts +23 -1
- package/src/lib/seam/connect/routes/networks.ts +23 -1
- package/src/lib/seam/connect/routes/noise-sensors-noise-thresholds.ts +23 -1
- package/src/lib/seam/connect/routes/noise-sensors.ts +23 -1
- package/src/lib/seam/connect/routes/phones.ts +23 -1
- package/src/lib/seam/connect/routes/thermostats-climate-setting-schedules.ts +23 -1
- package/src/lib/seam/connect/routes/thermostats.ts +23 -1
- package/src/lib/seam/connect/routes/user-identities-enrollment-automations.ts +23 -1
- package/src/lib/seam/connect/routes/user-identities.ts +23 -1
- package/src/lib/seam/connect/routes/webhooks.ts +23 -1
- package/src/lib/seam/connect/routes/workspaces.ts +23 -1
- package/src/lib/seam/connect/seam-http.ts +23 -1
- 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 {
|
|
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 SeamHttpAcsEntrances {
|
|
|
131
134
|
return new SeamHttpAcsEntrances(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(
|
|
135
157
|
body?: AcsEntrancesGetParams,
|
|
136
158
|
): Promise<AcsEntrancesGetResponse['acs_entrance']> {
|
|
@@ -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 {
|
|
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 SeamHttpAcsSystems {
|
|
|
131
134
|
return new SeamHttpAcsSystems(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(
|
|
135
157
|
body?: AcsSystemsGetParams,
|
|
136
158
|
): Promise<AcsSystemsGetResponse['acs_system']> {
|
|
@@ -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 {
|
|
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 SeamHttpAcsUsers {
|
|
|
131
134
|
return new SeamHttpAcsUsers(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 addToAccessGroup(body?: AcsUsersAddToAccessGroupBody): Promise<void> {
|
|
135
157
|
await this.client.request<AcsUsersAddToAccessGroupResponse>({
|
|
136
158
|
url: '/acs/users/add_to_access_group',
|
|
@@ -3,7 +3,10 @@
|
|
|
3
3
|
* Do not edit this file or add other files to this directory.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
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,
|
|
@@ -135,6 +138,25 @@ export class SeamHttpAcs {
|
|
|
135
138
|
return new SeamHttpAcs(constructorOptions)
|
|
136
139
|
}
|
|
137
140
|
|
|
141
|
+
async updateClientSessionToken(
|
|
142
|
+
clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
|
|
143
|
+
): Promise<void> {
|
|
144
|
+
const { headers } = this.client.defaults
|
|
145
|
+
const authHeaders = getAuthHeadersForClientSessionToken({
|
|
146
|
+
clientSessionToken,
|
|
147
|
+
})
|
|
148
|
+
for (const key of Object.keys(authHeaders)) {
|
|
149
|
+
if (headers[key] == null) {
|
|
150
|
+
throw new Error(
|
|
151
|
+
'Cannot update a clientSessionToken on a client created without a clientSessionToken',
|
|
152
|
+
)
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
this.client.defaults.headers = { ...headers, ...authHeaders }
|
|
156
|
+
const clientSessions = SeamHttpClientSessions.fromClient(this.client)
|
|
157
|
+
await clientSessions.get()
|
|
158
|
+
}
|
|
159
|
+
|
|
138
160
|
get accessGroups(): SeamHttpAcsAccessGroups {
|
|
139
161
|
return SeamHttpAcsAccessGroups.fromClient(this.client, this.defaults)
|
|
140
162
|
}
|
|
@@ -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 {
|
|
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 SeamHttpActionAttempts {
|
|
|
132
135
|
return new SeamHttpActionAttempts(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
|
async get(
|
|
136
158
|
body?: ActionAttemptsGetParams,
|
|
137
159
|
options: Pick<SeamHttpRequestOptions, 'waitForActionAttempt'> = {},
|
|
@@ -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 {
|
|
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,
|
|
@@ -129,6 +132,25 @@ export class SeamHttpClientSessions {
|
|
|
129
132
|
return new SeamHttpClientSessions(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
|
async create(
|
|
133
155
|
body?: ClientSessionsCreateBody,
|
|
134
156
|
): Promise<ClientSessionsCreateResponse['client_session']> {
|
|
@@ -10,7 +10,10 @@ import type {
|
|
|
10
10
|
} from '@seamapi/types/connect'
|
|
11
11
|
import type { SetNonNullable } from 'type-fest'
|
|
12
12
|
|
|
13
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
getAuthHeadersForClientSessionToken,
|
|
15
|
+
warnOnInsecureuserIdentifierKey,
|
|
16
|
+
} from 'lib/seam/connect/auth.js'
|
|
14
17
|
import { type Client, createClient } from 'lib/seam/connect/client.js'
|
|
15
18
|
import {
|
|
16
19
|
isSeamHttpOptionsWithApiKey,
|
|
@@ -135,6 +138,25 @@ export class SeamHttpConnectWebviews {
|
|
|
135
138
|
return new SeamHttpConnectWebviews(constructorOptions)
|
|
136
139
|
}
|
|
137
140
|
|
|
141
|
+
async updateClientSessionToken(
|
|
142
|
+
clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
|
|
143
|
+
): Promise<void> {
|
|
144
|
+
const { headers } = this.client.defaults
|
|
145
|
+
const authHeaders = getAuthHeadersForClientSessionToken({
|
|
146
|
+
clientSessionToken,
|
|
147
|
+
})
|
|
148
|
+
for (const key of Object.keys(authHeaders)) {
|
|
149
|
+
if (headers[key] == null) {
|
|
150
|
+
throw new Error(
|
|
151
|
+
'Cannot update a clientSessionToken on a client created without a clientSessionToken',
|
|
152
|
+
)
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
this.client.defaults.headers = { ...headers, ...authHeaders }
|
|
156
|
+
const clientSessions = SeamHttpClientSessions.fromClient(this.client)
|
|
157
|
+
await clientSessions.get()
|
|
158
|
+
}
|
|
159
|
+
|
|
138
160
|
async create(
|
|
139
161
|
body?: ConnectWebviewsCreateBody,
|
|
140
162
|
): Promise<ConnectWebviewsCreateResponse['connect_webview']> {
|
|
@@ -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 {
|
|
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 SeamHttpConnectedAccounts {
|
|
|
131
134
|
return new SeamHttpConnectedAccounts(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 delete(body?: ConnectedAccountsDeleteBody): Promise<void> {
|
|
135
157
|
await this.client.request<ConnectedAccountsDeleteResponse>({
|
|
136
158
|
url: '/connected_accounts/delete',
|
|
@@ -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 {
|
|
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 SeamHttpDevicesUnmanaged {
|
|
|
131
134
|
return new SeamHttpDevicesUnmanaged(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(
|
|
135
157
|
body?: DevicesUnmanagedGetParams,
|
|
136
158
|
): Promise<DevicesUnmanagedGetResponse['device']> {
|
|
@@ -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 {
|
|
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 SeamHttpDevices {
|
|
|
132
135
|
return new SeamHttpDevices(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 unmanaged(): SeamHttpDevicesUnmanaged {
|
|
136
158
|
return SeamHttpDevicesUnmanaged.fromClient(this.client, this.defaults)
|
|
137
159
|
}
|
|
@@ -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 {
|
|
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 SeamHttpEvents {
|
|
|
131
134
|
return new SeamHttpEvents(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?: EventsGetParams): Promise<EventsGetResponse['event']> {
|
|
135
157
|
const { data } = await this.client.request<EventsGetResponse>({
|
|
136
158
|
url: '/events/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 {
|
|
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 {
|
|
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 {
|
|
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 {
|
|
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 {
|
|
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 {
|
|
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<
|