@seamapi/http 0.2.1 → 0.4.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 +106 -1
- package/dist/connect.cjs.map +1 -1
- package/dist/connect.d.cts +157 -124
- package/lib/seam/connect/api-error-type.d.ts +8 -0
- package/lib/seam/connect/api-error-type.js +3 -0
- package/lib/seam/connect/api-error-type.js.map +1 -0
- package/lib/seam/connect/client.js +6 -0
- package/lib/seam/connect/client.js.map +1 -1
- package/lib/seam/connect/error-interceptor.d.ts +1 -0
- package/lib/seam/connect/error-interceptor.js +43 -0
- package/lib/seam/connect/error-interceptor.js.map +1 -0
- package/lib/seam/connect/index.d.ts +4 -1
- package/lib/seam/connect/index.js +4 -1
- package/lib/seam/connect/index.js.map +1 -1
- package/lib/seam/connect/parse-options.js +6 -0
- package/lib/seam/connect/parse-options.js.map +1 -1
- package/lib/seam/connect/routes/access-codes-unmanaged.d.ts +7 -7
- package/lib/seam/connect/routes/access-codes-unmanaged.js.map +1 -1
- package/lib/seam/connect/routes/access-codes.d.ts +10 -10
- package/lib/seam/connect/routes/access-codes.js.map +1 -1
- package/lib/seam/connect/routes/acs-access-groups.d.ts +11 -11
- package/lib/seam/connect/routes/acs-access-groups.js.map +1 -1
- package/lib/seam/connect/routes/acs-credentials.d.ts +6 -6
- package/lib/seam/connect/routes/acs-credentials.js.map +1 -1
- package/lib/seam/connect/routes/acs-systems.d.ts +4 -4
- package/lib/seam/connect/routes/acs-systems.js.map +1 -1
- package/lib/seam/connect/routes/acs-users.d.ts +11 -11
- package/lib/seam/connect/routes/acs-users.js.map +1 -1
- package/lib/seam/connect/routes/action-attempts.d.ts +4 -4
- package/lib/seam/connect/routes/action-attempts.js.map +1 -1
- package/lib/seam/connect/routes/client-sessions.d.ts +8 -8
- package/lib/seam/connect/routes/client-sessions.js.map +1 -1
- package/lib/seam/connect/routes/connect-webviews.d.ts +6 -6
- package/lib/seam/connect/routes/connect-webviews.js.map +1 -1
- package/lib/seam/connect/routes/connected-accounts.d.ts +3 -3
- package/lib/seam/connect/routes/connected-accounts.js.map +1 -1
- package/lib/seam/connect/routes/devices-unmanaged.d.ts +5 -5
- package/lib/seam/connect/routes/devices-unmanaged.js.map +1 -1
- package/lib/seam/connect/routes/devices.d.ts +8 -8
- package/lib/seam/connect/routes/devices.js.map +1 -1
- package/lib/seam/connect/routes/events.d.ts +4 -4
- package/lib/seam/connect/routes/events.js.map +1 -1
- package/lib/seam/connect/routes/locks.d.ts +6 -6
- package/lib/seam/connect/routes/locks.js.map +1 -1
- package/lib/seam/connect/routes/noise-sensors-noise-thresholds.d.ts +7 -7
- package/lib/seam/connect/routes/noise-sensors-noise-thresholds.js.map +1 -1
- package/lib/seam/connect/routes/thermostats-climate-setting-schedules.d.ts +7 -7
- package/lib/seam/connect/routes/thermostats-climate-setting-schedules.js.map +1 -1
- package/lib/seam/connect/routes/thermostats.d.ts +10 -10
- package/lib/seam/connect/routes/thermostats.js.map +1 -1
- package/lib/seam/connect/routes/webhooks.d.ts +4 -4
- package/lib/seam/connect/routes/webhooks.js.map +1 -1
- package/lib/seam/connect/routes/workspaces.d.ts +1 -1
- package/lib/seam/connect/routes/workspaces.js.map +1 -1
- package/lib/seam/connect/seam-http-error.d.ts +20 -0
- package/lib/seam/connect/seam-http-error.js +43 -0
- package/lib/seam/connect/seam-http-error.js.map +1 -0
- package/lib/version.d.ts +2 -0
- package/lib/version.js +3 -0
- package/lib/version.js.map +1 -0
- package/package.json +5 -2
- package/src/lib/seam/connect/api-error-type.ts +11 -0
- package/src/lib/seam/connect/client.ts +9 -0
- package/src/lib/seam/connect/error-interceptor.ts +61 -0
- package/src/lib/seam/connect/index.ts +4 -1
- package/src/lib/seam/connect/parse-options.ts +8 -0
- package/src/lib/seam/connect/routes/access-codes-unmanaged.ts +7 -7
- package/src/lib/seam/connect/routes/access-codes.ts +10 -10
- package/src/lib/seam/connect/routes/acs-access-groups.ts +12 -11
- package/src/lib/seam/connect/routes/acs-credentials.ts +6 -6
- package/src/lib/seam/connect/routes/acs-systems.ts +4 -4
- package/src/lib/seam/connect/routes/acs-users.ts +13 -11
- package/src/lib/seam/connect/routes/action-attempts.ts +4 -4
- package/src/lib/seam/connect/routes/client-sessions.ts +8 -8
- package/src/lib/seam/connect/routes/connect-webviews.ts +7 -6
- package/src/lib/seam/connect/routes/connected-accounts.ts +3 -3
- package/src/lib/seam/connect/routes/devices-unmanaged.ts +6 -5
- package/src/lib/seam/connect/routes/devices.ts +10 -8
- package/src/lib/seam/connect/routes/events.ts +4 -4
- package/src/lib/seam/connect/routes/locks.ts +6 -6
- package/src/lib/seam/connect/routes/noise-sensors-noise-thresholds.ts +7 -7
- package/src/lib/seam/connect/routes/thermostats-climate-setting-schedules.ts +7 -7
- package/src/lib/seam/connect/routes/thermostats.ts +10 -10
- package/src/lib/seam/connect/routes/webhooks.ts +4 -4
- package/src/lib/seam/connect/routes/workspaces.ts +1 -1
- package/src/lib/seam/connect/seam-http-error.ts +64 -0
- package/src/lib/version.ts +3 -0
|
@@ -87,7 +87,7 @@ export class SeamHttpConnectWebviews {
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
async create(
|
|
90
|
-
body
|
|
90
|
+
body?: ConnectWebviewsCreateBody,
|
|
91
91
|
): Promise<ConnectWebviewsCreateResponse['connect_webview']> {
|
|
92
92
|
const { data } = await this.client.request<ConnectWebviewsCreateResponse>({
|
|
93
93
|
url: '/connect_webviews/create',
|
|
@@ -97,7 +97,7 @@ export class SeamHttpConnectWebviews {
|
|
|
97
97
|
return data.connect_webview
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
async delete(body
|
|
100
|
+
async delete(body?: ConnectWebviewsDeleteBody): Promise<void> {
|
|
101
101
|
await this.client.request<ConnectWebviewsDeleteResponse>({
|
|
102
102
|
url: '/connect_webviews/delete',
|
|
103
103
|
method: 'post',
|
|
@@ -106,7 +106,7 @@ export class SeamHttpConnectWebviews {
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
async get(
|
|
109
|
-
body
|
|
109
|
+
body?: ConnectWebviewsGetParams,
|
|
110
110
|
): Promise<ConnectWebviewsGetResponse['connect_webview']> {
|
|
111
111
|
const { data } = await this.client.request<ConnectWebviewsGetResponse>({
|
|
112
112
|
url: '/connect_webviews/get',
|
|
@@ -117,7 +117,7 @@ export class SeamHttpConnectWebviews {
|
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
async list(
|
|
120
|
-
body
|
|
120
|
+
body?: ConnectWebviewsListParams,
|
|
121
121
|
): Promise<ConnectWebviewsListResponse['connect_webviews']> {
|
|
122
122
|
const { data } = await this.client.request<ConnectWebviewsListResponse>({
|
|
123
123
|
url: '/connect_webviews/list',
|
|
@@ -150,13 +150,14 @@ export type ConnectWebviewsDeleteResponse = SetNonNullable<
|
|
|
150
150
|
Required<RouteResponse<'/connect_webviews/delete'>>
|
|
151
151
|
>
|
|
152
152
|
|
|
153
|
-
export type
|
|
153
|
+
export type ConnectWebviewsGetParams = RouteRequestBody<'/connect_webviews/get'>
|
|
154
154
|
|
|
155
155
|
export type ConnectWebviewsGetResponse = SetNonNullable<
|
|
156
156
|
Required<RouteResponse<'/connect_webviews/get'>>
|
|
157
157
|
>
|
|
158
158
|
|
|
159
|
-
export type
|
|
159
|
+
export type ConnectWebviewsListParams =
|
|
160
|
+
RouteRequestBody<'/connect_webviews/list'>
|
|
160
161
|
|
|
161
162
|
export type ConnectWebviewsListResponse = SetNonNullable<
|
|
162
163
|
Required<RouteResponse<'/connect_webviews/list'>>
|
|
@@ -86,7 +86,7 @@ export class SeamHttpConnectedAccounts {
|
|
|
86
86
|
return SeamHttpConnectedAccounts.fromClientSessionToken(token, options)
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
async delete(body
|
|
89
|
+
async delete(body?: ConnectedAccountsDeleteBody): Promise<void> {
|
|
90
90
|
await this.client.request<ConnectedAccountsDeleteResponse>({
|
|
91
91
|
url: '/connected_accounts/delete',
|
|
92
92
|
method: 'post',
|
|
@@ -95,7 +95,7 @@ export class SeamHttpConnectedAccounts {
|
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
async get(
|
|
98
|
-
body
|
|
98
|
+
body?: ConnectedAccountsGetParams,
|
|
99
99
|
): Promise<ConnectedAccountsGetResponse['connected_account']> {
|
|
100
100
|
const { data } = await this.client.request<ConnectedAccountsGetResponse>({
|
|
101
101
|
url: '/connected_accounts/get',
|
|
@@ -124,7 +124,7 @@ export type ConnectedAccountsDeleteResponse = SetNonNullable<
|
|
|
124
124
|
Required<RouteResponse<'/connected_accounts/delete'>>
|
|
125
125
|
>
|
|
126
126
|
|
|
127
|
-
export type
|
|
127
|
+
export type ConnectedAccountsGetParams =
|
|
128
128
|
RouteRequestBody<'/connected_accounts/get'>
|
|
129
129
|
|
|
130
130
|
export type ConnectedAccountsGetResponse = SetNonNullable<
|
|
@@ -83,7 +83,7 @@ export class SeamHttpDevicesUnmanaged {
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
async get(
|
|
86
|
-
body
|
|
86
|
+
body?: DevicesUnmanagedGetParams,
|
|
87
87
|
): Promise<DevicesUnmanagedGetResponse['device']> {
|
|
88
88
|
const { data } = await this.client.request<DevicesUnmanagedGetResponse>({
|
|
89
89
|
url: '/devices/unmanaged/get',
|
|
@@ -94,7 +94,7 @@ export class SeamHttpDevicesUnmanaged {
|
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
async list(
|
|
97
|
-
body
|
|
97
|
+
body?: DevicesUnmanagedListParams,
|
|
98
98
|
): Promise<DevicesUnmanagedListResponse['devices']> {
|
|
99
99
|
const { data } = await this.client.request<DevicesUnmanagedListResponse>({
|
|
100
100
|
url: '/devices/unmanaged/list',
|
|
@@ -104,7 +104,7 @@ export class SeamHttpDevicesUnmanaged {
|
|
|
104
104
|
return data.devices
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
async update(body
|
|
107
|
+
async update(body?: DevicesUnmanagedUpdateBody): Promise<void> {
|
|
108
108
|
await this.client.request<DevicesUnmanagedUpdateResponse>({
|
|
109
109
|
url: '/devices/unmanaged/update',
|
|
110
110
|
method: 'post',
|
|
@@ -113,13 +113,14 @@ export class SeamHttpDevicesUnmanaged {
|
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
export type
|
|
116
|
+
export type DevicesUnmanagedGetParams =
|
|
117
|
+
RouteRequestBody<'/devices/unmanaged/get'>
|
|
117
118
|
|
|
118
119
|
export type DevicesUnmanagedGetResponse = SetNonNullable<
|
|
119
120
|
Required<RouteResponse<'/devices/unmanaged/get'>>
|
|
120
121
|
>
|
|
121
122
|
|
|
122
|
-
export type
|
|
123
|
+
export type DevicesUnmanagedListParams =
|
|
123
124
|
RouteRequestBody<'/devices/unmanaged/list'>
|
|
124
125
|
|
|
125
126
|
export type DevicesUnmanagedListResponse = SetNonNullable<
|
|
@@ -87,7 +87,7 @@ export class SeamHttpDevices {
|
|
|
87
87
|
return SeamHttpDevicesUnmanaged.fromClient(this.client)
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
async delete(body
|
|
90
|
+
async delete(body?: DevicesDeleteBody): Promise<void> {
|
|
91
91
|
await this.client.request<DevicesDeleteResponse>({
|
|
92
92
|
url: '/devices/delete',
|
|
93
93
|
method: 'post',
|
|
@@ -95,7 +95,7 @@ export class SeamHttpDevices {
|
|
|
95
95
|
})
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
async get(body
|
|
98
|
+
async get(body?: DevicesGetParams): Promise<DevicesGetResponse['device']> {
|
|
99
99
|
const { data } = await this.client.request<DevicesGetResponse>({
|
|
100
100
|
url: '/devices/get',
|
|
101
101
|
method: 'post',
|
|
@@ -104,7 +104,9 @@ export class SeamHttpDevices {
|
|
|
104
104
|
return data.device
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
async list(
|
|
107
|
+
async list(
|
|
108
|
+
body?: DevicesListParams,
|
|
109
|
+
): Promise<DevicesListResponse['devices']> {
|
|
108
110
|
const { data } = await this.client.request<DevicesListResponse>({
|
|
109
111
|
url: '/devices/list',
|
|
110
112
|
method: 'post',
|
|
@@ -114,7 +116,7 @@ export class SeamHttpDevices {
|
|
|
114
116
|
}
|
|
115
117
|
|
|
116
118
|
async listDeviceProviders(
|
|
117
|
-
body
|
|
119
|
+
body?: DevicesListDeviceProvidersParams,
|
|
118
120
|
): Promise<DevicesListDeviceProvidersResponse['device_providers']> {
|
|
119
121
|
const { data } =
|
|
120
122
|
await this.client.request<DevicesListDeviceProvidersResponse>({
|
|
@@ -125,7 +127,7 @@ export class SeamHttpDevices {
|
|
|
125
127
|
return data.device_providers
|
|
126
128
|
}
|
|
127
129
|
|
|
128
|
-
async update(body
|
|
130
|
+
async update(body?: DevicesUpdateBody): Promise<void> {
|
|
129
131
|
await this.client.request<DevicesUpdateResponse>({
|
|
130
132
|
url: '/devices/update',
|
|
131
133
|
method: 'post',
|
|
@@ -140,19 +142,19 @@ export type DevicesDeleteResponse = SetNonNullable<
|
|
|
140
142
|
Required<RouteResponse<'/devices/delete'>>
|
|
141
143
|
>
|
|
142
144
|
|
|
143
|
-
export type
|
|
145
|
+
export type DevicesGetParams = RouteRequestBody<'/devices/get'>
|
|
144
146
|
|
|
145
147
|
export type DevicesGetResponse = SetNonNullable<
|
|
146
148
|
Required<RouteResponse<'/devices/get'>>
|
|
147
149
|
>
|
|
148
150
|
|
|
149
|
-
export type
|
|
151
|
+
export type DevicesListParams = RouteRequestBody<'/devices/list'>
|
|
150
152
|
|
|
151
153
|
export type DevicesListResponse = SetNonNullable<
|
|
152
154
|
Required<RouteResponse<'/devices/list'>>
|
|
153
155
|
>
|
|
154
156
|
|
|
155
|
-
export type
|
|
157
|
+
export type DevicesListDeviceProvidersParams =
|
|
156
158
|
RouteRequestBody<'/devices/list_device_providers'>
|
|
157
159
|
|
|
158
160
|
export type DevicesListDeviceProvidersResponse = SetNonNullable<
|
|
@@ -82,7 +82,7 @@ export class SeamHttpEvents {
|
|
|
82
82
|
return SeamHttpEvents.fromClientSessionToken(token, options)
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
async get(body
|
|
85
|
+
async get(body?: EventsGetParams): Promise<EventsGetResponse['event']> {
|
|
86
86
|
const { data } = await this.client.request<EventsGetResponse>({
|
|
87
87
|
url: '/events/get',
|
|
88
88
|
method: 'post',
|
|
@@ -91,7 +91,7 @@ export class SeamHttpEvents {
|
|
|
91
91
|
return data.event
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
async list(body
|
|
94
|
+
async list(body?: EventsListParams): Promise<EventsListResponse['events']> {
|
|
95
95
|
const { data } = await this.client.request<EventsListResponse>({
|
|
96
96
|
url: '/events/list',
|
|
97
97
|
method: 'post',
|
|
@@ -101,13 +101,13 @@ export class SeamHttpEvents {
|
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
export type
|
|
104
|
+
export type EventsGetParams = RouteRequestBody<'/events/get'>
|
|
105
105
|
|
|
106
106
|
export type EventsGetResponse = SetNonNullable<
|
|
107
107
|
Required<RouteResponse<'/events/get'>>
|
|
108
108
|
>
|
|
109
109
|
|
|
110
|
-
export type
|
|
110
|
+
export type EventsListParams = RouteRequestBody<'/events/list'>
|
|
111
111
|
|
|
112
112
|
export type EventsListResponse = SetNonNullable<
|
|
113
113
|
Required<RouteResponse<'/events/list'>>
|
|
@@ -82,7 +82,7 @@ export class SeamHttpLocks {
|
|
|
82
82
|
return SeamHttpLocks.fromClientSessionToken(token, options)
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
async get(body
|
|
85
|
+
async get(body?: LocksGetParams): Promise<LocksGetResponse['device']> {
|
|
86
86
|
const { data } = await this.client.request<LocksGetResponse>({
|
|
87
87
|
url: '/locks/get',
|
|
88
88
|
method: 'post',
|
|
@@ -91,7 +91,7 @@ export class SeamHttpLocks {
|
|
|
91
91
|
return data.device
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
async list(body
|
|
94
|
+
async list(body?: LocksListParams): Promise<LocksListResponse['devices']> {
|
|
95
95
|
const { data } = await this.client.request<LocksListResponse>({
|
|
96
96
|
url: '/locks/list',
|
|
97
97
|
method: 'post',
|
|
@@ -101,7 +101,7 @@ export class SeamHttpLocks {
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
async lockDoor(
|
|
104
|
-
body
|
|
104
|
+
body?: LocksLockDoorBody,
|
|
105
105
|
): Promise<LocksLockDoorResponse['action_attempt']> {
|
|
106
106
|
const { data } = await this.client.request<LocksLockDoorResponse>({
|
|
107
107
|
url: '/locks/lock_door',
|
|
@@ -112,7 +112,7 @@ export class SeamHttpLocks {
|
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
async unlockDoor(
|
|
115
|
-
body
|
|
115
|
+
body?: LocksUnlockDoorBody,
|
|
116
116
|
): Promise<LocksUnlockDoorResponse['action_attempt']> {
|
|
117
117
|
const { data } = await this.client.request<LocksUnlockDoorResponse>({
|
|
118
118
|
url: '/locks/unlock_door',
|
|
@@ -123,13 +123,13 @@ export class SeamHttpLocks {
|
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
export type
|
|
126
|
+
export type LocksGetParams = RouteRequestBody<'/locks/get'>
|
|
127
127
|
|
|
128
128
|
export type LocksGetResponse = SetNonNullable<
|
|
129
129
|
Required<RouteResponse<'/locks/get'>>
|
|
130
130
|
>
|
|
131
131
|
|
|
132
|
-
export type
|
|
132
|
+
export type LocksListParams = RouteRequestBody<'/locks/list'>
|
|
133
133
|
|
|
134
134
|
export type LocksListResponse = SetNonNullable<
|
|
135
135
|
Required<RouteResponse<'/locks/list'>>
|
|
@@ -85,7 +85,7 @@ export class SeamHttpNoiseSensorsNoiseThresholds {
|
|
|
85
85
|
)
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
async create(body
|
|
88
|
+
async create(body?: NoiseSensorsNoiseThresholdsCreateBody): Promise<void> {
|
|
89
89
|
await this.client.request<NoiseSensorsNoiseThresholdsCreateResponse>({
|
|
90
90
|
url: '/noise_sensors/noise_thresholds/create',
|
|
91
91
|
method: 'post',
|
|
@@ -93,7 +93,7 @@ export class SeamHttpNoiseSensorsNoiseThresholds {
|
|
|
93
93
|
})
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
async delete(body
|
|
96
|
+
async delete(body?: NoiseSensorsNoiseThresholdsDeleteBody): Promise<void> {
|
|
97
97
|
await this.client.request<NoiseSensorsNoiseThresholdsDeleteResponse>({
|
|
98
98
|
url: '/noise_sensors/noise_thresholds/delete',
|
|
99
99
|
method: 'post',
|
|
@@ -102,7 +102,7 @@ export class SeamHttpNoiseSensorsNoiseThresholds {
|
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
async get(
|
|
105
|
-
body
|
|
105
|
+
body?: NoiseSensorsNoiseThresholdsGetParams,
|
|
106
106
|
): Promise<NoiseSensorsNoiseThresholdsGetResponse['noise_threshold']> {
|
|
107
107
|
const { data } =
|
|
108
108
|
await this.client.request<NoiseSensorsNoiseThresholdsGetResponse>({
|
|
@@ -114,7 +114,7 @@ export class SeamHttpNoiseSensorsNoiseThresholds {
|
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
async list(
|
|
117
|
-
body
|
|
117
|
+
body?: NoiseSensorsNoiseThresholdsListParams,
|
|
118
118
|
): Promise<NoiseSensorsNoiseThresholdsListResponse['noise_thresholds']> {
|
|
119
119
|
const { data } =
|
|
120
120
|
await this.client.request<NoiseSensorsNoiseThresholdsListResponse>({
|
|
@@ -125,7 +125,7 @@ export class SeamHttpNoiseSensorsNoiseThresholds {
|
|
|
125
125
|
return data.noise_thresholds
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
-
async update(body
|
|
128
|
+
async update(body?: NoiseSensorsNoiseThresholdsUpdateBody): Promise<void> {
|
|
129
129
|
await this.client.request<NoiseSensorsNoiseThresholdsUpdateResponse>({
|
|
130
130
|
url: '/noise_sensors/noise_thresholds/update',
|
|
131
131
|
method: 'post',
|
|
@@ -148,14 +148,14 @@ export type NoiseSensorsNoiseThresholdsDeleteResponse = SetNonNullable<
|
|
|
148
148
|
Required<RouteResponse<'/noise_sensors/noise_thresholds/delete'>>
|
|
149
149
|
>
|
|
150
150
|
|
|
151
|
-
export type
|
|
151
|
+
export type NoiseSensorsNoiseThresholdsGetParams =
|
|
152
152
|
RouteRequestBody<'/noise_sensors/noise_thresholds/get'>
|
|
153
153
|
|
|
154
154
|
export type NoiseSensorsNoiseThresholdsGetResponse = SetNonNullable<
|
|
155
155
|
Required<RouteResponse<'/noise_sensors/noise_thresholds/get'>>
|
|
156
156
|
>
|
|
157
157
|
|
|
158
|
-
export type
|
|
158
|
+
export type NoiseSensorsNoiseThresholdsListParams =
|
|
159
159
|
RouteRequestBody<'/noise_sensors/noise_thresholds/list'>
|
|
160
160
|
|
|
161
161
|
export type NoiseSensorsNoiseThresholdsListResponse = SetNonNullable<
|
|
@@ -86,7 +86,7 @@ export class SeamHttpThermostatsClimateSettingSchedules {
|
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
async create(
|
|
89
|
-
body
|
|
89
|
+
body?: ThermostatsClimateSettingSchedulesCreateBody,
|
|
90
90
|
): Promise<
|
|
91
91
|
ThermostatsClimateSettingSchedulesCreateResponse['climate_setting_schedule']
|
|
92
92
|
> {
|
|
@@ -102,7 +102,7 @@ export class SeamHttpThermostatsClimateSettingSchedules {
|
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
async delete(
|
|
105
|
-
body
|
|
105
|
+
body?: ThermostatsClimateSettingSchedulesDeleteBody,
|
|
106
106
|
): Promise<void> {
|
|
107
107
|
await this.client.request<ThermostatsClimateSettingSchedulesDeleteResponse>(
|
|
108
108
|
{
|
|
@@ -114,7 +114,7 @@ export class SeamHttpThermostatsClimateSettingSchedules {
|
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
async get(
|
|
117
|
-
body
|
|
117
|
+
body?: ThermostatsClimateSettingSchedulesGetParams,
|
|
118
118
|
): Promise<
|
|
119
119
|
ThermostatsClimateSettingSchedulesGetResponse['climate_setting_schedule']
|
|
120
120
|
> {
|
|
@@ -128,7 +128,7 @@ export class SeamHttpThermostatsClimateSettingSchedules {
|
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
async list(
|
|
131
|
-
body
|
|
131
|
+
body?: ThermostatsClimateSettingSchedulesListParams,
|
|
132
132
|
): Promise<
|
|
133
133
|
ThermostatsClimateSettingSchedulesListResponse['climate_setting_schedules']
|
|
134
134
|
> {
|
|
@@ -144,7 +144,7 @@ export class SeamHttpThermostatsClimateSettingSchedules {
|
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
async update(
|
|
147
|
-
body
|
|
147
|
+
body?: ThermostatsClimateSettingSchedulesUpdateBody,
|
|
148
148
|
): Promise<void> {
|
|
149
149
|
await this.client.request<ThermostatsClimateSettingSchedulesUpdateResponse>(
|
|
150
150
|
{
|
|
@@ -170,14 +170,14 @@ export type ThermostatsClimateSettingSchedulesDeleteResponse = SetNonNullable<
|
|
|
170
170
|
Required<RouteResponse<'/thermostats/climate_setting_schedules/delete'>>
|
|
171
171
|
>
|
|
172
172
|
|
|
173
|
-
export type
|
|
173
|
+
export type ThermostatsClimateSettingSchedulesGetParams =
|
|
174
174
|
RouteRequestBody<'/thermostats/climate_setting_schedules/get'>
|
|
175
175
|
|
|
176
176
|
export type ThermostatsClimateSettingSchedulesGetResponse = SetNonNullable<
|
|
177
177
|
Required<RouteResponse<'/thermostats/climate_setting_schedules/get'>>
|
|
178
178
|
>
|
|
179
179
|
|
|
180
|
-
export type
|
|
180
|
+
export type ThermostatsClimateSettingSchedulesListParams =
|
|
181
181
|
RouteRequestBody<'/thermostats/climate_setting_schedules/list'>
|
|
182
182
|
|
|
183
183
|
export type ThermostatsClimateSettingSchedulesListResponse = SetNonNullable<
|
|
@@ -87,7 +87,7 @@ export class SeamHttpThermostats {
|
|
|
87
87
|
return SeamHttpThermostatsClimateSettingSchedules.fromClient(this.client)
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
async cool(body
|
|
90
|
+
async cool(body?: ThermostatsCoolBody): Promise<void> {
|
|
91
91
|
await this.client.request<ThermostatsCoolResponse>({
|
|
92
92
|
url: '/thermostats/cool',
|
|
93
93
|
method: 'post',
|
|
@@ -96,7 +96,7 @@ export class SeamHttpThermostats {
|
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
async get(
|
|
99
|
-
body
|
|
99
|
+
body?: ThermostatsGetParams,
|
|
100
100
|
): Promise<ThermostatsGetResponse['thermostat']> {
|
|
101
101
|
const { data } = await this.client.request<ThermostatsGetResponse>({
|
|
102
102
|
url: '/thermostats/get',
|
|
@@ -106,7 +106,7 @@ export class SeamHttpThermostats {
|
|
|
106
106
|
return data.thermostat
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
async heat(body
|
|
109
|
+
async heat(body?: ThermostatsHeatBody): Promise<void> {
|
|
110
110
|
await this.client.request<ThermostatsHeatResponse>({
|
|
111
111
|
url: '/thermostats/heat',
|
|
112
112
|
method: 'post',
|
|
@@ -114,7 +114,7 @@ export class SeamHttpThermostats {
|
|
|
114
114
|
})
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
async heatCool(body
|
|
117
|
+
async heatCool(body?: ThermostatsHeatCoolBody): Promise<void> {
|
|
118
118
|
await this.client.request<ThermostatsHeatCoolResponse>({
|
|
119
119
|
url: '/thermostats/heat_cool',
|
|
120
120
|
method: 'post',
|
|
@@ -123,7 +123,7 @@ export class SeamHttpThermostats {
|
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
async list(
|
|
126
|
-
body
|
|
126
|
+
body?: ThermostatsListParams,
|
|
127
127
|
): Promise<ThermostatsListResponse['thermostats']> {
|
|
128
128
|
const { data } = await this.client.request<ThermostatsListResponse>({
|
|
129
129
|
url: '/thermostats/list',
|
|
@@ -133,7 +133,7 @@ export class SeamHttpThermostats {
|
|
|
133
133
|
return data.thermostats
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
-
async off(body
|
|
136
|
+
async off(body?: ThermostatsOffBody): Promise<void> {
|
|
137
137
|
await this.client.request<ThermostatsOffResponse>({
|
|
138
138
|
url: '/thermostats/off',
|
|
139
139
|
method: 'post',
|
|
@@ -141,7 +141,7 @@ export class SeamHttpThermostats {
|
|
|
141
141
|
})
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
async setFanMode(body
|
|
144
|
+
async setFanMode(body?: ThermostatsSetFanModeBody): Promise<void> {
|
|
145
145
|
await this.client.request<ThermostatsSetFanModeResponse>({
|
|
146
146
|
url: '/thermostats/set_fan_mode',
|
|
147
147
|
method: 'post',
|
|
@@ -149,7 +149,7 @@ export class SeamHttpThermostats {
|
|
|
149
149
|
})
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
-
async update(body
|
|
152
|
+
async update(body?: ThermostatsUpdateBody): Promise<void> {
|
|
153
153
|
await this.client.request<ThermostatsUpdateResponse>({
|
|
154
154
|
url: '/thermostats/update',
|
|
155
155
|
method: 'post',
|
|
@@ -164,7 +164,7 @@ export type ThermostatsCoolResponse = SetNonNullable<
|
|
|
164
164
|
Required<RouteResponse<'/thermostats/cool'>>
|
|
165
165
|
>
|
|
166
166
|
|
|
167
|
-
export type
|
|
167
|
+
export type ThermostatsGetParams = RouteRequestBody<'/thermostats/get'>
|
|
168
168
|
|
|
169
169
|
export type ThermostatsGetResponse = SetNonNullable<
|
|
170
170
|
Required<RouteResponse<'/thermostats/get'>>
|
|
@@ -182,7 +182,7 @@ export type ThermostatsHeatCoolResponse = SetNonNullable<
|
|
|
182
182
|
Required<RouteResponse<'/thermostats/heat_cool'>>
|
|
183
183
|
>
|
|
184
184
|
|
|
185
|
-
export type
|
|
185
|
+
export type ThermostatsListParams = RouteRequestBody<'/thermostats/list'>
|
|
186
186
|
|
|
187
187
|
export type ThermostatsListResponse = SetNonNullable<
|
|
188
188
|
Required<RouteResponse<'/thermostats/list'>>
|
|
@@ -87,7 +87,7 @@ export class SeamHttpWebhooks {
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
async create(
|
|
90
|
-
body
|
|
90
|
+
body?: WebhooksCreateBody,
|
|
91
91
|
): Promise<WebhooksCreateResponse['webhook']> {
|
|
92
92
|
const { data } = await this.client.request<WebhooksCreateResponse>({
|
|
93
93
|
url: '/webhooks/create',
|
|
@@ -97,7 +97,7 @@ export class SeamHttpWebhooks {
|
|
|
97
97
|
return data.webhook
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
async delete(body
|
|
100
|
+
async delete(body?: WebhooksDeleteBody): Promise<void> {
|
|
101
101
|
await this.client.request<WebhooksDeleteResponse>({
|
|
102
102
|
url: '/webhooks/delete',
|
|
103
103
|
method: 'post',
|
|
@@ -105,7 +105,7 @@ export class SeamHttpWebhooks {
|
|
|
105
105
|
})
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
async get(body
|
|
108
|
+
async get(body?: WebhooksGetParams): Promise<WebhooksGetResponse['webhook']> {
|
|
109
109
|
const { data } = await this.client.request<WebhooksGetResponse>({
|
|
110
110
|
url: '/webhooks/get',
|
|
111
111
|
method: 'post',
|
|
@@ -138,7 +138,7 @@ export type WebhooksDeleteResponse = SetNonNullable<
|
|
|
138
138
|
Required<RouteResponse<'/webhooks/delete'>>
|
|
139
139
|
>
|
|
140
140
|
|
|
141
|
-
export type
|
|
141
|
+
export type WebhooksGetParams = RouteRequestBody<'/webhooks/get'>
|
|
142
142
|
|
|
143
143
|
export type WebhooksGetResponse = SetNonNullable<
|
|
144
144
|
Required<RouteResponse<'/webhooks/get'>>
|
|
@@ -108,7 +108,7 @@ export class SeamHttpWorkspaces {
|
|
|
108
108
|
return data.workspaces
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
async resetSandbox(body
|
|
111
|
+
async resetSandbox(body?: WorkspacesResetSandboxBody): Promise<void> {
|
|
112
112
|
await this.client.request<WorkspacesResetSandboxResponse>({
|
|
113
113
|
url: '/workspaces/reset_sandbox',
|
|
114
114
|
method: 'post',
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { ApiError } from './api-error-type.js'
|
|
2
|
+
|
|
3
|
+
export class SeamHttpApiError extends Error {
|
|
4
|
+
code: string
|
|
5
|
+
statusCode: number
|
|
6
|
+
requestId: string
|
|
7
|
+
data?: unknown
|
|
8
|
+
|
|
9
|
+
constructor(error: ApiError, statusCode: number, requestId: string) {
|
|
10
|
+
const { type, message, data } = error
|
|
11
|
+
super(message)
|
|
12
|
+
this.name = this.constructor.name
|
|
13
|
+
Error.captureStackTrace(this, this.constructor)
|
|
14
|
+
this.code = type
|
|
15
|
+
this.statusCode = statusCode
|
|
16
|
+
this.requestId = requestId
|
|
17
|
+
if (data != null) this.data = data
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const isSeamHttpApiError = (
|
|
22
|
+
error: unknown,
|
|
23
|
+
): error is SeamHttpApiError => {
|
|
24
|
+
return error instanceof SeamHttpApiError
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export class SeamHttpUnauthorizedError extends SeamHttpApiError {
|
|
28
|
+
override code: 'unauthorized'
|
|
29
|
+
override statusCode: 401
|
|
30
|
+
|
|
31
|
+
constructor(requestId: string) {
|
|
32
|
+
const type = 'unauthorized'
|
|
33
|
+
const status = 401
|
|
34
|
+
super({ type, message: 'Unauthorized' }, status, requestId)
|
|
35
|
+
this.name = this.constructor.name
|
|
36
|
+
Error.captureStackTrace(this, this.constructor)
|
|
37
|
+
this.code = type
|
|
38
|
+
this.statusCode = status
|
|
39
|
+
this.requestId = requestId
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export const isSeamHttpUnauthorizedError = (
|
|
44
|
+
error: unknown,
|
|
45
|
+
): error is SeamHttpUnauthorizedError => {
|
|
46
|
+
return error instanceof SeamHttpUnauthorizedError
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export class SeamHttpInvalidInputError extends SeamHttpApiError {
|
|
50
|
+
override code: 'invalid_input'
|
|
51
|
+
|
|
52
|
+
constructor(error: ApiError, statusCode: number, requestId: string) {
|
|
53
|
+
super(error, statusCode, requestId)
|
|
54
|
+
this.name = this.constructor.name
|
|
55
|
+
Error.captureStackTrace(this, this.constructor)
|
|
56
|
+
this.code = 'invalid_input'
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export const isSeamHttpInvalidInputError = (
|
|
61
|
+
error: unknown,
|
|
62
|
+
): error is SeamHttpInvalidInputError => {
|
|
63
|
+
return error instanceof SeamHttpInvalidInputError
|
|
64
|
+
}
|