@seamapi/http 0.0.2 → 0.2.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/dist/connect.cjs +1807 -96
- package/dist/connect.cjs.map +1 -1
- package/dist/connect.d.cts +472 -15
- package/lib/params-serializer.d.ts +5 -0
- package/lib/params-serializer.js +42 -0
- package/lib/params-serializer.js.map +1 -0
- package/lib/seam/connect/auth.d.ts +4 -3
- package/lib/seam/connect/auth.js +59 -8
- package/lib/seam/connect/auth.js.map +1 -1
- package/lib/seam/connect/client.d.ts +10 -10
- package/lib/seam/connect/client.js +16 -49
- package/lib/seam/connect/client.js.map +1 -1
- package/lib/seam/connect/index.d.ts +2 -1
- package/lib/seam/connect/index.js +2 -1
- package/lib/seam/connect/index.js.map +1 -1
- package/lib/seam/connect/options.d.ts +23 -0
- package/lib/seam/connect/options.js +39 -0
- package/lib/seam/connect/options.js.map +1 -0
- package/lib/seam/connect/parse-options.d.ts +6 -2
- package/lib/seam/connect/parse-options.js +35 -10
- package/lib/seam/connect/parse-options.js.map +1 -1
- package/lib/seam/connect/routes/access-codes-unmanaged.d.ts +27 -0
- package/lib/seam/connect/routes/access-codes-unmanaged.js +84 -0
- package/lib/seam/connect/routes/access-codes-unmanaged.js.map +1 -0
- package/lib/seam/connect/routes/access-codes.d.ts +38 -0
- package/lib/seam/connect/routes/access-codes.js +113 -0
- package/lib/seam/connect/routes/access-codes.js.map +1 -0
- package/lib/seam/connect/routes/acs-access-groups.d.ts +36 -0
- package/lib/seam/connect/routes/acs-access-groups.js +107 -0
- package/lib/seam/connect/routes/acs-access-groups.js.map +1 -0
- package/lib/seam/connect/routes/acs-credentials.d.ts +24 -0
- package/lib/seam/connect/routes/acs-credentials.js +78 -0
- package/lib/seam/connect/routes/acs-credentials.js.map +1 -0
- package/lib/seam/connect/routes/acs-systems.d.ts +18 -0
- package/lib/seam/connect/routes/acs-systems.js +63 -0
- package/lib/seam/connect/routes/acs-systems.js.map +1 -0
- package/lib/seam/connect/routes/acs-users.d.ts +39 -0
- package/lib/seam/connect/routes/acs-users.js +113 -0
- package/lib/seam/connect/routes/acs-users.js.map +1 -0
- package/lib/seam/connect/routes/acs.d.ts +18 -0
- package/lib/seam/connect/routes/acs.js +63 -0
- package/lib/seam/connect/routes/acs.js.map +1 -0
- package/lib/seam/connect/routes/action-attempts.d.ts +18 -0
- package/lib/seam/connect/routes/action-attempts.js +63 -0
- package/lib/seam/connect/routes/action-attempts.js.map +1 -0
- package/lib/seam/connect/routes/client-sessions.d.ts +30 -0
- package/lib/seam/connect/routes/client-sessions.js +93 -0
- package/lib/seam/connect/routes/client-sessions.js.map +1 -0
- package/lib/seam/connect/routes/connect-webviews.d.ts +27 -0
- package/lib/seam/connect/routes/connect-webviews.js +85 -0
- package/lib/seam/connect/routes/connect-webviews.js.map +1 -0
- package/lib/seam/connect/routes/connected-accounts.d.ts +21 -0
- package/lib/seam/connect/routes/connected-accounts.js +70 -0
- package/lib/seam/connect/routes/connected-accounts.js.map +1 -0
- package/lib/seam/connect/routes/devices-unmanaged.d.ts +21 -0
- package/lib/seam/connect/routes/devices-unmanaged.js +70 -0
- package/lib/seam/connect/routes/devices-unmanaged.js.map +1 -0
- package/lib/seam/connect/routes/devices.d.ts +29 -0
- package/lib/seam/connect/routes/devices.js +89 -0
- package/lib/seam/connect/routes/devices.js.map +1 -0
- package/lib/seam/connect/routes/events.d.ts +18 -0
- package/lib/seam/connect/routes/events.js +63 -0
- package/lib/seam/connect/routes/events.js.map +1 -0
- package/lib/seam/connect/routes/index.d.ts +21 -0
- package/lib/seam/connect/routes/index.js +22 -0
- package/lib/seam/connect/routes/index.js.map +1 -0
- package/lib/seam/connect/routes/locks.d.ts +24 -0
- package/lib/seam/connect/routes/locks.js +79 -0
- package/lib/seam/connect/routes/locks.js.map +1 -0
- package/lib/seam/connect/routes/noise-sensors-noise-thresholds.d.ts +27 -0
- package/lib/seam/connect/routes/noise-sensors-noise-thresholds.js +84 -0
- package/lib/seam/connect/routes/noise-sensors-noise-thresholds.js.map +1 -0
- package/lib/seam/connect/routes/noise-sensors.d.ts +12 -0
- package/lib/seam/connect/routes/noise-sensors.js +51 -0
- package/lib/seam/connect/routes/noise-sensors.js.map +1 -0
- package/lib/seam/connect/routes/thermostats-climate-setting-schedules.d.ts +27 -0
- package/lib/seam/connect/routes/thermostats-climate-setting-schedules.js +85 -0
- package/lib/seam/connect/routes/thermostats-climate-setting-schedules.js.map +1 -0
- package/lib/seam/connect/routes/thermostats.d.ts +38 -0
- package/lib/seam/connect/routes/thermostats.js +109 -0
- package/lib/seam/connect/routes/thermostats.js.map +1 -0
- package/lib/seam/connect/routes/webhooks.d.ts +24 -0
- package/lib/seam/connect/routes/webhooks.js +78 -0
- package/lib/seam/connect/routes/webhooks.js.map +1 -0
- package/lib/seam/connect/routes/workspaces.d.ts +17 -7
- package/lib/seam/connect/routes/workspaces.js +61 -11
- package/lib/seam/connect/routes/workspaces.js.map +1 -1
- package/lib/seam/connect/seam-http.d.ts +24 -0
- package/lib/seam/connect/seam-http.js +82 -0
- package/lib/seam/connect/seam-http.js.map +1 -0
- package/package.json +9 -3
- package/src/lib/params-serializer.ts +55 -0
- package/src/lib/seam/connect/auth.ts +101 -13
- package/src/lib/seam/connect/client.ts +30 -62
- package/src/lib/seam/connect/env.d.ts +11 -0
- package/src/lib/seam/connect/index.ts +2 -1
- package/src/lib/seam/connect/{client-options.ts → options.ts} +37 -15
- package/src/lib/seam/connect/parse-options.ts +55 -14
- package/src/lib/seam/connect/routes/access-codes-unmanaged.ts +170 -0
- package/src/lib/seam/connect/routes/access-codes.ts +226 -0
- package/src/lib/seam/connect/routes/acs-access-groups.ts +216 -0
- package/src/lib/seam/connect/routes/acs-credentials.ts +151 -0
- package/src/lib/seam/connect/routes/acs-systems.ts +118 -0
- package/src/lib/seam/connect/routes/acs-users.ts +221 -0
- package/src/lib/seam/connect/routes/acs.ts +101 -0
- package/src/lib/seam/connect/routes/action-attempts.ts +118 -0
- package/src/lib/seam/connect/routes/client-sessions.ts +187 -0
- package/src/lib/seam/connect/routes/connect-webviews.ts +170 -0
- package/src/lib/seam/connect/routes/connected-accounts.ts +139 -0
- package/src/lib/seam/connect/routes/devices-unmanaged.ts +134 -0
- package/src/lib/seam/connect/routes/devices.ts +166 -0
- package/src/lib/seam/connect/routes/events.ts +114 -0
- package/src/lib/seam/connect/routes/index.ts +21 -0
- package/src/lib/seam/connect/routes/locks.ts +148 -0
- package/src/lib/seam/connect/routes/noise-sensors-noise-thresholds.ts +170 -0
- package/src/lib/seam/connect/routes/noise-sensors.ts +86 -0
- package/src/lib/seam/connect/routes/thermostats-climate-setting-schedules.ts +192 -0
- package/src/lib/seam/connect/routes/thermostats.ts +208 -0
- package/src/lib/seam/connect/routes/webhooks.ts +151 -0
- package/src/lib/seam/connect/routes/workspaces.ts +118 -22
- package/src/lib/seam/connect/seam-http.ts +141 -0
- package/lib/seam/connect/axios.d.ts +0 -3
- package/lib/seam/connect/axios.js +0 -17
- package/lib/seam/connect/axios.js.map +0 -1
- package/lib/seam/connect/client-options.d.ts +0 -19
- package/lib/seam/connect/client-options.js +0 -29
- package/lib/seam/connect/client-options.js.map +0 -1
- package/lib/seam/connect/legacy/workspaces.d.ts +0 -8
- package/lib/seam/connect/legacy/workspaces.js +0 -10
- package/lib/seam/connect/legacy/workspaces.js.map +0 -1
- package/src/lib/seam/connect/axios.ts +0 -23
- package/src/lib/seam/connect/legacy/workspaces.ts +0 -26
|
@@ -0,0 +1,170 @@
|
|
|
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
|
+
type SeamHttpFromPublishableKeyOptions,
|
|
16
|
+
SeamHttpInvalidOptionsError,
|
|
17
|
+
type SeamHttpOptions,
|
|
18
|
+
type SeamHttpOptionsWithApiKey,
|
|
19
|
+
type SeamHttpOptionsWithClient,
|
|
20
|
+
type SeamHttpOptionsWithClientSessionToken,
|
|
21
|
+
} from 'lib/seam/connect/options.js'
|
|
22
|
+
import { parseOptions } from 'lib/seam/connect/parse-options.js'
|
|
23
|
+
|
|
24
|
+
import { SeamHttpClientSessions } from './client-sessions.js'
|
|
25
|
+
|
|
26
|
+
export class SeamHttpNoiseSensorsNoiseThresholds {
|
|
27
|
+
client: Client
|
|
28
|
+
|
|
29
|
+
constructor(apiKeyOrOptions: string | SeamHttpOptions = {}) {
|
|
30
|
+
const clientOptions = parseOptions(apiKeyOrOptions)
|
|
31
|
+
this.client = createClient(clientOptions)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
static fromClient(
|
|
35
|
+
client: SeamHttpOptionsWithClient['client'],
|
|
36
|
+
options: Omit<SeamHttpOptionsWithClient, 'client'> = {},
|
|
37
|
+
): SeamHttpNoiseSensorsNoiseThresholds {
|
|
38
|
+
const constructorOptions = { ...options, client }
|
|
39
|
+
if (!isSeamHttpOptionsWithClient(constructorOptions)) {
|
|
40
|
+
throw new SeamHttpInvalidOptionsError('Missing client')
|
|
41
|
+
}
|
|
42
|
+
return new SeamHttpNoiseSensorsNoiseThresholds(constructorOptions)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
static fromApiKey(
|
|
46
|
+
apiKey: SeamHttpOptionsWithApiKey['apiKey'],
|
|
47
|
+
options: Omit<SeamHttpOptionsWithApiKey, 'apiKey'> = {},
|
|
48
|
+
): SeamHttpNoiseSensorsNoiseThresholds {
|
|
49
|
+
const constructorOptions = { ...options, apiKey }
|
|
50
|
+
if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
|
|
51
|
+
throw new SeamHttpInvalidOptionsError('Missing apiKey')
|
|
52
|
+
}
|
|
53
|
+
return new SeamHttpNoiseSensorsNoiseThresholds(constructorOptions)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
static fromClientSessionToken(
|
|
57
|
+
clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
|
|
58
|
+
options: Omit<
|
|
59
|
+
SeamHttpOptionsWithClientSessionToken,
|
|
60
|
+
'clientSessionToken'
|
|
61
|
+
> = {},
|
|
62
|
+
): SeamHttpNoiseSensorsNoiseThresholds {
|
|
63
|
+
const constructorOptions = { ...options, clientSessionToken }
|
|
64
|
+
if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
|
|
65
|
+
throw new SeamHttpInvalidOptionsError('Missing clientSessionToken')
|
|
66
|
+
}
|
|
67
|
+
return new SeamHttpNoiseSensorsNoiseThresholds(constructorOptions)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
static async fromPublishableKey(
|
|
71
|
+
publishableKey: string,
|
|
72
|
+
userIdentifierKey: string,
|
|
73
|
+
options: SeamHttpFromPublishableKeyOptions = {},
|
|
74
|
+
): Promise<SeamHttpNoiseSensorsNoiseThresholds> {
|
|
75
|
+
warnOnInsecureuserIdentifierKey(userIdentifierKey)
|
|
76
|
+
const clientOptions = parseOptions({ ...options, publishableKey })
|
|
77
|
+
const client = createClient(clientOptions)
|
|
78
|
+
const clientSessions = SeamHttpClientSessions.fromClient(client)
|
|
79
|
+
const { token } = await clientSessions.getOrCreate({
|
|
80
|
+
user_identifier_key: userIdentifierKey,
|
|
81
|
+
})
|
|
82
|
+
return SeamHttpNoiseSensorsNoiseThresholds.fromClientSessionToken(
|
|
83
|
+
token,
|
|
84
|
+
options,
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
async create(body: NoiseSensorsNoiseThresholdsCreateBody): Promise<void> {
|
|
89
|
+
await this.client.request<NoiseSensorsNoiseThresholdsCreateResponse>({
|
|
90
|
+
url: '/noise_sensors/noise_thresholds/create',
|
|
91
|
+
method: 'post',
|
|
92
|
+
data: body,
|
|
93
|
+
})
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
async delete(body: NoiseSensorsNoiseThresholdsDeleteBody): Promise<void> {
|
|
97
|
+
await this.client.request<NoiseSensorsNoiseThresholdsDeleteResponse>({
|
|
98
|
+
url: '/noise_sensors/noise_thresholds/delete',
|
|
99
|
+
method: 'post',
|
|
100
|
+
data: body,
|
|
101
|
+
})
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
async get(
|
|
105
|
+
body: NoiseSensorsNoiseThresholdsGetBody,
|
|
106
|
+
): Promise<NoiseSensorsNoiseThresholdsGetResponse['noise_threshold']> {
|
|
107
|
+
const { data } =
|
|
108
|
+
await this.client.request<NoiseSensorsNoiseThresholdsGetResponse>({
|
|
109
|
+
url: '/noise_sensors/noise_thresholds/get',
|
|
110
|
+
method: 'post',
|
|
111
|
+
data: body,
|
|
112
|
+
})
|
|
113
|
+
return data.noise_threshold
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
async list(
|
|
117
|
+
body: NoiseSensorsNoiseThresholdsListBody,
|
|
118
|
+
): Promise<NoiseSensorsNoiseThresholdsListResponse['noise_thresholds']> {
|
|
119
|
+
const { data } =
|
|
120
|
+
await this.client.request<NoiseSensorsNoiseThresholdsListResponse>({
|
|
121
|
+
url: '/noise_sensors/noise_thresholds/list',
|
|
122
|
+
method: 'post',
|
|
123
|
+
data: body,
|
|
124
|
+
})
|
|
125
|
+
return data.noise_thresholds
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
async update(body: NoiseSensorsNoiseThresholdsUpdateBody): Promise<void> {
|
|
129
|
+
await this.client.request<NoiseSensorsNoiseThresholdsUpdateResponse>({
|
|
130
|
+
url: '/noise_sensors/noise_thresholds/update',
|
|
131
|
+
method: 'post',
|
|
132
|
+
data: body,
|
|
133
|
+
})
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export type NoiseSensorsNoiseThresholdsCreateBody =
|
|
138
|
+
RouteRequestBody<'/noise_sensors/noise_thresholds/create'>
|
|
139
|
+
|
|
140
|
+
export type NoiseSensorsNoiseThresholdsCreateResponse = SetNonNullable<
|
|
141
|
+
Required<RouteResponse<'/noise_sensors/noise_thresholds/create'>>
|
|
142
|
+
>
|
|
143
|
+
|
|
144
|
+
export type NoiseSensorsNoiseThresholdsDeleteBody =
|
|
145
|
+
RouteRequestBody<'/noise_sensors/noise_thresholds/delete'>
|
|
146
|
+
|
|
147
|
+
export type NoiseSensorsNoiseThresholdsDeleteResponse = SetNonNullable<
|
|
148
|
+
Required<RouteResponse<'/noise_sensors/noise_thresholds/delete'>>
|
|
149
|
+
>
|
|
150
|
+
|
|
151
|
+
export type NoiseSensorsNoiseThresholdsGetBody =
|
|
152
|
+
RouteRequestBody<'/noise_sensors/noise_thresholds/get'>
|
|
153
|
+
|
|
154
|
+
export type NoiseSensorsNoiseThresholdsGetResponse = SetNonNullable<
|
|
155
|
+
Required<RouteResponse<'/noise_sensors/noise_thresholds/get'>>
|
|
156
|
+
>
|
|
157
|
+
|
|
158
|
+
export type NoiseSensorsNoiseThresholdsListBody =
|
|
159
|
+
RouteRequestBody<'/noise_sensors/noise_thresholds/list'>
|
|
160
|
+
|
|
161
|
+
export type NoiseSensorsNoiseThresholdsListResponse = SetNonNullable<
|
|
162
|
+
Required<RouteResponse<'/noise_sensors/noise_thresholds/list'>>
|
|
163
|
+
>
|
|
164
|
+
|
|
165
|
+
export type NoiseSensorsNoiseThresholdsUpdateBody =
|
|
166
|
+
RouteRequestBody<'/noise_sensors/noise_thresholds/update'>
|
|
167
|
+
|
|
168
|
+
export type NoiseSensorsNoiseThresholdsUpdateResponse = SetNonNullable<
|
|
169
|
+
Required<RouteResponse<'/noise_sensors/noise_thresholds/update'>>
|
|
170
|
+
>
|
|
@@ -0,0 +1,86 @@
|
|
|
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 { warnOnInsecureuserIdentifierKey } from 'lib/seam/connect/auth.js'
|
|
7
|
+
import { type Client, createClient } from 'lib/seam/connect/client.js'
|
|
8
|
+
import {
|
|
9
|
+
isSeamHttpOptionsWithApiKey,
|
|
10
|
+
isSeamHttpOptionsWithClient,
|
|
11
|
+
isSeamHttpOptionsWithClientSessionToken,
|
|
12
|
+
type SeamHttpFromPublishableKeyOptions,
|
|
13
|
+
SeamHttpInvalidOptionsError,
|
|
14
|
+
type SeamHttpOptions,
|
|
15
|
+
type SeamHttpOptionsWithApiKey,
|
|
16
|
+
type SeamHttpOptionsWithClient,
|
|
17
|
+
type SeamHttpOptionsWithClientSessionToken,
|
|
18
|
+
} from 'lib/seam/connect/options.js'
|
|
19
|
+
import { parseOptions } from 'lib/seam/connect/parse-options.js'
|
|
20
|
+
|
|
21
|
+
import { SeamHttpClientSessions } from './client-sessions.js'
|
|
22
|
+
import { SeamHttpNoiseSensorsNoiseThresholds } from './noise-sensors-noise-thresholds.js'
|
|
23
|
+
|
|
24
|
+
export class SeamHttpNoiseSensors {
|
|
25
|
+
client: Client
|
|
26
|
+
|
|
27
|
+
constructor(apiKeyOrOptions: string | SeamHttpOptions = {}) {
|
|
28
|
+
const clientOptions = parseOptions(apiKeyOrOptions)
|
|
29
|
+
this.client = createClient(clientOptions)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
static fromClient(
|
|
33
|
+
client: SeamHttpOptionsWithClient['client'],
|
|
34
|
+
options: Omit<SeamHttpOptionsWithClient, 'client'> = {},
|
|
35
|
+
): SeamHttpNoiseSensors {
|
|
36
|
+
const constructorOptions = { ...options, client }
|
|
37
|
+
if (!isSeamHttpOptionsWithClient(constructorOptions)) {
|
|
38
|
+
throw new SeamHttpInvalidOptionsError('Missing client')
|
|
39
|
+
}
|
|
40
|
+
return new SeamHttpNoiseSensors(constructorOptions)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
static fromApiKey(
|
|
44
|
+
apiKey: SeamHttpOptionsWithApiKey['apiKey'],
|
|
45
|
+
options: Omit<SeamHttpOptionsWithApiKey, 'apiKey'> = {},
|
|
46
|
+
): SeamHttpNoiseSensors {
|
|
47
|
+
const constructorOptions = { ...options, apiKey }
|
|
48
|
+
if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
|
|
49
|
+
throw new SeamHttpInvalidOptionsError('Missing apiKey')
|
|
50
|
+
}
|
|
51
|
+
return new SeamHttpNoiseSensors(constructorOptions)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
static fromClientSessionToken(
|
|
55
|
+
clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
|
|
56
|
+
options: Omit<
|
|
57
|
+
SeamHttpOptionsWithClientSessionToken,
|
|
58
|
+
'clientSessionToken'
|
|
59
|
+
> = {},
|
|
60
|
+
): SeamHttpNoiseSensors {
|
|
61
|
+
const constructorOptions = { ...options, clientSessionToken }
|
|
62
|
+
if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
|
|
63
|
+
throw new SeamHttpInvalidOptionsError('Missing clientSessionToken')
|
|
64
|
+
}
|
|
65
|
+
return new SeamHttpNoiseSensors(constructorOptions)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
static async fromPublishableKey(
|
|
69
|
+
publishableKey: string,
|
|
70
|
+
userIdentifierKey: string,
|
|
71
|
+
options: SeamHttpFromPublishableKeyOptions = {},
|
|
72
|
+
): Promise<SeamHttpNoiseSensors> {
|
|
73
|
+
warnOnInsecureuserIdentifierKey(userIdentifierKey)
|
|
74
|
+
const clientOptions = parseOptions({ ...options, publishableKey })
|
|
75
|
+
const client = createClient(clientOptions)
|
|
76
|
+
const clientSessions = SeamHttpClientSessions.fromClient(client)
|
|
77
|
+
const { token } = await clientSessions.getOrCreate({
|
|
78
|
+
user_identifier_key: userIdentifierKey,
|
|
79
|
+
})
|
|
80
|
+
return SeamHttpNoiseSensors.fromClientSessionToken(token, options)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
get noiseThresholds(): SeamHttpNoiseSensorsNoiseThresholds {
|
|
84
|
+
return SeamHttpNoiseSensorsNoiseThresholds.fromClient(this.client)
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -0,0 +1,192 @@
|
|
|
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
|
+
type SeamHttpFromPublishableKeyOptions,
|
|
16
|
+
SeamHttpInvalidOptionsError,
|
|
17
|
+
type SeamHttpOptions,
|
|
18
|
+
type SeamHttpOptionsWithApiKey,
|
|
19
|
+
type SeamHttpOptionsWithClient,
|
|
20
|
+
type SeamHttpOptionsWithClientSessionToken,
|
|
21
|
+
} from 'lib/seam/connect/options.js'
|
|
22
|
+
import { parseOptions } from 'lib/seam/connect/parse-options.js'
|
|
23
|
+
|
|
24
|
+
import { SeamHttpClientSessions } from './client-sessions.js'
|
|
25
|
+
|
|
26
|
+
export class SeamHttpThermostatsClimateSettingSchedules {
|
|
27
|
+
client: Client
|
|
28
|
+
|
|
29
|
+
constructor(apiKeyOrOptions: string | SeamHttpOptions = {}) {
|
|
30
|
+
const clientOptions = parseOptions(apiKeyOrOptions)
|
|
31
|
+
this.client = createClient(clientOptions)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
static fromClient(
|
|
35
|
+
client: SeamHttpOptionsWithClient['client'],
|
|
36
|
+
options: Omit<SeamHttpOptionsWithClient, 'client'> = {},
|
|
37
|
+
): SeamHttpThermostatsClimateSettingSchedules {
|
|
38
|
+
const constructorOptions = { ...options, client }
|
|
39
|
+
if (!isSeamHttpOptionsWithClient(constructorOptions)) {
|
|
40
|
+
throw new SeamHttpInvalidOptionsError('Missing client')
|
|
41
|
+
}
|
|
42
|
+
return new SeamHttpThermostatsClimateSettingSchedules(constructorOptions)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
static fromApiKey(
|
|
46
|
+
apiKey: SeamHttpOptionsWithApiKey['apiKey'],
|
|
47
|
+
options: Omit<SeamHttpOptionsWithApiKey, 'apiKey'> = {},
|
|
48
|
+
): SeamHttpThermostatsClimateSettingSchedules {
|
|
49
|
+
const constructorOptions = { ...options, apiKey }
|
|
50
|
+
if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
|
|
51
|
+
throw new SeamHttpInvalidOptionsError('Missing apiKey')
|
|
52
|
+
}
|
|
53
|
+
return new SeamHttpThermostatsClimateSettingSchedules(constructorOptions)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
static fromClientSessionToken(
|
|
57
|
+
clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
|
|
58
|
+
options: Omit<
|
|
59
|
+
SeamHttpOptionsWithClientSessionToken,
|
|
60
|
+
'clientSessionToken'
|
|
61
|
+
> = {},
|
|
62
|
+
): SeamHttpThermostatsClimateSettingSchedules {
|
|
63
|
+
const constructorOptions = { ...options, clientSessionToken }
|
|
64
|
+
if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
|
|
65
|
+
throw new SeamHttpInvalidOptionsError('Missing clientSessionToken')
|
|
66
|
+
}
|
|
67
|
+
return new SeamHttpThermostatsClimateSettingSchedules(constructorOptions)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
static async fromPublishableKey(
|
|
71
|
+
publishableKey: string,
|
|
72
|
+
userIdentifierKey: string,
|
|
73
|
+
options: SeamHttpFromPublishableKeyOptions = {},
|
|
74
|
+
): Promise<SeamHttpThermostatsClimateSettingSchedules> {
|
|
75
|
+
warnOnInsecureuserIdentifierKey(userIdentifierKey)
|
|
76
|
+
const clientOptions = parseOptions({ ...options, publishableKey })
|
|
77
|
+
const client = createClient(clientOptions)
|
|
78
|
+
const clientSessions = SeamHttpClientSessions.fromClient(client)
|
|
79
|
+
const { token } = await clientSessions.getOrCreate({
|
|
80
|
+
user_identifier_key: userIdentifierKey,
|
|
81
|
+
})
|
|
82
|
+
return SeamHttpThermostatsClimateSettingSchedules.fromClientSessionToken(
|
|
83
|
+
token,
|
|
84
|
+
options,
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
async create(
|
|
89
|
+
body: ThermostatsClimateSettingSchedulesCreateBody,
|
|
90
|
+
): Promise<
|
|
91
|
+
ThermostatsClimateSettingSchedulesCreateResponse['climate_setting_schedule']
|
|
92
|
+
> {
|
|
93
|
+
const { data } =
|
|
94
|
+
await this.client.request<ThermostatsClimateSettingSchedulesCreateResponse>(
|
|
95
|
+
{
|
|
96
|
+
url: '/thermostats/climate_setting_schedules/create',
|
|
97
|
+
method: 'post',
|
|
98
|
+
data: body,
|
|
99
|
+
},
|
|
100
|
+
)
|
|
101
|
+
return data.climate_setting_schedule
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
async delete(
|
|
105
|
+
body: ThermostatsClimateSettingSchedulesDeleteBody,
|
|
106
|
+
): Promise<void> {
|
|
107
|
+
await this.client.request<ThermostatsClimateSettingSchedulesDeleteResponse>(
|
|
108
|
+
{
|
|
109
|
+
url: '/thermostats/climate_setting_schedules/delete',
|
|
110
|
+
method: 'post',
|
|
111
|
+
data: body,
|
|
112
|
+
},
|
|
113
|
+
)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
async get(
|
|
117
|
+
body: ThermostatsClimateSettingSchedulesGetBody,
|
|
118
|
+
): Promise<
|
|
119
|
+
ThermostatsClimateSettingSchedulesGetResponse['climate_setting_schedule']
|
|
120
|
+
> {
|
|
121
|
+
const { data } =
|
|
122
|
+
await this.client.request<ThermostatsClimateSettingSchedulesGetResponse>({
|
|
123
|
+
url: '/thermostats/climate_setting_schedules/get',
|
|
124
|
+
method: 'post',
|
|
125
|
+
data: body,
|
|
126
|
+
})
|
|
127
|
+
return data.climate_setting_schedule
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
async list(
|
|
131
|
+
body: ThermostatsClimateSettingSchedulesListBody,
|
|
132
|
+
): Promise<
|
|
133
|
+
ThermostatsClimateSettingSchedulesListResponse['climate_setting_schedules']
|
|
134
|
+
> {
|
|
135
|
+
const { data } =
|
|
136
|
+
await this.client.request<ThermostatsClimateSettingSchedulesListResponse>(
|
|
137
|
+
{
|
|
138
|
+
url: '/thermostats/climate_setting_schedules/list',
|
|
139
|
+
method: 'post',
|
|
140
|
+
data: body,
|
|
141
|
+
},
|
|
142
|
+
)
|
|
143
|
+
return data.climate_setting_schedules
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
async update(
|
|
147
|
+
body: ThermostatsClimateSettingSchedulesUpdateBody,
|
|
148
|
+
): Promise<void> {
|
|
149
|
+
await this.client.request<ThermostatsClimateSettingSchedulesUpdateResponse>(
|
|
150
|
+
{
|
|
151
|
+
url: '/thermostats/climate_setting_schedules/update',
|
|
152
|
+
method: 'post',
|
|
153
|
+
data: body,
|
|
154
|
+
},
|
|
155
|
+
)
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export type ThermostatsClimateSettingSchedulesCreateBody =
|
|
160
|
+
RouteRequestBody<'/thermostats/climate_setting_schedules/create'>
|
|
161
|
+
|
|
162
|
+
export type ThermostatsClimateSettingSchedulesCreateResponse = SetNonNullable<
|
|
163
|
+
Required<RouteResponse<'/thermostats/climate_setting_schedules/create'>>
|
|
164
|
+
>
|
|
165
|
+
|
|
166
|
+
export type ThermostatsClimateSettingSchedulesDeleteBody =
|
|
167
|
+
RouteRequestBody<'/thermostats/climate_setting_schedules/delete'>
|
|
168
|
+
|
|
169
|
+
export type ThermostatsClimateSettingSchedulesDeleteResponse = SetNonNullable<
|
|
170
|
+
Required<RouteResponse<'/thermostats/climate_setting_schedules/delete'>>
|
|
171
|
+
>
|
|
172
|
+
|
|
173
|
+
export type ThermostatsClimateSettingSchedulesGetBody =
|
|
174
|
+
RouteRequestBody<'/thermostats/climate_setting_schedules/get'>
|
|
175
|
+
|
|
176
|
+
export type ThermostatsClimateSettingSchedulesGetResponse = SetNonNullable<
|
|
177
|
+
Required<RouteResponse<'/thermostats/climate_setting_schedules/get'>>
|
|
178
|
+
>
|
|
179
|
+
|
|
180
|
+
export type ThermostatsClimateSettingSchedulesListBody =
|
|
181
|
+
RouteRequestBody<'/thermostats/climate_setting_schedules/list'>
|
|
182
|
+
|
|
183
|
+
export type ThermostatsClimateSettingSchedulesListResponse = SetNonNullable<
|
|
184
|
+
Required<RouteResponse<'/thermostats/climate_setting_schedules/list'>>
|
|
185
|
+
>
|
|
186
|
+
|
|
187
|
+
export type ThermostatsClimateSettingSchedulesUpdateBody =
|
|
188
|
+
RouteRequestBody<'/thermostats/climate_setting_schedules/update'>
|
|
189
|
+
|
|
190
|
+
export type ThermostatsClimateSettingSchedulesUpdateResponse = SetNonNullable<
|
|
191
|
+
Required<RouteResponse<'/thermostats/climate_setting_schedules/update'>>
|
|
192
|
+
>
|
|
@@ -0,0 +1,208 @@
|
|
|
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
|
+
type SeamHttpFromPublishableKeyOptions,
|
|
16
|
+
SeamHttpInvalidOptionsError,
|
|
17
|
+
type SeamHttpOptions,
|
|
18
|
+
type SeamHttpOptionsWithApiKey,
|
|
19
|
+
type SeamHttpOptionsWithClient,
|
|
20
|
+
type SeamHttpOptionsWithClientSessionToken,
|
|
21
|
+
} from 'lib/seam/connect/options.js'
|
|
22
|
+
import { parseOptions } from 'lib/seam/connect/parse-options.js'
|
|
23
|
+
|
|
24
|
+
import { SeamHttpClientSessions } from './client-sessions.js'
|
|
25
|
+
import { SeamHttpThermostatsClimateSettingSchedules } from './thermostats-climate-setting-schedules.js'
|
|
26
|
+
|
|
27
|
+
export class SeamHttpThermostats {
|
|
28
|
+
client: Client
|
|
29
|
+
|
|
30
|
+
constructor(apiKeyOrOptions: string | SeamHttpOptions = {}) {
|
|
31
|
+
const clientOptions = parseOptions(apiKeyOrOptions)
|
|
32
|
+
this.client = createClient(clientOptions)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
static fromClient(
|
|
36
|
+
client: SeamHttpOptionsWithClient['client'],
|
|
37
|
+
options: Omit<SeamHttpOptionsWithClient, 'client'> = {},
|
|
38
|
+
): SeamHttpThermostats {
|
|
39
|
+
const constructorOptions = { ...options, client }
|
|
40
|
+
if (!isSeamHttpOptionsWithClient(constructorOptions)) {
|
|
41
|
+
throw new SeamHttpInvalidOptionsError('Missing client')
|
|
42
|
+
}
|
|
43
|
+
return new SeamHttpThermostats(constructorOptions)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
static fromApiKey(
|
|
47
|
+
apiKey: SeamHttpOptionsWithApiKey['apiKey'],
|
|
48
|
+
options: Omit<SeamHttpOptionsWithApiKey, 'apiKey'> = {},
|
|
49
|
+
): SeamHttpThermostats {
|
|
50
|
+
const constructorOptions = { ...options, apiKey }
|
|
51
|
+
if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
|
|
52
|
+
throw new SeamHttpInvalidOptionsError('Missing apiKey')
|
|
53
|
+
}
|
|
54
|
+
return new SeamHttpThermostats(constructorOptions)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
static fromClientSessionToken(
|
|
58
|
+
clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
|
|
59
|
+
options: Omit<
|
|
60
|
+
SeamHttpOptionsWithClientSessionToken,
|
|
61
|
+
'clientSessionToken'
|
|
62
|
+
> = {},
|
|
63
|
+
): SeamHttpThermostats {
|
|
64
|
+
const constructorOptions = { ...options, clientSessionToken }
|
|
65
|
+
if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
|
|
66
|
+
throw new SeamHttpInvalidOptionsError('Missing clientSessionToken')
|
|
67
|
+
}
|
|
68
|
+
return new SeamHttpThermostats(constructorOptions)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
static async fromPublishableKey(
|
|
72
|
+
publishableKey: string,
|
|
73
|
+
userIdentifierKey: string,
|
|
74
|
+
options: SeamHttpFromPublishableKeyOptions = {},
|
|
75
|
+
): Promise<SeamHttpThermostats> {
|
|
76
|
+
warnOnInsecureuserIdentifierKey(userIdentifierKey)
|
|
77
|
+
const clientOptions = parseOptions({ ...options, publishableKey })
|
|
78
|
+
const client = createClient(clientOptions)
|
|
79
|
+
const clientSessions = SeamHttpClientSessions.fromClient(client)
|
|
80
|
+
const { token } = await clientSessions.getOrCreate({
|
|
81
|
+
user_identifier_key: userIdentifierKey,
|
|
82
|
+
})
|
|
83
|
+
return SeamHttpThermostats.fromClientSessionToken(token, options)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
get climateSettingSchedules(): SeamHttpThermostatsClimateSettingSchedules {
|
|
87
|
+
return SeamHttpThermostatsClimateSettingSchedules.fromClient(this.client)
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
async cool(body: ThermostatsCoolBody): Promise<void> {
|
|
91
|
+
await this.client.request<ThermostatsCoolResponse>({
|
|
92
|
+
url: '/thermostats/cool',
|
|
93
|
+
method: 'post',
|
|
94
|
+
data: body,
|
|
95
|
+
})
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
async get(
|
|
99
|
+
body: ThermostatsGetBody,
|
|
100
|
+
): Promise<ThermostatsGetResponse['thermostat']> {
|
|
101
|
+
const { data } = await this.client.request<ThermostatsGetResponse>({
|
|
102
|
+
url: '/thermostats/get',
|
|
103
|
+
method: 'post',
|
|
104
|
+
data: body,
|
|
105
|
+
})
|
|
106
|
+
return data.thermostat
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
async heat(body: ThermostatsHeatBody): Promise<void> {
|
|
110
|
+
await this.client.request<ThermostatsHeatResponse>({
|
|
111
|
+
url: '/thermostats/heat',
|
|
112
|
+
method: 'post',
|
|
113
|
+
data: body,
|
|
114
|
+
})
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
async heatCool(body: ThermostatsHeatCoolBody): Promise<void> {
|
|
118
|
+
await this.client.request<ThermostatsHeatCoolResponse>({
|
|
119
|
+
url: '/thermostats/heat_cool',
|
|
120
|
+
method: 'post',
|
|
121
|
+
data: body,
|
|
122
|
+
})
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
async list(
|
|
126
|
+
body: ThermostatsListBody,
|
|
127
|
+
): Promise<ThermostatsListResponse['thermostats']> {
|
|
128
|
+
const { data } = await this.client.request<ThermostatsListResponse>({
|
|
129
|
+
url: '/thermostats/list',
|
|
130
|
+
method: 'post',
|
|
131
|
+
data: body,
|
|
132
|
+
})
|
|
133
|
+
return data.thermostats
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
async off(body: ThermostatsOffBody): Promise<void> {
|
|
137
|
+
await this.client.request<ThermostatsOffResponse>({
|
|
138
|
+
url: '/thermostats/off',
|
|
139
|
+
method: 'post',
|
|
140
|
+
data: body,
|
|
141
|
+
})
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
async setFanMode(body: ThermostatsSetFanModeBody): Promise<void> {
|
|
145
|
+
await this.client.request<ThermostatsSetFanModeResponse>({
|
|
146
|
+
url: '/thermostats/set_fan_mode',
|
|
147
|
+
method: 'post',
|
|
148
|
+
data: body,
|
|
149
|
+
})
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
async update(body: ThermostatsUpdateBody): Promise<void> {
|
|
153
|
+
await this.client.request<ThermostatsUpdateResponse>({
|
|
154
|
+
url: '/thermostats/update',
|
|
155
|
+
method: 'post',
|
|
156
|
+
data: body,
|
|
157
|
+
})
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export type ThermostatsCoolBody = RouteRequestBody<'/thermostats/cool'>
|
|
162
|
+
|
|
163
|
+
export type ThermostatsCoolResponse = SetNonNullable<
|
|
164
|
+
Required<RouteResponse<'/thermostats/cool'>>
|
|
165
|
+
>
|
|
166
|
+
|
|
167
|
+
export type ThermostatsGetBody = RouteRequestBody<'/thermostats/get'>
|
|
168
|
+
|
|
169
|
+
export type ThermostatsGetResponse = SetNonNullable<
|
|
170
|
+
Required<RouteResponse<'/thermostats/get'>>
|
|
171
|
+
>
|
|
172
|
+
|
|
173
|
+
export type ThermostatsHeatBody = RouteRequestBody<'/thermostats/heat'>
|
|
174
|
+
|
|
175
|
+
export type ThermostatsHeatResponse = SetNonNullable<
|
|
176
|
+
Required<RouteResponse<'/thermostats/heat'>>
|
|
177
|
+
>
|
|
178
|
+
|
|
179
|
+
export type ThermostatsHeatCoolBody = RouteRequestBody<'/thermostats/heat_cool'>
|
|
180
|
+
|
|
181
|
+
export type ThermostatsHeatCoolResponse = SetNonNullable<
|
|
182
|
+
Required<RouteResponse<'/thermostats/heat_cool'>>
|
|
183
|
+
>
|
|
184
|
+
|
|
185
|
+
export type ThermostatsListBody = RouteRequestBody<'/thermostats/list'>
|
|
186
|
+
|
|
187
|
+
export type ThermostatsListResponse = SetNonNullable<
|
|
188
|
+
Required<RouteResponse<'/thermostats/list'>>
|
|
189
|
+
>
|
|
190
|
+
|
|
191
|
+
export type ThermostatsOffBody = RouteRequestBody<'/thermostats/off'>
|
|
192
|
+
|
|
193
|
+
export type ThermostatsOffResponse = SetNonNullable<
|
|
194
|
+
Required<RouteResponse<'/thermostats/off'>>
|
|
195
|
+
>
|
|
196
|
+
|
|
197
|
+
export type ThermostatsSetFanModeBody =
|
|
198
|
+
RouteRequestBody<'/thermostats/set_fan_mode'>
|
|
199
|
+
|
|
200
|
+
export type ThermostatsSetFanModeResponse = SetNonNullable<
|
|
201
|
+
Required<RouteResponse<'/thermostats/set_fan_mode'>>
|
|
202
|
+
>
|
|
203
|
+
|
|
204
|
+
export type ThermostatsUpdateBody = RouteRequestBody<'/thermostats/update'>
|
|
205
|
+
|
|
206
|
+
export type ThermostatsUpdateResponse = SetNonNullable<
|
|
207
|
+
Required<RouteResponse<'/thermostats/update'>>
|
|
208
|
+
>
|