een-api-toolkit 0.0.18 → 0.1.4

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 (55) hide show
  1. package/CHANGELOG.md +8 -5
  2. package/README.md +29 -41
  3. package/dist/index.cjs +1 -1
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.d.ts +339 -821
  6. package/dist/index.js +295 -340
  7. package/dist/index.js.map +1 -1
  8. package/docs/AI-CONTEXT.md +151 -237
  9. package/examples/vue-bridges/.env.example +13 -0
  10. package/examples/vue-bridges/e2e/app.spec.ts +73 -0
  11. package/examples/vue-bridges/e2e/auth.spec.ts +206 -0
  12. package/examples/{vue-basic → vue-bridges}/index.html +1 -1
  13. package/examples/vue-bridges/package-lock.json +1583 -0
  14. package/examples/vue-bridges/package.json +28 -0
  15. package/examples/vue-bridges/playwright.config.ts +46 -0
  16. package/examples/vue-bridges/src/App.vue +108 -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-cameras/e2e/app.spec.ts +2 -2
  26. package/examples/vue-cameras/e2e/auth.spec.ts +206 -0
  27. package/examples/vue-cameras/src/App.vue +4 -4
  28. package/examples/vue-cameras/src/views/CameraDetail.vue +57 -9
  29. package/examples/vue-cameras/src/views/Cameras.vue +69 -18
  30. package/examples/vue-cameras/src/views/Home.vue +36 -11
  31. package/examples/{vue-basic → vue-users}/README.md +4 -4
  32. package/examples/{vue-basic → vue-users}/e2e/app.spec.ts +3 -3
  33. package/examples/{vue-basic → vue-users}/e2e/auth.spec.ts +2 -2
  34. package/examples/vue-users/index.html +13 -0
  35. package/examples/{vue-basic → vue-users}/package-lock.json +3 -3
  36. package/examples/{vue-basic → vue-users}/package.json +1 -1
  37. package/examples/{vue-basic → vue-users}/src/App.vue +1 -1
  38. package/examples/vue-users/src/main.ts +23 -0
  39. package/examples/{vue-basic → vue-users}/src/views/Home.vue +27 -12
  40. package/examples/{vue-basic → vue-users}/src/views/Users.vue +51 -10
  41. package/examples/vue-users/tsconfig.json +21 -0
  42. package/examples/vue-users/tsconfig.node.json +10 -0
  43. package/examples/vue-users/vite.config.ts +12 -0
  44. package/package.json +1 -1
  45. /package/examples/{vue-basic → vue-bridges}/src/main.ts +0 -0
  46. /package/examples/{vue-basic → vue-bridges}/tsconfig.json +0 -0
  47. /package/examples/{vue-basic → vue-bridges}/tsconfig.node.json +0 -0
  48. /package/examples/{vue-basic → vue-bridges}/vite.config.ts +0 -0
  49. /package/examples/{vue-basic → vue-users}/.env.example +0 -0
  50. /package/examples/{vue-basic → vue-users}/playwright.config.ts +0 -0
  51. /package/examples/{vue-basic → vue-users}/src/router/index.ts +0 -0
  52. /package/examples/{vue-basic → vue-users}/src/views/Callback.vue +0 -0
  53. /package/examples/{vue-basic → vue-users}/src/views/Login.vue +0 -0
  54. /package/examples/{vue-basic → vue-users}/src/views/Logout.vue +0 -0
  55. /package/examples/{vue-basic → vue-users}/src/vite-env.d.ts +0 -0
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
  *
@@ -46,7 +185,29 @@ export declare interface Camera {
46
185
  ipAddress?: string;
47
186
  /** Timezone of the camera location (IANA timezone name) */
48
187
  timezone?: string;
49
- /** Current status of the camera (string or object with connectionStatus) */
188
+ /**
189
+ * Current status of the camera.
190
+ *
191
+ * @remarks
192
+ * The API may return status as either a string (`CameraStatus`) or an object
193
+ * with a `connectionStatus` property, depending on the `include` parameters.
194
+ *
195
+ * Use the helper function to safely extract the status string:
196
+ * ```typescript
197
+ * function getStatusString(status?: CameraStatus | { connectionStatus?: CameraStatus }): CameraStatus | undefined {
198
+ * if (!status) return undefined
199
+ * if (typeof status === 'string') return status
200
+ * return status.connectionStatus
201
+ * }
202
+ * ```
203
+ *
204
+ * Or use optional chaining with type guards:
205
+ * ```typescript
206
+ * const statusValue = typeof camera.status === 'string'
207
+ * ? camera.status
208
+ * : camera.status?.connectionStatus
209
+ * ```
210
+ */
50
211
  status?: CameraStatus | {
51
212
  connectionStatus?: CameraStatus;
52
213
  };
@@ -295,6 +456,119 @@ export declare function getAccessToken(code: string): Promise<Result<TokenRespon
295
456
  */
296
457
  export declare function getAuthUrl(): string;
297
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
+
298
572
  /**
299
573
  * Get a specific camera by ID.
300
574
  *
@@ -575,6 +849,70 @@ export declare function handleAuthCallback(code: string, state: string): Promise
575
849
  */
576
850
  export declare function initEenToolkit(options?: EenToolkitConfig): void;
577
851
 
852
+ /**
853
+ * Parameters for listing bridges.
854
+ *
855
+ * @remarks
856
+ * Supports filtering options matching the EEN API v3.0.
857
+ * All array parameters are sent as comma-separated values.
858
+ *
859
+ * For more details, see the
860
+ * [EEN API Documentation](https://developer.eagleeyenetworks.com/reference/listbridges).
861
+ *
862
+ * @example
863
+ * ```typescript
864
+ * import { getBridges } from 'een-api-toolkit'
865
+ *
866
+ * // Get online bridges with pagination
867
+ * const { data } = await getBridges({
868
+ * pageSize: 50,
869
+ * status__in: ['online'],
870
+ * include: ['deviceInfo', 'networkInfo']
871
+ * })
872
+ *
873
+ * // Filter by location
874
+ * const { data: filtered } = await getBridges({
875
+ * locationId__in: ['loc-123']
876
+ * })
877
+ * ```
878
+ *
879
+ * @category Bridges
880
+ */
881
+ export declare interface ListBridgesParams {
882
+ /** Number of results per page (default: 100, max: 1000) */
883
+ pageSize?: number;
884
+ /** Token for fetching a specific page */
885
+ pageToken?: string;
886
+ /** Additional fields to include in the response */
887
+ include?: string[];
888
+ /** Fields to sort by (prefix with - for descending) */
889
+ sort?: string[];
890
+ /** Filter by location IDs */
891
+ locationId__in?: string[];
892
+ /** Filter by tags (all tags must be present) */
893
+ tags__contains?: string[];
894
+ /** Filter by tags (any tag must be present) */
895
+ tags__any?: string[];
896
+ /** Filter by exact name */
897
+ name?: string;
898
+ /** Filter by name containing substring (case-insensitive) */
899
+ name__contains?: string;
900
+ /** Filter by exact names (any match) */
901
+ name__in?: string[];
902
+ /** Filter by bridge IDs */
903
+ id__in?: string[];
904
+ /** Exclude bridge IDs */
905
+ id__notIn?: string[];
906
+ /** Full-text search query */
907
+ q?: string;
908
+ /** Minimum search relevance score */
909
+ qRelevance__gte?: number;
910
+ /** Filter by status values (any match) */
911
+ status__in?: BridgeStatus[];
912
+ /** Filter by status not equal to */
913
+ status__ne?: BridgeStatus;
914
+ }
915
+
578
916
  /**
579
917
  * Parameters for listing cameras.
580
918
  *
@@ -952,574 +1290,6 @@ logout: () => void;
952
1290
  initialize: () => void;
953
1291
  }, "setToken" | "setRefreshTokenMarker" | "setSessionId" | "setBaseUrl" | "setUserProfile" | "setupAutoRefresh" | "clearRefreshFailed" | "logout" | "initialize">>;
954
1292
 
955
- /**
956
- * Vue 3 composable for getting a single camera by ID.
957
- *
958
- * @remarks
959
- * Provides reactive access to a specific camera. The camera ID can be provided
960
- * as a string or a getter function (useful for reactive route params).
961
- *
962
- * @param cameraId - The camera ID (string or getter function)
963
- * @param options - Configuration options
964
- * @returns Reactive camera state and control functions
965
- *
966
- * @example
967
- * ```vue
968
- * <script setup>
969
- * import { useCamera } from 'een-api-toolkit'
970
- * import { useRoute } from 'vue-router'
971
- *
972
- * const route = useRoute()
973
- *
974
- * // Static ID
975
- * const { camera, loading, error } = useCamera('camera-123')
976
- *
977
- * // Or reactive ID from route
978
- * const { camera: routeCamera } = useCamera(() => route.params.id as string)
979
- * </script>
980
- *
981
- * <template>
982
- * <div v-if="loading">Loading...</div>
983
- * <div v-else-if="error">Error: {{ error.message }}</div>
984
- * <div v-else-if="camera">
985
- * <h1>{{ camera.name }}</h1>
986
- * <p>Status: {{ camera.status }}</p>
987
- * </div>
988
- * </template>
989
- * ```
990
- *
991
- * @example
992
- * ```typescript
993
- * // With additional fields
994
- * const { camera } = useCamera('camera-123', {
995
- * include: ['deviceInfo', 'status', 'shareDetails']
996
- * })
997
- *
998
- * // Access device info when loaded
999
- * watchEffect(() => {
1000
- * if (camera.value?.deviceInfo) {
1001
- * console.log('Camera make:', camera.value.deviceInfo.make)
1002
- * }
1003
- * })
1004
- * ```
1005
- *
1006
- * @category Cameras
1007
- */
1008
- export declare function useCamera(cameraId: string | (() => string), options?: UseCameraOptions): {
1009
- camera: Ref< {
1010
- id: string;
1011
- name: string;
1012
- accountId: string;
1013
- bridgeId?: string | null | undefined;
1014
- locationId?: string | null | undefined;
1015
- guid?: string | undefined;
1016
- macAddress?: string | undefined;
1017
- ipAddress?: string | undefined;
1018
- timezone?: string | undefined;
1019
- status?: CameraStatus | {
1020
- connectionStatus?: CameraStatus | undefined;
1021
- } | undefined;
1022
- tags?: string[] | undefined;
1023
- packages?: string[] | undefined;
1024
- multiCameraId?: string | null | undefined;
1025
- speakerId?: string | null | undefined;
1026
- deviceInfo?: {
1027
- make?: string | undefined;
1028
- model?: string | undefined;
1029
- firmwareVersion?: string | undefined;
1030
- directToCloud?: boolean | undefined;
1031
- serialNumber?: string | undefined;
1032
- resolution?: string | undefined;
1033
- type?: string | undefined;
1034
- } | undefined;
1035
- shareDetails?: {
1036
- shared?: boolean | undefined;
1037
- accountId?: string | undefined;
1038
- firstResponder?: boolean | undefined;
1039
- permissions?: string[] | undefined;
1040
- } | undefined;
1041
- streamUrls?: {
1042
- hls?: string | undefined;
1043
- rtsp?: string | undefined;
1044
- webrtc?: string | undefined;
1045
- jpeg?: string | undefined;
1046
- } | undefined;
1047
- rtspConnectionSettings?: {
1048
- url?: string | undefined;
1049
- username?: string | undefined;
1050
- password?: string | undefined;
1051
- transport?: "tcp" | "udp" | undefined;
1052
- } | undefined;
1053
- devicePosition?: {
1054
- latitude?: number | undefined;
1055
- longitude?: number | undefined;
1056
- altitude?: number | undefined;
1057
- floor?: number | undefined;
1058
- azimuth?: number | undefined;
1059
- } | undefined;
1060
- enabledAnalytics?: string[] | undefined;
1061
- recordingModes?: {
1062
- continuous?: boolean | undefined;
1063
- motion?: boolean | undefined;
1064
- scheduled?: boolean | undefined;
1065
- } | undefined;
1066
- createdAt?: string | undefined;
1067
- updatedAt?: string | undefined;
1068
- } | null, Camera | {
1069
- id: string;
1070
- name: string;
1071
- accountId: string;
1072
- bridgeId?: string | null | undefined;
1073
- locationId?: string | null | undefined;
1074
- guid?: string | undefined;
1075
- macAddress?: string | undefined;
1076
- ipAddress?: string | undefined;
1077
- timezone?: string | undefined;
1078
- status?: CameraStatus | {
1079
- connectionStatus?: CameraStatus | undefined;
1080
- } | undefined;
1081
- tags?: string[] | undefined;
1082
- packages?: string[] | undefined;
1083
- multiCameraId?: string | null | undefined;
1084
- speakerId?: string | null | undefined;
1085
- deviceInfo?: {
1086
- make?: string | undefined;
1087
- model?: string | undefined;
1088
- firmwareVersion?: string | undefined;
1089
- directToCloud?: boolean | undefined;
1090
- serialNumber?: string | undefined;
1091
- resolution?: string | undefined;
1092
- type?: string | undefined;
1093
- } | undefined;
1094
- shareDetails?: {
1095
- shared?: boolean | undefined;
1096
- accountId?: string | undefined;
1097
- firstResponder?: boolean | undefined;
1098
- permissions?: string[] | undefined;
1099
- } | undefined;
1100
- streamUrls?: {
1101
- hls?: string | undefined;
1102
- rtsp?: string | undefined;
1103
- webrtc?: string | undefined;
1104
- jpeg?: string | undefined;
1105
- } | undefined;
1106
- rtspConnectionSettings?: {
1107
- url?: string | undefined;
1108
- username?: string | undefined;
1109
- password?: string | undefined;
1110
- transport?: "tcp" | "udp" | undefined;
1111
- } | undefined;
1112
- devicePosition?: {
1113
- latitude?: number | undefined;
1114
- longitude?: number | undefined;
1115
- altitude?: number | undefined;
1116
- floor?: number | undefined;
1117
- azimuth?: number | undefined;
1118
- } | undefined;
1119
- enabledAnalytics?: string[] | undefined;
1120
- recordingModes?: {
1121
- continuous?: boolean | undefined;
1122
- motion?: boolean | undefined;
1123
- scheduled?: boolean | undefined;
1124
- } | undefined;
1125
- createdAt?: string | undefined;
1126
- updatedAt?: string | undefined;
1127
- } | null>;
1128
- loading: Ref<boolean, boolean>;
1129
- error: Ref< {
1130
- code: ErrorCode;
1131
- message: string;
1132
- status?: number | undefined;
1133
- details?: unknown;
1134
- } | null, EenError | {
1135
- code: ErrorCode;
1136
- message: string;
1137
- status?: number | undefined;
1138
- details?: unknown;
1139
- } | null>;
1140
- fetch: (params?: GetCameraParams) => Promise<Result<Camera>>;
1141
- refresh: () => Promise<Result<Camera>>;
1142
- };
1143
-
1144
- /**
1145
- * Options for the useCamera composable.
1146
- *
1147
- * @category Cameras
1148
- */
1149
- export declare interface UseCameraOptions {
1150
- /**
1151
- * Whether to fetch the camera immediately on mount.
1152
- * @defaultValue true
1153
- */
1154
- immediate?: boolean;
1155
- /**
1156
- * Additional fields to include in the response.
1157
- */
1158
- include?: string[];
1159
- }
1160
-
1161
- /**
1162
- * Vue 3 composable for listing cameras with pagination.
1163
- *
1164
- * @remarks
1165
- * Provides reactive access to a paginated list of cameras with built-in
1166
- * pagination controls. Automatically fetches on mount unless disabled.
1167
- *
1168
- * @param initialParams - Initial pagination/filter parameters
1169
- * @param options - Configuration options
1170
- * @returns Reactive cameras state and pagination controls
1171
- *
1172
- * @example
1173
- * ```vue
1174
- * <script setup>
1175
- * import { useCameras } from 'een-api-toolkit'
1176
- *
1177
- * const {
1178
- * cameras,
1179
- * loading,
1180
- * error,
1181
- * hasNextPage,
1182
- * fetchNextPage,
1183
- * refresh
1184
- * } = useCameras({ pageSize: 20, status__in: ['online'] })
1185
- * </script>
1186
- *
1187
- * <template>
1188
- * <div v-if="loading">Loading...</div>
1189
- * <div v-else-if="error">Error: {{ error.message }}</div>
1190
- * <div v-else>
1191
- * <ul>
1192
- * <li v-for="camera in cameras" :key="camera.id">
1193
- * {{ camera.name }} ({{ camera.status }})
1194
- * </li>
1195
- * </ul>
1196
- * <button v-if="hasNextPage" @click="fetchNextPage">Load More</button>
1197
- * <button @click="refresh">Refresh</button>
1198
- * </div>
1199
- * </template>
1200
- * ```
1201
- *
1202
- * @example
1203
- * ```typescript
1204
- * // Change parameters dynamically
1205
- * const { cameras, setParams, fetch } = useCameras()
1206
- *
1207
- * async function filterByStatus(status: string) {
1208
- * setParams({ pageSize: 50, status__in: [status] })
1209
- * await fetch()
1210
- * }
1211
- * ```
1212
- *
1213
- * @category Cameras
1214
- */
1215
- export declare function useCameras(initialParams?: ListCamerasParams, options?: UseCamerasOptions): {
1216
- cameras: Ref< {
1217
- id: string;
1218
- name: string;
1219
- accountId: string;
1220
- bridgeId?: string | null | undefined;
1221
- locationId?: string | null | undefined;
1222
- guid?: string | undefined;
1223
- macAddress?: string | undefined;
1224
- ipAddress?: string | undefined;
1225
- timezone?: string | undefined;
1226
- status?: CameraStatus | {
1227
- connectionStatus?: CameraStatus | undefined;
1228
- } | undefined;
1229
- tags?: string[] | undefined;
1230
- packages?: string[] | undefined;
1231
- multiCameraId?: string | null | undefined;
1232
- speakerId?: string | null | undefined;
1233
- deviceInfo?: {
1234
- make?: string | undefined;
1235
- model?: string | undefined;
1236
- firmwareVersion?: string | undefined;
1237
- directToCloud?: boolean | undefined;
1238
- serialNumber?: string | undefined;
1239
- resolution?: string | undefined;
1240
- type?: string | undefined;
1241
- } | undefined;
1242
- shareDetails?: {
1243
- shared?: boolean | undefined;
1244
- accountId?: string | undefined;
1245
- firstResponder?: boolean | undefined;
1246
- permissions?: string[] | undefined;
1247
- } | undefined;
1248
- streamUrls?: {
1249
- hls?: string | undefined;
1250
- rtsp?: string | undefined;
1251
- webrtc?: string | undefined;
1252
- jpeg?: string | undefined;
1253
- } | undefined;
1254
- rtspConnectionSettings?: {
1255
- url?: string | undefined;
1256
- username?: string | undefined;
1257
- password?: string | undefined;
1258
- transport?: "tcp" | "udp" | undefined;
1259
- } | undefined;
1260
- devicePosition?: {
1261
- latitude?: number | undefined;
1262
- longitude?: number | undefined;
1263
- altitude?: number | undefined;
1264
- floor?: number | undefined;
1265
- azimuth?: number | undefined;
1266
- } | undefined;
1267
- enabledAnalytics?: string[] | undefined;
1268
- recordingModes?: {
1269
- continuous?: boolean | undefined;
1270
- motion?: boolean | undefined;
1271
- scheduled?: boolean | undefined;
1272
- } | undefined;
1273
- createdAt?: string | undefined;
1274
- updatedAt?: string | undefined;
1275
- }[], Camera[] | {
1276
- id: string;
1277
- name: string;
1278
- accountId: string;
1279
- bridgeId?: string | null | undefined;
1280
- locationId?: string | null | undefined;
1281
- guid?: string | undefined;
1282
- macAddress?: string | undefined;
1283
- ipAddress?: string | undefined;
1284
- timezone?: string | undefined;
1285
- status?: CameraStatus | {
1286
- connectionStatus?: CameraStatus | undefined;
1287
- } | undefined;
1288
- tags?: string[] | undefined;
1289
- packages?: string[] | undefined;
1290
- multiCameraId?: string | null | undefined;
1291
- speakerId?: string | null | undefined;
1292
- deviceInfo?: {
1293
- make?: string | undefined;
1294
- model?: string | undefined;
1295
- firmwareVersion?: string | undefined;
1296
- directToCloud?: boolean | undefined;
1297
- serialNumber?: string | undefined;
1298
- resolution?: string | undefined;
1299
- type?: string | undefined;
1300
- } | undefined;
1301
- shareDetails?: {
1302
- shared?: boolean | undefined;
1303
- accountId?: string | undefined;
1304
- firstResponder?: boolean | undefined;
1305
- permissions?: string[] | undefined;
1306
- } | undefined;
1307
- streamUrls?: {
1308
- hls?: string | undefined;
1309
- rtsp?: string | undefined;
1310
- webrtc?: string | undefined;
1311
- jpeg?: string | undefined;
1312
- } | undefined;
1313
- rtspConnectionSettings?: {
1314
- url?: string | undefined;
1315
- username?: string | undefined;
1316
- password?: string | undefined;
1317
- transport?: "tcp" | "udp" | undefined;
1318
- } | undefined;
1319
- devicePosition?: {
1320
- latitude?: number | undefined;
1321
- longitude?: number | undefined;
1322
- altitude?: number | undefined;
1323
- floor?: number | undefined;
1324
- azimuth?: number | undefined;
1325
- } | undefined;
1326
- enabledAnalytics?: string[] | undefined;
1327
- recordingModes?: {
1328
- continuous?: boolean | undefined;
1329
- motion?: boolean | undefined;
1330
- scheduled?: boolean | undefined;
1331
- } | undefined;
1332
- createdAt?: string | undefined;
1333
- updatedAt?: string | undefined;
1334
- }[]>;
1335
- loading: Ref<boolean, boolean>;
1336
- error: Ref< {
1337
- code: ErrorCode;
1338
- message: string;
1339
- status?: number | undefined;
1340
- details?: unknown;
1341
- } | null, EenError | {
1342
- code: ErrorCode;
1343
- message: string;
1344
- status?: number | undefined;
1345
- details?: unknown;
1346
- } | null>;
1347
- nextPageToken: Ref<string | undefined, string | undefined>;
1348
- prevPageToken: Ref<string | undefined, string | undefined>;
1349
- totalSize: Ref<number | undefined, number | undefined>;
1350
- hasNextPage: ComputedRef<boolean>;
1351
- hasPrevPage: ComputedRef<boolean>;
1352
- params: Ref< {
1353
- pageSize?: number | undefined;
1354
- pageToken?: string | undefined;
1355
- include?: string[] | undefined;
1356
- sort?: string[] | undefined;
1357
- locationId__in?: string[] | undefined;
1358
- bridgeId__in?: string[] | undefined;
1359
- multiCameraId?: string | undefined;
1360
- multiCameraId__ne?: string | undefined;
1361
- multiCameraId__in?: string[] | undefined;
1362
- tags__contains?: string[] | undefined;
1363
- tags__any?: string[] | undefined;
1364
- packages__contains?: string[] | undefined;
1365
- name?: string | undefined;
1366
- name__contains?: string | undefined;
1367
- name__in?: string[] | undefined;
1368
- id__in?: string[] | undefined;
1369
- id__notIn?: string[] | undefined;
1370
- id__contains?: string | undefined;
1371
- layoutId?: string | undefined;
1372
- shared?: boolean | undefined;
1373
- sharedCameraAccount?: string | undefined;
1374
- firstResponder?: boolean | undefined;
1375
- directToCloud?: boolean | undefined;
1376
- speakerId__in?: string[] | undefined;
1377
- q?: string | undefined;
1378
- qRelevance__gte?: number | undefined;
1379
- enabledAnalytics__contains?: string[] | undefined;
1380
- status__in?: CameraStatus[] | undefined;
1381
- status__ne?: CameraStatus | undefined;
1382
- }, ListCamerasParams | {
1383
- pageSize?: number | undefined;
1384
- pageToken?: string | undefined;
1385
- include?: string[] | undefined;
1386
- sort?: string[] | undefined;
1387
- locationId__in?: string[] | undefined;
1388
- bridgeId__in?: string[] | undefined;
1389
- multiCameraId?: string | undefined;
1390
- multiCameraId__ne?: string | undefined;
1391
- multiCameraId__in?: string[] | undefined;
1392
- tags__contains?: string[] | undefined;
1393
- tags__any?: string[] | undefined;
1394
- packages__contains?: string[] | undefined;
1395
- name?: string | undefined;
1396
- name__contains?: string | undefined;
1397
- name__in?: string[] | undefined;
1398
- id__in?: string[] | undefined;
1399
- id__notIn?: string[] | undefined;
1400
- id__contains?: string | undefined;
1401
- layoutId?: string | undefined;
1402
- shared?: boolean | undefined;
1403
- sharedCameraAccount?: string | undefined;
1404
- firstResponder?: boolean | undefined;
1405
- directToCloud?: boolean | undefined;
1406
- speakerId__in?: string[] | undefined;
1407
- q?: string | undefined;
1408
- qRelevance__gte?: number | undefined;
1409
- enabledAnalytics__contains?: string[] | undefined;
1410
- status__in?: CameraStatus[] | undefined;
1411
- status__ne?: CameraStatus | undefined;
1412
- }>;
1413
- fetch: (fetchParams?: ListCamerasParams) => Promise<Result<PaginatedResult<Camera>>>;
1414
- refresh: () => Promise<Result<PaginatedResult<Camera>>>;
1415
- fetchNextPage: () => Promise<Result<PaginatedResult<Camera>> | undefined>;
1416
- fetchPrevPage: () => Promise<Result<PaginatedResult<Camera>> | undefined>;
1417
- setParams: (newParams: ListCamerasParams) => void;
1418
- };
1419
-
1420
- /**
1421
- * Options for the useCameras composable.
1422
- *
1423
- * @category Cameras
1424
- */
1425
- export declare interface UseCamerasOptions {
1426
- /**
1427
- * Whether to fetch cameras immediately on mount.
1428
- * @defaultValue true
1429
- */
1430
- immediate?: boolean;
1431
- }
1432
-
1433
- /**
1434
- * Vue 3 composable for getting the current authenticated user.
1435
- *
1436
- * @remarks
1437
- * Provides reactive access to the current user's profile with automatic
1438
- * fetching on component mount (configurable via options).
1439
- *
1440
- * @param options - Configuration options
1441
- * @returns Reactive user state and control functions
1442
- *
1443
- * @example
1444
- * ```vue
1445
- * <script setup>
1446
- * import { useCurrentUser } from 'een-api-toolkit'
1447
- *
1448
- * const { user, loading, error, refresh } = useCurrentUser()
1449
- * </script>
1450
- *
1451
- * <template>
1452
- * <div v-if="loading">Loading...</div>
1453
- * <div v-else-if="error">Error: {{ error.message }}</div>
1454
- * <div v-else-if="user">
1455
- * <h1>Welcome, {{ user.firstName }}!</h1>
1456
- * <p>Email: {{ user.email }}</p>
1457
- * <button @click="refresh">Refresh</button>
1458
- * </div>
1459
- * </template>
1460
- * ```
1461
- *
1462
- * @example
1463
- * ```typescript
1464
- * // Manual fetch (don't fetch on mount)
1465
- * const { user, fetch } = useCurrentUser({ immediate: false })
1466
- *
1467
- * onMounted(async () => {
1468
- * if (someCondition) {
1469
- * await fetch()
1470
- * }
1471
- * })
1472
- * ```
1473
- *
1474
- * @category Users
1475
- */
1476
- export declare function useCurrentUser(options?: UseCurrentUserOptions): {
1477
- user: Ref< {
1478
- id: string;
1479
- email: string;
1480
- firstName: string;
1481
- lastName: string;
1482
- accountId?: string | undefined;
1483
- timeZone?: string | undefined;
1484
- language?: string | undefined;
1485
- } | null, UserProfile | {
1486
- id: string;
1487
- email: string;
1488
- firstName: string;
1489
- lastName: string;
1490
- accountId?: string | undefined;
1491
- timeZone?: string | undefined;
1492
- language?: string | undefined;
1493
- } | null>;
1494
- loading: Ref<boolean, boolean>;
1495
- error: Ref< {
1496
- code: ErrorCode;
1497
- message: string;
1498
- status?: number | undefined;
1499
- details?: unknown;
1500
- } | null, EenError | {
1501
- code: ErrorCode;
1502
- message: string;
1503
- status?: number | undefined;
1504
- details?: unknown;
1505
- } | null>;
1506
- fetch: () => Promise<Result<UserProfile>>;
1507
- refresh: () => Promise<Result<UserProfile>>;
1508
- };
1509
-
1510
- /**
1511
- * Options for the useCurrentUser composable.
1512
- *
1513
- * @category Users
1514
- */
1515
- export declare interface UseCurrentUserOptions {
1516
- /**
1517
- * Whether to fetch the user immediately on mount.
1518
- * @defaultValue true
1519
- */
1520
- immediate?: boolean;
1521
- }
1522
-
1523
1293
  /**
1524
1294
  * User entity from EEN API v3.0.
1525
1295
  *
@@ -1589,256 +1359,4 @@ export declare interface UserProfile {
1589
1359
  language?: string;
1590
1360
  }
1591
1361
 
1592
- /**
1593
- * Vue 3 composable for getting a single user by ID.
1594
- *
1595
- * @remarks
1596
- * Provides reactive access to a specific user. The user ID can be provided
1597
- * as a string or a getter function (useful for reactive route params).
1598
- *
1599
- * @param userId - The user ID (string or getter function)
1600
- * @param options - Configuration options
1601
- * @returns Reactive user state and control functions
1602
- *
1603
- * @example
1604
- * ```vue
1605
- * <script setup>
1606
- * import { useUser } from 'een-api-toolkit'
1607
- * import { useRoute } from 'vue-router'
1608
- *
1609
- * const route = useRoute()
1610
- *
1611
- * // Static ID
1612
- * const { user, loading, error } = useUser('user-123')
1613
- *
1614
- * // Or reactive ID from route
1615
- * const { user: routeUser } = useUser(() => route.params.id as string)
1616
- * </script>
1617
- *
1618
- * <template>
1619
- * <div v-if="loading">Loading...</div>
1620
- * <div v-else-if="error">Error: {{ error.message }}</div>
1621
- * <div v-else-if="user">
1622
- * <h1>{{ user.firstName }} {{ user.lastName }}</h1>
1623
- * <p>Email: {{ user.email }}</p>
1624
- * </div>
1625
- * </template>
1626
- * ```
1627
- *
1628
- * @example
1629
- * ```typescript
1630
- * // With additional fields
1631
- * const { user } = useUser('user-123', {
1632
- * include: ['permissions']
1633
- * })
1634
- *
1635
- * // Access permissions when loaded
1636
- * watchEffect(() => {
1637
- * if (user.value?.permissions) {
1638
- * console.log('User permissions:', user.value.permissions)
1639
- * }
1640
- * })
1641
- * ```
1642
- *
1643
- * @category Users
1644
- */
1645
- export declare function useUser(userId: string | (() => string), options?: UseUserOptions): {
1646
- user: Ref< {
1647
- id: string;
1648
- email: string;
1649
- firstName: string;
1650
- lastName: string;
1651
- accountId?: string | undefined;
1652
- timeZone?: string | undefined;
1653
- language?: string | undefined;
1654
- phone?: string | undefined;
1655
- mobilePhone?: string | undefined;
1656
- permissions?: string[] | undefined;
1657
- lastLogin?: string | undefined;
1658
- isActive?: boolean | undefined;
1659
- createdAt?: string | undefined;
1660
- updatedAt?: string | undefined;
1661
- } | null, User | {
1662
- id: string;
1663
- email: string;
1664
- firstName: string;
1665
- lastName: string;
1666
- accountId?: string | undefined;
1667
- timeZone?: string | undefined;
1668
- language?: string | undefined;
1669
- phone?: string | undefined;
1670
- mobilePhone?: string | undefined;
1671
- permissions?: string[] | undefined;
1672
- lastLogin?: string | undefined;
1673
- isActive?: boolean | undefined;
1674
- createdAt?: string | undefined;
1675
- updatedAt?: string | undefined;
1676
- } | null>;
1677
- loading: Ref<boolean, boolean>;
1678
- error: Ref< {
1679
- code: ErrorCode;
1680
- message: string;
1681
- status?: number | undefined;
1682
- details?: unknown;
1683
- } | null, EenError | {
1684
- code: ErrorCode;
1685
- message: string;
1686
- status?: number | undefined;
1687
- details?: unknown;
1688
- } | null>;
1689
- fetch: (params?: GetUserParams) => Promise<Result<User>>;
1690
- refresh: () => Promise<Result<User>>;
1691
- };
1692
-
1693
- /**
1694
- * Options for the useUser composable.
1695
- *
1696
- * @category Users
1697
- */
1698
- export declare interface UseUserOptions {
1699
- /**
1700
- * Whether to fetch the user immediately on mount.
1701
- * @defaultValue true
1702
- */
1703
- immediate?: boolean;
1704
- /**
1705
- * Additional fields to include in the response.
1706
- */
1707
- include?: string[];
1708
- }
1709
-
1710
- /**
1711
- * Vue 3 composable for listing users with pagination.
1712
- *
1713
- * @remarks
1714
- * Provides reactive access to a paginated list of users with built-in
1715
- * pagination controls. Automatically fetches on mount unless disabled.
1716
- *
1717
- * @param initialParams - Initial pagination/filter parameters
1718
- * @param options - Configuration options
1719
- * @returns Reactive users state and pagination controls
1720
- *
1721
- * @example
1722
- * ```vue
1723
- * <script setup>
1724
- * import { useUsers } from 'een-api-toolkit'
1725
- *
1726
- * const {
1727
- * users,
1728
- * loading,
1729
- * error,
1730
- * hasNextPage,
1731
- * fetchNextPage,
1732
- * refresh
1733
- * } = useUsers({ pageSize: 20 })
1734
- * </script>
1735
- *
1736
- * <template>
1737
- * <div v-if="loading">Loading...</div>
1738
- * <div v-else-if="error">Error: {{ error.message }}</div>
1739
- * <div v-else>
1740
- * <ul>
1741
- * <li v-for="user in users" :key="user.id">
1742
- * {{ user.firstName }} {{ user.lastName }} ({{ user.email }})
1743
- * </li>
1744
- * </ul>
1745
- * <button v-if="hasNextPage" @click="fetchNextPage">
1746
- * Load More
1747
- * </button>
1748
- * <button @click="refresh">Refresh</button>
1749
- * </div>
1750
- * </template>
1751
- * ```
1752
- *
1753
- * @example
1754
- * ```typescript
1755
- * // Change parameters dynamically
1756
- * const { users, setParams, fetch } = useUsers()
1757
- *
1758
- * async function searchUsers(query: string) {
1759
- * setParams({ pageSize: 50 })
1760
- * await fetch()
1761
- * }
1762
- * ```
1763
- *
1764
- * @category Users
1765
- */
1766
- export declare function useUsers(initialParams?: ListUsersParams, options?: UseUsersOptions): {
1767
- users: Ref< {
1768
- id: string;
1769
- email: string;
1770
- firstName: string;
1771
- lastName: string;
1772
- accountId?: string | undefined;
1773
- timeZone?: string | undefined;
1774
- language?: string | undefined;
1775
- phone?: string | undefined;
1776
- mobilePhone?: string | undefined;
1777
- permissions?: string[] | undefined;
1778
- lastLogin?: string | undefined;
1779
- isActive?: boolean | undefined;
1780
- createdAt?: string | undefined;
1781
- updatedAt?: string | undefined;
1782
- }[], User[] | {
1783
- id: string;
1784
- email: string;
1785
- firstName: string;
1786
- lastName: string;
1787
- accountId?: string | undefined;
1788
- timeZone?: string | undefined;
1789
- language?: string | undefined;
1790
- phone?: string | undefined;
1791
- mobilePhone?: string | undefined;
1792
- permissions?: string[] | undefined;
1793
- lastLogin?: string | undefined;
1794
- isActive?: boolean | undefined;
1795
- createdAt?: string | undefined;
1796
- updatedAt?: string | undefined;
1797
- }[]>;
1798
- loading: Ref<boolean, boolean>;
1799
- error: Ref< {
1800
- code: ErrorCode;
1801
- message: string;
1802
- status?: number | undefined;
1803
- details?: unknown;
1804
- } | null, EenError | {
1805
- code: ErrorCode;
1806
- message: string;
1807
- status?: number | undefined;
1808
- details?: unknown;
1809
- } | null>;
1810
- nextPageToken: Ref<string | undefined, string | undefined>;
1811
- prevPageToken: Ref<string | undefined, string | undefined>;
1812
- totalSize: Ref<number | undefined, number | undefined>;
1813
- hasNextPage: ComputedRef<boolean>;
1814
- hasPrevPage: ComputedRef<boolean>;
1815
- params: Ref< {
1816
- pageSize?: number | undefined;
1817
- pageToken?: string | undefined;
1818
- include?: string[] | undefined;
1819
- }, ListUsersParams | {
1820
- pageSize?: number | undefined;
1821
- pageToken?: string | undefined;
1822
- include?: string[] | undefined;
1823
- }>;
1824
- fetch: (fetchParams?: ListUsersParams) => Promise<Result<PaginatedResult<User>>>;
1825
- refresh: () => Promise<Result<PaginatedResult<User>>>;
1826
- fetchNextPage: () => Promise<Result<PaginatedResult<User>> | undefined>;
1827
- fetchPrevPage: () => Promise<Result<PaginatedResult<User>> | undefined>;
1828
- setParams: (newParams: ListUsersParams) => void;
1829
- };
1830
-
1831
- /**
1832
- * Options for the useUsers composable.
1833
- *
1834
- * @category Users
1835
- */
1836
- export declare interface UseUsersOptions {
1837
- /**
1838
- * Whether to fetch users immediately on mount.
1839
- * @defaultValue true
1840
- */
1841
- immediate?: boolean;
1842
- }
1843
-
1844
1362
  export { }