@seamapi/http 2.24.1 → 2.26.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 +37 -0
- package/lib/error-interceptor.js +2 -2
- package/lib/error-interceptor.js.map +1 -1
- package/lib/resolve-action-attempt.d.ts +4 -4
- package/lib/resources/access-grant.d.ts +1 -1
- package/lib/resources/action-attempt.d.ts +871 -139
- package/lib/resources/event.d.ts +9 -4
- package/lib/routes/access-codes/access-codes.js +1 -1
- package/lib/routes/access-codes/access-codes.js.map +1 -1
- package/lib/routes/access-grants/access-grants.d.ts +25 -25
- package/lib/routes/access-methods/access-methods.d.ts +5 -5
- package/lib/routes/access-methods/access-methods.js +1 -1
- package/lib/routes/access-methods/access-methods.js.map +1 -1
- package/lib/routes/acs/encoders/simulate/simulate.d.ts +5 -5
- package/lib/routes/customers/customers.d.ts +185 -185
- package/lib/routes/noise-sensors/noise-thresholds/noise-thresholds.js +1 -1
- package/lib/routes/noise-sensors/noise-thresholds/noise-thresholds.js.map +1 -1
- package/lib/routes/thermostats/simulate/simulate.d.ts +8 -8
- package/lib/routes/thermostats/thermostats.d.ts +5 -5
- package/lib/routes/user-identities/user-identities.d.ts +5 -5
- package/lib/routes/user-identities/user-identities.js +1 -1
- package/lib/routes/user-identities/user-identities.js.map +1 -1
- package/lib/routes/workspaces/workspaces.d.ts +1 -1
- package/lib/seam-http-error.d.ts +16 -3
- package/lib/seam-http-error.js +18 -6
- package/lib/seam-http-error.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +3 -3
- package/src/lib/error-interceptor.ts +6 -2
- package/src/lib/resolve-action-attempt.ts +8 -6
- package/src/lib/resources/access-grant.ts +1 -1
- package/src/lib/resources/action-attempt.ts +1101 -201
- package/src/lib/resources/event.ts +10 -5
- package/src/lib/routes/access-codes/access-codes.ts +1 -1
- package/src/lib/routes/access-grants/access-grants.ts +27 -27
- package/src/lib/routes/access-methods/access-methods.ts +6 -6
- package/src/lib/routes/acs/encoders/simulate/simulate.ts +5 -6
- package/src/lib/routes/customers/customers.ts +235 -236
- package/src/lib/routes/noise-sensors/noise-thresholds/noise-thresholds.ts +1 -1
- package/src/lib/routes/thermostats/simulate/simulate.ts +9 -10
- package/src/lib/routes/thermostats/thermostats.ts +7 -7
- package/src/lib/routes/user-identities/user-identities.ts +6 -6
- package/src/lib/routes/workspaces/workspaces.ts +1 -1
- package/src/lib/seam-http-error.ts +43 -6
- package/src/lib/version.ts +1 -1
|
@@ -202,16 +202,6 @@ export class SeamHttpThermostatsSimulate {
|
|
|
202
202
|
}
|
|
203
203
|
|
|
204
204
|
export type ThermostatsSimulateHvacModeAdjustedParameters = {
|
|
205
|
-
/**
|
|
206
|
-
* ID of the thermostat device for which you want to simulate having adjusted the HVAC mode.
|
|
207
|
-
*/
|
|
208
|
-
device_id: string
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* HVAC mode that you want to simulate.
|
|
212
|
-
*/
|
|
213
|
-
hvac_mode: 'off' | 'cool' | 'heat' | 'heat_cool'
|
|
214
|
-
|
|
215
205
|
/**
|
|
216
206
|
* Cooling [set point](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/set-points) in °C that you want to simulate. You must set `cooling_set_point_celsius` or `cooling_set_point_fahrenheit`.
|
|
217
207
|
*/
|
|
@@ -220,6 +210,11 @@ export type ThermostatsSimulateHvacModeAdjustedParameters = {
|
|
|
220
210
|
* Cooling [set point](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/set-points) in °F that you want to simulate. You must set `cooling_set_point_fahrenheit` or `cooling_set_point_celsius`.
|
|
221
211
|
*/
|
|
222
212
|
cooling_set_point_fahrenheit?: number | undefined
|
|
213
|
+
/**
|
|
214
|
+
* ID of the thermostat device for which you want to simulate having adjusted the HVAC mode.
|
|
215
|
+
*/
|
|
216
|
+
device_id: string
|
|
217
|
+
|
|
223
218
|
/**
|
|
224
219
|
* Heating [set point](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/set-points) in °C that you want to simulate. You must set `heating_set_point_celsius` or `heating_set_point_fahrenheit`.
|
|
225
220
|
*/
|
|
@@ -228,6 +223,10 @@ export type ThermostatsSimulateHvacModeAdjustedParameters = {
|
|
|
228
223
|
* Heating [set point](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/set-points) in °F that you want to simulate. You must set `heating_set_point_fahrenheit` or `heating_set_point_celsius`.
|
|
229
224
|
*/
|
|
230
225
|
heating_set_point_fahrenheit?: number | undefined
|
|
226
|
+
/**
|
|
227
|
+
* HVAC mode that you want to simulate.
|
|
228
|
+
*/
|
|
229
|
+
hvac_mode: 'off' | 'cool' | 'heat' | 'heat_cool'
|
|
231
230
|
}
|
|
232
231
|
|
|
233
232
|
/**
|
|
@@ -879,13 +879,6 @@ export type ThermostatsSetFanModeOptions = Pick<
|
|
|
879
879
|
>
|
|
880
880
|
|
|
881
881
|
export type ThermostatsSetHvacModeParameters = {
|
|
882
|
-
/**
|
|
883
|
-
* ID of the thermostat device for which you want to set the HVAC mode.
|
|
884
|
-
*/
|
|
885
|
-
device_id: string
|
|
886
|
-
|
|
887
|
-
hvac_mode_setting: 'off' | 'cool' | 'heat' | 'heat_cool' | 'eco'
|
|
888
|
-
|
|
889
882
|
/**
|
|
890
883
|
* [Cooling set point](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/set-points) in °C that you want to set for the thermostat. You must set one of the `cooling_set_point` parameters.
|
|
891
884
|
*/
|
|
@@ -894,6 +887,11 @@ export type ThermostatsSetHvacModeParameters = {
|
|
|
894
887
|
* [Cooling set point](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/set-points) in °F that you want to set for the thermostat. You must set one of the `cooling_set_point` parameters.
|
|
895
888
|
*/
|
|
896
889
|
cooling_set_point_fahrenheit?: number | undefined
|
|
890
|
+
/**
|
|
891
|
+
* ID of the thermostat device for which you want to set the HVAC mode.
|
|
892
|
+
*/
|
|
893
|
+
device_id: string
|
|
894
|
+
|
|
897
895
|
/**
|
|
898
896
|
* [Heating set point](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/set-points) in °C that you want to set for the thermostat. You must set one of the `heating_set_point` parameters.
|
|
899
897
|
*/
|
|
@@ -902,6 +900,8 @@ export type ThermostatsSetHvacModeParameters = {
|
|
|
902
900
|
* [Heating set point](https://docs.seam.co/capability-guides/thermostats/understanding-thermostat-concepts/set-points) in °F that you want to set for the thermostat. You must set one of the `heating_set_point` parameters.
|
|
903
901
|
*/
|
|
904
902
|
heating_set_point_fahrenheit?: number | undefined
|
|
903
|
+
|
|
904
|
+
hvac_mode_setting: 'off' | 'cool' | 'heat' | 'heat_cool' | 'eco'
|
|
905
905
|
}
|
|
906
906
|
|
|
907
907
|
/**
|
|
@@ -423,8 +423,8 @@ export class SeamHttpUserIdentities {
|
|
|
423
423
|
requiredParameterNames: [],
|
|
424
424
|
atLeastOneParameterNames: [
|
|
425
425
|
'merged_user_identity_ids',
|
|
426
|
-
'user_identity_id',
|
|
427
426
|
'merged_user_identity_keys',
|
|
427
|
+
'user_identity_id',
|
|
428
428
|
'user_identity_key',
|
|
429
429
|
],
|
|
430
430
|
responseKey: undefined,
|
|
@@ -772,22 +772,22 @@ export type UserIdentitiesMergeParameters = RequireAtLeastOne<
|
|
|
772
772
|
* IDs of the user identities to merge into the primary user identity. These user identities are deleted.
|
|
773
773
|
*/
|
|
774
774
|
merged_user_identity_ids?: Array<string> | undefined
|
|
775
|
-
/**
|
|
776
|
-
* ID of the primary user identity to keep.
|
|
777
|
-
*/
|
|
778
|
-
user_identity_id?: string | undefined
|
|
779
775
|
/**
|
|
780
776
|
* Keys of the user identities to merge into the primary user identity. These user identities are deleted.
|
|
781
777
|
*/
|
|
782
778
|
merged_user_identity_keys?: Array<string> | undefined
|
|
779
|
+
/**
|
|
780
|
+
* ID of the primary user identity to keep.
|
|
781
|
+
*/
|
|
782
|
+
user_identity_id?: string | undefined
|
|
783
783
|
/**
|
|
784
784
|
* Key of the primary user identity to keep.
|
|
785
785
|
*/
|
|
786
786
|
user_identity_key?: string | undefined
|
|
787
787
|
},
|
|
788
788
|
| 'merged_user_identity_ids'
|
|
789
|
-
| 'user_identity_id'
|
|
790
789
|
| 'merged_user_identity_keys'
|
|
790
|
+
| 'user_identity_id'
|
|
791
791
|
| 'user_identity_key'
|
|
792
792
|
>
|
|
793
793
|
|
|
@@ -312,7 +312,7 @@ export type WorkspacesCreateParameters = {
|
|
|
312
312
|
name: string
|
|
313
313
|
|
|
314
314
|
/**
|
|
315
|
-
* ID of the organization to associate with the new workspace.
|
|
315
|
+
* ID of the organization to associate with the new workspace. If omitted, the new workspace is associated with the organization that you administer, if you administer exactly one.
|
|
316
316
|
*/
|
|
317
317
|
organization_id?: string | undefined
|
|
318
318
|
/**
|
|
@@ -22,9 +22,14 @@ export class SeamHttpApiError extends Error {
|
|
|
22
22
|
*/
|
|
23
23
|
data?: unknown
|
|
24
24
|
|
|
25
|
-
constructor(
|
|
25
|
+
constructor(
|
|
26
|
+
error: ApiError,
|
|
27
|
+
statusCode: number,
|
|
28
|
+
requestId: string,
|
|
29
|
+
options: ErrorOptions = {},
|
|
30
|
+
) {
|
|
26
31
|
const { type, message, data } = error
|
|
27
|
-
super(message)
|
|
32
|
+
super(message, options)
|
|
28
33
|
this.name = this.constructor.name
|
|
29
34
|
this.code = type
|
|
30
35
|
this.statusCode = statusCode
|
|
@@ -49,10 +54,15 @@ export class SeamHttpUnauthorizedError extends SeamHttpApiError {
|
|
|
49
54
|
override code: 'unauthorized'
|
|
50
55
|
override statusCode: 401
|
|
51
56
|
|
|
52
|
-
constructor(requestId: string) {
|
|
57
|
+
constructor(requestId: string, error?: ApiError, options: ErrorOptions = {}) {
|
|
53
58
|
const type = 'unauthorized'
|
|
54
59
|
const status = 401
|
|
55
|
-
super(
|
|
60
|
+
super(
|
|
61
|
+
error ?? { type, message: 'Unauthorized' },
|
|
62
|
+
status,
|
|
63
|
+
requestId,
|
|
64
|
+
options,
|
|
65
|
+
)
|
|
56
66
|
this.name = this.constructor.name
|
|
57
67
|
this.code = type
|
|
58
68
|
this.statusCode = status
|
|
@@ -69,6 +79,15 @@ export const isSeamHttpUnauthorizedError = (
|
|
|
69
79
|
return error instanceof SeamHttpUnauthorizedError
|
|
70
80
|
}
|
|
71
81
|
|
|
82
|
+
/**
|
|
83
|
+
* A request parameter that failed validation,
|
|
84
|
+
* along with the messages explaining why.
|
|
85
|
+
*/
|
|
86
|
+
export interface SeamValidationError {
|
|
87
|
+
parameterName: string
|
|
88
|
+
errorMessages: string[]
|
|
89
|
+
}
|
|
90
|
+
|
|
72
91
|
/**
|
|
73
92
|
* Error thrown when the Seam API returns an `invalid_input` error response.
|
|
74
93
|
*/
|
|
@@ -77,13 +96,31 @@ export class SeamHttpInvalidInputError extends SeamHttpApiError {
|
|
|
77
96
|
|
|
78
97
|
readonly #validationErrors: NonNullable<ApiError['validation_errors']>
|
|
79
98
|
|
|
80
|
-
constructor(
|
|
81
|
-
|
|
99
|
+
constructor(
|
|
100
|
+
error: ApiError,
|
|
101
|
+
statusCode: number,
|
|
102
|
+
requestId: string,
|
|
103
|
+
options: ErrorOptions = {},
|
|
104
|
+
) {
|
|
105
|
+
super(error, statusCode, requestId, options)
|
|
82
106
|
this.name = this.constructor.name
|
|
83
107
|
this.code = 'invalid_input'
|
|
84
108
|
this.#validationErrors = error.validation_errors ?? {}
|
|
85
109
|
}
|
|
86
110
|
|
|
111
|
+
/**
|
|
112
|
+
* Validation errors returned by the Seam API,
|
|
113
|
+
* one entry per request parameter that failed validation.
|
|
114
|
+
*/
|
|
115
|
+
get validationErrors(): SeamValidationError[] {
|
|
116
|
+
return Object.entries(this.#validationErrors)
|
|
117
|
+
.filter(([parameterName]) => parameterName !== '_errors')
|
|
118
|
+
.map(([parameterName, { _errors }]) => ({
|
|
119
|
+
parameterName,
|
|
120
|
+
errorMessages: _errors,
|
|
121
|
+
}))
|
|
122
|
+
}
|
|
123
|
+
|
|
87
124
|
/**
|
|
88
125
|
* Returns the validation error messages for the request parameter,
|
|
89
126
|
* or an empty array if the parameter had no validation errors.
|
package/src/lib/version.ts
CHANGED