@seamapi/http 2.34.0 → 2.36.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.
Files changed (84) hide show
  1. package/lib/resources/access-code.d.ts +1 -1
  2. package/lib/resources/acs-system.d.ts +1 -1
  3. package/lib/resources/action-attempt.d.ts +63 -0
  4. package/lib/resources/camera-live-view-answer.d.ts +9 -0
  5. package/lib/resources/camera-live-view-answer.js +6 -0
  6. package/lib/resources/camera-live-view-answer.js.map +1 -0
  7. package/lib/resources/camera-live-view-session.d.ts +21 -0
  8. package/lib/resources/camera-live-view-session.js +6 -0
  9. package/lib/resources/camera-live-view-session.js.map +1 -0
  10. package/lib/resources/device-provider.d.ts +9 -1
  11. package/lib/resources/device.d.ts +27 -2
  12. package/lib/resources/event.d.ts +8 -0
  13. package/lib/resources/index.d.ts +3 -0
  14. package/lib/resources/media.d.ts +49 -0
  15. package/lib/resources/media.js +6 -0
  16. package/lib/resources/media.js.map +1 -0
  17. package/lib/resources/unmanaged-access-code.d.ts +1 -1
  18. package/lib/resources/unmanaged-device.d.ts +10 -2
  19. package/lib/routes/cameras/cameras.d.ts +19 -0
  20. package/lib/routes/cameras/cameras.js +89 -0
  21. package/lib/routes/cameras/cameras.js.map +1 -0
  22. package/lib/routes/cameras/index.d.ts +2 -0
  23. package/lib/routes/cameras/index.js +7 -0
  24. package/lib/routes/cameras/index.js.map +1 -0
  25. package/lib/routes/cameras/live-views/index.d.ts +1 -0
  26. package/lib/routes/cameras/live-views/index.js +6 -0
  27. package/lib/routes/cameras/live-views/index.js.map +1 -0
  28. package/lib/routes/cameras/live-views/live-views.d.ts +100 -0
  29. package/lib/routes/cameras/live-views/live-views.js +144 -0
  30. package/lib/routes/cameras/live-views/live-views.js.map +1 -0
  31. package/lib/routes/client-sessions/client-sessions.d.ts +2 -2
  32. package/lib/routes/connect-webviews/connect-webviews.d.ts +1 -1
  33. package/lib/routes/customers/customers.d.ts +20 -12
  34. package/lib/routes/devices/devices.d.ts +3 -3
  35. package/lib/routes/devices/unmanaged/unmanaged.d.ts +3 -3
  36. package/lib/routes/index.d.ts +2 -0
  37. package/lib/routes/index.js +2 -0
  38. package/lib/routes/index.js.map +1 -1
  39. package/lib/routes/media/index.d.ts +1 -0
  40. package/lib/routes/media/index.js +6 -0
  41. package/lib/routes/media/index.js.map +1 -0
  42. package/lib/routes/media/media.d.ts +41 -0
  43. package/lib/routes/media/media.js +102 -0
  44. package/lib/routes/media/media.js.map +1 -0
  45. package/lib/routes/seam-http-endpoints.d.ts +31 -3
  46. package/lib/routes/seam-http-endpoints.js +58 -0
  47. package/lib/routes/seam-http-endpoints.js.map +1 -1
  48. package/lib/routes/seam-http.d.ts +4 -0
  49. package/lib/routes/seam-http.js +8 -0
  50. package/lib/routes/seam-http.js.map +1 -1
  51. package/lib/routes/thermostats/thermostats.d.ts +18 -0
  52. package/lib/routes/thermostats/thermostats.js +20 -0
  53. package/lib/routes/thermostats/thermostats.js.map +1 -1
  54. package/lib/version.d.ts +1 -1
  55. package/lib/version.js +1 -1
  56. package/package.json +2 -2
  57. package/src/lib/resources/access-code.ts +1 -1
  58. package/src/lib/resources/acs-system.ts +1 -1
  59. package/src/lib/resources/action-attempt.ts +77 -0
  60. package/src/lib/resources/camera-live-view-answer.ts +14 -0
  61. package/src/lib/resources/camera-live-view-session.ts +29 -0
  62. package/src/lib/resources/device-provider.ts +9 -0
  63. package/src/lib/resources/device.ts +29 -1
  64. package/src/lib/resources/event.ts +8 -0
  65. package/src/lib/resources/index.ts +3 -0
  66. package/src/lib/resources/media.ts +58 -0
  67. package/src/lib/resources/unmanaged-access-code.ts +1 -1
  68. package/src/lib/resources/unmanaged-device.ts +10 -1
  69. package/src/lib/routes/cameras/cameras.ts +165 -0
  70. package/src/lib/routes/cameras/index.ts +7 -0
  71. package/src/lib/routes/cameras/live-views/index.ts +6 -0
  72. package/src/lib/routes/cameras/live-views/live-views.ts +316 -0
  73. package/src/lib/routes/client-sessions/client-sessions.ts +2 -2
  74. package/src/lib/routes/connect-webviews/connect-webviews.ts +1 -0
  75. package/src/lib/routes/customers/customers.ts +20 -12
  76. package/src/lib/routes/devices/devices.ts +3 -0
  77. package/src/lib/routes/devices/unmanaged/unmanaged.ts +3 -0
  78. package/src/lib/routes/index.ts +2 -0
  79. package/src/lib/routes/media/index.ts +6 -0
  80. package/src/lib/routes/media/media.ts +203 -0
  81. package/src/lib/routes/seam-http-endpoints.ts +112 -0
  82. package/src/lib/routes/seam-http.ts +10 -0
  83. package/src/lib/routes/thermostats/thermostats.ts +49 -0
  84. package/src/lib/version.ts +1 -1
@@ -1801,6 +1801,83 @@ export type ActionAttempt =
1801
1801
  */
1802
1802
  action_attempt_id: string
1803
1803
 
1804
+ /**
1805
+ * Action attempt to track the status of returning a thermostat to its weekly program.
1806
+ */
1807
+ action_type: 'ACTIVATE_WEEKLY_PROGRAM'
1808
+
1809
+ /**
1810
+ * Error associated with the action.
1811
+ */
1812
+ error: null
1813
+ /**
1814
+ * Result of the action.
1815
+ */
1816
+ result: {}
1817
+
1818
+ status: 'success'
1819
+ }
1820
+ | {
1821
+ /**
1822
+ * ID of the action attempt.
1823
+ */
1824
+ action_attempt_id: string
1825
+
1826
+ /**
1827
+ * Action attempt to track the status of returning a thermostat to its weekly program.
1828
+ */
1829
+ action_type: 'ACTIVATE_WEEKLY_PROGRAM'
1830
+
1831
+ /**
1832
+ * Error associated with the action.
1833
+ */
1834
+ error: null
1835
+ /**
1836
+ * Result of the action.
1837
+ */
1838
+ result: null
1839
+
1840
+ status: 'pending'
1841
+ }
1842
+ | {
1843
+ /**
1844
+ * ID of the action attempt.
1845
+ */
1846
+ action_attempt_id: string
1847
+
1848
+ /**
1849
+ * Action attempt to track the status of returning a thermostat to its weekly program.
1850
+ */
1851
+ action_type: 'ACTIVATE_WEEKLY_PROGRAM'
1852
+
1853
+ /**
1854
+ * Error associated with the action.
1855
+ */
1856
+ error: {
1857
+ /**
1858
+ * Detailed description of the error. Provides insights into the issue and potentially how to rectify it.
1859
+ */
1860
+ message: string
1861
+
1862
+ /**
1863
+ * Type of the error.
1864
+ */
1865
+ type: string
1866
+ }
1867
+
1868
+ /**
1869
+ * Result of the action.
1870
+ */
1871
+ result: null
1872
+
1873
+ status: 'error'
1874
+ }
1875
+ | {
1876
+ /**
1877
+ * ID of the action attempt.
1878
+ */
1879
+ action_attempt_id: string
1880
+
1804
1881
  /**
1805
1882
  * Action attempt to track the status of simulating a keypad code entry.
1806
1883
  */
@@ -0,0 +1,14 @@
1
+ /*
2
+ * Automatically generated by codegen/smith.ts.
3
+ * Do not edit this file.
4
+ */
5
+
6
+ /**
7
+ * Represents the WebRTC SDP answer that starts streaming video from a camera for a live view session.
8
+ */
9
+ export type CameraLiveViewAnswer = {
10
+ /**
11
+ * WebRTC SDP answer for the offer, limited to 64 KiB of UTF-8 data.
12
+ */
13
+ sdp_answer: string
14
+ }
@@ -0,0 +1,29 @@
1
+ /*
2
+ * Automatically generated by codegen/smith.ts.
3
+ * Do not edit this file.
4
+ */
5
+
6
+ /**
7
+ * Represents a short-lived live view session for a single camera. Use the session ID and token to start a WebRTC stream and to stop the session.
8
+ */
9
+ export type CameraLiveViewSession = {
10
+ /**
11
+ * ID of the camera live view session.
12
+ */
13
+ camera_live_view_session_id: string
14
+
15
+ /**
16
+ * ID of the camera.
17
+ */
18
+ device_id: string
19
+
20
+ /**
21
+ * Date and time at which the live view session expires.
22
+ */
23
+ expires_at: string
24
+
25
+ /**
26
+ * Token that authorizes the offer and stop requests for this session.
27
+ */
28
+ token: string
29
+ }
@@ -4,6 +4,10 @@
4
4
  */
5
5
 
6
6
  export type DeviceProvider = {
7
+ /**
8
+ * Indicates whether the thermostat can be returned to its weekly program, the schedule that is configured on the device itself, releasing any hold that Seam has set.
9
+ */
10
+ can_activate_weekly_program?: boolean | undefined
7
11
  /**
8
12
  * Indicates whether the lock supports configuring automatic locking.
9
13
  */
@@ -76,6 +80,10 @@ export type DeviceProvider = {
76
80
  * Indicates whether the device supports simulating removal in a sandbox.
77
81
  */
78
82
  can_simulate_removal?: boolean | undefined
83
+ /**
84
+ * Indicates whether the camera supports streaming live video through a camera live view session.
85
+ */
86
+ can_stream_live_video?: boolean | undefined
79
87
  /**
80
88
  * Indicates whether the thermostat can be turned off.
81
89
  */
@@ -147,6 +155,7 @@ export type DeviceProvider = {
147
155
  | 'ring'
148
156
  | 'tapo'
149
157
  | 'arlo'
158
+ | 'reolink'
150
159
  | 'ical'
151
160
  | 'lodgify'
152
161
  | 'hostaway'
@@ -7,6 +7,10 @@
7
7
  * Represents a [device](https://www.seam.co/docs/core-concepts/devices) that has been connected to Seam.
8
8
  */
9
9
  export type Device = {
10
+ /**
11
+ * Indicates whether the thermostat can be returned to its weekly program, the schedule that is configured on the device itself, releasing any hold that Seam has set.
12
+ */
13
+ can_activate_weekly_program?: boolean | undefined
10
14
  /**
11
15
  * Indicates whether the lock supports configuring automatic locking.
12
16
  */
@@ -79,6 +83,10 @@ export type Device = {
79
83
  * Indicates whether the device supports simulating removal in a sandbox.
80
84
  */
81
85
  can_simulate_removal?: boolean | undefined
86
+ /**
87
+ * Indicates whether the camera supports streaming live video through a camera live view session.
88
+ */
89
+ can_stream_live_video?: boolean | undefined
82
90
  /**
83
91
  * Indicates whether the thermostat can be turned off.
84
92
  */
@@ -213,6 +221,7 @@ export type Device = {
213
221
  | 'ring_camera'
214
222
  | 'tapo_camera'
215
223
  | 'arlo_camera'
224
+ | 'reolink_camera'
216
225
 
217
226
  /**
218
227
  * Display name of the device, defaults to nickname (if it is set) or `properties.appearance.name`, otherwise. Enables administrators and users to identify the device easily, especially when there are numerous devices.
@@ -280,7 +289,7 @@ export type Device = {
280
289
  */
281
290
  message: string
282
291
  } /**
283
- * Indicates that Seam's integration user does not have sufficient permissions on the provider's system to which this device belongs, so Seam cannot manage access codes or unlock the device. See the error message for specifics, then either reauthorize the connected account in Seam or grant the integration user the required permissions in the provider's system.
292
+ * Indicates that the provider's system to which this device belongs is not letting Seam act on it, so Seam cannot manage access codes or unlock the device. The error message says which of three causes applies. Seam's integration user may not have sufficient permissions on the provider's system, or may have been suspended there: grant the integration user the required permissions in the provider's system, or reauthorize the connected account in Seam. The provider account or site may not have a valid subscription with the provider: set up or renew that subscription with the provider. Or the provider may have rejected the credential Seam uses to operate the device's hub: contact Seam support to re-activate it.
284
293
  */
285
294
  | {
286
295
  /**
@@ -1623,6 +1632,25 @@ export type Device = {
1623
1632
  timezone_raw_offset_ms?: number | undefined
1624
1633
  }
1625
1634
  | undefined
1635
+ /**
1636
+ * Metadata for a Reolink camera.
1637
+ */
1638
+ reolink_metadata?:
1639
+ | {
1640
+ /**
1641
+ * Firmware version reported by the camera.
1642
+ */
1643
+ firmware_version?: string | undefined
1644
+ /**
1645
+ * Hardware version reported by the camera.
1646
+ */
1647
+ hardware_version?: string | undefined
1648
+ /**
1649
+ * Model reported by the Reolink camera.
1650
+ */
1651
+ model?: string | undefined
1652
+ }
1653
+ | undefined
1626
1654
  /**
1627
1655
  * Metadata for a Ring device.
1628
1656
  */
@@ -6363,6 +6363,10 @@ export type SeamEvent =
6363
6363
  * URL to a thumbnail image captured at the time of activation.
6364
6364
  */
6365
6365
  image_url?: string | undefined
6366
+ /**
6367
+ * IDs of the media, such as a video clip and a thumbnail image, captured for this activation. Use `/media/get` to retrieve each one.
6368
+ */
6369
+ media_ids?: Array<string> | undefined
6366
6370
  /**
6367
6371
  * Sub-type of motion detected, if available.
6368
6372
  */
@@ -6425,6 +6429,10 @@ export type SeamEvent =
6425
6429
  * URL to a thumbnail image captured at the time the doorbell was pressed.
6426
6430
  */
6427
6431
  image_url?: string | undefined
6432
+ /**
6433
+ * IDs of the media, such as a video clip and a thumbnail image, captured when the doorbell was pressed. Use `/media/get` to retrieve each one.
6434
+ */
6435
+ media_ids?: Array<string> | undefined
6428
6436
  /**
6429
6437
  * Date and time at which the event occurred.
6430
6438
  */
@@ -14,6 +14,8 @@ export type { AcsSystem } from './acs-system.js'
14
14
  export type { AcsUser } from './acs-user.js'
15
15
  export type { ActionAttempt } from './action-attempt.js'
16
16
  export type { Batch } from './batch.js'
17
+ export type { CameraLiveViewAnswer } from './camera-live-view-answer.js'
18
+ export type { CameraLiveViewSession } from './camera-live-view-session.js'
17
19
  export type { ClientSession } from './client-session.js'
18
20
  export type { ConnectWebview } from './connect-webview.js'
19
21
  export type { ConnectedAccount } from './connected-account.js'
@@ -22,6 +24,7 @@ export type { Device } from './device.js'
22
24
  export type { DeviceProvider } from './device-provider.js'
23
25
  export type { SeamEvent } from './event.js'
24
26
  export type { InstantKey } from './instant-key.js'
27
+ export type { Media } from './media.js'
25
28
  export type { NoiseThreshold } from './noise-threshold.js'
26
29
  export type { Phone } from './phone.js'
27
30
  export type { Space } from './space.js'
@@ -0,0 +1,58 @@
1
+ /*
2
+ * Automatically generated by codegen/smith.ts.
3
+ * Do not edit this file.
4
+ */
5
+
6
+ /**
7
+ * Represents a piece of media, such as a video clip or a thumbnail image, that a device captured for an event. Media is in beta.
8
+ */
9
+ export type Media = {
10
+ /**
11
+ * MIME type of the media, such as `video/mp4` or `image/jpeg`.
12
+ */
13
+ content_type: string | null
14
+ /**
15
+ * Date and time at which the media was created.
16
+ */
17
+ created_at: string
18
+
19
+ /**
20
+ * ID of the device that captured the media.
21
+ */
22
+ device_id: string | null
23
+ /**
24
+ * ID of the event that the media belongs to.
25
+ */
26
+ event_id: string | null
27
+ /**
28
+ * Date and time at which the media stops being available. Null when Seam does not know when the media expires.
29
+ */
30
+ expires_at: string | null
31
+ /**
32
+ * ID of the media.
33
+ */
34
+ media_id: string
35
+
36
+ /**
37
+ * Type of the media: a video clip or a still image.
38
+ */
39
+ media_type: 'video' | 'image'
40
+
41
+ /**
42
+ * Status of the media. `pending` means that Seam is still retrieving the media. `available` means that `url` can be used to download it. `unavailable` means that no media exists for the event, and `failed` means that Seam could not retrieve it.
43
+ */
44
+ status: 'pending' | 'available' | 'unavailable' | 'failed'
45
+
46
+ /**
47
+ * Short-lived URL from which you can download the media. Null unless `status` is `available`. The URL expires after about five minutes. Call `/media/get` again for a new URL.
48
+ */
49
+ url: string | null
50
+ /**
51
+ * Video codec used to encode the media. Only present for video media. `hevc` (H.265) playback support varies by browser and device, so check compatibility before assuming a clip plays inline.
52
+ */
53
+ video_codec?: 'h264' | 'hevc' | undefined
54
+ /**
55
+ * ID of the workspace that contains the media.
56
+ */
57
+ workspace_id: string
58
+ }
@@ -430,7 +430,7 @@ export type UnmanagedAccessCode = {
430
430
  */
431
431
  message: string
432
432
  } /**
433
- * Indicates that Seam's integration user does not have sufficient permissions on the provider's system to which this device belongs, so Seam cannot manage access codes or unlock the device. See the error message for specifics, then either reauthorize the connected account in Seam or grant the integration user the required permissions in the provider's system.
433
+ * Indicates that the provider's system to which this device belongs is not letting Seam act on it, so Seam cannot manage access codes or unlock the device. The error message says which of three causes applies. Seam's integration user may not have sufficient permissions on the provider's system, or may have been suspended there: grant the integration user the required permissions in the provider's system, or reauthorize the connected account in Seam. The provider account or site may not have a valid subscription with the provider: set up or renew that subscription with the provider. Or the provider may have rejected the credential Seam uses to operate the device's hub: contact Seam support to re-activate it.
434
434
  */
435
435
  | {
436
436
  /**
@@ -7,6 +7,10 @@
7
7
  * Represents an [unmanaged device](https://www.seam.co/docs/core-concepts/devices/managed-and-unmanaged-devices). An unmanaged device has a limited set of visible properties and a subset of supported events. You cannot control an unmanaged device. Any [access codes](https://www.seam.co/docs/low-level-apis/smart-locks/access-codes/migrating-existing-access-codes) on an unmanaged device are unmanaged. To control an unmanaged device with Seam, [convert it to a managed device](https://www.seam.co/docs/core-concepts/devices/managed-and-unmanaged-devices#convert-an-unmanaged-device-to-managed).
8
8
  */
9
9
  export type UnmanagedDevice = {
10
+ /**
11
+ * Indicates whether the thermostat can be returned to its weekly program, the schedule that is configured on the device itself, releasing any hold that Seam has set.
12
+ */
13
+ can_activate_weekly_program?: boolean | undefined
10
14
  /**
11
15
  * Indicates whether the lock supports configuring automatic locking.
12
16
  */
@@ -79,6 +83,10 @@ export type UnmanagedDevice = {
79
83
  * Indicates whether the device supports simulating removal in a sandbox.
80
84
  */
81
85
  can_simulate_removal?: boolean | undefined
86
+ /**
87
+ * Indicates whether the camera supports streaming live video through a camera live view session.
88
+ */
89
+ can_stream_live_video?: boolean | undefined
82
90
  /**
83
91
  * Indicates whether the thermostat can be turned off.
84
92
  */
@@ -168,6 +176,7 @@ export type UnmanagedDevice = {
168
176
  | 'ring_camera'
169
177
  | 'tapo_camera'
170
178
  | 'arlo_camera'
179
+ | 'reolink_camera'
171
180
 
172
181
  /**
173
182
  * Display name of the device, defaults to nickname (if it is set) or `properties.appearance.name`, otherwise. Enables administrators and users to identify the device easily, especially when there are numerous devices.
@@ -235,7 +244,7 @@ export type UnmanagedDevice = {
235
244
  */
236
245
  message: string
237
246
  } /**
238
- * Indicates that Seam's integration user does not have sufficient permissions on the provider's system to which this device belongs, so Seam cannot manage access codes or unlock the device. See the error message for specifics, then either reauthorize the connected account in Seam or grant the integration user the required permissions in the provider's system.
247
+ * Indicates that the provider's system to which this device belongs is not letting Seam act on it, so Seam cannot manage access codes or unlock the device. The error message says which of three causes applies. Seam's integration user may not have sufficient permissions on the provider's system, or may have been suspended there: grant the integration user the required permissions in the provider's system, or reauthorize the connected account in Seam. The provider account or site may not have a valid subscription with the provider: set up or renew that subscription with the provider. Or the provider may have rejected the credential Seam uses to operate the device's hub: contact Seam support to re-activate it.
239
248
  */
240
249
  | {
241
250
  /**
@@ -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,7 @@
1
+ /*
2
+ * Automatically generated by codegen/smith.ts.
3
+ * Do not edit this file or add other files to this directory.
4
+ */
5
+
6
+ export * from './cameras.js'
7
+ export * from './live-views/index.js'
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Automatically generated by codegen/smith.ts.
3
+ * Do not edit this file or add other files to this directory.
4
+ */
5
+
6
+ export * from './live-views.js'