een-api-toolkit 0.1.2 → 0.1.7

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 (47) hide show
  1. package/CHANGELOG.md +10 -53
  2. package/dist/index.cjs +1 -1
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.ts +686 -1
  5. package/dist/index.js +457 -222
  6. package/dist/index.js.map +1 -1
  7. package/docs/AI-CONTEXT.md +293 -1
  8. package/examples/vue-bridges/.env.example +13 -0
  9. package/examples/vue-bridges/e2e/app.spec.ts +73 -0
  10. package/examples/vue-bridges/e2e/auth.spec.ts +206 -0
  11. package/examples/vue-bridges/index.html +13 -0
  12. package/examples/vue-bridges/package-lock.json +1583 -0
  13. package/examples/vue-bridges/package.json +28 -0
  14. package/examples/vue-bridges/playwright.config.ts +46 -0
  15. package/examples/vue-bridges/src/App.vue +108 -0
  16. package/examples/vue-bridges/src/main.ts +23 -0
  17. package/examples/vue-bridges/src/router/index.ts +68 -0
  18. package/examples/vue-bridges/src/views/BridgeDetail.vue +279 -0
  19. package/examples/vue-bridges/src/views/Bridges.vue +297 -0
  20. package/examples/vue-bridges/src/views/Callback.vue +76 -0
  21. package/examples/vue-bridges/src/views/Home.vue +150 -0
  22. package/examples/vue-bridges/src/views/Login.vue +33 -0
  23. package/examples/vue-bridges/src/views/Logout.vue +66 -0
  24. package/examples/vue-bridges/src/vite-env.d.ts +12 -0
  25. package/examples/vue-bridges/tsconfig.json +21 -0
  26. package/examples/vue-bridges/tsconfig.node.json +10 -0
  27. package/examples/vue-bridges/vite.config.ts +12 -0
  28. package/examples/vue-media/.env.example +5 -0
  29. package/examples/vue-media/e2e/app.spec.ts +55 -0
  30. package/examples/vue-media/e2e/auth.spec.ts +344 -0
  31. package/examples/vue-media/index.html +13 -0
  32. package/examples/vue-media/package-lock.json +1583 -0
  33. package/examples/vue-media/package.json +28 -0
  34. package/examples/vue-media/playwright.config.ts +28 -0
  35. package/examples/vue-media/src/App.vue +122 -0
  36. package/examples/vue-media/src/main.ts +22 -0
  37. package/examples/vue-media/src/router/index.ts +61 -0
  38. package/examples/vue-media/src/views/Callback.vue +76 -0
  39. package/examples/vue-media/src/views/Home.vue +86 -0
  40. package/examples/vue-media/src/views/LiveCamera.vue +330 -0
  41. package/examples/vue-media/src/views/Login.vue +32 -0
  42. package/examples/vue-media/src/views/Logout.vue +59 -0
  43. package/examples/vue-media/src/vite-env.d.ts +12 -0
  44. package/examples/vue-media/tsconfig.json +21 -0
  45. package/examples/vue-media/tsconfig.node.json +10 -0
  46. package/examples/vue-media/vite.config.ts +12 -0
  47. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -2,6 +2,145 @@ import { ComputedRef } from 'vue';
2
2
  import { Ref } from 'vue';
3
3
  import { StoreDefinition } from 'pinia';
4
4
 
5
+ /**
6
+ * Bridge entity from EEN API v3.0.
7
+ *
8
+ * @remarks
9
+ * Represents a bridge in the Eagle Eye Networks platform. Bridges are
10
+ * physical devices that connect cameras to the cloud. They aggregate
11
+ * video streams from multiple cameras and provide network connectivity.
12
+ *
13
+ * For more details on bridge management, see the
14
+ * [EEN API Documentation](https://developer.eagleeyenetworks.com/reference/listbridges).
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * import { getBridges, type Bridge } from 'een-api-toolkit'
19
+ *
20
+ * const { data, error } = await getBridges({ include: ['status'] })
21
+ * if (data) {
22
+ * data.results.forEach((bridge: Bridge) => {
23
+ * console.log(`${bridge.name}: ${bridge.status}`)
24
+ * })
25
+ * }
26
+ * ```
27
+ *
28
+ * @category Bridges
29
+ */
30
+ export declare interface Bridge {
31
+ /** Unique identifier for the bridge */
32
+ id: string;
33
+ /** Display name of the bridge */
34
+ name: string;
35
+ /** ID of the account this bridge belongs to */
36
+ accountId: string;
37
+ /** ID of the location where the bridge is installed */
38
+ locationId?: string | null;
39
+ /** Globally unique identifier */
40
+ guid?: string;
41
+ /** Timezone of the bridge location (IANA timezone name) */
42
+ timezone?: string;
43
+ /**
44
+ * Current status of the bridge.
45
+ *
46
+ * @remarks
47
+ * The API may return status as either a string or an object
48
+ * depending on the `include` parameters.
49
+ */
50
+ status?: BridgeStatus | {
51
+ connectionStatus?: BridgeStatus;
52
+ };
53
+ /** Tags assigned to this bridge for organization */
54
+ tags?: string[];
55
+ /** Device information (make, model, firmware) */
56
+ deviceInfo?: BridgeDeviceInfo;
57
+ /** Network information (IP addresses, MAC) */
58
+ networkInfo?: BridgeNetworkInfo;
59
+ /** Physical position of the bridge */
60
+ devicePosition?: BridgeDevicePosition;
61
+ /** Number of cameras connected to this bridge */
62
+ cameraCount?: number;
63
+ /** ISO 8601 timestamp when the bridge was created */
64
+ createdAt?: string;
65
+ /** ISO 8601 timestamp when the bridge was last updated */
66
+ updatedAt?: string;
67
+ }
68
+
69
+ /**
70
+ * Device information for a bridge.
71
+ *
72
+ * @remarks
73
+ * Contains hardware and firmware details about the physical bridge device.
74
+ *
75
+ * @category Bridges
76
+ */
77
+ export declare interface BridgeDeviceInfo {
78
+ /** Bridge manufacturer */
79
+ make?: string;
80
+ /** Bridge model */
81
+ model?: string;
82
+ /** Firmware version */
83
+ firmwareVersion?: string;
84
+ /** Serial number */
85
+ serialNumber?: string;
86
+ /** Hardware version */
87
+ hardwareVersion?: string;
88
+ }
89
+
90
+ /**
91
+ * Bridge position/location data.
92
+ *
93
+ * @remarks
94
+ * Physical location of the bridge.
95
+ *
96
+ * @category Bridges
97
+ */
98
+ export declare interface BridgeDevicePosition {
99
+ /** Latitude coordinate */
100
+ latitude?: number;
101
+ /** Longitude coordinate */
102
+ longitude?: number;
103
+ /** Altitude in meters */
104
+ altitude?: number;
105
+ /** Floor level */
106
+ floor?: number;
107
+ /** Direction bridge is facing (0-360 degrees) */
108
+ azimuth?: number;
109
+ }
110
+
111
+ /**
112
+ * Network information for a bridge.
113
+ *
114
+ * @remarks
115
+ * Contains network connectivity details for the bridge.
116
+ *
117
+ * @category Bridges
118
+ */
119
+ export declare interface BridgeNetworkInfo {
120
+ /** Local IP address of the bridge */
121
+ localIpAddress?: string;
122
+ /** Public IP address of the bridge */
123
+ publicIpAddress?: string;
124
+ /** MAC address */
125
+ macAddress?: string;
126
+ /** Subnet mask */
127
+ subnetMask?: string;
128
+ /** Default gateway */
129
+ gateway?: string;
130
+ /** DNS servers */
131
+ dnsServers?: string[];
132
+ }
133
+
134
+ /**
135
+ * Bridge status values from EEN API v3.0.
136
+ *
137
+ * @remarks
138
+ * Indicates the current operational state of a bridge.
139
+ *
140
+ * @category Bridges
141
+ */
142
+ export declare type BridgeStatus = 'online' | 'offline' | 'error' | 'idle' | 'registered' | 'attaching' | 'initializing';
143
+
5
144
  /**
6
145
  * Camera entity from EEN API v3.0.
7
146
  *
@@ -303,7 +442,7 @@ export declare interface EenToolkitConfig {
303
442
  *
304
443
  * @category Types
305
444
  */
306
- export declare type ErrorCode = 'AUTH_REQUIRED' | 'AUTH_FAILED' | 'TOKEN_EXPIRED' | 'API_ERROR' | 'NETWORK_ERROR' | 'VALIDATION_ERROR' | 'NOT_FOUND' | 'FORBIDDEN' | 'RATE_LIMITED' | 'UNKNOWN_ERROR';
445
+ export declare type ErrorCode = 'AUTH_REQUIRED' | 'AUTH_FAILED' | 'TOKEN_EXPIRED' | 'API_ERROR' | 'NETWORK_ERROR' | 'VALIDATION_ERROR' | 'NOT_FOUND' | 'FORBIDDEN' | 'RATE_LIMITED' | 'SERVICE_UNAVAILABLE' | 'UNKNOWN_ERROR';
307
446
 
308
447
  /* Excluded from this release type: failure */
309
448
 
@@ -317,6 +456,119 @@ export declare function getAccessToken(code: string): Promise<Result<TokenRespon
317
456
  */
318
457
  export declare function getAuthUrl(): string;
319
458
 
459
+ /**
460
+ * Get a specific bridge by ID.
461
+ *
462
+ * @remarks
463
+ * Fetches a single bridge from `/api/v3.0/bridges/{bridgeId}`. Use the `include`
464
+ * parameter to request additional fields.
465
+ *
466
+ * For more details, see the
467
+ * [EEN API Documentation](https://developer.eagleeyenetworks.com/reference/getbridge).
468
+ *
469
+ * @param bridgeId - The unique identifier of the bridge to fetch
470
+ * @param params - Optional parameters (e.g., include additional fields)
471
+ * @returns A Result containing the bridge or an error
472
+ *
473
+ * @example
474
+ * ```typescript
475
+ * import { getBridge } from 'een-api-toolkit'
476
+ *
477
+ * const { data, error } = await getBridge('bridge-123')
478
+ *
479
+ * if (error) {
480
+ * if (error.code === 'NOT_FOUND') {
481
+ * console.log('Bridge not found')
482
+ * }
483
+ * return
484
+ * }
485
+ *
486
+ * console.log(`Bridge: ${data.name} (${data.status})`)
487
+ *
488
+ * // With additional fields
489
+ * const { data: bridgeWithDetails } = await getBridge('bridge-123', {
490
+ * include: ['deviceInfo', 'networkInfo', 'status']
491
+ * })
492
+ * ```
493
+ *
494
+ * @category Bridges
495
+ */
496
+ export declare function getBridge(bridgeId: string, params?: GetBridgeParams): Promise<Result<Bridge>>;
497
+
498
+ /**
499
+ * Parameters for getting a single bridge.
500
+ *
501
+ * @remarks
502
+ * Valid include values: account, status, locationSummary, deviceAddress,
503
+ * timeZone, notes, tags, devicePosition, networkInfo, deviceInfo,
504
+ * effectivePermissions, firmware
505
+ *
506
+ * @example
507
+ * ```typescript
508
+ * import { getBridge } from 'een-api-toolkit'
509
+ *
510
+ * const { data } = await getBridge('bridge-123', {
511
+ * include: ['deviceInfo', 'status', 'networkInfo']
512
+ * })
513
+ * ```
514
+ *
515
+ * @category Bridges
516
+ */
517
+ export declare interface GetBridgeParams {
518
+ /**
519
+ * Additional fields to include in the response.
520
+ * Valid values: account, status, locationSummary, deviceAddress,
521
+ * timeZone, notes, tags, devicePosition, networkInfo, deviceInfo,
522
+ * effectivePermissions, firmware
523
+ */
524
+ include?: string[];
525
+ }
526
+
527
+ /**
528
+ * List bridges with optional pagination and filtering.
529
+ *
530
+ * @remarks
531
+ * Fetches a paginated list of bridges from `/api/v3.0/bridges`. Supports
532
+ * filtering options for location, status, tags, and more.
533
+ *
534
+ * For more details, see the
535
+ * [EEN API Documentation](https://developer.eagleeyenetworks.com/reference/listbridges).
536
+ *
537
+ * @param params - Optional pagination and filtering parameters
538
+ * @returns A Result containing a paginated list of bridges or an error
539
+ *
540
+ * @example
541
+ * ```typescript
542
+ * import { getBridges } from 'een-api-toolkit'
543
+ *
544
+ * // Basic usage
545
+ * const { data, error } = await getBridges()
546
+ * if (data) {
547
+ * console.log(`Found ${data.results.length} bridges`)
548
+ * }
549
+ *
550
+ * // With filters
551
+ * const { data } = await getBridges({
552
+ * pageSize: 50,
553
+ * status__in: ['online'],
554
+ * include: ['deviceInfo', 'networkInfo']
555
+ * })
556
+ *
557
+ * // Fetch all bridges
558
+ * let allBridges: Bridge[] = []
559
+ * let pageToken: string | undefined
560
+ * do {
561
+ * const { data, error } = await getBridges({ pageSize: 100, pageToken })
562
+ * if (error) break
563
+ * allBridges.push(...data.results)
564
+ * pageToken = data.nextPageToken
565
+ * } while (pageToken)
566
+ * ```
567
+ *
568
+ * @category Bridges
569
+ */
570
+ export declare function getBridges(params?: ListBridgesParams): Promise<Result<PaginatedResult<Bridge>>>;
571
+
320
572
  /**
321
573
  * Get a specific camera by ID.
322
574
  *
@@ -472,11 +724,200 @@ export declare function getConfig(): EenToolkitConfig;
472
724
  */
473
725
  export declare function getCurrentUser(): Promise<Result<UserProfile>>;
474
726
 
727
+ /**
728
+ * Get a live image from a camera.
729
+ *
730
+ * @remarks
731
+ * Fetches a new live image from the specified camera. This call waits until
732
+ * a new image is available from the device. The image is returned as a
733
+ * base64 data URL that can be used directly in an HTML img element.
734
+ *
735
+ * Note: Live images only support the 'preview' stream type.
736
+ *
737
+ * **Memory Considerations**: Images are loaded into memory and base64 encoded,
738
+ * adding ~33% size overhead. Typical preview images are <500KB. For high-frequency
739
+ * polling, consider implementing error backoff and limiting concurrent requests.
740
+ *
741
+ * For more details, see the
742
+ * [EEN API Documentation](https://developer.eagleeyenetworks.com/reference/getliveimage).
743
+ *
744
+ * @param params - Parameters including the required deviceId
745
+ * @returns A Result containing the live image data or an error
746
+ *
747
+ * @example
748
+ * ```typescript
749
+ * import { getLiveImage } from 'een-api-toolkit'
750
+ *
751
+ * const { data, error } = await getLiveImage({ deviceId: 'camera-123' })
752
+ *
753
+ * if (data) {
754
+ * // Display in an img element
755
+ * document.getElementById('cameraImage').src = data.imageData
756
+ * console.log('Image timestamp:', data.timestamp)
757
+ * }
758
+ *
759
+ * // Continuously update the image with proper error handling
760
+ * let isRunning = true
761
+ * async function refreshLoop() {
762
+ * const imgElement = document.getElementById('cameraImage') as HTMLImageElement
763
+ * while (isRunning) {
764
+ * const { data, error } = await getLiveImage({ deviceId: 'camera-123' })
765
+ * if (error) {
766
+ * console.error('Refresh failed:', error.message)
767
+ * break // Stop on error
768
+ * }
769
+ * if (data) {
770
+ * imgElement.src = data.imageData
771
+ * }
772
+ * await new Promise(r => setTimeout(r, 1000))
773
+ * }
774
+ * }
775
+ * // Call refreshLoop() to start, set isRunning = false to stop
776
+ * ```
777
+ *
778
+ * @category Media
779
+ */
780
+ export declare function getLiveImage(params: GetLiveImageParams): Promise<Result<LiveImageResult>>;
781
+
782
+ /**
783
+ * Parameters for getting a live image.
784
+ *
785
+ * @remarks
786
+ * Used to fetch a live image from a camera.
787
+ * Note: Live images only support 'preview' type.
788
+ *
789
+ * For more details, see the
790
+ * [EEN API Documentation](https://developer.eagleeyenetworks.com/reference/getliveimage).
791
+ *
792
+ * @example
793
+ * ```typescript
794
+ * import { getLiveImage } from 'een-api-toolkit'
795
+ *
796
+ * const { data } = await getLiveImage({
797
+ * deviceId: 'camera-123',
798
+ * type: 'preview'
799
+ * })
800
+ *
801
+ * if (data) {
802
+ * // Display the image in an <img> element
803
+ * imgElement.src = data.imageData
804
+ * }
805
+ * ```
806
+ *
807
+ * @category Media
808
+ */
809
+ export declare interface GetLiveImageParams {
810
+ /** The ID of the device (camera) - required */
811
+ deviceId: string;
812
+ /** Stream type - only 'preview' is supported for live images */
813
+ type?: 'preview';
814
+ }
815
+
475
816
  /**
476
817
  * Get the proxy URL
477
818
  */
478
819
  export declare function getProxyUrl(): string | undefined;
479
820
 
821
+ /**
822
+ * Get a recorded image from a camera.
823
+ *
824
+ * @remarks
825
+ * Fetches a recorded image from the specified camera at a specific timestamp.
826
+ * You can specify the desired timestamp using various operators (exact, gte, lte, etc.)
827
+ * or use a pageToken from a previous request to navigate through images.
828
+ *
829
+ * The image is returned as a base64 data URL that can be used directly in an HTML img element.
830
+ *
831
+ * Note: The 'main' type is rate-limited and requires an actual recording at the timestamp.
832
+ *
833
+ * For more details, see the
834
+ * [EEN API Documentation](https://developer.eagleeyenetworks.com/reference/getrecordedimage).
835
+ *
836
+ * @param params - Parameters including deviceId/pageToken and timestamp options
837
+ * @returns A Result containing the recorded image data or an error
838
+ *
839
+ * @example
840
+ * ```typescript
841
+ * import { getRecordedImage } from 'een-api-toolkit'
842
+ *
843
+ * // Get image at or after a specific time
844
+ * const { data, error } = await getRecordedImage({
845
+ * deviceId: 'camera-123',
846
+ * type: 'preview',
847
+ * timestamp__gte: '2024-01-15T10:00:00.000Z'
848
+ * })
849
+ *
850
+ * if (data) {
851
+ * imgElement.src = data.imageData
852
+ * console.log('Actual timestamp:', data.timestamp)
853
+ *
854
+ * // Get the next image using the token
855
+ * if (data.nextToken) {
856
+ * const { data: nextImage } = await getRecordedImage({
857
+ * pageToken: data.nextToken
858
+ * })
859
+ * }
860
+ * }
861
+ * ```
862
+ *
863
+ * @category Media
864
+ */
865
+ export declare function getRecordedImage(params: GetRecordedImageParams): Promise<Result<RecordedImageResult>>;
866
+
867
+ /**
868
+ * Parameters for getting a recorded image.
869
+ *
870
+ * @remarks
871
+ * Used to fetch a recorded image from a camera at a specific timestamp.
872
+ * Either deviceId with a timestamp parameter, or pageToken is required.
873
+ *
874
+ * For more details, see the
875
+ * [EEN API Documentation](https://developer.eagleeyenetworks.com/reference/getrecordedimage).
876
+ *
877
+ * @example
878
+ * ```typescript
879
+ * import { getRecordedImage } from 'een-api-toolkit'
880
+ *
881
+ * // Get image at or after a specific time
882
+ * const { data } = await getRecordedImage({
883
+ * deviceId: 'camera-123',
884
+ * type: 'preview',
885
+ * timestamp__gte: '2024-01-15T10:00:00.000Z'
886
+ * })
887
+ * ```
888
+ *
889
+ * @category Media
890
+ */
891
+ export declare interface GetRecordedImageParams {
892
+ /** The ID of the device (camera) - required unless using pageToken */
893
+ deviceId?: string;
894
+ /** Token from previous request to fetch next/previous image */
895
+ pageToken?: string;
896
+ /** Stream type (preview or main) */
897
+ type?: MediaStreamType;
898
+ /** Return first image with timestamp less than this value */
899
+ timestamp__lt?: string;
900
+ /** Return first image with timestamp less than or equal to this value */
901
+ timestamp__lte?: string;
902
+ /** Return image at this exact timestamp */
903
+ timestamp?: string;
904
+ /** Return first image with timestamp greater than or equal to this value */
905
+ timestamp__gte?: string;
906
+ /** Return first image with timestamp greater than this value */
907
+ timestamp__gt?: string;
908
+ /** List of overlay IDs to include */
909
+ overlayId__in?: string[];
910
+ /**
911
+ * Include options for overlays.
912
+ * Valid values: overlayEmbedded, overlaySvgHeader
913
+ */
914
+ include?: string[];
915
+ /** Target width for the returned image (32-7680) */
916
+ targetWidth?: number;
917
+ /** Target height for the returned image (32-4320) */
918
+ targetHeight?: number;
919
+ }
920
+
480
921
  /**
481
922
  * Get the redirect URI
482
923
  */
@@ -597,6 +1038,70 @@ export declare function handleAuthCallback(code: string, state: string): Promise
597
1038
  */
598
1039
  export declare function initEenToolkit(options?: EenToolkitConfig): void;
599
1040
 
1041
+ /**
1042
+ * Parameters for listing bridges.
1043
+ *
1044
+ * @remarks
1045
+ * Supports filtering options matching the EEN API v3.0.
1046
+ * All array parameters are sent as comma-separated values.
1047
+ *
1048
+ * For more details, see the
1049
+ * [EEN API Documentation](https://developer.eagleeyenetworks.com/reference/listbridges).
1050
+ *
1051
+ * @example
1052
+ * ```typescript
1053
+ * import { getBridges } from 'een-api-toolkit'
1054
+ *
1055
+ * // Get online bridges with pagination
1056
+ * const { data } = await getBridges({
1057
+ * pageSize: 50,
1058
+ * status__in: ['online'],
1059
+ * include: ['deviceInfo', 'networkInfo']
1060
+ * })
1061
+ *
1062
+ * // Filter by location
1063
+ * const { data: filtered } = await getBridges({
1064
+ * locationId__in: ['loc-123']
1065
+ * })
1066
+ * ```
1067
+ *
1068
+ * @category Bridges
1069
+ */
1070
+ export declare interface ListBridgesParams {
1071
+ /** Number of results per page (default: 100, max: 1000) */
1072
+ pageSize?: number;
1073
+ /** Token for fetching a specific page */
1074
+ pageToken?: string;
1075
+ /** Additional fields to include in the response */
1076
+ include?: string[];
1077
+ /** Fields to sort by (prefix with - for descending) */
1078
+ sort?: string[];
1079
+ /** Filter by location IDs */
1080
+ locationId__in?: string[];
1081
+ /** Filter by tags (all tags must be present) */
1082
+ tags__contains?: string[];
1083
+ /** Filter by tags (any tag must be present) */
1084
+ tags__any?: string[];
1085
+ /** Filter by exact name */
1086
+ name?: string;
1087
+ /** Filter by name containing substring (case-insensitive) */
1088
+ name__contains?: string;
1089
+ /** Filter by exact names (any match) */
1090
+ name__in?: string[];
1091
+ /** Filter by bridge IDs */
1092
+ id__in?: string[];
1093
+ /** Exclude bridge IDs */
1094
+ id__notIn?: string[];
1095
+ /** Full-text search query */
1096
+ q?: string;
1097
+ /** Minimum search relevance score */
1098
+ qRelevance__gte?: number;
1099
+ /** Filter by status values (any match) */
1100
+ status__in?: BridgeStatus[];
1101
+ /** Filter by status not equal to */
1102
+ status__ne?: BridgeStatus;
1103
+ }
1104
+
600
1105
  /**
601
1106
  * Parameters for listing cameras.
602
1107
  *
@@ -694,6 +1199,91 @@ export declare interface ListCamerasParams {
694
1199
  status__ne?: CameraStatus;
695
1200
  }
696
1201
 
1202
+ /**
1203
+ * List media intervals (recording periods) for a device.
1204
+ *
1205
+ * @remarks
1206
+ * Fetches a paginated list of time intervals for which recordings exist.
1207
+ * Use this to find available recordings for a camera.
1208
+ *
1209
+ * For more details, see the
1210
+ * [EEN API Documentation](https://developer.eagleeyenetworks.com/reference/listmedia).
1211
+ *
1212
+ * @param params - Required parameters including deviceId, type, mediaType, and startTimestamp
1213
+ * @returns A Result containing a paginated list of media intervals or an error
1214
+ *
1215
+ * @example
1216
+ * ```typescript
1217
+ * import { listMedia } from 'een-api-toolkit'
1218
+ *
1219
+ * // Get video recordings from the last hour
1220
+ * const { data, error } = await listMedia({
1221
+ * deviceId: 'camera-123',
1222
+ * type: 'preview',
1223
+ * mediaType: 'video',
1224
+ * startTimestamp: new Date(Date.now() - 3600000).toISOString()
1225
+ * })
1226
+ *
1227
+ * if (data) {
1228
+ * console.log(`Found ${data.results.length} recording intervals`)
1229
+ * data.results.forEach(interval => {
1230
+ * console.log(`${interval.startTimestamp} - ${interval.endTimestamp}`)
1231
+ * })
1232
+ * }
1233
+ * ```
1234
+ *
1235
+ * @category Media
1236
+ */
1237
+ export declare function listMedia(params: ListMediaParams): Promise<Result<PaginatedResult<MediaInterval>>>;
1238
+
1239
+ /**
1240
+ * Parameters for listing media intervals.
1241
+ *
1242
+ * @remarks
1243
+ * Used to query recording intervals for a device.
1244
+ *
1245
+ * For more details, see the
1246
+ * [EEN API Documentation](https://developer.eagleeyenetworks.com/reference/listmedia).
1247
+ *
1248
+ * @example
1249
+ * ```typescript
1250
+ * import { listMedia } from 'een-api-toolkit'
1251
+ *
1252
+ * // Get video recordings from the last hour
1253
+ * const { data } = await listMedia({
1254
+ * deviceId: 'camera-123',
1255
+ * type: 'preview',
1256
+ * mediaType: 'video',
1257
+ * startTimestamp: new Date(Date.now() - 3600000).toISOString()
1258
+ * })
1259
+ * ```
1260
+ *
1261
+ * @category Media
1262
+ */
1263
+ export declare interface ListMediaParams {
1264
+ /** The ID of the device (camera) - required */
1265
+ deviceId: string;
1266
+ /** Stream type (preview or main) - required */
1267
+ type: MediaStreamType;
1268
+ /** Media type (video or image) - required */
1269
+ mediaType: MediaType;
1270
+ /** Minimum timestamp from which to list recordings (ISO 8601) - required */
1271
+ startTimestamp: string;
1272
+ /** Maximum timestamp until which to list recordings (ISO 8601) */
1273
+ endTimestamp?: string;
1274
+ /** If true, coalesce connected intervals into a single interval (default: true) */
1275
+ coalesce?: boolean;
1276
+ /**
1277
+ * Additional fields to include in the response.
1278
+ * Valid values: flvUrl, rtspUrl, rtspsUrl, hlsUrl, multipartUrl, mp4Url, wsLiveUrl
1279
+ */
1280
+ include?: string[];
1281
+ /** Token for fetching a specific page */
1282
+ pageToken?: string;
1283
+ /** Number of results per page */
1284
+ pageSize?: number;
1285
+ }
1286
+
697
1287
  /**
698
1288
  * Parameters for listing users.
699
1289
  *
@@ -721,6 +1311,80 @@ export declare interface ListUsersParams {
721
1311
  include?: string[];
722
1312
  }
723
1313
 
1314
+ /**
1315
+ * Result of getting a live image.
1316
+ *
1317
+ * @remarks
1318
+ * Contains the image data as a base64 data URL and metadata from response headers.
1319
+ *
1320
+ * @category Media
1321
+ */
1322
+ export declare interface LiveImageResult {
1323
+ /** Base64 encoded image data URL (data:image/jpeg;base64,...) */
1324
+ imageData: string;
1325
+ /** Timestamp of the image (from X-Een-Timestamp header) */
1326
+ timestamp: string | null;
1327
+ /** Token to fetch the previous image (from X-Een-PrevToken header) */
1328
+ prevToken: string | null;
1329
+ }
1330
+
1331
+ /**
1332
+ * Media interval from EEN API v3.0.
1333
+ *
1334
+ * @remarks
1335
+ * Represents a time interval for which recordings exist.
1336
+ *
1337
+ * @category Media
1338
+ */
1339
+ export declare interface MediaInterval {
1340
+ /** Stream type (preview or main) */
1341
+ type: MediaStreamType;
1342
+ /** The device ID that generated the media */
1343
+ deviceId: string;
1344
+ /** Type of media contained (video or image) */
1345
+ mediaType: MediaType;
1346
+ /** Start time of the media interval (ISO 8601) */
1347
+ startTimestamp: string;
1348
+ /** End time of the media interval (ISO 8601) */
1349
+ endTimestamp: string;
1350
+ /** Flash video URL (if requested via include) */
1351
+ flvUrl?: string | null;
1352
+ /** RTSP URL (if requested via include) */
1353
+ rtspUrl?: string;
1354
+ /** RTSPS URL (if requested via include) */
1355
+ rtspsUrl?: string;
1356
+ /** HLS URL (if requested via include) */
1357
+ hlsUrl?: string | null;
1358
+ /** Multipart URL (if requested via include) */
1359
+ multipartUrl?: string;
1360
+ /** MP4 URL (if requested via include) */
1361
+ mp4Url?: string | null;
1362
+ /** WebSocket live URL (if requested via include) */
1363
+ wsLiveUrl?: string;
1364
+ }
1365
+
1366
+ /**
1367
+ * Stream type values from EEN API v3.0.
1368
+ *
1369
+ * @remarks
1370
+ * Indicates the quality/type of the media stream.
1371
+ * - `preview`: Low resolution, low framerate stream
1372
+ * - `main`: High resolution stream
1373
+ *
1374
+ * @category Media
1375
+ */
1376
+ export declare type MediaStreamType = 'preview' | 'main';
1377
+
1378
+ /**
1379
+ * Media type values from EEN API v3.0.
1380
+ *
1381
+ * @remarks
1382
+ * Indicates the type of media content.
1383
+ *
1384
+ * @category Media
1385
+ */
1386
+ export declare type MediaType = 'video' | 'image';
1387
+
724
1388
  /**
725
1389
  * Paginated response from list operations.
726
1390
  *
@@ -772,6 +1436,27 @@ export declare interface PaginationParams {
772
1436
  pageToken?: string;
773
1437
  }
774
1438
 
1439
+ /**
1440
+ * Result of getting a recorded image.
1441
+ *
1442
+ * @remarks
1443
+ * Contains the image data as a base64 data URL and metadata from response headers.
1444
+ *
1445
+ * @category Media
1446
+ */
1447
+ export declare interface RecordedImageResult {
1448
+ /** Base64 encoded image data URL (data:image/jpeg;base64,...) */
1449
+ imageData: string;
1450
+ /** Timestamp of the image (from X-Een-Timestamp header) */
1451
+ timestamp: string | null;
1452
+ /** Token to fetch the next image (from X-Een-NextToken header) */
1453
+ nextToken: string | null;
1454
+ /** Token to fetch the previous image (from X-Een-PrevToken header) */
1455
+ prevToken: string | null;
1456
+ /** SVG overlay data (from X-Een-OverlaySvg header, if requested) */
1457
+ overlaySvg: string | null;
1458
+ }
1459
+
775
1460
  /**
776
1461
  * Refresh the access token using stored refresh token
777
1462
  */