een-api-toolkit 0.1.2 → 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.
- package/CHANGELOG.md +9 -53
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +316 -0
- package/dist/index.js +291 -213
- package/dist/index.js.map +1 -1
- package/docs/AI-CONTEXT.md +134 -1
- package/examples/vue-bridges/.env.example +13 -0
- package/examples/vue-bridges/e2e/app.spec.ts +73 -0
- package/examples/vue-bridges/e2e/auth.spec.ts +206 -0
- package/examples/vue-bridges/index.html +13 -0
- package/examples/vue-bridges/package-lock.json +1583 -0
- package/examples/vue-bridges/package.json +28 -0
- package/examples/vue-bridges/playwright.config.ts +46 -0
- package/examples/vue-bridges/src/App.vue +108 -0
- package/examples/vue-bridges/src/main.ts +23 -0
- package/examples/vue-bridges/src/router/index.ts +68 -0
- package/examples/vue-bridges/src/views/BridgeDetail.vue +279 -0
- package/examples/vue-bridges/src/views/Bridges.vue +297 -0
- package/examples/vue-bridges/src/views/Callback.vue +76 -0
- package/examples/vue-bridges/src/views/Home.vue +150 -0
- package/examples/vue-bridges/src/views/Login.vue +33 -0
- package/examples/vue-bridges/src/views/Logout.vue +66 -0
- package/examples/vue-bridges/src/vite-env.d.ts +12 -0
- package/examples/vue-bridges/tsconfig.json +21 -0
- package/examples/vue-bridges/tsconfig.node.json +10 -0
- package/examples/vue-bridges/vite.config.ts +12 -0
- 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
|
*
|
|
@@ -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
|
*
|
|
@@ -597,6 +849,70 @@ export declare function handleAuthCallback(code: string, state: string): Promise
|
|
|
597
849
|
*/
|
|
598
850
|
export declare function initEenToolkit(options?: EenToolkitConfig): void;
|
|
599
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
|
+
|
|
600
916
|
/**
|
|
601
917
|
* Parameters for listing cameras.
|
|
602
918
|
*
|