@seamapi/http 2.33.0 → 2.35.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/lib/resources/access-code.d.ts +2 -2
- package/lib/resources/action-attempt.d.ts +63 -0
- package/lib/resources/camera-live-view-answer.d.ts +9 -0
- package/lib/resources/camera-live-view-answer.js +6 -0
- package/lib/resources/camera-live-view-answer.js.map +1 -0
- package/lib/resources/camera-live-view-session.d.ts +21 -0
- package/lib/resources/camera-live-view-session.js +6 -0
- package/lib/resources/camera-live-view-session.js.map +1 -0
- package/lib/resources/device-provider.d.ts +9 -1
- package/lib/resources/device.d.ts +34 -1
- package/lib/resources/event.d.ts +8 -0
- package/lib/resources/index.d.ts +3 -0
- package/lib/resources/media.d.ts +45 -0
- package/lib/resources/media.js +6 -0
- package/lib/resources/media.js.map +1 -0
- package/lib/resources/unmanaged-access-code.d.ts +2 -2
- package/lib/resources/unmanaged-device.d.ts +9 -1
- package/lib/routes/cameras/cameras.d.ts +19 -0
- package/lib/routes/cameras/cameras.js +89 -0
- package/lib/routes/cameras/cameras.js.map +1 -0
- package/lib/routes/cameras/index.d.ts +2 -0
- package/lib/routes/cameras/index.js +7 -0
- package/lib/routes/cameras/index.js.map +1 -0
- package/lib/routes/cameras/live-views/index.d.ts +1 -0
- package/lib/routes/cameras/live-views/index.js +6 -0
- package/lib/routes/cameras/live-views/index.js.map +1 -0
- package/lib/routes/cameras/live-views/live-views.d.ts +100 -0
- package/lib/routes/cameras/live-views/live-views.js +144 -0
- package/lib/routes/cameras/live-views/live-views.js.map +1 -0
- package/lib/routes/connect-webviews/connect-webviews.d.ts +1 -1
- package/lib/routes/devices/devices.d.ts +3 -3
- package/lib/routes/devices/unmanaged/unmanaged.d.ts +3 -3
- package/lib/routes/events/events.d.ts +2 -2
- package/lib/routes/index.d.ts +2 -0
- package/lib/routes/index.js +2 -0
- package/lib/routes/index.js.map +1 -1
- package/lib/routes/media/index.d.ts +1 -0
- package/lib/routes/media/index.js +6 -0
- package/lib/routes/media/index.js.map +1 -0
- package/lib/routes/media/media.d.ts +41 -0
- package/lib/routes/media/media.js +102 -0
- package/lib/routes/media/media.js.map +1 -0
- package/lib/routes/seam-http-endpoints.d.ts +31 -3
- package/lib/routes/seam-http-endpoints.js +58 -0
- package/lib/routes/seam-http-endpoints.js.map +1 -1
- package/lib/routes/seam-http.d.ts +4 -0
- package/lib/routes/seam-http.js +8 -0
- package/lib/routes/seam-http.js.map +1 -1
- package/lib/routes/thermostats/thermostats.d.ts +18 -0
- package/lib/routes/thermostats/thermostats.js +20 -0
- package/lib/routes/thermostats/thermostats.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +2 -2
- package/src/lib/resources/access-code.ts +2 -2
- package/src/lib/resources/action-attempt.ts +77 -0
- package/src/lib/resources/camera-live-view-answer.ts +14 -0
- package/src/lib/resources/camera-live-view-session.ts +29 -0
- package/src/lib/resources/device-provider.ts +9 -0
- package/src/lib/resources/device.ts +36 -0
- package/src/lib/resources/event.ts +8 -0
- package/src/lib/resources/index.ts +3 -0
- package/src/lib/resources/media.ts +54 -0
- package/src/lib/resources/unmanaged-access-code.ts +2 -2
- package/src/lib/resources/unmanaged-device.ts +9 -0
- package/src/lib/routes/cameras/cameras.ts +165 -0
- package/src/lib/routes/cameras/index.ts +7 -0
- package/src/lib/routes/cameras/live-views/index.ts +6 -0
- package/src/lib/routes/cameras/live-views/live-views.ts +316 -0
- package/src/lib/routes/connect-webviews/connect-webviews.ts +1 -0
- package/src/lib/routes/devices/devices.ts +3 -0
- package/src/lib/routes/devices/unmanaged/unmanaged.ts +3 -0
- package/src/lib/routes/events/events.ts +2 -2
- package/src/lib/routes/index.ts +2 -0
- package/src/lib/routes/media/index.ts +6 -0
- package/src/lib/routes/media/media.ts +203 -0
- package/src/lib/routes/seam-http-endpoints.ts +112 -0
- package/src/lib/routes/seam-http.ts +10 -0
- package/src/lib/routes/thermostats/thermostats.ts +49 -0
- package/src/lib/version.ts +1 -1
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Automatically generated by codegen/smith.ts.
|
|
3
|
+
* Do not edit this file or add other files to this directory.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
getAuthHeadersForClientSessionToken,
|
|
8
|
+
warnOnInsecureuserIdentifierKey,
|
|
9
|
+
} from 'lib/auth.js'
|
|
10
|
+
import { type Client, createClient } from 'lib/client.js'
|
|
11
|
+
import {
|
|
12
|
+
isSeamHttpOptionsWithApiKey,
|
|
13
|
+
isSeamHttpOptionsWithClient,
|
|
14
|
+
isSeamHttpOptionsWithClientSessionToken,
|
|
15
|
+
isSeamHttpOptionsWithConsoleSessionToken,
|
|
16
|
+
isSeamHttpOptionsWithPersonalAccessToken,
|
|
17
|
+
type SeamHttpFromPublishableKeyOptions,
|
|
18
|
+
SeamHttpInvalidOptionsError,
|
|
19
|
+
type SeamHttpOptions,
|
|
20
|
+
type SeamHttpOptionsWithApiKey,
|
|
21
|
+
type SeamHttpOptionsWithClient,
|
|
22
|
+
type SeamHttpOptionsWithClientSessionToken,
|
|
23
|
+
type SeamHttpOptionsWithConsoleSessionToken,
|
|
24
|
+
type SeamHttpOptionsWithPersonalAccessToken,
|
|
25
|
+
type SeamHttpRequestOptions,
|
|
26
|
+
} from 'lib/options.js'
|
|
27
|
+
import {
|
|
28
|
+
limitToSeamHttpRequestOptions,
|
|
29
|
+
parseOptions,
|
|
30
|
+
} from 'lib/parse-options.js'
|
|
31
|
+
import { SeamHttpClientSessions } from 'lib/routes/client-sessions/index.js'
|
|
32
|
+
import type { SeamPaginatedRequest } from 'lib/seam-http-request.js'
|
|
33
|
+
import { SeamPaginator } from 'lib/seam-paginator.js'
|
|
34
|
+
|
|
35
|
+
import { SeamHttpCamerasLiveViews } from './live-views/index.js'
|
|
36
|
+
|
|
37
|
+
export class SeamHttpCameras {
|
|
38
|
+
client: Client
|
|
39
|
+
readonly defaults: Required<SeamHttpRequestOptions>
|
|
40
|
+
|
|
41
|
+
constructor(apiKeyOrOptions: string | SeamHttpOptions = {}) {
|
|
42
|
+
const options = parseOptions(apiKeyOrOptions)
|
|
43
|
+
this.client = 'client' in options ? options.client : createClient(options)
|
|
44
|
+
this.defaults = limitToSeamHttpRequestOptions(options)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
static fromClient(
|
|
48
|
+
client: SeamHttpOptionsWithClient['client'],
|
|
49
|
+
options: Omit<SeamHttpOptionsWithClient, 'client'> = {},
|
|
50
|
+
): SeamHttpCameras {
|
|
51
|
+
const constructorOptions = { ...options, client }
|
|
52
|
+
if (!isSeamHttpOptionsWithClient(constructorOptions)) {
|
|
53
|
+
throw new SeamHttpInvalidOptionsError('Missing client')
|
|
54
|
+
}
|
|
55
|
+
return new SeamHttpCameras(constructorOptions)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
static fromApiKey(
|
|
59
|
+
apiKey: SeamHttpOptionsWithApiKey['apiKey'],
|
|
60
|
+
options: Omit<SeamHttpOptionsWithApiKey, 'apiKey'> = {},
|
|
61
|
+
): SeamHttpCameras {
|
|
62
|
+
const constructorOptions = { ...options, apiKey }
|
|
63
|
+
if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
|
|
64
|
+
throw new SeamHttpInvalidOptionsError('Missing apiKey')
|
|
65
|
+
}
|
|
66
|
+
return new SeamHttpCameras(constructorOptions)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
static fromClientSessionToken(
|
|
70
|
+
clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
|
|
71
|
+
options: Omit<
|
|
72
|
+
SeamHttpOptionsWithClientSessionToken,
|
|
73
|
+
'clientSessionToken'
|
|
74
|
+
> = {},
|
|
75
|
+
): SeamHttpCameras {
|
|
76
|
+
const constructorOptions = { ...options, clientSessionToken }
|
|
77
|
+
if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
|
|
78
|
+
throw new SeamHttpInvalidOptionsError('Missing clientSessionToken')
|
|
79
|
+
}
|
|
80
|
+
return new SeamHttpCameras(constructorOptions)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
static async fromPublishableKey(
|
|
84
|
+
publishableKey: string,
|
|
85
|
+
userIdentifierKey: string,
|
|
86
|
+
options: SeamHttpFromPublishableKeyOptions = {},
|
|
87
|
+
): Promise<SeamHttpCameras> {
|
|
88
|
+
warnOnInsecureuserIdentifierKey(userIdentifierKey)
|
|
89
|
+
const clientOptions = parseOptions({ ...options, publishableKey })
|
|
90
|
+
if (isSeamHttpOptionsWithClient(clientOptions)) {
|
|
91
|
+
throw new SeamHttpInvalidOptionsError(
|
|
92
|
+
'The client option cannot be used with SeamHttpCameras.fromPublishableKey',
|
|
93
|
+
)
|
|
94
|
+
}
|
|
95
|
+
const client = createClient(clientOptions)
|
|
96
|
+
const clientSessions = SeamHttpClientSessions.fromClient(client)
|
|
97
|
+
const { token } = await clientSessions.getOrCreate({
|
|
98
|
+
user_identifier_key: userIdentifierKey,
|
|
99
|
+
})
|
|
100
|
+
return SeamHttpCameras.fromClientSessionToken(token, options)
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
static fromConsoleSessionToken(
|
|
104
|
+
consoleSessionToken: SeamHttpOptionsWithConsoleSessionToken['consoleSessionToken'],
|
|
105
|
+
workspaceId: SeamHttpOptionsWithConsoleSessionToken['workspaceId'],
|
|
106
|
+
options: Omit<
|
|
107
|
+
SeamHttpOptionsWithConsoleSessionToken,
|
|
108
|
+
'consoleSessionToken' | 'workspaceId'
|
|
109
|
+
> = {},
|
|
110
|
+
): SeamHttpCameras {
|
|
111
|
+
const constructorOptions = { ...options, consoleSessionToken, workspaceId }
|
|
112
|
+
if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
|
|
113
|
+
throw new SeamHttpInvalidOptionsError(
|
|
114
|
+
'Missing consoleSessionToken or workspaceId',
|
|
115
|
+
)
|
|
116
|
+
}
|
|
117
|
+
return new SeamHttpCameras(constructorOptions)
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
static fromPersonalAccessToken(
|
|
121
|
+
personalAccessToken: SeamHttpOptionsWithPersonalAccessToken['personalAccessToken'],
|
|
122
|
+
workspaceId: SeamHttpOptionsWithPersonalAccessToken['workspaceId'],
|
|
123
|
+
options: Omit<
|
|
124
|
+
SeamHttpOptionsWithPersonalAccessToken,
|
|
125
|
+
'personalAccessToken' | 'workspaceId'
|
|
126
|
+
> = {},
|
|
127
|
+
): SeamHttpCameras {
|
|
128
|
+
const constructorOptions = { ...options, personalAccessToken, workspaceId }
|
|
129
|
+
if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
|
|
130
|
+
throw new SeamHttpInvalidOptionsError(
|
|
131
|
+
'Missing personalAccessToken or workspaceId',
|
|
132
|
+
)
|
|
133
|
+
}
|
|
134
|
+
return new SeamHttpCameras(constructorOptions)
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
createPaginator<const TResponse, const TResponseKey extends keyof TResponse>(
|
|
138
|
+
request: SeamPaginatedRequest<TResponse, TResponseKey>,
|
|
139
|
+
): SeamPaginator<TResponse, TResponseKey> {
|
|
140
|
+
return new SeamPaginator<TResponse, TResponseKey>(request)
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
async updateClientSessionToken(
|
|
144
|
+
clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
|
|
145
|
+
): Promise<void> {
|
|
146
|
+
const { headers } = this.client.defaults
|
|
147
|
+
const authHeaders = getAuthHeadersForClientSessionToken({
|
|
148
|
+
clientSessionToken,
|
|
149
|
+
})
|
|
150
|
+
for (const key of Object.keys(authHeaders)) {
|
|
151
|
+
if (headers[key] == null) {
|
|
152
|
+
throw new Error(
|
|
153
|
+
'Cannot update a clientSessionToken on a client created without a clientSessionToken',
|
|
154
|
+
)
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
this.client.defaults.headers = { ...headers, ...authHeaders }
|
|
158
|
+
const clientSessions = SeamHttpClientSessions.fromClient(this.client)
|
|
159
|
+
await clientSessions.get()
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
get liveViews(): SeamHttpCamerasLiveViews {
|
|
163
|
+
return SeamHttpCamerasLiveViews.fromClient(this.client, this.defaults)
|
|
164
|
+
}
|
|
165
|
+
}
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Automatically generated by codegen/smith.ts.
|
|
3
|
+
* Do not edit this file or add other files to this directory.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
getAuthHeadersForClientSessionToken,
|
|
8
|
+
warnOnInsecureuserIdentifierKey,
|
|
9
|
+
} from 'lib/auth.js'
|
|
10
|
+
import { type Client, createClient } from 'lib/client.js'
|
|
11
|
+
import {
|
|
12
|
+
isSeamHttpOptionsWithApiKey,
|
|
13
|
+
isSeamHttpOptionsWithClient,
|
|
14
|
+
isSeamHttpOptionsWithClientSessionToken,
|
|
15
|
+
isSeamHttpOptionsWithConsoleSessionToken,
|
|
16
|
+
isSeamHttpOptionsWithPersonalAccessToken,
|
|
17
|
+
type SeamHttpFromPublishableKeyOptions,
|
|
18
|
+
SeamHttpInvalidOptionsError,
|
|
19
|
+
type SeamHttpOptions,
|
|
20
|
+
type SeamHttpOptionsWithApiKey,
|
|
21
|
+
type SeamHttpOptionsWithClient,
|
|
22
|
+
type SeamHttpOptionsWithClientSessionToken,
|
|
23
|
+
type SeamHttpOptionsWithConsoleSessionToken,
|
|
24
|
+
type SeamHttpOptionsWithPersonalAccessToken,
|
|
25
|
+
type SeamHttpRequestOptions,
|
|
26
|
+
} from 'lib/options.js'
|
|
27
|
+
import {
|
|
28
|
+
limitToSeamHttpRequestOptions,
|
|
29
|
+
parseOptions,
|
|
30
|
+
} from 'lib/parse-options.js'
|
|
31
|
+
import type { CameraLiveViewAnswer } from 'lib/resources/camera-live-view-answer.js'
|
|
32
|
+
import type { CameraLiveViewSession } from 'lib/resources/camera-live-view-session.js'
|
|
33
|
+
import { SeamHttpClientSessions } from 'lib/routes/client-sessions/index.js'
|
|
34
|
+
import {
|
|
35
|
+
SeamHttpRequest,
|
|
36
|
+
type SeamPaginatedRequest,
|
|
37
|
+
} from 'lib/seam-http-request.js'
|
|
38
|
+
import { SeamPaginator } from 'lib/seam-paginator.js'
|
|
39
|
+
|
|
40
|
+
export class SeamHttpCamerasLiveViews {
|
|
41
|
+
client: Client
|
|
42
|
+
readonly defaults: Required<SeamHttpRequestOptions>
|
|
43
|
+
|
|
44
|
+
constructor(apiKeyOrOptions: string | SeamHttpOptions = {}) {
|
|
45
|
+
const options = parseOptions(apiKeyOrOptions)
|
|
46
|
+
this.client = 'client' in options ? options.client : createClient(options)
|
|
47
|
+
this.defaults = limitToSeamHttpRequestOptions(options)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
static fromClient(
|
|
51
|
+
client: SeamHttpOptionsWithClient['client'],
|
|
52
|
+
options: Omit<SeamHttpOptionsWithClient, 'client'> = {},
|
|
53
|
+
): SeamHttpCamerasLiveViews {
|
|
54
|
+
const constructorOptions = { ...options, client }
|
|
55
|
+
if (!isSeamHttpOptionsWithClient(constructorOptions)) {
|
|
56
|
+
throw new SeamHttpInvalidOptionsError('Missing client')
|
|
57
|
+
}
|
|
58
|
+
return new SeamHttpCamerasLiveViews(constructorOptions)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
static fromApiKey(
|
|
62
|
+
apiKey: SeamHttpOptionsWithApiKey['apiKey'],
|
|
63
|
+
options: Omit<SeamHttpOptionsWithApiKey, 'apiKey'> = {},
|
|
64
|
+
): SeamHttpCamerasLiveViews {
|
|
65
|
+
const constructorOptions = { ...options, apiKey }
|
|
66
|
+
if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
|
|
67
|
+
throw new SeamHttpInvalidOptionsError('Missing apiKey')
|
|
68
|
+
}
|
|
69
|
+
return new SeamHttpCamerasLiveViews(constructorOptions)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
static fromClientSessionToken(
|
|
73
|
+
clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
|
|
74
|
+
options: Omit<
|
|
75
|
+
SeamHttpOptionsWithClientSessionToken,
|
|
76
|
+
'clientSessionToken'
|
|
77
|
+
> = {},
|
|
78
|
+
): SeamHttpCamerasLiveViews {
|
|
79
|
+
const constructorOptions = { ...options, clientSessionToken }
|
|
80
|
+
if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
|
|
81
|
+
throw new SeamHttpInvalidOptionsError('Missing clientSessionToken')
|
|
82
|
+
}
|
|
83
|
+
return new SeamHttpCamerasLiveViews(constructorOptions)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
static async fromPublishableKey(
|
|
87
|
+
publishableKey: string,
|
|
88
|
+
userIdentifierKey: string,
|
|
89
|
+
options: SeamHttpFromPublishableKeyOptions = {},
|
|
90
|
+
): Promise<SeamHttpCamerasLiveViews> {
|
|
91
|
+
warnOnInsecureuserIdentifierKey(userIdentifierKey)
|
|
92
|
+
const clientOptions = parseOptions({ ...options, publishableKey })
|
|
93
|
+
if (isSeamHttpOptionsWithClient(clientOptions)) {
|
|
94
|
+
throw new SeamHttpInvalidOptionsError(
|
|
95
|
+
'The client option cannot be used with SeamHttpCamerasLiveViews.fromPublishableKey',
|
|
96
|
+
)
|
|
97
|
+
}
|
|
98
|
+
const client = createClient(clientOptions)
|
|
99
|
+
const clientSessions = SeamHttpClientSessions.fromClient(client)
|
|
100
|
+
const { token } = await clientSessions.getOrCreate({
|
|
101
|
+
user_identifier_key: userIdentifierKey,
|
|
102
|
+
})
|
|
103
|
+
return SeamHttpCamerasLiveViews.fromClientSessionToken(token, options)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
static fromConsoleSessionToken(
|
|
107
|
+
consoleSessionToken: SeamHttpOptionsWithConsoleSessionToken['consoleSessionToken'],
|
|
108
|
+
workspaceId: SeamHttpOptionsWithConsoleSessionToken['workspaceId'],
|
|
109
|
+
options: Omit<
|
|
110
|
+
SeamHttpOptionsWithConsoleSessionToken,
|
|
111
|
+
'consoleSessionToken' | 'workspaceId'
|
|
112
|
+
> = {},
|
|
113
|
+
): SeamHttpCamerasLiveViews {
|
|
114
|
+
const constructorOptions = { ...options, consoleSessionToken, workspaceId }
|
|
115
|
+
if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
|
|
116
|
+
throw new SeamHttpInvalidOptionsError(
|
|
117
|
+
'Missing consoleSessionToken or workspaceId',
|
|
118
|
+
)
|
|
119
|
+
}
|
|
120
|
+
return new SeamHttpCamerasLiveViews(constructorOptions)
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
static fromPersonalAccessToken(
|
|
124
|
+
personalAccessToken: SeamHttpOptionsWithPersonalAccessToken['personalAccessToken'],
|
|
125
|
+
workspaceId: SeamHttpOptionsWithPersonalAccessToken['workspaceId'],
|
|
126
|
+
options: Omit<
|
|
127
|
+
SeamHttpOptionsWithPersonalAccessToken,
|
|
128
|
+
'personalAccessToken' | 'workspaceId'
|
|
129
|
+
> = {},
|
|
130
|
+
): SeamHttpCamerasLiveViews {
|
|
131
|
+
const constructorOptions = { ...options, personalAccessToken, workspaceId }
|
|
132
|
+
if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
|
|
133
|
+
throw new SeamHttpInvalidOptionsError(
|
|
134
|
+
'Missing personalAccessToken or workspaceId',
|
|
135
|
+
)
|
|
136
|
+
}
|
|
137
|
+
return new SeamHttpCamerasLiveViews(constructorOptions)
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
createPaginator<const TResponse, const TResponseKey extends keyof TResponse>(
|
|
141
|
+
request: SeamPaginatedRequest<TResponse, TResponseKey>,
|
|
142
|
+
): SeamPaginator<TResponse, TResponseKey> {
|
|
143
|
+
return new SeamPaginator<TResponse, TResponseKey>(request)
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
async updateClientSessionToken(
|
|
147
|
+
clientSessionToken: SeamHttpOptionsWithClientSessionToken['clientSessionToken'],
|
|
148
|
+
): Promise<void> {
|
|
149
|
+
const { headers } = this.client.defaults
|
|
150
|
+
const authHeaders = getAuthHeadersForClientSessionToken({
|
|
151
|
+
clientSessionToken,
|
|
152
|
+
})
|
|
153
|
+
for (const key of Object.keys(authHeaders)) {
|
|
154
|
+
if (headers[key] == null) {
|
|
155
|
+
throw new Error(
|
|
156
|
+
'Cannot update a clientSessionToken on a client created without a clientSessionToken',
|
|
157
|
+
)
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
this.client.defaults.headers = { ...headers, ...authHeaders }
|
|
161
|
+
const clientSessions = SeamHttpClientSessions.fromClient(this.client)
|
|
162
|
+
await clientSessions.get()
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Creates a short-lived live view session for a single camera. Pass the returned session ID and token to `/cameras/live_views/offer` to start a WebRTC stream, and to `/cameras/live_views/stop` to end the session.
|
|
167
|
+
*
|
|
168
|
+
* Camera live view is in beta. To enable it for your workspace, contact Seam support. To check whether a camera supports live view, use `device.can_stream_live_video`.
|
|
169
|
+
*/
|
|
170
|
+
create(
|
|
171
|
+
parameters: CamerasLiveViewsCreateParameters,
|
|
172
|
+
options: CamerasLiveViewsCreateOptions = {},
|
|
173
|
+
): CamerasLiveViewsCreateRequest {
|
|
174
|
+
return new SeamHttpRequest(this, {
|
|
175
|
+
pathname: '/cameras/live_views/create',
|
|
176
|
+
method: 'POST',
|
|
177
|
+
body: parameters,
|
|
178
|
+
parameters,
|
|
179
|
+
hasRequiredParameters: true,
|
|
180
|
+
requiredParameterNames: ['device_id'],
|
|
181
|
+
atLeastOneParameterNames: [],
|
|
182
|
+
responseKey: 'camera_live_view_session',
|
|
183
|
+
options,
|
|
184
|
+
})
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Exchanges a WebRTC SDP offer for an SDP answer that starts streaming video from the camera, for a live view session that you created using `/cameras/live_views/create`.
|
|
189
|
+
*
|
|
190
|
+
* Camera live view is in beta. To enable it for your workspace, contact Seam support.
|
|
191
|
+
*/
|
|
192
|
+
offer(
|
|
193
|
+
parameters: CamerasLiveViewsOfferParameters,
|
|
194
|
+
options: CamerasLiveViewsOfferOptions = {},
|
|
195
|
+
): CamerasLiveViewsOfferRequest {
|
|
196
|
+
return new SeamHttpRequest(this, {
|
|
197
|
+
pathname: '/cameras/live_views/offer',
|
|
198
|
+
method: 'POST',
|
|
199
|
+
body: parameters,
|
|
200
|
+
parameters,
|
|
201
|
+
hasRequiredParameters: true,
|
|
202
|
+
requiredParameterNames: [
|
|
203
|
+
'camera_live_view_session_id',
|
|
204
|
+
'sdp_offer',
|
|
205
|
+
'token',
|
|
206
|
+
],
|
|
207
|
+
atLeastOneParameterNames: [],
|
|
208
|
+
responseKey: 'camera_live_view_answer',
|
|
209
|
+
options,
|
|
210
|
+
})
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Stops a camera live view session that the current client session owns.
|
|
215
|
+
*
|
|
216
|
+
* Camera live view is in beta. To enable it for your workspace, contact Seam support.
|
|
217
|
+
*/
|
|
218
|
+
stop(
|
|
219
|
+
parameters: CamerasLiveViewsStopParameters,
|
|
220
|
+
options: CamerasLiveViewsStopOptions = {},
|
|
221
|
+
): CamerasLiveViewsStopRequest {
|
|
222
|
+
return new SeamHttpRequest(this, {
|
|
223
|
+
pathname: '/cameras/live_views/stop',
|
|
224
|
+
method: 'POST',
|
|
225
|
+
body: parameters,
|
|
226
|
+
parameters,
|
|
227
|
+
hasRequiredParameters: true,
|
|
228
|
+
requiredParameterNames: ['camera_live_view_session_id', 'token'],
|
|
229
|
+
atLeastOneParameterNames: [],
|
|
230
|
+
responseKey: undefined,
|
|
231
|
+
options,
|
|
232
|
+
})
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
export type CamerasLiveViewsCreateParameters = {
|
|
237
|
+
/**
|
|
238
|
+
* ID of the camera to view.
|
|
239
|
+
*/
|
|
240
|
+
device_id: string
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Number of seconds for which the live view session is valid, up to 600.
|
|
244
|
+
*/
|
|
245
|
+
duration_seconds?: number | undefined
|
|
246
|
+
/**
|
|
247
|
+
* Indicates whether to include the camera's audio.
|
|
248
|
+
*/
|
|
249
|
+
include_audio?: boolean | undefined
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* @deprecated Use CamerasLiveViewsCreateRequest instead.
|
|
254
|
+
*/
|
|
255
|
+
export type CamerasLiveViewsCreateResponse = {
|
|
256
|
+
camera_live_view_session: CameraLiveViewSession
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
export type CamerasLiveViewsCreateRequest = SeamHttpRequest<
|
|
260
|
+
CamerasLiveViewsCreateResponse,
|
|
261
|
+
'camera_live_view_session'
|
|
262
|
+
>
|
|
263
|
+
|
|
264
|
+
export interface CamerasLiveViewsCreateOptions {}
|
|
265
|
+
|
|
266
|
+
export type CamerasLiveViewsOfferParameters = {
|
|
267
|
+
/**
|
|
268
|
+
* ID of the camera live view session.
|
|
269
|
+
*/
|
|
270
|
+
camera_live_view_session_id: string
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* WebRTC SDP offer from the viewer, limited to 64 KiB of UTF-8 data.
|
|
274
|
+
*/
|
|
275
|
+
sdp_offer: string
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Token returned when the camera live view session was created.
|
|
279
|
+
*/
|
|
280
|
+
token: string
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* @deprecated Use CamerasLiveViewsOfferRequest instead.
|
|
285
|
+
*/
|
|
286
|
+
export type CamerasLiveViewsOfferResponse = {
|
|
287
|
+
camera_live_view_answer: CameraLiveViewAnswer
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
export type CamerasLiveViewsOfferRequest = SeamHttpRequest<
|
|
291
|
+
CamerasLiveViewsOfferResponse,
|
|
292
|
+
'camera_live_view_answer'
|
|
293
|
+
>
|
|
294
|
+
|
|
295
|
+
export interface CamerasLiveViewsOfferOptions {}
|
|
296
|
+
|
|
297
|
+
export type CamerasLiveViewsStopParameters = {
|
|
298
|
+
/**
|
|
299
|
+
* ID of the camera live view session.
|
|
300
|
+
*/
|
|
301
|
+
camera_live_view_session_id: string
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Token returned when the camera live view session was created.
|
|
305
|
+
*/
|
|
306
|
+
token: string
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* @deprecated Use CamerasLiveViewsStopRequest instead.
|
|
311
|
+
*/
|
|
312
|
+
export type CamerasLiveViewsStopResponse = void
|
|
313
|
+
|
|
314
|
+
export type CamerasLiveViewsStopRequest = SeamHttpRequest<void, undefined>
|
|
315
|
+
|
|
316
|
+
export interface CamerasLiveViewsStopOptions {}
|
|
@@ -384,6 +384,7 @@ export type DevicesListParameters = {
|
|
|
384
384
|
| 'android_phone'
|
|
385
385
|
| 'ring_camera'
|
|
386
386
|
| 'tapo_camera'
|
|
387
|
+
| 'arlo_camera'
|
|
387
388
|
| undefined
|
|
388
389
|
/**
|
|
389
390
|
* Array of device types for which you want to list devices.
|
|
@@ -434,6 +435,7 @@ export type DevicesListParameters = {
|
|
|
434
435
|
| 'android_phone'
|
|
435
436
|
| 'ring_camera'
|
|
436
437
|
| 'tapo_camera'
|
|
438
|
+
| 'arlo_camera'
|
|
437
439
|
>
|
|
438
440
|
| undefined
|
|
439
441
|
/**
|
|
@@ -490,6 +492,7 @@ export type DevicesListParameters = {
|
|
|
490
492
|
| 'ultraloq'
|
|
491
493
|
| 'ring'
|
|
492
494
|
| 'tapo'
|
|
495
|
+
| 'arlo'
|
|
493
496
|
| 'ical'
|
|
494
497
|
| 'lodgify'
|
|
495
498
|
| 'hostaway'
|
|
@@ -331,6 +331,7 @@ export type DevicesUnmanagedListParameters = {
|
|
|
331
331
|
| 'android_phone'
|
|
332
332
|
| 'ring_camera'
|
|
333
333
|
| 'tapo_camera'
|
|
334
|
+
| 'arlo_camera'
|
|
334
335
|
| undefined
|
|
335
336
|
/**
|
|
336
337
|
* Array of device types for which you want to list devices.
|
|
@@ -381,6 +382,7 @@ export type DevicesUnmanagedListParameters = {
|
|
|
381
382
|
| 'android_phone'
|
|
382
383
|
| 'ring_camera'
|
|
383
384
|
| 'tapo_camera'
|
|
385
|
+
| 'arlo_camera'
|
|
384
386
|
>
|
|
385
387
|
| undefined
|
|
386
388
|
/**
|
|
@@ -437,6 +439,7 @@ export type DevicesUnmanagedListParameters = {
|
|
|
437
439
|
| 'ultraloq'
|
|
438
440
|
| 'ring'
|
|
439
441
|
| 'tapo'
|
|
442
|
+
| 'arlo'
|
|
440
443
|
| 'ical'
|
|
441
444
|
| 'lodgify'
|
|
442
445
|
| 'hostaway'
|
|
@@ -359,7 +359,7 @@ export type EventsListParameters = RequireAtLeastOne<
|
|
|
359
359
|
| 'access_code.delay_in_issuing'
|
|
360
360
|
| 'access_code.failed_to_issue'
|
|
361
361
|
| 'access_code.failed_to_update'
|
|
362
|
-
| 'access_code.
|
|
362
|
+
| 'access_code.failed_to_delete'
|
|
363
363
|
| 'access_code.deleted'
|
|
364
364
|
| 'access_code.delay_in_removing_from_device'
|
|
365
365
|
| 'access_code.failed_to_remove_from_device'
|
|
@@ -479,7 +479,7 @@ export type EventsListParameters = RequireAtLeastOne<
|
|
|
479
479
|
| 'access_code.delay_in_issuing'
|
|
480
480
|
| 'access_code.failed_to_issue'
|
|
481
481
|
| 'access_code.failed_to_update'
|
|
482
|
-
| 'access_code.
|
|
482
|
+
| 'access_code.failed_to_delete'
|
|
483
483
|
| 'access_code.deleted'
|
|
484
484
|
| 'access_code.delay_in_removing_from_device'
|
|
485
485
|
| 'access_code.failed_to_remove_from_device'
|
package/src/lib/routes/index.ts
CHANGED
|
@@ -8,6 +8,7 @@ export * from './access-grants/index.js'
|
|
|
8
8
|
export * from './access-methods/index.js'
|
|
9
9
|
export * from './acs/index.js'
|
|
10
10
|
export * from './action-attempts/index.js'
|
|
11
|
+
export * from './cameras/index.js'
|
|
11
12
|
export * from './client-sessions/index.js'
|
|
12
13
|
export * from './connect-webviews/index.js'
|
|
13
14
|
export * from './connected-accounts/index.js'
|
|
@@ -16,6 +17,7 @@ export * from './devices/index.js'
|
|
|
16
17
|
export * from './events/index.js'
|
|
17
18
|
export * from './instant-keys/index.js'
|
|
18
19
|
export * from './locks/index.js'
|
|
20
|
+
export * from './media/index.js'
|
|
19
21
|
export * from './noise-sensors/index.js'
|
|
20
22
|
export * from './phones/index.js'
|
|
21
23
|
export * from './seam-http.js'
|