@seamapi/http 0.0.2 → 0.1.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 +1386 -61
- package/dist/connect.cjs.map +1 -1
- package/dist/connect.d.cts +420 -7
- package/lib/seam/connect/auth.d.ts +1 -1
- package/lib/seam/connect/auth.js +7 -7
- package/lib/seam/connect/auth.js.map +1 -1
- package/lib/seam/connect/axios.js +3 -1
- package/lib/seam/connect/axios.js.map +1 -1
- package/lib/seam/connect/client-options.d.ts +7 -3
- package/lib/seam/connect/client-options.js +18 -3
- package/lib/seam/connect/client-options.js.map +1 -1
- package/lib/seam/connect/client.d.ts +16 -4
- package/lib/seam/connect/client.js +55 -28
- package/lib/seam/connect/client.js.map +1 -1
- package/lib/seam/connect/parse-options.d.ts +1 -1
- package/lib/seam/connect/parse-options.js +8 -1
- package/lib/seam/connect/parse-options.js.map +1 -1
- package/lib/seam/connect/routes/access-codes-unmanaged.d.ts +26 -0
- package/lib/seam/connect/routes/access-codes-unmanaged.js +72 -0
- package/lib/seam/connect/routes/access-codes-unmanaged.js.map +1 -0
- package/lib/seam/connect/routes/access-codes.d.ts +37 -0
- package/lib/seam/connect/routes/access-codes.js +101 -0
- package/lib/seam/connect/routes/access-codes.js.map +1 -0
- package/lib/seam/connect/routes/acs-access-groups.d.ts +35 -0
- package/lib/seam/connect/routes/acs-access-groups.js +95 -0
- package/lib/seam/connect/routes/acs-access-groups.js.map +1 -0
- package/lib/seam/connect/routes/acs-credentials.d.ts +23 -0
- package/lib/seam/connect/routes/acs-credentials.js +66 -0
- package/lib/seam/connect/routes/acs-credentials.js.map +1 -0
- package/lib/seam/connect/routes/acs-systems.d.ts +17 -0
- package/lib/seam/connect/routes/acs-systems.js +51 -0
- package/lib/seam/connect/routes/acs-systems.js.map +1 -0
- package/lib/seam/connect/routes/acs-users.d.ts +32 -0
- package/lib/seam/connect/routes/acs-users.js +87 -0
- package/lib/seam/connect/routes/acs-users.js.map +1 -0
- package/lib/seam/connect/routes/acs.d.ts +17 -0
- package/lib/seam/connect/routes/acs.js +51 -0
- package/lib/seam/connect/routes/acs.js.map +1 -0
- package/lib/seam/connect/routes/action-attempts.d.ts +17 -0
- package/lib/seam/connect/routes/action-attempts.js +51 -0
- package/lib/seam/connect/routes/action-attempts.js.map +1 -0
- package/lib/seam/connect/routes/client-sessions.d.ts +26 -0
- package/lib/seam/connect/routes/client-sessions.js +74 -0
- package/lib/seam/connect/routes/client-sessions.js.map +1 -0
- package/lib/seam/connect/routes/connect-webviews.d.ts +26 -0
- package/lib/seam/connect/routes/connect-webviews.js +73 -0
- package/lib/seam/connect/routes/connect-webviews.js.map +1 -0
- package/lib/seam/connect/routes/connected-accounts.d.ts +20 -0
- package/lib/seam/connect/routes/connected-accounts.js +58 -0
- package/lib/seam/connect/routes/connected-accounts.js.map +1 -0
- package/lib/seam/connect/routes/devices-unmanaged.d.ts +20 -0
- package/lib/seam/connect/routes/devices-unmanaged.js +58 -0
- package/lib/seam/connect/routes/devices-unmanaged.js.map +1 -0
- package/lib/seam/connect/routes/devices.d.ts +28 -0
- package/lib/seam/connect/routes/devices.js +77 -0
- package/lib/seam/connect/routes/devices.js.map +1 -0
- package/lib/seam/connect/routes/events.d.ts +17 -0
- package/lib/seam/connect/routes/events.js +51 -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 +23 -0
- package/lib/seam/connect/routes/locks.js +67 -0
- package/lib/seam/connect/routes/locks.js.map +1 -0
- package/lib/seam/connect/routes/noise-sensors-noise-thresholds.d.ts +26 -0
- package/lib/seam/connect/routes/noise-sensors-noise-thresholds.js +72 -0
- package/lib/seam/connect/routes/noise-sensors-noise-thresholds.js.map +1 -0
- package/lib/seam/connect/routes/noise-sensors.d.ts +11 -0
- package/lib/seam/connect/routes/noise-sensors.js +39 -0
- package/lib/seam/connect/routes/noise-sensors.js.map +1 -0
- package/lib/seam/connect/routes/thermostats-climate-setting-schedules.d.ts +26 -0
- package/lib/seam/connect/routes/thermostats-climate-setting-schedules.js +73 -0
- package/lib/seam/connect/routes/thermostats-climate-setting-schedules.js.map +1 -0
- package/lib/seam/connect/routes/thermostats.d.ts +37 -0
- package/lib/seam/connect/routes/thermostats.js +97 -0
- package/lib/seam/connect/routes/thermostats.js.map +1 -0
- package/lib/seam/connect/routes/webhooks.d.ts +23 -0
- package/lib/seam/connect/routes/webhooks.js +66 -0
- package/lib/seam/connect/routes/webhooks.js.map +1 -0
- package/lib/seam/connect/routes/workspaces.d.ts +14 -5
- package/lib/seam/connect/routes/workspaces.js +48 -10
- package/lib/seam/connect/routes/workspaces.js.map +1 -1
- package/package.json +4 -1
- package/src/lib/seam/connect/auth.ts +7 -7
- package/src/lib/seam/connect/axios.ts +2 -0
- package/src/lib/seam/connect/client-options.ts +32 -4
- package/src/lib/seam/connect/client.ts +88 -15
- package/src/lib/seam/connect/parse-options.ts +16 -2
- package/src/lib/seam/connect/routes/access-codes-unmanaged.ts +157 -0
- package/src/lib/seam/connect/routes/access-codes.ts +226 -0
- package/src/lib/seam/connect/routes/acs-access-groups.ts +207 -0
- package/src/lib/seam/connect/routes/acs-credentials.ts +139 -0
- package/src/lib/seam/connect/routes/acs-systems.ts +108 -0
- package/src/lib/seam/connect/routes/acs-users.ts +187 -0
- package/src/lib/seam/connect/routes/acs.ts +85 -0
- package/src/lib/seam/connect/routes/action-attempts.ts +104 -0
- package/src/lib/seam/connect/routes/client-sessions.ts +159 -0
- package/src/lib/seam/connect/routes/connect-webviews.ts +159 -0
- package/src/lib/seam/connect/routes/connected-accounts.ts +124 -0
- package/src/lib/seam/connect/routes/devices-unmanaged.ts +120 -0
- package/src/lib/seam/connect/routes/devices.ts +158 -0
- package/src/lib/seam/connect/routes/events.ts +100 -0
- package/src/lib/seam/connect/routes/index.ts +21 -0
- package/src/lib/seam/connect/routes/locks.ts +138 -0
- package/src/lib/seam/connect/routes/noise-sensors-noise-thresholds.ts +154 -0
- package/src/lib/seam/connect/routes/noise-sensors.ts +70 -0
- package/src/lib/seam/connect/routes/thermostats-climate-setting-schedules.ts +176 -0
- package/src/lib/seam/connect/routes/thermostats.ts +206 -0
- package/src/lib/seam/connect/routes/webhooks.ts +141 -0
- package/src/lib/seam/connect/routes/workspaces.ts +100 -17
- 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/legacy/workspaces.ts +0 -26
|
@@ -0,0 +1,124 @@
|
|
|
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 {
|
|
7
|
+
RouteRequestBody,
|
|
8
|
+
RouteRequestParams,
|
|
9
|
+
RouteResponse,
|
|
10
|
+
} from '@seamapi/types/connect'
|
|
11
|
+
import type { Axios } from 'axios'
|
|
12
|
+
import type { SetNonNullable } from 'type-fest'
|
|
13
|
+
|
|
14
|
+
import { createAxiosClient } from 'lib/seam/connect/axios.js'
|
|
15
|
+
import {
|
|
16
|
+
isSeamHttpOptionsWithApiKey,
|
|
17
|
+
isSeamHttpOptionsWithClient,
|
|
18
|
+
isSeamHttpOptionsWithClientSessionToken,
|
|
19
|
+
SeamHttpInvalidOptionsError,
|
|
20
|
+
type SeamHttpOptions,
|
|
21
|
+
type SeamHttpOptionsWithApiKey,
|
|
22
|
+
type SeamHttpOptionsWithClient,
|
|
23
|
+
type SeamHttpOptionsWithClientSessionToken,
|
|
24
|
+
} from 'lib/seam/connect/client-options.js'
|
|
25
|
+
import { parseOptions } from 'lib/seam/connect/parse-options.js'
|
|
26
|
+
|
|
27
|
+
export class SeamHttpConnectedAccounts {
|
|
28
|
+
client: Axios
|
|
29
|
+
|
|
30
|
+
constructor(apiKeyOrOptions: string | SeamHttpOptions) {
|
|
31
|
+
const options = parseOptions(apiKeyOrOptions)
|
|
32
|
+
this.client = createAxiosClient(options)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
static fromClient(
|
|
36
|
+
client: SeamHttpOptionsWithClient['client'],
|
|
37
|
+
options: Omit<SeamHttpOptionsWithClient, 'client'> = {},
|
|
38
|
+
): SeamHttpConnectedAccounts {
|
|
39
|
+
const opts = { ...options, client }
|
|
40
|
+
if (!isSeamHttpOptionsWithClient(opts)) {
|
|
41
|
+
throw new SeamHttpInvalidOptionsError('Missing client')
|
|
42
|
+
}
|
|
43
|
+
return new SeamHttpConnectedAccounts(opts)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
static fromApiKey(
|
|
47
|
+
apiKey: SeamHttpOptionsWithApiKey['apiKey'],
|
|
48
|
+
options: Omit<SeamHttpOptionsWithApiKey, 'apiKey'> = {},
|
|
49
|
+
): SeamHttpConnectedAccounts {
|
|
50
|
+
const opts = { ...options, apiKey }
|
|
51
|
+
if (!isSeamHttpOptionsWithApiKey(opts)) {
|
|
52
|
+
throw new SeamHttpInvalidOptionsError('Missing apiKey')
|
|
53
|
+
}
|
|
54
|
+
return new SeamHttpConnectedAccounts(opts)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
static fromClientSessionToken(
|
|
58
|
+
clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
|
|
59
|
+
options: Omit<
|
|
60
|
+
SeamHttpOptionsWithClientSessionToken,
|
|
61
|
+
'clientSessionToken'
|
|
62
|
+
> = {},
|
|
63
|
+
): SeamHttpConnectedAccounts {
|
|
64
|
+
const opts = { ...options, clientSessionToken }
|
|
65
|
+
if (!isSeamHttpOptionsWithClientSessionToken(opts)) {
|
|
66
|
+
throw new SeamHttpInvalidOptionsError('Missing clientSessionToken')
|
|
67
|
+
}
|
|
68
|
+
return new SeamHttpConnectedAccounts(opts)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
async delete(body: ConnectedAccountsDeleteBody): Promise<void> {
|
|
72
|
+
await this.client.request<ConnectedAccountsDeleteResponse>({
|
|
73
|
+
url: '/connected_accounts/delete',
|
|
74
|
+
method: 'post',
|
|
75
|
+
data: body,
|
|
76
|
+
})
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
async get(
|
|
80
|
+
body: ConnectedAccountsGetBody,
|
|
81
|
+
): Promise<ConnectedAccountsGetResponse['connected_account']> {
|
|
82
|
+
const { data } = await this.client.request<ConnectedAccountsGetResponse>({
|
|
83
|
+
url: '/connected_accounts/get',
|
|
84
|
+
method: 'post',
|
|
85
|
+
data: body,
|
|
86
|
+
})
|
|
87
|
+
return data.connected_account
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
async list(
|
|
91
|
+
params?: ConnectedAccountsListParams,
|
|
92
|
+
): Promise<ConnectedAccountsListResponse['connected_accounts']> {
|
|
93
|
+
const { data } = await this.client.request<ConnectedAccountsListResponse>({
|
|
94
|
+
url: '/connected_accounts/list',
|
|
95
|
+
method: 'get',
|
|
96
|
+
params,
|
|
97
|
+
})
|
|
98
|
+
return data.connected_accounts
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export type ConnectedAccountsDeleteBody = SetNonNullable<
|
|
103
|
+
Required<RouteRequestBody<'/connected_accounts/delete'>>
|
|
104
|
+
>
|
|
105
|
+
|
|
106
|
+
export type ConnectedAccountsDeleteResponse = SetNonNullable<
|
|
107
|
+
Required<RouteResponse<'/connected_accounts/delete'>>
|
|
108
|
+
>
|
|
109
|
+
|
|
110
|
+
export type ConnectedAccountsGetBody = SetNonNullable<
|
|
111
|
+
Required<RouteRequestBody<'/connected_accounts/get'>>
|
|
112
|
+
>
|
|
113
|
+
|
|
114
|
+
export type ConnectedAccountsGetResponse = SetNonNullable<
|
|
115
|
+
Required<RouteResponse<'/connected_accounts/get'>>
|
|
116
|
+
>
|
|
117
|
+
|
|
118
|
+
export type ConnectedAccountsListParams = SetNonNullable<
|
|
119
|
+
Required<RouteRequestParams<'/connected_accounts/list'>>
|
|
120
|
+
>
|
|
121
|
+
|
|
122
|
+
export type ConnectedAccountsListResponse = SetNonNullable<
|
|
123
|
+
Required<RouteResponse<'/connected_accounts/list'>>
|
|
124
|
+
>
|
|
@@ -0,0 +1,120 @@
|
|
|
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 { Axios } from 'axios'
|
|
8
|
+
import type { SetNonNullable } from 'type-fest'
|
|
9
|
+
|
|
10
|
+
import { createAxiosClient } from 'lib/seam/connect/axios.js'
|
|
11
|
+
import {
|
|
12
|
+
isSeamHttpOptionsWithApiKey,
|
|
13
|
+
isSeamHttpOptionsWithClient,
|
|
14
|
+
isSeamHttpOptionsWithClientSessionToken,
|
|
15
|
+
SeamHttpInvalidOptionsError,
|
|
16
|
+
type SeamHttpOptions,
|
|
17
|
+
type SeamHttpOptionsWithApiKey,
|
|
18
|
+
type SeamHttpOptionsWithClient,
|
|
19
|
+
type SeamHttpOptionsWithClientSessionToken,
|
|
20
|
+
} from 'lib/seam/connect/client-options.js'
|
|
21
|
+
import { parseOptions } from 'lib/seam/connect/parse-options.js'
|
|
22
|
+
|
|
23
|
+
export class SeamHttpDevicesUnmanaged {
|
|
24
|
+
client: Axios
|
|
25
|
+
|
|
26
|
+
constructor(apiKeyOrOptions: string | SeamHttpOptions) {
|
|
27
|
+
const options = parseOptions(apiKeyOrOptions)
|
|
28
|
+
this.client = createAxiosClient(options)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
static fromClient(
|
|
32
|
+
client: SeamHttpOptionsWithClient['client'],
|
|
33
|
+
options: Omit<SeamHttpOptionsWithClient, 'client'> = {},
|
|
34
|
+
): SeamHttpDevicesUnmanaged {
|
|
35
|
+
const opts = { ...options, client }
|
|
36
|
+
if (!isSeamHttpOptionsWithClient(opts)) {
|
|
37
|
+
throw new SeamHttpInvalidOptionsError('Missing client')
|
|
38
|
+
}
|
|
39
|
+
return new SeamHttpDevicesUnmanaged(opts)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
static fromApiKey(
|
|
43
|
+
apiKey: SeamHttpOptionsWithApiKey['apiKey'],
|
|
44
|
+
options: Omit<SeamHttpOptionsWithApiKey, 'apiKey'> = {},
|
|
45
|
+
): SeamHttpDevicesUnmanaged {
|
|
46
|
+
const opts = { ...options, apiKey }
|
|
47
|
+
if (!isSeamHttpOptionsWithApiKey(opts)) {
|
|
48
|
+
throw new SeamHttpInvalidOptionsError('Missing apiKey')
|
|
49
|
+
}
|
|
50
|
+
return new SeamHttpDevicesUnmanaged(opts)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
static fromClientSessionToken(
|
|
54
|
+
clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
|
|
55
|
+
options: Omit<
|
|
56
|
+
SeamHttpOptionsWithClientSessionToken,
|
|
57
|
+
'clientSessionToken'
|
|
58
|
+
> = {},
|
|
59
|
+
): SeamHttpDevicesUnmanaged {
|
|
60
|
+
const opts = { ...options, clientSessionToken }
|
|
61
|
+
if (!isSeamHttpOptionsWithClientSessionToken(opts)) {
|
|
62
|
+
throw new SeamHttpInvalidOptionsError('Missing clientSessionToken')
|
|
63
|
+
}
|
|
64
|
+
return new SeamHttpDevicesUnmanaged(opts)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
async get(
|
|
68
|
+
body: DevicesUnmanagedGetBody,
|
|
69
|
+
): Promise<DevicesUnmanagedGetResponse['device']> {
|
|
70
|
+
const { data } = await this.client.request<DevicesUnmanagedGetResponse>({
|
|
71
|
+
url: '/devices/unmanaged/get',
|
|
72
|
+
method: 'post',
|
|
73
|
+
data: body,
|
|
74
|
+
})
|
|
75
|
+
return data.device
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
async list(
|
|
79
|
+
body: DevicesUnmanagedListBody,
|
|
80
|
+
): Promise<DevicesUnmanagedListResponse['devices']> {
|
|
81
|
+
const { data } = await this.client.request<DevicesUnmanagedListResponse>({
|
|
82
|
+
url: '/devices/unmanaged/list',
|
|
83
|
+
method: 'post',
|
|
84
|
+
data: body,
|
|
85
|
+
})
|
|
86
|
+
return data.devices
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
async update(body: DevicesUnmanagedUpdateBody): Promise<void> {
|
|
90
|
+
await this.client.request<DevicesUnmanagedUpdateResponse>({
|
|
91
|
+
url: '/devices/unmanaged/update',
|
|
92
|
+
method: 'post',
|
|
93
|
+
data: body,
|
|
94
|
+
})
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export type DevicesUnmanagedGetBody = SetNonNullable<
|
|
99
|
+
Required<RouteRequestBody<'/devices/unmanaged/get'>>
|
|
100
|
+
>
|
|
101
|
+
|
|
102
|
+
export type DevicesUnmanagedGetResponse = SetNonNullable<
|
|
103
|
+
Required<RouteResponse<'/devices/unmanaged/get'>>
|
|
104
|
+
>
|
|
105
|
+
|
|
106
|
+
export type DevicesUnmanagedListBody = SetNonNullable<
|
|
107
|
+
Required<RouteRequestBody<'/devices/unmanaged/list'>>
|
|
108
|
+
>
|
|
109
|
+
|
|
110
|
+
export type DevicesUnmanagedListResponse = SetNonNullable<
|
|
111
|
+
Required<RouteResponse<'/devices/unmanaged/list'>>
|
|
112
|
+
>
|
|
113
|
+
|
|
114
|
+
export type DevicesUnmanagedUpdateBody = SetNonNullable<
|
|
115
|
+
Required<RouteRequestBody<'/devices/unmanaged/update'>>
|
|
116
|
+
>
|
|
117
|
+
|
|
118
|
+
export type DevicesUnmanagedUpdateResponse = SetNonNullable<
|
|
119
|
+
Required<RouteResponse<'/devices/unmanaged/update'>>
|
|
120
|
+
>
|
|
@@ -0,0 +1,158 @@
|
|
|
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 { Axios } from 'axios'
|
|
8
|
+
import type { SetNonNullable } from 'type-fest'
|
|
9
|
+
|
|
10
|
+
import { createAxiosClient } from 'lib/seam/connect/axios.js'
|
|
11
|
+
import {
|
|
12
|
+
isSeamHttpOptionsWithApiKey,
|
|
13
|
+
isSeamHttpOptionsWithClient,
|
|
14
|
+
isSeamHttpOptionsWithClientSessionToken,
|
|
15
|
+
SeamHttpInvalidOptionsError,
|
|
16
|
+
type SeamHttpOptions,
|
|
17
|
+
type SeamHttpOptionsWithApiKey,
|
|
18
|
+
type SeamHttpOptionsWithClient,
|
|
19
|
+
type SeamHttpOptionsWithClientSessionToken,
|
|
20
|
+
} from 'lib/seam/connect/client-options.js'
|
|
21
|
+
import { parseOptions } from 'lib/seam/connect/parse-options.js'
|
|
22
|
+
|
|
23
|
+
import { SeamHttpDevicesUnmanaged } from './devices-unmanaged.js'
|
|
24
|
+
|
|
25
|
+
export class SeamHttpDevices {
|
|
26
|
+
client: Axios
|
|
27
|
+
|
|
28
|
+
constructor(apiKeyOrOptions: string | SeamHttpOptions) {
|
|
29
|
+
const options = parseOptions(apiKeyOrOptions)
|
|
30
|
+
this.client = createAxiosClient(options)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
static fromClient(
|
|
34
|
+
client: SeamHttpOptionsWithClient['client'],
|
|
35
|
+
options: Omit<SeamHttpOptionsWithClient, 'client'> = {},
|
|
36
|
+
): SeamHttpDevices {
|
|
37
|
+
const opts = { ...options, client }
|
|
38
|
+
if (!isSeamHttpOptionsWithClient(opts)) {
|
|
39
|
+
throw new SeamHttpInvalidOptionsError('Missing client')
|
|
40
|
+
}
|
|
41
|
+
return new SeamHttpDevices(opts)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
static fromApiKey(
|
|
45
|
+
apiKey: SeamHttpOptionsWithApiKey['apiKey'],
|
|
46
|
+
options: Omit<SeamHttpOptionsWithApiKey, 'apiKey'> = {},
|
|
47
|
+
): SeamHttpDevices {
|
|
48
|
+
const opts = { ...options, apiKey }
|
|
49
|
+
if (!isSeamHttpOptionsWithApiKey(opts)) {
|
|
50
|
+
throw new SeamHttpInvalidOptionsError('Missing apiKey')
|
|
51
|
+
}
|
|
52
|
+
return new SeamHttpDevices(opts)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
static fromClientSessionToken(
|
|
56
|
+
clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
|
|
57
|
+
options: Omit<
|
|
58
|
+
SeamHttpOptionsWithClientSessionToken,
|
|
59
|
+
'clientSessionToken'
|
|
60
|
+
> = {},
|
|
61
|
+
): SeamHttpDevices {
|
|
62
|
+
const opts = { ...options, clientSessionToken }
|
|
63
|
+
if (!isSeamHttpOptionsWithClientSessionToken(opts)) {
|
|
64
|
+
throw new SeamHttpInvalidOptionsError('Missing clientSessionToken')
|
|
65
|
+
}
|
|
66
|
+
return new SeamHttpDevices(opts)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
get unmanaged(): SeamHttpDevicesUnmanaged {
|
|
70
|
+
return SeamHttpDevicesUnmanaged.fromClient(this.client)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
async delete(body: DevicesDeleteBody): Promise<void> {
|
|
74
|
+
await this.client.request<DevicesDeleteResponse>({
|
|
75
|
+
url: '/devices/delete',
|
|
76
|
+
method: 'post',
|
|
77
|
+
data: body,
|
|
78
|
+
})
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
async get(body: DevicesGetBody): Promise<DevicesGetResponse['device']> {
|
|
82
|
+
const { data } = await this.client.request<DevicesGetResponse>({
|
|
83
|
+
url: '/devices/get',
|
|
84
|
+
method: 'post',
|
|
85
|
+
data: body,
|
|
86
|
+
})
|
|
87
|
+
return data.device
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
async list(body: DevicesListBody): Promise<DevicesListResponse['devices']> {
|
|
91
|
+
const { data } = await this.client.request<DevicesListResponse>({
|
|
92
|
+
url: '/devices/list',
|
|
93
|
+
method: 'post',
|
|
94
|
+
data: body,
|
|
95
|
+
})
|
|
96
|
+
return data.devices
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
async listDeviceProviders(
|
|
100
|
+
body: DevicesListDeviceProvidersBody,
|
|
101
|
+
): Promise<DevicesListDeviceProvidersResponse['device_providers']> {
|
|
102
|
+
const { data } =
|
|
103
|
+
await this.client.request<DevicesListDeviceProvidersResponse>({
|
|
104
|
+
url: '/devices/list_device_providers',
|
|
105
|
+
method: 'post',
|
|
106
|
+
data: body,
|
|
107
|
+
})
|
|
108
|
+
return data.device_providers
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
async update(body: DevicesUpdateBody): Promise<void> {
|
|
112
|
+
await this.client.request<DevicesUpdateResponse>({
|
|
113
|
+
url: '/devices/update',
|
|
114
|
+
method: 'post',
|
|
115
|
+
data: body,
|
|
116
|
+
})
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export type DevicesDeleteBody = SetNonNullable<
|
|
121
|
+
Required<RouteRequestBody<'/devices/delete'>>
|
|
122
|
+
>
|
|
123
|
+
|
|
124
|
+
export type DevicesDeleteResponse = SetNonNullable<
|
|
125
|
+
Required<RouteResponse<'/devices/delete'>>
|
|
126
|
+
>
|
|
127
|
+
|
|
128
|
+
export type DevicesGetBody = SetNonNullable<
|
|
129
|
+
Required<RouteRequestBody<'/devices/get'>>
|
|
130
|
+
>
|
|
131
|
+
|
|
132
|
+
export type DevicesGetResponse = SetNonNullable<
|
|
133
|
+
Required<RouteResponse<'/devices/get'>>
|
|
134
|
+
>
|
|
135
|
+
|
|
136
|
+
export type DevicesListBody = SetNonNullable<
|
|
137
|
+
Required<RouteRequestBody<'/devices/list'>>
|
|
138
|
+
>
|
|
139
|
+
|
|
140
|
+
export type DevicesListResponse = SetNonNullable<
|
|
141
|
+
Required<RouteResponse<'/devices/list'>>
|
|
142
|
+
>
|
|
143
|
+
|
|
144
|
+
export type DevicesListDeviceProvidersBody = SetNonNullable<
|
|
145
|
+
Required<RouteRequestBody<'/devices/list_device_providers'>>
|
|
146
|
+
>
|
|
147
|
+
|
|
148
|
+
export type DevicesListDeviceProvidersResponse = SetNonNullable<
|
|
149
|
+
Required<RouteResponse<'/devices/list_device_providers'>>
|
|
150
|
+
>
|
|
151
|
+
|
|
152
|
+
export type DevicesUpdateBody = SetNonNullable<
|
|
153
|
+
Required<RouteRequestBody<'/devices/update'>>
|
|
154
|
+
>
|
|
155
|
+
|
|
156
|
+
export type DevicesUpdateResponse = SetNonNullable<
|
|
157
|
+
Required<RouteResponse<'/devices/update'>>
|
|
158
|
+
>
|
|
@@ -0,0 +1,100 @@
|
|
|
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 { Axios } from 'axios'
|
|
8
|
+
import type { SetNonNullable } from 'type-fest'
|
|
9
|
+
|
|
10
|
+
import { createAxiosClient } from 'lib/seam/connect/axios.js'
|
|
11
|
+
import {
|
|
12
|
+
isSeamHttpOptionsWithApiKey,
|
|
13
|
+
isSeamHttpOptionsWithClient,
|
|
14
|
+
isSeamHttpOptionsWithClientSessionToken,
|
|
15
|
+
SeamHttpInvalidOptionsError,
|
|
16
|
+
type SeamHttpOptions,
|
|
17
|
+
type SeamHttpOptionsWithApiKey,
|
|
18
|
+
type SeamHttpOptionsWithClient,
|
|
19
|
+
type SeamHttpOptionsWithClientSessionToken,
|
|
20
|
+
} from 'lib/seam/connect/client-options.js'
|
|
21
|
+
import { parseOptions } from 'lib/seam/connect/parse-options.js'
|
|
22
|
+
|
|
23
|
+
export class SeamHttpEvents {
|
|
24
|
+
client: Axios
|
|
25
|
+
|
|
26
|
+
constructor(apiKeyOrOptions: string | SeamHttpOptions) {
|
|
27
|
+
const options = parseOptions(apiKeyOrOptions)
|
|
28
|
+
this.client = createAxiosClient(options)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
static fromClient(
|
|
32
|
+
client: SeamHttpOptionsWithClient['client'],
|
|
33
|
+
options: Omit<SeamHttpOptionsWithClient, 'client'> = {},
|
|
34
|
+
): SeamHttpEvents {
|
|
35
|
+
const opts = { ...options, client }
|
|
36
|
+
if (!isSeamHttpOptionsWithClient(opts)) {
|
|
37
|
+
throw new SeamHttpInvalidOptionsError('Missing client')
|
|
38
|
+
}
|
|
39
|
+
return new SeamHttpEvents(opts)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
static fromApiKey(
|
|
43
|
+
apiKey: SeamHttpOptionsWithApiKey['apiKey'],
|
|
44
|
+
options: Omit<SeamHttpOptionsWithApiKey, 'apiKey'> = {},
|
|
45
|
+
): SeamHttpEvents {
|
|
46
|
+
const opts = { ...options, apiKey }
|
|
47
|
+
if (!isSeamHttpOptionsWithApiKey(opts)) {
|
|
48
|
+
throw new SeamHttpInvalidOptionsError('Missing apiKey')
|
|
49
|
+
}
|
|
50
|
+
return new SeamHttpEvents(opts)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
static fromClientSessionToken(
|
|
54
|
+
clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
|
|
55
|
+
options: Omit<
|
|
56
|
+
SeamHttpOptionsWithClientSessionToken,
|
|
57
|
+
'clientSessionToken'
|
|
58
|
+
> = {},
|
|
59
|
+
): SeamHttpEvents {
|
|
60
|
+
const opts = { ...options, clientSessionToken }
|
|
61
|
+
if (!isSeamHttpOptionsWithClientSessionToken(opts)) {
|
|
62
|
+
throw new SeamHttpInvalidOptionsError('Missing clientSessionToken')
|
|
63
|
+
}
|
|
64
|
+
return new SeamHttpEvents(opts)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
async get(body: EventsGetBody): Promise<EventsGetResponse['event']> {
|
|
68
|
+
const { data } = await this.client.request<EventsGetResponse>({
|
|
69
|
+
url: '/events/get',
|
|
70
|
+
method: 'post',
|
|
71
|
+
data: body,
|
|
72
|
+
})
|
|
73
|
+
return data.event
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
async list(body: EventsListBody): Promise<EventsListResponse['events']> {
|
|
77
|
+
const { data } = await this.client.request<EventsListResponse>({
|
|
78
|
+
url: '/events/list',
|
|
79
|
+
method: 'post',
|
|
80
|
+
data: body,
|
|
81
|
+
})
|
|
82
|
+
return data.events
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export type EventsGetBody = SetNonNullable<
|
|
87
|
+
Required<RouteRequestBody<'/events/get'>>
|
|
88
|
+
>
|
|
89
|
+
|
|
90
|
+
export type EventsGetResponse = SetNonNullable<
|
|
91
|
+
Required<RouteResponse<'/events/get'>>
|
|
92
|
+
>
|
|
93
|
+
|
|
94
|
+
export type EventsListBody = SetNonNullable<
|
|
95
|
+
Required<RouteRequestBody<'/events/list'>>
|
|
96
|
+
>
|
|
97
|
+
|
|
98
|
+
export type EventsListResponse = SetNonNullable<
|
|
99
|
+
Required<RouteResponse<'/events/list'>>
|
|
100
|
+
>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export * from './access-codes.js'
|
|
2
|
+
export * from './access-codes-unmanaged.js'
|
|
3
|
+
export * from './acs.js'
|
|
4
|
+
export * from './acs-access-groups.js'
|
|
5
|
+
export * from './acs-credentials.js'
|
|
6
|
+
export * from './acs-systems.js'
|
|
7
|
+
export * from './acs-users.js'
|
|
8
|
+
export * from './action-attempts.js'
|
|
9
|
+
export * from './client-sessions.js'
|
|
10
|
+
export * from './connect-webviews.js'
|
|
11
|
+
export * from './connected-accounts.js'
|
|
12
|
+
export * from './devices.js'
|
|
13
|
+
export * from './devices-unmanaged.js'
|
|
14
|
+
export * from './events.js'
|
|
15
|
+
export * from './locks.js'
|
|
16
|
+
export * from './noise-sensors.js'
|
|
17
|
+
export * from './noise-sensors-noise-thresholds.js'
|
|
18
|
+
export * from './thermostats.js'
|
|
19
|
+
export * from './thermostats-climate-setting-schedules.js'
|
|
20
|
+
export * from './webhooks.js'
|
|
21
|
+
export * from './workspaces.js'
|
|
@@ -0,0 +1,138 @@
|
|
|
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 { Axios } from 'axios'
|
|
8
|
+
import type { SetNonNullable } from 'type-fest'
|
|
9
|
+
|
|
10
|
+
import { createAxiosClient } from 'lib/seam/connect/axios.js'
|
|
11
|
+
import {
|
|
12
|
+
isSeamHttpOptionsWithApiKey,
|
|
13
|
+
isSeamHttpOptionsWithClient,
|
|
14
|
+
isSeamHttpOptionsWithClientSessionToken,
|
|
15
|
+
SeamHttpInvalidOptionsError,
|
|
16
|
+
type SeamHttpOptions,
|
|
17
|
+
type SeamHttpOptionsWithApiKey,
|
|
18
|
+
type SeamHttpOptionsWithClient,
|
|
19
|
+
type SeamHttpOptionsWithClientSessionToken,
|
|
20
|
+
} from 'lib/seam/connect/client-options.js'
|
|
21
|
+
import { parseOptions } from 'lib/seam/connect/parse-options.js'
|
|
22
|
+
|
|
23
|
+
export class SeamHttpLocks {
|
|
24
|
+
client: Axios
|
|
25
|
+
|
|
26
|
+
constructor(apiKeyOrOptions: string | SeamHttpOptions) {
|
|
27
|
+
const options = parseOptions(apiKeyOrOptions)
|
|
28
|
+
this.client = createAxiosClient(options)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
static fromClient(
|
|
32
|
+
client: SeamHttpOptionsWithClient['client'],
|
|
33
|
+
options: Omit<SeamHttpOptionsWithClient, 'client'> = {},
|
|
34
|
+
): SeamHttpLocks {
|
|
35
|
+
const opts = { ...options, client }
|
|
36
|
+
if (!isSeamHttpOptionsWithClient(opts)) {
|
|
37
|
+
throw new SeamHttpInvalidOptionsError('Missing client')
|
|
38
|
+
}
|
|
39
|
+
return new SeamHttpLocks(opts)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
static fromApiKey(
|
|
43
|
+
apiKey: SeamHttpOptionsWithApiKey['apiKey'],
|
|
44
|
+
options: Omit<SeamHttpOptionsWithApiKey, 'apiKey'> = {},
|
|
45
|
+
): SeamHttpLocks {
|
|
46
|
+
const opts = { ...options, apiKey }
|
|
47
|
+
if (!isSeamHttpOptionsWithApiKey(opts)) {
|
|
48
|
+
throw new SeamHttpInvalidOptionsError('Missing apiKey')
|
|
49
|
+
}
|
|
50
|
+
return new SeamHttpLocks(opts)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
static fromClientSessionToken(
|
|
54
|
+
clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
|
|
55
|
+
options: Omit<
|
|
56
|
+
SeamHttpOptionsWithClientSessionToken,
|
|
57
|
+
'clientSessionToken'
|
|
58
|
+
> = {},
|
|
59
|
+
): SeamHttpLocks {
|
|
60
|
+
const opts = { ...options, clientSessionToken }
|
|
61
|
+
if (!isSeamHttpOptionsWithClientSessionToken(opts)) {
|
|
62
|
+
throw new SeamHttpInvalidOptionsError('Missing clientSessionToken')
|
|
63
|
+
}
|
|
64
|
+
return new SeamHttpLocks(opts)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
async get(body: LocksGetBody): Promise<LocksGetResponse['device']> {
|
|
68
|
+
const { data } = await this.client.request<LocksGetResponse>({
|
|
69
|
+
url: '/locks/get',
|
|
70
|
+
method: 'post',
|
|
71
|
+
data: body,
|
|
72
|
+
})
|
|
73
|
+
return data.device
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
async list(body: LocksListBody): Promise<LocksListResponse['devices']> {
|
|
77
|
+
const { data } = await this.client.request<LocksListResponse>({
|
|
78
|
+
url: '/locks/list',
|
|
79
|
+
method: 'post',
|
|
80
|
+
data: body,
|
|
81
|
+
})
|
|
82
|
+
return data.devices
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
async lockDoor(
|
|
86
|
+
body: LocksLockDoorBody,
|
|
87
|
+
): Promise<LocksLockDoorResponse['action_attempt']> {
|
|
88
|
+
const { data } = await this.client.request<LocksLockDoorResponse>({
|
|
89
|
+
url: '/locks/lock_door',
|
|
90
|
+
method: 'post',
|
|
91
|
+
data: body,
|
|
92
|
+
})
|
|
93
|
+
return data.action_attempt
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
async unlockDoor(
|
|
97
|
+
body: LocksUnlockDoorBody,
|
|
98
|
+
): Promise<LocksUnlockDoorResponse['action_attempt']> {
|
|
99
|
+
const { data } = await this.client.request<LocksUnlockDoorResponse>({
|
|
100
|
+
url: '/locks/unlock_door',
|
|
101
|
+
method: 'post',
|
|
102
|
+
data: body,
|
|
103
|
+
})
|
|
104
|
+
return data.action_attempt
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export type LocksGetBody = SetNonNullable<
|
|
109
|
+
Required<RouteRequestBody<'/locks/get'>>
|
|
110
|
+
>
|
|
111
|
+
|
|
112
|
+
export type LocksGetResponse = SetNonNullable<
|
|
113
|
+
Required<RouteResponse<'/locks/get'>>
|
|
114
|
+
>
|
|
115
|
+
|
|
116
|
+
export type LocksListBody = SetNonNullable<
|
|
117
|
+
Required<RouteRequestBody<'/locks/list'>>
|
|
118
|
+
>
|
|
119
|
+
|
|
120
|
+
export type LocksListResponse = SetNonNullable<
|
|
121
|
+
Required<RouteResponse<'/locks/list'>>
|
|
122
|
+
>
|
|
123
|
+
|
|
124
|
+
export type LocksLockDoorBody = SetNonNullable<
|
|
125
|
+
Required<RouteRequestBody<'/locks/lock_door'>>
|
|
126
|
+
>
|
|
127
|
+
|
|
128
|
+
export type LocksLockDoorResponse = SetNonNullable<
|
|
129
|
+
Required<RouteResponse<'/locks/lock_door'>>
|
|
130
|
+
>
|
|
131
|
+
|
|
132
|
+
export type LocksUnlockDoorBody = SetNonNullable<
|
|
133
|
+
Required<RouteRequestBody<'/locks/unlock_door'>>
|
|
134
|
+
>
|
|
135
|
+
|
|
136
|
+
export type LocksUnlockDoorResponse = SetNonNullable<
|
|
137
|
+
Required<RouteResponse<'/locks/unlock_door'>>
|
|
138
|
+
>
|