@seamapi/http 0.4.0 → 0.6.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 +212 -1
- package/dist/connect.cjs +691 -26
- package/dist/connect.cjs.map +1 -1
- package/dist/connect.d.cts +101 -11
- package/lib/seam/connect/auth.js +55 -4
- package/lib/seam/connect/auth.js.map +1 -1
- package/lib/seam/connect/options.d.ts +11 -1
- package/lib/seam/connect/options.js +51 -1
- package/lib/seam/connect/options.js.map +1 -1
- package/lib/seam/connect/routes/access-codes-unmanaged.d.ts +3 -1
- 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 +3 -1
- 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 +3 -10
- package/lib/seam/connect/routes/acs-access-groups.js +15 -23
- package/lib/seam/connect/routes/acs-access-groups.js.map +1 -1
- package/lib/seam/connect/routes/acs-credentials.d.ts +9 -1
- package/lib/seam/connect/routes/acs-credentials.js +29 -1
- package/lib/seam/connect/routes/acs-credentials.js.map +1 -1
- package/lib/seam/connect/routes/acs-systems.d.ts +3 -1
- 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 +3 -1
- 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 +3 -1
- 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 +3 -1
- 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 +6 -1
- package/lib/seam/connect/routes/client-sessions.js +22 -1
- package/lib/seam/connect/routes/client-sessions.js.map +1 -1
- package/lib/seam/connect/routes/connect-webviews.d.ts +3 -1
- 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 +3 -1
- 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 +3 -1
- 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 +3 -1
- 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 +3 -1
- package/lib/seam/connect/routes/events.js +15 -1
- package/lib/seam/connect/routes/events.js.map +1 -1
- package/lib/seam/connect/routes/index.d.ts +1 -0
- package/lib/seam/connect/routes/index.js +1 -0
- package/lib/seam/connect/routes/index.js.map +1 -1
- package/lib/seam/connect/routes/locks.d.ts +3 -1
- package/lib/seam/connect/routes/locks.js +15 -1
- package/lib/seam/connect/routes/locks.js.map +1 -1
- package/lib/seam/connect/routes/noise-sensors-noise-thresholds.d.ts +3 -1
- 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 +3 -1
- 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/thermostats-climate-setting-schedules.d.ts +3 -1
- 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 +3 -1
- 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.d.ts +38 -0
- package/lib/seam/connect/routes/user-identities.js +121 -0
- package/lib/seam/connect/routes/user-identities.js.map +1 -0
- package/lib/seam/connect/routes/webhooks.d.ts +3 -1
- 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 +3 -1
- 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 +5 -2
- package/lib/seam/connect/seam-http.js +19 -2
- 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 +95 -3
- package/src/lib/seam/connect/options.ts +105 -1
- package/src/lib/seam/connect/routes/access-codes-unmanaged.ts +38 -0
- package/src/lib/seam/connect/routes/access-codes.ts +38 -0
- package/src/lib/seam/connect/routes/acs-access-groups.ts +37 -47
- package/src/lib/seam/connect/routes/acs-credentials.ts +68 -0
- package/src/lib/seam/connect/routes/acs-systems.ts +38 -0
- package/src/lib/seam/connect/routes/acs-users.ts +38 -0
- package/src/lib/seam/connect/routes/acs.ts +38 -0
- package/src/lib/seam/connect/routes/action-attempts.ts +38 -0
- package/src/lib/seam/connect/routes/client-sessions.ts +53 -0
- package/src/lib/seam/connect/routes/connect-webviews.ts +38 -0
- package/src/lib/seam/connect/routes/connected-accounts.ts +38 -0
- package/src/lib/seam/connect/routes/devices-unmanaged.ts +38 -0
- package/src/lib/seam/connect/routes/devices.ts +38 -0
- package/src/lib/seam/connect/routes/events.ts +38 -0
- package/src/lib/seam/connect/routes/index.ts +1 -0
- package/src/lib/seam/connect/routes/locks.ts +38 -0
- package/src/lib/seam/connect/routes/noise-sensors-noise-thresholds.ts +38 -0
- package/src/lib/seam/connect/routes/noise-sensors.ts +38 -0
- package/src/lib/seam/connect/routes/thermostats-climate-setting-schedules.ts +38 -0
- package/src/lib/seam/connect/routes/thermostats.ts +38 -0
- package/src/lib/seam/connect/routes/user-identities.ts +261 -0
- package/src/lib/seam/connect/routes/webhooks.ts +38 -0
- package/src/lib/seam/connect/routes/workspaces.ts +38 -0
- package/src/lib/seam/connect/seam-http.ts +43 -0
- package/src/lib/version.ts +1 -1
|
@@ -12,12 +12,16 @@ import {
|
|
|
12
12
|
isSeamHttpOptionsWithApiKey,
|
|
13
13
|
isSeamHttpOptionsWithClient,
|
|
14
14
|
isSeamHttpOptionsWithClientSessionToken,
|
|
15
|
+
isSeamHttpOptionsWithConsoleSessionToken,
|
|
16
|
+
isSeamHttpOptionsWithPersonalAccessToken,
|
|
15
17
|
type SeamHttpFromPublishableKeyOptions,
|
|
16
18
|
SeamHttpInvalidOptionsError,
|
|
17
19
|
type SeamHttpOptions,
|
|
18
20
|
type SeamHttpOptionsWithApiKey,
|
|
19
21
|
type SeamHttpOptionsWithClient,
|
|
20
22
|
type SeamHttpOptionsWithClientSessionToken,
|
|
23
|
+
type SeamHttpOptionsWithConsoleSessionToken,
|
|
24
|
+
type SeamHttpOptionsWithPersonalAccessToken,
|
|
21
25
|
} from 'lib/seam/connect/options.js'
|
|
22
26
|
import { parseOptions } from 'lib/seam/connect/parse-options.js'
|
|
23
27
|
|
|
@@ -82,6 +86,40 @@ export class SeamHttpEvents {
|
|
|
82
86
|
return SeamHttpEvents.fromClientSessionToken(token, options)
|
|
83
87
|
}
|
|
84
88
|
|
|
89
|
+
static fromConsoleSessionToken(
|
|
90
|
+
consoleSessionToken: SeamHttpOptionsWithConsoleSessionToken['consoleSessionToken'],
|
|
91
|
+
workspaceId: SeamHttpOptionsWithConsoleSessionToken['workspaceId'],
|
|
92
|
+
options: Omit<
|
|
93
|
+
SeamHttpOptionsWithConsoleSessionToken,
|
|
94
|
+
'consoleSessionToken' | 'workspaceId'
|
|
95
|
+
> = {},
|
|
96
|
+
): SeamHttpEvents {
|
|
97
|
+
const constructorOptions = { ...options, consoleSessionToken, workspaceId }
|
|
98
|
+
if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
|
|
99
|
+
throw new SeamHttpInvalidOptionsError(
|
|
100
|
+
'Missing consoleSessionToken or workspaceId',
|
|
101
|
+
)
|
|
102
|
+
}
|
|
103
|
+
return new SeamHttpEvents(constructorOptions)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
static fromPersonalAccessToken(
|
|
107
|
+
personalAccessToken: SeamHttpOptionsWithPersonalAccessToken['personalAccessToken'],
|
|
108
|
+
workspaceId: SeamHttpOptionsWithPersonalAccessToken['workspaceId'],
|
|
109
|
+
options: Omit<
|
|
110
|
+
SeamHttpOptionsWithPersonalAccessToken,
|
|
111
|
+
'personalAccessToken' | 'workspaceId'
|
|
112
|
+
> = {},
|
|
113
|
+
): SeamHttpEvents {
|
|
114
|
+
const constructorOptions = { ...options, personalAccessToken, workspaceId }
|
|
115
|
+
if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
|
|
116
|
+
throw new SeamHttpInvalidOptionsError(
|
|
117
|
+
'Missing personalAccessToken or workspaceId',
|
|
118
|
+
)
|
|
119
|
+
}
|
|
120
|
+
return new SeamHttpEvents(constructorOptions)
|
|
121
|
+
}
|
|
122
|
+
|
|
85
123
|
async get(body?: EventsGetParams): Promise<EventsGetResponse['event']> {
|
|
86
124
|
const { data } = await this.client.request<EventsGetResponse>({
|
|
87
125
|
url: '/events/get',
|
|
@@ -17,5 +17,6 @@ export * from './noise-sensors.js'
|
|
|
17
17
|
export * from './noise-sensors-noise-thresholds.js'
|
|
18
18
|
export * from './thermostats.js'
|
|
19
19
|
export * from './thermostats-climate-setting-schedules.js'
|
|
20
|
+
export * from './user-identities.js'
|
|
20
21
|
export * from './webhooks.js'
|
|
21
22
|
export * from './workspaces.js'
|
|
@@ -12,12 +12,16 @@ import {
|
|
|
12
12
|
isSeamHttpOptionsWithApiKey,
|
|
13
13
|
isSeamHttpOptionsWithClient,
|
|
14
14
|
isSeamHttpOptionsWithClientSessionToken,
|
|
15
|
+
isSeamHttpOptionsWithConsoleSessionToken,
|
|
16
|
+
isSeamHttpOptionsWithPersonalAccessToken,
|
|
15
17
|
type SeamHttpFromPublishableKeyOptions,
|
|
16
18
|
SeamHttpInvalidOptionsError,
|
|
17
19
|
type SeamHttpOptions,
|
|
18
20
|
type SeamHttpOptionsWithApiKey,
|
|
19
21
|
type SeamHttpOptionsWithClient,
|
|
20
22
|
type SeamHttpOptionsWithClientSessionToken,
|
|
23
|
+
type SeamHttpOptionsWithConsoleSessionToken,
|
|
24
|
+
type SeamHttpOptionsWithPersonalAccessToken,
|
|
21
25
|
} from 'lib/seam/connect/options.js'
|
|
22
26
|
import { parseOptions } from 'lib/seam/connect/parse-options.js'
|
|
23
27
|
|
|
@@ -82,6 +86,40 @@ export class SeamHttpLocks {
|
|
|
82
86
|
return SeamHttpLocks.fromClientSessionToken(token, options)
|
|
83
87
|
}
|
|
84
88
|
|
|
89
|
+
static fromConsoleSessionToken(
|
|
90
|
+
consoleSessionToken: SeamHttpOptionsWithConsoleSessionToken['consoleSessionToken'],
|
|
91
|
+
workspaceId: SeamHttpOptionsWithConsoleSessionToken['workspaceId'],
|
|
92
|
+
options: Omit<
|
|
93
|
+
SeamHttpOptionsWithConsoleSessionToken,
|
|
94
|
+
'consoleSessionToken' | 'workspaceId'
|
|
95
|
+
> = {},
|
|
96
|
+
): SeamHttpLocks {
|
|
97
|
+
const constructorOptions = { ...options, consoleSessionToken, workspaceId }
|
|
98
|
+
if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
|
|
99
|
+
throw new SeamHttpInvalidOptionsError(
|
|
100
|
+
'Missing consoleSessionToken or workspaceId',
|
|
101
|
+
)
|
|
102
|
+
}
|
|
103
|
+
return new SeamHttpLocks(constructorOptions)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
static fromPersonalAccessToken(
|
|
107
|
+
personalAccessToken: SeamHttpOptionsWithPersonalAccessToken['personalAccessToken'],
|
|
108
|
+
workspaceId: SeamHttpOptionsWithPersonalAccessToken['workspaceId'],
|
|
109
|
+
options: Omit<
|
|
110
|
+
SeamHttpOptionsWithPersonalAccessToken,
|
|
111
|
+
'personalAccessToken' | 'workspaceId'
|
|
112
|
+
> = {},
|
|
113
|
+
): SeamHttpLocks {
|
|
114
|
+
const constructorOptions = { ...options, personalAccessToken, workspaceId }
|
|
115
|
+
if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
|
|
116
|
+
throw new SeamHttpInvalidOptionsError(
|
|
117
|
+
'Missing personalAccessToken or workspaceId',
|
|
118
|
+
)
|
|
119
|
+
}
|
|
120
|
+
return new SeamHttpLocks(constructorOptions)
|
|
121
|
+
}
|
|
122
|
+
|
|
85
123
|
async get(body?: LocksGetParams): Promise<LocksGetResponse['device']> {
|
|
86
124
|
const { data } = await this.client.request<LocksGetResponse>({
|
|
87
125
|
url: '/locks/get',
|
|
@@ -12,12 +12,16 @@ import {
|
|
|
12
12
|
isSeamHttpOptionsWithApiKey,
|
|
13
13
|
isSeamHttpOptionsWithClient,
|
|
14
14
|
isSeamHttpOptionsWithClientSessionToken,
|
|
15
|
+
isSeamHttpOptionsWithConsoleSessionToken,
|
|
16
|
+
isSeamHttpOptionsWithPersonalAccessToken,
|
|
15
17
|
type SeamHttpFromPublishableKeyOptions,
|
|
16
18
|
SeamHttpInvalidOptionsError,
|
|
17
19
|
type SeamHttpOptions,
|
|
18
20
|
type SeamHttpOptionsWithApiKey,
|
|
19
21
|
type SeamHttpOptionsWithClient,
|
|
20
22
|
type SeamHttpOptionsWithClientSessionToken,
|
|
23
|
+
type SeamHttpOptionsWithConsoleSessionToken,
|
|
24
|
+
type SeamHttpOptionsWithPersonalAccessToken,
|
|
21
25
|
} from 'lib/seam/connect/options.js'
|
|
22
26
|
import { parseOptions } from 'lib/seam/connect/parse-options.js'
|
|
23
27
|
|
|
@@ -85,6 +89,40 @@ export class SeamHttpNoiseSensorsNoiseThresholds {
|
|
|
85
89
|
)
|
|
86
90
|
}
|
|
87
91
|
|
|
92
|
+
static fromConsoleSessionToken(
|
|
93
|
+
consoleSessionToken: SeamHttpOptionsWithConsoleSessionToken['consoleSessionToken'],
|
|
94
|
+
workspaceId: SeamHttpOptionsWithConsoleSessionToken['workspaceId'],
|
|
95
|
+
options: Omit<
|
|
96
|
+
SeamHttpOptionsWithConsoleSessionToken,
|
|
97
|
+
'consoleSessionToken' | 'workspaceId'
|
|
98
|
+
> = {},
|
|
99
|
+
): SeamHttpNoiseSensorsNoiseThresholds {
|
|
100
|
+
const constructorOptions = { ...options, consoleSessionToken, workspaceId }
|
|
101
|
+
if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
|
|
102
|
+
throw new SeamHttpInvalidOptionsError(
|
|
103
|
+
'Missing consoleSessionToken or workspaceId',
|
|
104
|
+
)
|
|
105
|
+
}
|
|
106
|
+
return new SeamHttpNoiseSensorsNoiseThresholds(constructorOptions)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
static fromPersonalAccessToken(
|
|
110
|
+
personalAccessToken: SeamHttpOptionsWithPersonalAccessToken['personalAccessToken'],
|
|
111
|
+
workspaceId: SeamHttpOptionsWithPersonalAccessToken['workspaceId'],
|
|
112
|
+
options: Omit<
|
|
113
|
+
SeamHttpOptionsWithPersonalAccessToken,
|
|
114
|
+
'personalAccessToken' | 'workspaceId'
|
|
115
|
+
> = {},
|
|
116
|
+
): SeamHttpNoiseSensorsNoiseThresholds {
|
|
117
|
+
const constructorOptions = { ...options, personalAccessToken, workspaceId }
|
|
118
|
+
if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
|
|
119
|
+
throw new SeamHttpInvalidOptionsError(
|
|
120
|
+
'Missing personalAccessToken or workspaceId',
|
|
121
|
+
)
|
|
122
|
+
}
|
|
123
|
+
return new SeamHttpNoiseSensorsNoiseThresholds(constructorOptions)
|
|
124
|
+
}
|
|
125
|
+
|
|
88
126
|
async create(body?: NoiseSensorsNoiseThresholdsCreateBody): Promise<void> {
|
|
89
127
|
await this.client.request<NoiseSensorsNoiseThresholdsCreateResponse>({
|
|
90
128
|
url: '/noise_sensors/noise_thresholds/create',
|
|
@@ -9,12 +9,16 @@ import {
|
|
|
9
9
|
isSeamHttpOptionsWithApiKey,
|
|
10
10
|
isSeamHttpOptionsWithClient,
|
|
11
11
|
isSeamHttpOptionsWithClientSessionToken,
|
|
12
|
+
isSeamHttpOptionsWithConsoleSessionToken,
|
|
13
|
+
isSeamHttpOptionsWithPersonalAccessToken,
|
|
12
14
|
type SeamHttpFromPublishableKeyOptions,
|
|
13
15
|
SeamHttpInvalidOptionsError,
|
|
14
16
|
type SeamHttpOptions,
|
|
15
17
|
type SeamHttpOptionsWithApiKey,
|
|
16
18
|
type SeamHttpOptionsWithClient,
|
|
17
19
|
type SeamHttpOptionsWithClientSessionToken,
|
|
20
|
+
type SeamHttpOptionsWithConsoleSessionToken,
|
|
21
|
+
type SeamHttpOptionsWithPersonalAccessToken,
|
|
18
22
|
} from 'lib/seam/connect/options.js'
|
|
19
23
|
import { parseOptions } from 'lib/seam/connect/parse-options.js'
|
|
20
24
|
|
|
@@ -80,6 +84,40 @@ export class SeamHttpNoiseSensors {
|
|
|
80
84
|
return SeamHttpNoiseSensors.fromClientSessionToken(token, options)
|
|
81
85
|
}
|
|
82
86
|
|
|
87
|
+
static fromConsoleSessionToken(
|
|
88
|
+
consoleSessionToken: SeamHttpOptionsWithConsoleSessionToken['consoleSessionToken'],
|
|
89
|
+
workspaceId: SeamHttpOptionsWithConsoleSessionToken['workspaceId'],
|
|
90
|
+
options: Omit<
|
|
91
|
+
SeamHttpOptionsWithConsoleSessionToken,
|
|
92
|
+
'consoleSessionToken' | 'workspaceId'
|
|
93
|
+
> = {},
|
|
94
|
+
): SeamHttpNoiseSensors {
|
|
95
|
+
const constructorOptions = { ...options, consoleSessionToken, workspaceId }
|
|
96
|
+
if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
|
|
97
|
+
throw new SeamHttpInvalidOptionsError(
|
|
98
|
+
'Missing consoleSessionToken or workspaceId',
|
|
99
|
+
)
|
|
100
|
+
}
|
|
101
|
+
return new SeamHttpNoiseSensors(constructorOptions)
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
static fromPersonalAccessToken(
|
|
105
|
+
personalAccessToken: SeamHttpOptionsWithPersonalAccessToken['personalAccessToken'],
|
|
106
|
+
workspaceId: SeamHttpOptionsWithPersonalAccessToken['workspaceId'],
|
|
107
|
+
options: Omit<
|
|
108
|
+
SeamHttpOptionsWithPersonalAccessToken,
|
|
109
|
+
'personalAccessToken' | 'workspaceId'
|
|
110
|
+
> = {},
|
|
111
|
+
): SeamHttpNoiseSensors {
|
|
112
|
+
const constructorOptions = { ...options, personalAccessToken, workspaceId }
|
|
113
|
+
if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
|
|
114
|
+
throw new SeamHttpInvalidOptionsError(
|
|
115
|
+
'Missing personalAccessToken or workspaceId',
|
|
116
|
+
)
|
|
117
|
+
}
|
|
118
|
+
return new SeamHttpNoiseSensors(constructorOptions)
|
|
119
|
+
}
|
|
120
|
+
|
|
83
121
|
get noiseThresholds(): SeamHttpNoiseSensorsNoiseThresholds {
|
|
84
122
|
return SeamHttpNoiseSensorsNoiseThresholds.fromClient(this.client)
|
|
85
123
|
}
|
|
@@ -12,12 +12,16 @@ import {
|
|
|
12
12
|
isSeamHttpOptionsWithApiKey,
|
|
13
13
|
isSeamHttpOptionsWithClient,
|
|
14
14
|
isSeamHttpOptionsWithClientSessionToken,
|
|
15
|
+
isSeamHttpOptionsWithConsoleSessionToken,
|
|
16
|
+
isSeamHttpOptionsWithPersonalAccessToken,
|
|
15
17
|
type SeamHttpFromPublishableKeyOptions,
|
|
16
18
|
SeamHttpInvalidOptionsError,
|
|
17
19
|
type SeamHttpOptions,
|
|
18
20
|
type SeamHttpOptionsWithApiKey,
|
|
19
21
|
type SeamHttpOptionsWithClient,
|
|
20
22
|
type SeamHttpOptionsWithClientSessionToken,
|
|
23
|
+
type SeamHttpOptionsWithConsoleSessionToken,
|
|
24
|
+
type SeamHttpOptionsWithPersonalAccessToken,
|
|
21
25
|
} from 'lib/seam/connect/options.js'
|
|
22
26
|
import { parseOptions } from 'lib/seam/connect/parse-options.js'
|
|
23
27
|
|
|
@@ -85,6 +89,40 @@ export class SeamHttpThermostatsClimateSettingSchedules {
|
|
|
85
89
|
)
|
|
86
90
|
}
|
|
87
91
|
|
|
92
|
+
static fromConsoleSessionToken(
|
|
93
|
+
consoleSessionToken: SeamHttpOptionsWithConsoleSessionToken['consoleSessionToken'],
|
|
94
|
+
workspaceId: SeamHttpOptionsWithConsoleSessionToken['workspaceId'],
|
|
95
|
+
options: Omit<
|
|
96
|
+
SeamHttpOptionsWithConsoleSessionToken,
|
|
97
|
+
'consoleSessionToken' | 'workspaceId'
|
|
98
|
+
> = {},
|
|
99
|
+
): SeamHttpThermostatsClimateSettingSchedules {
|
|
100
|
+
const constructorOptions = { ...options, consoleSessionToken, workspaceId }
|
|
101
|
+
if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
|
|
102
|
+
throw new SeamHttpInvalidOptionsError(
|
|
103
|
+
'Missing consoleSessionToken or workspaceId',
|
|
104
|
+
)
|
|
105
|
+
}
|
|
106
|
+
return new SeamHttpThermostatsClimateSettingSchedules(constructorOptions)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
static fromPersonalAccessToken(
|
|
110
|
+
personalAccessToken: SeamHttpOptionsWithPersonalAccessToken['personalAccessToken'],
|
|
111
|
+
workspaceId: SeamHttpOptionsWithPersonalAccessToken['workspaceId'],
|
|
112
|
+
options: Omit<
|
|
113
|
+
SeamHttpOptionsWithPersonalAccessToken,
|
|
114
|
+
'personalAccessToken' | 'workspaceId'
|
|
115
|
+
> = {},
|
|
116
|
+
): SeamHttpThermostatsClimateSettingSchedules {
|
|
117
|
+
const constructorOptions = { ...options, personalAccessToken, workspaceId }
|
|
118
|
+
if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
|
|
119
|
+
throw new SeamHttpInvalidOptionsError(
|
|
120
|
+
'Missing personalAccessToken or workspaceId',
|
|
121
|
+
)
|
|
122
|
+
}
|
|
123
|
+
return new SeamHttpThermostatsClimateSettingSchedules(constructorOptions)
|
|
124
|
+
}
|
|
125
|
+
|
|
88
126
|
async create(
|
|
89
127
|
body?: ThermostatsClimateSettingSchedulesCreateBody,
|
|
90
128
|
): Promise<
|
|
@@ -12,12 +12,16 @@ import {
|
|
|
12
12
|
isSeamHttpOptionsWithApiKey,
|
|
13
13
|
isSeamHttpOptionsWithClient,
|
|
14
14
|
isSeamHttpOptionsWithClientSessionToken,
|
|
15
|
+
isSeamHttpOptionsWithConsoleSessionToken,
|
|
16
|
+
isSeamHttpOptionsWithPersonalAccessToken,
|
|
15
17
|
type SeamHttpFromPublishableKeyOptions,
|
|
16
18
|
SeamHttpInvalidOptionsError,
|
|
17
19
|
type SeamHttpOptions,
|
|
18
20
|
type SeamHttpOptionsWithApiKey,
|
|
19
21
|
type SeamHttpOptionsWithClient,
|
|
20
22
|
type SeamHttpOptionsWithClientSessionToken,
|
|
23
|
+
type SeamHttpOptionsWithConsoleSessionToken,
|
|
24
|
+
type SeamHttpOptionsWithPersonalAccessToken,
|
|
21
25
|
} from 'lib/seam/connect/options.js'
|
|
22
26
|
import { parseOptions } from 'lib/seam/connect/parse-options.js'
|
|
23
27
|
|
|
@@ -83,6 +87,40 @@ export class SeamHttpThermostats {
|
|
|
83
87
|
return SeamHttpThermostats.fromClientSessionToken(token, options)
|
|
84
88
|
}
|
|
85
89
|
|
|
90
|
+
static fromConsoleSessionToken(
|
|
91
|
+
consoleSessionToken: SeamHttpOptionsWithConsoleSessionToken['consoleSessionToken'],
|
|
92
|
+
workspaceId: SeamHttpOptionsWithConsoleSessionToken['workspaceId'],
|
|
93
|
+
options: Omit<
|
|
94
|
+
SeamHttpOptionsWithConsoleSessionToken,
|
|
95
|
+
'consoleSessionToken' | 'workspaceId'
|
|
96
|
+
> = {},
|
|
97
|
+
): SeamHttpThermostats {
|
|
98
|
+
const constructorOptions = { ...options, consoleSessionToken, workspaceId }
|
|
99
|
+
if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
|
|
100
|
+
throw new SeamHttpInvalidOptionsError(
|
|
101
|
+
'Missing consoleSessionToken or workspaceId',
|
|
102
|
+
)
|
|
103
|
+
}
|
|
104
|
+
return new SeamHttpThermostats(constructorOptions)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
static fromPersonalAccessToken(
|
|
108
|
+
personalAccessToken: SeamHttpOptionsWithPersonalAccessToken['personalAccessToken'],
|
|
109
|
+
workspaceId: SeamHttpOptionsWithPersonalAccessToken['workspaceId'],
|
|
110
|
+
options: Omit<
|
|
111
|
+
SeamHttpOptionsWithPersonalAccessToken,
|
|
112
|
+
'personalAccessToken' | 'workspaceId'
|
|
113
|
+
> = {},
|
|
114
|
+
): SeamHttpThermostats {
|
|
115
|
+
const constructorOptions = { ...options, personalAccessToken, workspaceId }
|
|
116
|
+
if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
|
|
117
|
+
throw new SeamHttpInvalidOptionsError(
|
|
118
|
+
'Missing personalAccessToken or workspaceId',
|
|
119
|
+
)
|
|
120
|
+
}
|
|
121
|
+
return new SeamHttpThermostats(constructorOptions)
|
|
122
|
+
}
|
|
123
|
+
|
|
86
124
|
get climateSettingSchedules(): SeamHttpThermostatsClimateSettingSchedules {
|
|
87
125
|
return SeamHttpThermostatsClimateSettingSchedules.fromClient(this.client)
|
|
88
126
|
}
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Automatically generated by generate-routes.ts.
|
|
3
|
+
* Do not edit this file or add other files to this directory.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { RouteRequestBody, RouteResponse } from '@seamapi/types/connect'
|
|
7
|
+
import type { SetNonNullable } from 'type-fest'
|
|
8
|
+
|
|
9
|
+
import { warnOnInsecureuserIdentifierKey } from 'lib/seam/connect/auth.js'
|
|
10
|
+
import { type Client, createClient } from 'lib/seam/connect/client.js'
|
|
11
|
+
import {
|
|
12
|
+
isSeamHttpOptionsWithApiKey,
|
|
13
|
+
isSeamHttpOptionsWithClient,
|
|
14
|
+
isSeamHttpOptionsWithClientSessionToken,
|
|
15
|
+
isSeamHttpOptionsWithConsoleSessionToken,
|
|
16
|
+
isSeamHttpOptionsWithPersonalAccessToken,
|
|
17
|
+
type SeamHttpFromPublishableKeyOptions,
|
|
18
|
+
SeamHttpInvalidOptionsError,
|
|
19
|
+
type SeamHttpOptions,
|
|
20
|
+
type SeamHttpOptionsWithApiKey,
|
|
21
|
+
type SeamHttpOptionsWithClient,
|
|
22
|
+
type SeamHttpOptionsWithClientSessionToken,
|
|
23
|
+
type SeamHttpOptionsWithConsoleSessionToken,
|
|
24
|
+
type SeamHttpOptionsWithPersonalAccessToken,
|
|
25
|
+
} from 'lib/seam/connect/options.js'
|
|
26
|
+
import { parseOptions } from 'lib/seam/connect/parse-options.js'
|
|
27
|
+
|
|
28
|
+
import { SeamHttpClientSessions } from './client-sessions.js'
|
|
29
|
+
|
|
30
|
+
export class SeamHttpUserIdentities {
|
|
31
|
+
client: Client
|
|
32
|
+
|
|
33
|
+
constructor(apiKeyOrOptions: string | SeamHttpOptions = {}) {
|
|
34
|
+
const clientOptions = parseOptions(apiKeyOrOptions)
|
|
35
|
+
this.client = createClient(clientOptions)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
static fromClient(
|
|
39
|
+
client: SeamHttpOptionsWithClient['client'],
|
|
40
|
+
options: Omit<SeamHttpOptionsWithClient, 'client'> = {},
|
|
41
|
+
): SeamHttpUserIdentities {
|
|
42
|
+
const constructorOptions = { ...options, client }
|
|
43
|
+
if (!isSeamHttpOptionsWithClient(constructorOptions)) {
|
|
44
|
+
throw new SeamHttpInvalidOptionsError('Missing client')
|
|
45
|
+
}
|
|
46
|
+
return new SeamHttpUserIdentities(constructorOptions)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
static fromApiKey(
|
|
50
|
+
apiKey: SeamHttpOptionsWithApiKey['apiKey'],
|
|
51
|
+
options: Omit<SeamHttpOptionsWithApiKey, 'apiKey'> = {},
|
|
52
|
+
): SeamHttpUserIdentities {
|
|
53
|
+
const constructorOptions = { ...options, apiKey }
|
|
54
|
+
if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
|
|
55
|
+
throw new SeamHttpInvalidOptionsError('Missing apiKey')
|
|
56
|
+
}
|
|
57
|
+
return new SeamHttpUserIdentities(constructorOptions)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
static fromClientSessionToken(
|
|
61
|
+
clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
|
|
62
|
+
options: Omit<
|
|
63
|
+
SeamHttpOptionsWithClientSessionToken,
|
|
64
|
+
'clientSessionToken'
|
|
65
|
+
> = {},
|
|
66
|
+
): SeamHttpUserIdentities {
|
|
67
|
+
const constructorOptions = { ...options, clientSessionToken }
|
|
68
|
+
if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
|
|
69
|
+
throw new SeamHttpInvalidOptionsError('Missing clientSessionToken')
|
|
70
|
+
}
|
|
71
|
+
return new SeamHttpUserIdentities(constructorOptions)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
static async fromPublishableKey(
|
|
75
|
+
publishableKey: string,
|
|
76
|
+
userIdentifierKey: string,
|
|
77
|
+
options: SeamHttpFromPublishableKeyOptions = {},
|
|
78
|
+
): Promise<SeamHttpUserIdentities> {
|
|
79
|
+
warnOnInsecureuserIdentifierKey(userIdentifierKey)
|
|
80
|
+
const clientOptions = parseOptions({ ...options, publishableKey })
|
|
81
|
+
const client = createClient(clientOptions)
|
|
82
|
+
const clientSessions = SeamHttpClientSessions.fromClient(client)
|
|
83
|
+
const { token } = await clientSessions.getOrCreate({
|
|
84
|
+
user_identifier_key: userIdentifierKey,
|
|
85
|
+
})
|
|
86
|
+
return SeamHttpUserIdentities.fromClientSessionToken(token, options)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
static fromConsoleSessionToken(
|
|
90
|
+
consoleSessionToken: SeamHttpOptionsWithConsoleSessionToken['consoleSessionToken'],
|
|
91
|
+
workspaceId: SeamHttpOptionsWithConsoleSessionToken['workspaceId'],
|
|
92
|
+
options: Omit<
|
|
93
|
+
SeamHttpOptionsWithConsoleSessionToken,
|
|
94
|
+
'consoleSessionToken' | 'workspaceId'
|
|
95
|
+
> = {},
|
|
96
|
+
): SeamHttpUserIdentities {
|
|
97
|
+
const constructorOptions = { ...options, consoleSessionToken, workspaceId }
|
|
98
|
+
if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
|
|
99
|
+
throw new SeamHttpInvalidOptionsError(
|
|
100
|
+
'Missing consoleSessionToken or workspaceId',
|
|
101
|
+
)
|
|
102
|
+
}
|
|
103
|
+
return new SeamHttpUserIdentities(constructorOptions)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
static fromPersonalAccessToken(
|
|
107
|
+
personalAccessToken: SeamHttpOptionsWithPersonalAccessToken['personalAccessToken'],
|
|
108
|
+
workspaceId: SeamHttpOptionsWithPersonalAccessToken['workspaceId'],
|
|
109
|
+
options: Omit<
|
|
110
|
+
SeamHttpOptionsWithPersonalAccessToken,
|
|
111
|
+
'personalAccessToken' | 'workspaceId'
|
|
112
|
+
> = {},
|
|
113
|
+
): SeamHttpUserIdentities {
|
|
114
|
+
const constructorOptions = { ...options, personalAccessToken, workspaceId }
|
|
115
|
+
if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
|
|
116
|
+
throw new SeamHttpInvalidOptionsError(
|
|
117
|
+
'Missing personalAccessToken or workspaceId',
|
|
118
|
+
)
|
|
119
|
+
}
|
|
120
|
+
return new SeamHttpUserIdentities(constructorOptions)
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
async addAcsUser(body?: UserIdentitiesAddAcsUserBody): Promise<void> {
|
|
124
|
+
await this.client.request<UserIdentitiesAddAcsUserResponse>({
|
|
125
|
+
url: '/user_identities/add_acs_user',
|
|
126
|
+
method: 'post',
|
|
127
|
+
data: body,
|
|
128
|
+
})
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
async create(
|
|
132
|
+
body?: UserIdentitiesCreateBody,
|
|
133
|
+
): Promise<UserIdentitiesCreateResponse['user_identity']> {
|
|
134
|
+
const { data } = await this.client.request<UserIdentitiesCreateResponse>({
|
|
135
|
+
url: '/user_identities/create',
|
|
136
|
+
method: 'post',
|
|
137
|
+
data: body,
|
|
138
|
+
})
|
|
139
|
+
return data.user_identity
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
async get(
|
|
143
|
+
body?: UserIdentitiesGetParams,
|
|
144
|
+
): Promise<UserIdentitiesGetResponse['user_identity']> {
|
|
145
|
+
const { data } = await this.client.request<UserIdentitiesGetResponse>({
|
|
146
|
+
url: '/user_identities/get',
|
|
147
|
+
method: 'post',
|
|
148
|
+
data: body,
|
|
149
|
+
})
|
|
150
|
+
return data.user_identity
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
async grantAccessToDevice(
|
|
154
|
+
body?: UserIdentitiesGrantAccessToDeviceBody,
|
|
155
|
+
): Promise<void> {
|
|
156
|
+
await this.client.request<UserIdentitiesGrantAccessToDeviceResponse>({
|
|
157
|
+
url: '/user_identities/grant_access_to_device',
|
|
158
|
+
method: 'post',
|
|
159
|
+
data: body,
|
|
160
|
+
})
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
async listAccessibleDevices(
|
|
164
|
+
body?: UserIdentitiesListAccessibleDevicesParams,
|
|
165
|
+
): Promise<
|
|
166
|
+
UserIdentitiesListAccessibleDevicesResponse['accessible_devices']
|
|
167
|
+
> {
|
|
168
|
+
const { data } =
|
|
169
|
+
await this.client.request<UserIdentitiesListAccessibleDevicesResponse>({
|
|
170
|
+
url: '/user_identities/list_accessible_devices',
|
|
171
|
+
method: 'post',
|
|
172
|
+
data: body,
|
|
173
|
+
})
|
|
174
|
+
return data.accessible_devices
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
async listAcsUsers(
|
|
178
|
+
body?: UserIdentitiesListAcsUsersParams,
|
|
179
|
+
): Promise<UserIdentitiesListAcsUsersResponse['acs_users']> {
|
|
180
|
+
const { data } =
|
|
181
|
+
await this.client.request<UserIdentitiesListAcsUsersResponse>({
|
|
182
|
+
url: '/user_identities/list_acs_users',
|
|
183
|
+
method: 'post',
|
|
184
|
+
data: body,
|
|
185
|
+
})
|
|
186
|
+
return data.acs_users
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
async removeAcsUser(body?: UserIdentitiesRemoveAcsUserBody): Promise<void> {
|
|
190
|
+
await this.client.request<UserIdentitiesRemoveAcsUserResponse>({
|
|
191
|
+
url: '/user_identities/remove_acs_user',
|
|
192
|
+
method: 'post',
|
|
193
|
+
data: body,
|
|
194
|
+
})
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
async revokeAccessToDevice(
|
|
198
|
+
body?: UserIdentitiesRevokeAccessToDeviceBody,
|
|
199
|
+
): Promise<void> {
|
|
200
|
+
await this.client.request<UserIdentitiesRevokeAccessToDeviceResponse>({
|
|
201
|
+
url: '/user_identities/revoke_access_to_device',
|
|
202
|
+
method: 'post',
|
|
203
|
+
data: body,
|
|
204
|
+
})
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export type UserIdentitiesAddAcsUserBody =
|
|
209
|
+
RouteRequestBody<'/user_identities/add_acs_user'>
|
|
210
|
+
|
|
211
|
+
export type UserIdentitiesAddAcsUserResponse = SetNonNullable<
|
|
212
|
+
Required<RouteResponse<'/user_identities/add_acs_user'>>
|
|
213
|
+
>
|
|
214
|
+
|
|
215
|
+
export type UserIdentitiesCreateBody =
|
|
216
|
+
RouteRequestBody<'/user_identities/create'>
|
|
217
|
+
|
|
218
|
+
export type UserIdentitiesCreateResponse = SetNonNullable<
|
|
219
|
+
Required<RouteResponse<'/user_identities/create'>>
|
|
220
|
+
>
|
|
221
|
+
|
|
222
|
+
export type UserIdentitiesGetParams = RouteRequestBody<'/user_identities/get'>
|
|
223
|
+
|
|
224
|
+
export type UserIdentitiesGetResponse = SetNonNullable<
|
|
225
|
+
Required<RouteResponse<'/user_identities/get'>>
|
|
226
|
+
>
|
|
227
|
+
|
|
228
|
+
export type UserIdentitiesGrantAccessToDeviceBody =
|
|
229
|
+
RouteRequestBody<'/user_identities/grant_access_to_device'>
|
|
230
|
+
|
|
231
|
+
export type UserIdentitiesGrantAccessToDeviceResponse = SetNonNullable<
|
|
232
|
+
Required<RouteResponse<'/user_identities/grant_access_to_device'>>
|
|
233
|
+
>
|
|
234
|
+
|
|
235
|
+
export type UserIdentitiesListAccessibleDevicesParams =
|
|
236
|
+
RouteRequestBody<'/user_identities/list_accessible_devices'>
|
|
237
|
+
|
|
238
|
+
export type UserIdentitiesListAccessibleDevicesResponse = SetNonNullable<
|
|
239
|
+
Required<RouteResponse<'/user_identities/list_accessible_devices'>>
|
|
240
|
+
>
|
|
241
|
+
|
|
242
|
+
export type UserIdentitiesListAcsUsersParams =
|
|
243
|
+
RouteRequestBody<'/user_identities/list_acs_users'>
|
|
244
|
+
|
|
245
|
+
export type UserIdentitiesListAcsUsersResponse = SetNonNullable<
|
|
246
|
+
Required<RouteResponse<'/user_identities/list_acs_users'>>
|
|
247
|
+
>
|
|
248
|
+
|
|
249
|
+
export type UserIdentitiesRemoveAcsUserBody =
|
|
250
|
+
RouteRequestBody<'/user_identities/remove_acs_user'>
|
|
251
|
+
|
|
252
|
+
export type UserIdentitiesRemoveAcsUserResponse = SetNonNullable<
|
|
253
|
+
Required<RouteResponse<'/user_identities/remove_acs_user'>>
|
|
254
|
+
>
|
|
255
|
+
|
|
256
|
+
export type UserIdentitiesRevokeAccessToDeviceBody =
|
|
257
|
+
RouteRequestBody<'/user_identities/revoke_access_to_device'>
|
|
258
|
+
|
|
259
|
+
export type UserIdentitiesRevokeAccessToDeviceResponse = SetNonNullable<
|
|
260
|
+
Required<RouteResponse<'/user_identities/revoke_access_to_device'>>
|
|
261
|
+
>
|
|
@@ -16,12 +16,16 @@ import {
|
|
|
16
16
|
isSeamHttpOptionsWithApiKey,
|
|
17
17
|
isSeamHttpOptionsWithClient,
|
|
18
18
|
isSeamHttpOptionsWithClientSessionToken,
|
|
19
|
+
isSeamHttpOptionsWithConsoleSessionToken,
|
|
20
|
+
isSeamHttpOptionsWithPersonalAccessToken,
|
|
19
21
|
type SeamHttpFromPublishableKeyOptions,
|
|
20
22
|
SeamHttpInvalidOptionsError,
|
|
21
23
|
type SeamHttpOptions,
|
|
22
24
|
type SeamHttpOptionsWithApiKey,
|
|
23
25
|
type SeamHttpOptionsWithClient,
|
|
24
26
|
type SeamHttpOptionsWithClientSessionToken,
|
|
27
|
+
type SeamHttpOptionsWithConsoleSessionToken,
|
|
28
|
+
type SeamHttpOptionsWithPersonalAccessToken,
|
|
25
29
|
} from 'lib/seam/connect/options.js'
|
|
26
30
|
import { parseOptions } from 'lib/seam/connect/parse-options.js'
|
|
27
31
|
|
|
@@ -86,6 +90,40 @@ export class SeamHttpWebhooks {
|
|
|
86
90
|
return SeamHttpWebhooks.fromClientSessionToken(token, options)
|
|
87
91
|
}
|
|
88
92
|
|
|
93
|
+
static fromConsoleSessionToken(
|
|
94
|
+
consoleSessionToken: SeamHttpOptionsWithConsoleSessionToken['consoleSessionToken'],
|
|
95
|
+
workspaceId: SeamHttpOptionsWithConsoleSessionToken['workspaceId'],
|
|
96
|
+
options: Omit<
|
|
97
|
+
SeamHttpOptionsWithConsoleSessionToken,
|
|
98
|
+
'consoleSessionToken' | 'workspaceId'
|
|
99
|
+
> = {},
|
|
100
|
+
): SeamHttpWebhooks {
|
|
101
|
+
const constructorOptions = { ...options, consoleSessionToken, workspaceId }
|
|
102
|
+
if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
|
|
103
|
+
throw new SeamHttpInvalidOptionsError(
|
|
104
|
+
'Missing consoleSessionToken or workspaceId',
|
|
105
|
+
)
|
|
106
|
+
}
|
|
107
|
+
return new SeamHttpWebhooks(constructorOptions)
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
static fromPersonalAccessToken(
|
|
111
|
+
personalAccessToken: SeamHttpOptionsWithPersonalAccessToken['personalAccessToken'],
|
|
112
|
+
workspaceId: SeamHttpOptionsWithPersonalAccessToken['workspaceId'],
|
|
113
|
+
options: Omit<
|
|
114
|
+
SeamHttpOptionsWithPersonalAccessToken,
|
|
115
|
+
'personalAccessToken' | 'workspaceId'
|
|
116
|
+
> = {},
|
|
117
|
+
): SeamHttpWebhooks {
|
|
118
|
+
const constructorOptions = { ...options, personalAccessToken, workspaceId }
|
|
119
|
+
if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
|
|
120
|
+
throw new SeamHttpInvalidOptionsError(
|
|
121
|
+
'Missing personalAccessToken or workspaceId',
|
|
122
|
+
)
|
|
123
|
+
}
|
|
124
|
+
return new SeamHttpWebhooks(constructorOptions)
|
|
125
|
+
}
|
|
126
|
+
|
|
89
127
|
async create(
|
|
90
128
|
body?: WebhooksCreateBody,
|
|
91
129
|
): Promise<WebhooksCreateResponse['webhook']> {
|