een-api-toolkit 0.3.47 → 0.3.49
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/.claude/agents/een-jobs-agent.md +676 -0
- package/CHANGELOG.md +7 -8
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1172 -28
- package/dist/index.js +796 -333
- package/dist/index.js.map +1 -1
- package/docs/AI-CONTEXT.md +22 -1
- package/docs/ai-reference/AI-AUTH.md +1 -1
- package/docs/ai-reference/AI-AUTOMATIONS.md +1 -1
- package/docs/ai-reference/AI-DEVICES.md +1 -1
- package/docs/ai-reference/AI-EVENTS.md +1 -1
- package/docs/ai-reference/AI-GROUPING.md +1 -1
- package/docs/ai-reference/AI-JOBS.md +1084 -0
- package/docs/ai-reference/AI-MEDIA.md +1 -1
- package/docs/ai-reference/AI-SETUP.md +1 -1
- package/docs/ai-reference/AI-USERS.md +1 -1
- package/examples/vue-jobs/.env.example +11 -0
- package/examples/vue-jobs/README.md +245 -0
- package/examples/vue-jobs/e2e/app.spec.ts +79 -0
- package/examples/vue-jobs/e2e/auth.spec.ts +382 -0
- package/examples/vue-jobs/e2e/delete-features.spec.ts +564 -0
- package/examples/vue-jobs/e2e/timelapse.spec.ts +361 -0
- package/examples/vue-jobs/index.html +13 -0
- package/examples/vue-jobs/package-lock.json +1722 -0
- package/examples/vue-jobs/package.json +28 -0
- package/examples/vue-jobs/playwright.config.ts +47 -0
- package/examples/vue-jobs/src/App.vue +154 -0
- package/examples/vue-jobs/src/main.ts +25 -0
- package/examples/vue-jobs/src/router/index.ts +82 -0
- package/examples/vue-jobs/src/views/Callback.vue +76 -0
- package/examples/vue-jobs/src/views/CreateExport.vue +284 -0
- package/examples/vue-jobs/src/views/Files.vue +424 -0
- package/examples/vue-jobs/src/views/Home.vue +195 -0
- package/examples/vue-jobs/src/views/JobDetail.vue +392 -0
- package/examples/vue-jobs/src/views/Jobs.vue +297 -0
- package/examples/vue-jobs/src/views/Login.vue +33 -0
- package/examples/vue-jobs/src/views/Logout.vue +59 -0
- package/examples/vue-jobs/src/vite-env.d.ts +1 -0
- package/examples/vue-jobs/tsconfig.json +25 -0
- package/examples/vue-jobs/vite.config.ts +12 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -13,6 +13,38 @@ import { StoreDefinition } from 'pinia';
|
|
|
13
13
|
*/
|
|
14
14
|
export declare type ActorType = 'bridge' | 'camera' | 'speaker' | 'account' | 'user' | 'layout' | 'job' | 'measurement' | 'sensor' | 'gateway';
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* Add/create a new file entry.
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* Creates a new file entry from `/api/v3.0/files`. The actual file content
|
|
21
|
+
* may be uploaded separately or referenced by URL.
|
|
22
|
+
*
|
|
23
|
+
* For more details, see the
|
|
24
|
+
* [EEN API Documentation](https://developer.eagleeyenetworks.com/reference/createfile).
|
|
25
|
+
*
|
|
26
|
+
* @param params - File creation parameters
|
|
27
|
+
* @returns A Result containing the created file or an error
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* import { addFile } from 'een-api-toolkit'
|
|
32
|
+
*
|
|
33
|
+
* const { data, error } = await addFile({
|
|
34
|
+
* name: 'Incident Report',
|
|
35
|
+
* type: 'upload',
|
|
36
|
+
* description: 'Security incident documentation'
|
|
37
|
+
* })
|
|
38
|
+
*
|
|
39
|
+
* if (data) {
|
|
40
|
+
* console.log('File created:', data.id)
|
|
41
|
+
* }
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @category Files
|
|
45
|
+
*/
|
|
46
|
+
export declare function addFile(params: CreateFileParams): Promise<Result<EenFile>>;
|
|
47
|
+
|
|
16
48
|
/**
|
|
17
49
|
* Alert entity from EEN API v3.0.
|
|
18
50
|
*
|
|
@@ -874,6 +906,156 @@ export declare interface CreateEventSubscriptionParams {
|
|
|
874
906
|
filters: FilterCreate[];
|
|
875
907
|
}
|
|
876
908
|
|
|
909
|
+
/**
|
|
910
|
+
* Create a new export job.
|
|
911
|
+
*
|
|
912
|
+
* @remarks
|
|
913
|
+
* Creates an asynchronous job to export video or images from a camera.
|
|
914
|
+
* The job is queued and processed in the background. Use `getJob()` to
|
|
915
|
+
* poll for completion.
|
|
916
|
+
*
|
|
917
|
+
* For more details, see the
|
|
918
|
+
* [EEN API Documentation](https://developer.eagleeyenetworks.com/reference/createexport).
|
|
919
|
+
*
|
|
920
|
+
* @param params - Export job parameters
|
|
921
|
+
* @returns A Result containing the created job or an error
|
|
922
|
+
*
|
|
923
|
+
* @example
|
|
924
|
+
* ```typescript
|
|
925
|
+
* import { createExportJob, getJob, formatTimestamp } from 'een-api-toolkit'
|
|
926
|
+
*
|
|
927
|
+
* // Create an export job
|
|
928
|
+
* const startTime = new Date(Date.now() - 60 * 60 * 1000) // 1 hour ago
|
|
929
|
+
* const endTime = new Date()
|
|
930
|
+
*
|
|
931
|
+
* const { data: job, error } = await createExportJob({
|
|
932
|
+
* name: 'Security Incident Export',
|
|
933
|
+
* type: 'video',
|
|
934
|
+
* cameraId: 'camera-123',
|
|
935
|
+
* startTimestamp: formatTimestamp(startTime.toISOString()),
|
|
936
|
+
* endTimestamp: formatTimestamp(endTime.toISOString())
|
|
937
|
+
* })
|
|
938
|
+
*
|
|
939
|
+
* if (error) {
|
|
940
|
+
* console.error('Failed to create export:', error.message)
|
|
941
|
+
* return
|
|
942
|
+
* }
|
|
943
|
+
*
|
|
944
|
+
* // Poll for completion
|
|
945
|
+
* let completed = false
|
|
946
|
+
* while (!completed) {
|
|
947
|
+
* await new Promise(r => setTimeout(r, 2000)) // Wait 2 seconds
|
|
948
|
+
* const { data: status } = await getJob(job.id)
|
|
949
|
+
* if (status?.state === 'success') {
|
|
950
|
+
* const fileUrl = status.result?.intervals?.[0]?.files?.[0]?.url
|
|
951
|
+
* const fileId = fileUrl?.substring(fileUrl.lastIndexOf('/') + 1)
|
|
952
|
+
* console.log('Export complete! File ID:', fileId)
|
|
953
|
+
* completed = true
|
|
954
|
+
* } else if (status?.state === 'failure') {
|
|
955
|
+
* console.error('Export failed:', status.error)
|
|
956
|
+
* completed = true
|
|
957
|
+
* } else {
|
|
958
|
+
* console.log('Progress:', status?.progress || 0, '%')
|
|
959
|
+
* }
|
|
960
|
+
* }
|
|
961
|
+
* ```
|
|
962
|
+
*
|
|
963
|
+
* @category Exports
|
|
964
|
+
*/
|
|
965
|
+
export declare function createExportJob(params: CreateExportParams): Promise<Result<ExportJobResponse>>;
|
|
966
|
+
|
|
967
|
+
/**
|
|
968
|
+
* Parameters for creating an export job.
|
|
969
|
+
*
|
|
970
|
+
* @remarks
|
|
971
|
+
* Creates an asynchronous job that exports video or images from a camera.
|
|
972
|
+
* The job progresses through states: pending → started → success/failure.
|
|
973
|
+
*
|
|
974
|
+
* @example
|
|
975
|
+
* ```typescript
|
|
976
|
+
* import { createExportJob, formatTimestamp } from 'een-api-toolkit'
|
|
977
|
+
*
|
|
978
|
+
* const startTime = new Date(Date.now() - 60 * 60 * 1000) // 1 hour ago
|
|
979
|
+
* const endTime = new Date()
|
|
980
|
+
*
|
|
981
|
+
* const { data, error } = await createExportJob({
|
|
982
|
+
* name: 'Security Incident Export',
|
|
983
|
+
* type: 'video',
|
|
984
|
+
* cameraId: 'camera-123',
|
|
985
|
+
* startTimestamp: formatTimestamp(startTime.toISOString()),
|
|
986
|
+
* endTimestamp: formatTimestamp(endTime.toISOString())
|
|
987
|
+
* })
|
|
988
|
+
*
|
|
989
|
+
* if (data) {
|
|
990
|
+
* console.log('Export job created:', data.id)
|
|
991
|
+
* // Poll getJob() to track progress
|
|
992
|
+
* }
|
|
993
|
+
* ```
|
|
994
|
+
*
|
|
995
|
+
* @category Exports
|
|
996
|
+
*/
|
|
997
|
+
export declare interface CreateExportParams {
|
|
998
|
+
/** Display name for the export job */
|
|
999
|
+
name?: string;
|
|
1000
|
+
/** Type of export to create */
|
|
1001
|
+
type: ExportType;
|
|
1002
|
+
/** Camera ID to export from */
|
|
1003
|
+
cameraId: string;
|
|
1004
|
+
/** Start timestamp for the export (ISO 8601 format with +00:00 timezone) */
|
|
1005
|
+
startTimestamp: string;
|
|
1006
|
+
/** End timestamp for the export (ISO 8601 format with +00:00 timezone) */
|
|
1007
|
+
endTimestamp: string;
|
|
1008
|
+
/**
|
|
1009
|
+
* Playback multiplier for time lapse video (required for timeLapse and bundle types).
|
|
1010
|
+
* Value must be between 1 and 48.
|
|
1011
|
+
* For example, a value of 10 means 10 minutes of recording becomes 1 minute of playback.
|
|
1012
|
+
*/
|
|
1013
|
+
playbackMultiplier?: number;
|
|
1014
|
+
/** If true, export is auto-deleted after 2 weeks (default: false) */
|
|
1015
|
+
autoDelete?: boolean;
|
|
1016
|
+
/** Directory path in archive to save the export (default: '/') */
|
|
1017
|
+
directory?: string;
|
|
1018
|
+
/** Notes/description for the export */
|
|
1019
|
+
notes?: string;
|
|
1020
|
+
/** Tags for categorization */
|
|
1021
|
+
tags?: string[];
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
/**
|
|
1025
|
+
* Parameters for adding/uploading a file.
|
|
1026
|
+
*
|
|
1027
|
+
* @remarks
|
|
1028
|
+
* Creates a new file entry. The actual file content may be uploaded
|
|
1029
|
+
* separately or referenced by URL.
|
|
1030
|
+
*
|
|
1031
|
+
* @example
|
|
1032
|
+
* ```typescript
|
|
1033
|
+
* import { addFile } from 'een-api-toolkit'
|
|
1034
|
+
*
|
|
1035
|
+
* const { data, error } = await addFile({
|
|
1036
|
+
* name: 'Incident Report',
|
|
1037
|
+
* type: 'upload',
|
|
1038
|
+
* description: 'Security incident documentation'
|
|
1039
|
+
* })
|
|
1040
|
+
* ```
|
|
1041
|
+
*
|
|
1042
|
+
* @category Files
|
|
1043
|
+
*/
|
|
1044
|
+
export declare interface CreateFileParams {
|
|
1045
|
+
/** Display name for the file */
|
|
1046
|
+
name: string;
|
|
1047
|
+
/** Type/category of the file */
|
|
1048
|
+
type?: FileType;
|
|
1049
|
+
/** Original filename */
|
|
1050
|
+
filename?: string;
|
|
1051
|
+
/** Description or notes about the file */
|
|
1052
|
+
description?: string;
|
|
1053
|
+
/** Tags for categorization */
|
|
1054
|
+
tags?: string[];
|
|
1055
|
+
/** Related camera ID */
|
|
1056
|
+
cameraId?: string;
|
|
1057
|
+
}
|
|
1058
|
+
|
|
877
1059
|
/**
|
|
878
1060
|
* Create a new layout.
|
|
879
1061
|
*
|
|
@@ -980,6 +1162,83 @@ export declare interface CreateLayoutParams {
|
|
|
980
1162
|
*/
|
|
981
1163
|
export declare function deleteEventSubscription(subscriptionId: string): Promise<Result<void>>;
|
|
982
1164
|
|
|
1165
|
+
/**
|
|
1166
|
+
* Delete (recycle) a file by ID.
|
|
1167
|
+
*
|
|
1168
|
+
* @remarks
|
|
1169
|
+
* Moves a file to the recycle bin (trash) via DELETE `/api/v3.0/files/{fileId}`.
|
|
1170
|
+
* This does not permanently delete the file - it can be recovered from trash.
|
|
1171
|
+
*
|
|
1172
|
+
* For more details, see the
|
|
1173
|
+
* [EEN API Documentation](https://developer.eagleeyenetworks.com/reference/deletefile).
|
|
1174
|
+
*
|
|
1175
|
+
* @param fileId - The unique identifier of the file to delete
|
|
1176
|
+
* @returns A Result indicating success or an error
|
|
1177
|
+
*
|
|
1178
|
+
* @example
|
|
1179
|
+
* ```typescript
|
|
1180
|
+
* import { deleteFile } from 'een-api-toolkit'
|
|
1181
|
+
*
|
|
1182
|
+
* async function recycleFile(fileId: string) {
|
|
1183
|
+
* const { error } = await deleteFile(fileId)
|
|
1184
|
+
*
|
|
1185
|
+
* if (error) {
|
|
1186
|
+
* if (error.code === 'NOT_FOUND') {
|
|
1187
|
+
* console.log('File not found or already deleted')
|
|
1188
|
+
* } else {
|
|
1189
|
+
* console.error('Failed to delete file:', error.message)
|
|
1190
|
+
* }
|
|
1191
|
+
* return false
|
|
1192
|
+
* }
|
|
1193
|
+
*
|
|
1194
|
+
* console.log('File moved to trash')
|
|
1195
|
+
* return true
|
|
1196
|
+
* }
|
|
1197
|
+
* ```
|
|
1198
|
+
*
|
|
1199
|
+
* @category Files
|
|
1200
|
+
*/
|
|
1201
|
+
export declare function deleteFile(fileId: string): Promise<Result<void>>;
|
|
1202
|
+
|
|
1203
|
+
/**
|
|
1204
|
+
* Delete (revoke) a job by ID.
|
|
1205
|
+
*
|
|
1206
|
+
* @remarks
|
|
1207
|
+
* Deletes a job from `/api/v3.0/jobs/{jobId}` regardless of its state.
|
|
1208
|
+
* This can be used to:
|
|
1209
|
+
* - Cancel a **pending** job before it starts processing
|
|
1210
|
+
* - Revoke a **started** job to stop processing
|
|
1211
|
+
* - Remove a **completed** job record
|
|
1212
|
+
*
|
|
1213
|
+
* For more details, see the
|
|
1214
|
+
* [EEN API Documentation](https://developer.eagleeyenetworks.com/reference/deletejob).
|
|
1215
|
+
*
|
|
1216
|
+
* @param jobId - The unique identifier of the job to delete
|
|
1217
|
+
* @returns A Result with void data on success, or an error
|
|
1218
|
+
*
|
|
1219
|
+
* @example
|
|
1220
|
+
* ```typescript
|
|
1221
|
+
* import { deleteJob } from 'een-api-toolkit'
|
|
1222
|
+
*
|
|
1223
|
+
* // Cancel a pending export job
|
|
1224
|
+
* const { error } = await deleteJob('job-123')
|
|
1225
|
+
*
|
|
1226
|
+
* if (error) {
|
|
1227
|
+
* if (error.code === 'NOT_FOUND') {
|
|
1228
|
+
* console.log('Job not found or already deleted')
|
|
1229
|
+
* } else {
|
|
1230
|
+
* console.error('Failed to delete job:', error.message)
|
|
1231
|
+
* }
|
|
1232
|
+
* return
|
|
1233
|
+
* }
|
|
1234
|
+
*
|
|
1235
|
+
* console.log('Job successfully revoked')
|
|
1236
|
+
* ```
|
|
1237
|
+
*
|
|
1238
|
+
* @category Jobs
|
|
1239
|
+
*/
|
|
1240
|
+
export declare function deleteJob(jobId: string): Promise<Result<void>>;
|
|
1241
|
+
|
|
983
1242
|
/**
|
|
984
1243
|
* Delete a layout.
|
|
985
1244
|
*
|
|
@@ -1031,6 +1290,190 @@ export declare type DeliveryConfig = SSEDeliveryConfig | WebhookDeliveryConfig;
|
|
|
1031
1290
|
*/
|
|
1032
1291
|
export declare type DeliveryConfigCreate = SSEDeliveryConfigCreate | WebhookDeliveryConfigCreate;
|
|
1033
1292
|
|
|
1293
|
+
/**
|
|
1294
|
+
* Download entity from EEN API v3.0.
|
|
1295
|
+
*
|
|
1296
|
+
* @remarks
|
|
1297
|
+
* Represents a downloadable item in the Eagle Eye Networks platform.
|
|
1298
|
+
* Downloads may expire after a certain time period.
|
|
1299
|
+
*
|
|
1300
|
+
* @example
|
|
1301
|
+
* ```typescript
|
|
1302
|
+
* import { listDownloads, type Download } from 'een-api-toolkit'
|
|
1303
|
+
*
|
|
1304
|
+
* const { data, error } = await listDownloads({ status__in: ['available'] })
|
|
1305
|
+
* if (data) {
|
|
1306
|
+
* data.results.forEach((download: Download) => {
|
|
1307
|
+
* console.log(`${download.name}: ${download.status}`)
|
|
1308
|
+
* })
|
|
1309
|
+
* }
|
|
1310
|
+
* ```
|
|
1311
|
+
*
|
|
1312
|
+
* @category Downloads
|
|
1313
|
+
*/
|
|
1314
|
+
export declare interface Download {
|
|
1315
|
+
/** Unique identifier for the download */
|
|
1316
|
+
id: string;
|
|
1317
|
+
/** ID of the account this download belongs to */
|
|
1318
|
+
accountId: string;
|
|
1319
|
+
/** Display name of the download */
|
|
1320
|
+
name: string;
|
|
1321
|
+
/** Current status of the download */
|
|
1322
|
+
status: DownloadStatus;
|
|
1323
|
+
/** MIME content type (e.g., 'video/mp4') */
|
|
1324
|
+
contentType?: string;
|
|
1325
|
+
/** File size in bytes */
|
|
1326
|
+
sizeBytes?: number;
|
|
1327
|
+
/** ID of the related file */
|
|
1328
|
+
fileId?: string;
|
|
1329
|
+
/** ID of the job that created this download */
|
|
1330
|
+
jobId?: string;
|
|
1331
|
+
/** ID of the camera this download relates to */
|
|
1332
|
+
cameraId?: string;
|
|
1333
|
+
/** Description or notes */
|
|
1334
|
+
description?: string;
|
|
1335
|
+
/** ISO 8601 timestamp when the download was created */
|
|
1336
|
+
createTimestamp: string;
|
|
1337
|
+
/** ISO 8601 timestamp when the download expires */
|
|
1338
|
+
expirationTimestamp?: string;
|
|
1339
|
+
/** Download URL (may be pre-signed) */
|
|
1340
|
+
downloadUrl?: string;
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1343
|
+
/**
|
|
1344
|
+
* Download the binary content of a download entry.
|
|
1345
|
+
*
|
|
1346
|
+
* @remarks
|
|
1347
|
+
* Downloads the actual file content from `/api/v3.0/downloads/{downloadId}:download`.
|
|
1348
|
+
* Returns a Blob that can be used to create a download link or process the file.
|
|
1349
|
+
*
|
|
1350
|
+
* For more details, see the
|
|
1351
|
+
* [EEN API Documentation](https://developer.eagleeyenetworks.com/reference/downloaddownload).
|
|
1352
|
+
*
|
|
1353
|
+
* @param downloadId - The unique identifier of the download to fetch
|
|
1354
|
+
* @returns A Result containing the download result with blob, filename, and metadata
|
|
1355
|
+
*
|
|
1356
|
+
* @example
|
|
1357
|
+
* ```typescript
|
|
1358
|
+
* import { downloadDownload } from 'een-api-toolkit'
|
|
1359
|
+
*
|
|
1360
|
+
* const { data, error } = await downloadDownload('download-123')
|
|
1361
|
+
*
|
|
1362
|
+
* if (error) {
|
|
1363
|
+
* console.error('Download failed:', error.message)
|
|
1364
|
+
* return
|
|
1365
|
+
* }
|
|
1366
|
+
*
|
|
1367
|
+
* // Create download link
|
|
1368
|
+
* const url = URL.createObjectURL(data.blob)
|
|
1369
|
+
* const a = document.createElement('a')
|
|
1370
|
+
* a.href = url
|
|
1371
|
+
* a.download = data.filename
|
|
1372
|
+
* a.click()
|
|
1373
|
+
* URL.revokeObjectURL(url)
|
|
1374
|
+
*
|
|
1375
|
+
* console.log(`Downloaded: ${data.filename} (${data.size} bytes)`)
|
|
1376
|
+
* ```
|
|
1377
|
+
*
|
|
1378
|
+
* @category Downloads
|
|
1379
|
+
*/
|
|
1380
|
+
export declare function downloadDownload(downloadId: string): Promise<Result<DownloadDownloadResult>>;
|
|
1381
|
+
|
|
1382
|
+
/**
|
|
1383
|
+
* Result from downloading via the downloads endpoint.
|
|
1384
|
+
*
|
|
1385
|
+
* @remarks
|
|
1386
|
+
* Reuses the same structure as file downloads.
|
|
1387
|
+
*
|
|
1388
|
+
* @category Downloads
|
|
1389
|
+
*/
|
|
1390
|
+
export declare type DownloadDownloadResult = DownloadFileResult;
|
|
1391
|
+
|
|
1392
|
+
/**
|
|
1393
|
+
* Download a file's binary content.
|
|
1394
|
+
*
|
|
1395
|
+
* @remarks
|
|
1396
|
+
* Downloads the actual file content from `/api/v3.0/files/{fileId}:download`.
|
|
1397
|
+
* Returns a Blob that can be used to create a download link or process the file.
|
|
1398
|
+
*
|
|
1399
|
+
* For more details, see the
|
|
1400
|
+
* [EEN API Documentation](https://developer.eagleeyenetworks.com/reference/downloadfile).
|
|
1401
|
+
*
|
|
1402
|
+
* @param fileId - The unique identifier of the file to download
|
|
1403
|
+
* @returns A Result containing the download result with blob, filename, and metadata
|
|
1404
|
+
*
|
|
1405
|
+
* @example
|
|
1406
|
+
* ```typescript
|
|
1407
|
+
* import { downloadFile } from 'een-api-toolkit'
|
|
1408
|
+
*
|
|
1409
|
+
* const { data, error } = await downloadFile('file-123')
|
|
1410
|
+
*
|
|
1411
|
+
* if (error) {
|
|
1412
|
+
* console.error('Download failed:', error.message)
|
|
1413
|
+
* return
|
|
1414
|
+
* }
|
|
1415
|
+
*
|
|
1416
|
+
* // Create download link
|
|
1417
|
+
* const url = URL.createObjectURL(data.blob)
|
|
1418
|
+
* const a = document.createElement('a')
|
|
1419
|
+
* a.href = url
|
|
1420
|
+
* a.download = data.filename
|
|
1421
|
+
* a.click()
|
|
1422
|
+
* URL.revokeObjectURL(url)
|
|
1423
|
+
*
|
|
1424
|
+
* console.log(`Downloaded: ${data.filename} (${data.size} bytes)`)
|
|
1425
|
+
* ```
|
|
1426
|
+
*
|
|
1427
|
+
* @category Files
|
|
1428
|
+
*/
|
|
1429
|
+
export declare function downloadFile(fileId: string): Promise<Result<DownloadFileResult>>;
|
|
1430
|
+
|
|
1431
|
+
/**
|
|
1432
|
+
* Result from downloading a file.
|
|
1433
|
+
*
|
|
1434
|
+
* @remarks
|
|
1435
|
+
* Contains the binary file data as a Blob along with metadata.
|
|
1436
|
+
*
|
|
1437
|
+
* @example
|
|
1438
|
+
* ```typescript
|
|
1439
|
+
* import { downloadFile } from 'een-api-toolkit'
|
|
1440
|
+
*
|
|
1441
|
+
* const { data, error } = await downloadFile('file-123')
|
|
1442
|
+
*
|
|
1443
|
+
* if (data) {
|
|
1444
|
+
* // Create download link
|
|
1445
|
+
* const url = URL.createObjectURL(data.blob)
|
|
1446
|
+
* const a = document.createElement('a')
|
|
1447
|
+
* a.href = url
|
|
1448
|
+
* a.download = data.filename
|
|
1449
|
+
* a.click()
|
|
1450
|
+
* URL.revokeObjectURL(url)
|
|
1451
|
+
* }
|
|
1452
|
+
* ```
|
|
1453
|
+
*
|
|
1454
|
+
* @category Files
|
|
1455
|
+
*/
|
|
1456
|
+
export declare interface DownloadFileResult {
|
|
1457
|
+
/** Binary file data */
|
|
1458
|
+
blob: Blob;
|
|
1459
|
+
/** Filename from Content-Disposition header */
|
|
1460
|
+
filename: string;
|
|
1461
|
+
/** MIME content type from Content-Type header */
|
|
1462
|
+
contentType: string;
|
|
1463
|
+
/** File size in bytes */
|
|
1464
|
+
size: number;
|
|
1465
|
+
}
|
|
1466
|
+
|
|
1467
|
+
/**
|
|
1468
|
+
* Download status from EEN API v3.0.
|
|
1469
|
+
*
|
|
1470
|
+
* @remarks
|
|
1471
|
+
* Indicates the availability status of a download.
|
|
1472
|
+
*
|
|
1473
|
+
* @category Downloads
|
|
1474
|
+
*/
|
|
1475
|
+
export declare type DownloadStatus = 'available' | 'expired' | 'pending' | 'error';
|
|
1476
|
+
|
|
1034
1477
|
/**
|
|
1035
1478
|
* Error object returned when an operation fails.
|
|
1036
1479
|
*
|
|
@@ -1062,6 +1505,72 @@ export declare interface EenError {
|
|
|
1062
1505
|
details?: unknown;
|
|
1063
1506
|
}
|
|
1064
1507
|
|
|
1508
|
+
/**
|
|
1509
|
+
* File entity from EEN API v3.0.
|
|
1510
|
+
*
|
|
1511
|
+
* @remarks
|
|
1512
|
+
* Represents a file stored in the Eagle Eye Networks platform.
|
|
1513
|
+
* Files can be exports, uploads, or snapshots.
|
|
1514
|
+
*
|
|
1515
|
+
* @example
|
|
1516
|
+
* ```typescript
|
|
1517
|
+
* import { listFiles, type EenFile } from 'een-api-toolkit'
|
|
1518
|
+
*
|
|
1519
|
+
* const { data, error } = await listFiles({ type__in: ['export'] })
|
|
1520
|
+
* if (data) {
|
|
1521
|
+
* data.results.forEach((file: EenFile) => {
|
|
1522
|
+
* console.log(`${file.name}: ${file.size} bytes`)
|
|
1523
|
+
* })
|
|
1524
|
+
* }
|
|
1525
|
+
* ```
|
|
1526
|
+
*
|
|
1527
|
+
* @category Files
|
|
1528
|
+
*/
|
|
1529
|
+
export declare interface EenFile {
|
|
1530
|
+
/** Unique identifier for the file */
|
|
1531
|
+
id: string;
|
|
1532
|
+
/** Display name of the file */
|
|
1533
|
+
name: string;
|
|
1534
|
+
/** MIME type from API (e.g., 'video/mp4', 'application/directory') */
|
|
1535
|
+
mimeType?: string;
|
|
1536
|
+
/** Directory path */
|
|
1537
|
+
directory?: string;
|
|
1538
|
+
/** ID of the account this file belongs to (requires include=accountId) */
|
|
1539
|
+
accountId?: string;
|
|
1540
|
+
/** Public share information (requires include=publicShare) */
|
|
1541
|
+
publicShare?: unknown;
|
|
1542
|
+
/** File notes/description (requires include=notes) */
|
|
1543
|
+
notes?: string;
|
|
1544
|
+
/** ISO 8601 timestamp when the file was created (requires include=createTimestamp) */
|
|
1545
|
+
createTimestamp?: string;
|
|
1546
|
+
/** ISO 8601 timestamp when the file was last updated (requires include=updateTimestamp) */
|
|
1547
|
+
updateTimestamp?: string;
|
|
1548
|
+
/** File size in bytes (requires include=size) */
|
|
1549
|
+
size?: number;
|
|
1550
|
+
/** Additional metadata (requires include=metadata) */
|
|
1551
|
+
metadata?: Record<string, unknown>;
|
|
1552
|
+
/** Tags for categorization (requires include=tags) */
|
|
1553
|
+
tags?: string[];
|
|
1554
|
+
/** Number of child files for directories (requires include=childCount) */
|
|
1555
|
+
childCount?: number;
|
|
1556
|
+
/** Additional file details (requires include=details) */
|
|
1557
|
+
details?: Record<string, unknown>;
|
|
1558
|
+
/** Original filename */
|
|
1559
|
+
filename?: string;
|
|
1560
|
+
/** MIME content type (e.g., 'video/mp4', 'image/jpeg') */
|
|
1561
|
+
contentType?: string;
|
|
1562
|
+
/** Type/category of the file */
|
|
1563
|
+
type?: FileType;
|
|
1564
|
+
/** ID of the job that created this file (for exports) */
|
|
1565
|
+
jobId?: string;
|
|
1566
|
+
/** ID of the camera this file relates to */
|
|
1567
|
+
cameraId?: string;
|
|
1568
|
+
/** Description or notes about the file */
|
|
1569
|
+
description?: string;
|
|
1570
|
+
/** ISO 8601 timestamp when the file expires (if applicable) */
|
|
1571
|
+
expirationTimestamp?: string;
|
|
1572
|
+
}
|
|
1573
|
+
|
|
1065
1574
|
/**
|
|
1066
1575
|
* Configuration for initializing the toolkit.
|
|
1067
1576
|
*
|
|
@@ -1476,6 +1985,31 @@ export declare interface EventTypeFilter {
|
|
|
1476
1985
|
id: string;
|
|
1477
1986
|
}
|
|
1478
1987
|
|
|
1988
|
+
/**
|
|
1989
|
+
* Response from creating an export job.
|
|
1990
|
+
*
|
|
1991
|
+
* @remarks
|
|
1992
|
+
* Returns the created job with its initial state. Use `getJob()` to poll
|
|
1993
|
+
* for completion.
|
|
1994
|
+
*
|
|
1995
|
+
* @category Exports
|
|
1996
|
+
*/
|
|
1997
|
+
export declare type ExportJobResponse = Job;
|
|
1998
|
+
|
|
1999
|
+
/**
|
|
2000
|
+
* Export types supported by the EEN API v3.0.
|
|
2001
|
+
*
|
|
2002
|
+
* @remarks
|
|
2003
|
+
* Different export types produce different output formats.
|
|
2004
|
+
*
|
|
2005
|
+
* - `bundle`: ZIP archive containing video clips and images
|
|
2006
|
+
* - `timeLapse`: Time-lapse video from multiple frames
|
|
2007
|
+
* - `video`: Single video file export
|
|
2008
|
+
*
|
|
2009
|
+
* @category Exports
|
|
2010
|
+
*/
|
|
2011
|
+
export declare type ExportType = 'bundle' | 'timeLapse' | 'video';
|
|
2012
|
+
|
|
1479
2013
|
/* Excluded from this release type: failure */
|
|
1480
2014
|
|
|
1481
2015
|
/**
|
|
@@ -1588,6 +2122,34 @@ export declare type FeedMediaType = 'video' | 'audio' | 'image' | 'halfDuplex' |
|
|
|
1588
2122
|
*/
|
|
1589
2123
|
export declare type FeedStreamType = 'main' | 'preview' | 'talkdown';
|
|
1590
2124
|
|
|
2125
|
+
/**
|
|
2126
|
+
* Valid include field names for the Files API.
|
|
2127
|
+
*
|
|
2128
|
+
* @remarks
|
|
2129
|
+
* These fields can be requested via the `include` parameter to get additional
|
|
2130
|
+
* file metadata that is not returned by default.
|
|
2131
|
+
*
|
|
2132
|
+
* @example
|
|
2133
|
+
* ```typescript
|
|
2134
|
+
* const { data } = await listFiles({
|
|
2135
|
+
* include: ['size', 'createTimestamp', 'tags', 'metadata']
|
|
2136
|
+
* })
|
|
2137
|
+
* ```
|
|
2138
|
+
*
|
|
2139
|
+
* @category Files
|
|
2140
|
+
*/
|
|
2141
|
+
export declare type FileIncludeField = 'accountId' | 'publicShare' | 'notes' | 'createTimestamp' | 'updateTimestamp' | 'size' | 'metadata' | 'tags' | 'childCount' | 'details';
|
|
2142
|
+
|
|
2143
|
+
/**
|
|
2144
|
+
* File type/category from EEN API v3.0.
|
|
2145
|
+
*
|
|
2146
|
+
* @remarks
|
|
2147
|
+
* Indicates the type of content in the file.
|
|
2148
|
+
*
|
|
2149
|
+
* @category Files
|
|
2150
|
+
*/
|
|
2151
|
+
export declare type FileType = 'export' | 'upload' | 'snapshot' | 'other';
|
|
2152
|
+
|
|
1591
2153
|
/**
|
|
1592
2154
|
* Filter creation parameters.
|
|
1593
2155
|
*
|
|
@@ -2071,6 +2633,56 @@ export declare function getConfig(): EenToolkitConfig;
|
|
|
2071
2633
|
*/
|
|
2072
2634
|
export declare function getCurrentUser(): Promise<Result<UserProfile>>;
|
|
2073
2635
|
|
|
2636
|
+
/**
|
|
2637
|
+
* Get a specific download by ID.
|
|
2638
|
+
*
|
|
2639
|
+
* @remarks
|
|
2640
|
+
* Fetches a single download's metadata from `/api/v3.0/downloads/{downloadId}`.
|
|
2641
|
+
* Use this to get download details before downloading.
|
|
2642
|
+
*
|
|
2643
|
+
* For more details, see the
|
|
2644
|
+
* [EEN API Documentation](https://developer.eagleeyenetworks.com/reference/getdownload).
|
|
2645
|
+
*
|
|
2646
|
+
* @param downloadId - The unique identifier of the download to fetch
|
|
2647
|
+
* @param params - Optional parameters (e.g., include additional fields)
|
|
2648
|
+
* @returns A Result containing the download or an error
|
|
2649
|
+
*
|
|
2650
|
+
* @example
|
|
2651
|
+
* ```typescript
|
|
2652
|
+
* import { getDownload } from 'een-api-toolkit'
|
|
2653
|
+
*
|
|
2654
|
+
* const { data, error } = await getDownload('download-123')
|
|
2655
|
+
*
|
|
2656
|
+
* if (error) {
|
|
2657
|
+
* if (error.code === 'NOT_FOUND') {
|
|
2658
|
+
* console.log('Download not found')
|
|
2659
|
+
* }
|
|
2660
|
+
* return
|
|
2661
|
+
* }
|
|
2662
|
+
*
|
|
2663
|
+
* console.log(`Download: ${data.name} (${data.status})`)
|
|
2664
|
+
* if (data.status === 'available') {
|
|
2665
|
+
* console.log(`Size: ${data.sizeBytes} bytes`)
|
|
2666
|
+
* }
|
|
2667
|
+
* ```
|
|
2668
|
+
*
|
|
2669
|
+
* @category Downloads
|
|
2670
|
+
*/
|
|
2671
|
+
export declare function getDownload(downloadId: string, params?: GetDownloadParams): Promise<Result<Download>>;
|
|
2672
|
+
|
|
2673
|
+
/**
|
|
2674
|
+
* Parameters for getting a single download.
|
|
2675
|
+
*
|
|
2676
|
+
* @remarks
|
|
2677
|
+
* Use to fetch download metadata and URL before downloading.
|
|
2678
|
+
*
|
|
2679
|
+
* @category Downloads
|
|
2680
|
+
*/
|
|
2681
|
+
export declare interface GetDownloadParams {
|
|
2682
|
+
/** Additional fields to include in the response */
|
|
2683
|
+
include?: string[];
|
|
2684
|
+
}
|
|
2685
|
+
|
|
2074
2686
|
/**
|
|
2075
2687
|
* Get a specific event by ID.
|
|
2076
2688
|
*
|
|
@@ -2269,55 +2881,174 @@ export declare interface GetEventMetricsParams {
|
|
|
2269
2881
|
}
|
|
2270
2882
|
|
|
2271
2883
|
/**
|
|
2272
|
-
* Parameters for getting a single event by ID.
|
|
2884
|
+
* Parameters for getting a single event by ID.
|
|
2885
|
+
*
|
|
2886
|
+
* @remarks
|
|
2887
|
+
* Supports including additional data schemas in the response.
|
|
2888
|
+
*
|
|
2889
|
+
* @example
|
|
2890
|
+
* ```typescript
|
|
2891
|
+
* import { getEvent } from 'een-api-toolkit'
|
|
2892
|
+
*
|
|
2893
|
+
* const { data } = await getEvent('event-123', {
|
|
2894
|
+
* include: ['data.een.objectDetection.v1', 'data.een.fullFrameImageUrl.v1']
|
|
2895
|
+
* })
|
|
2896
|
+
* ```
|
|
2897
|
+
*
|
|
2898
|
+
* @category Events
|
|
2899
|
+
*/
|
|
2900
|
+
export declare interface GetEventParams {
|
|
2901
|
+
/** Data schemas to include in the response */
|
|
2902
|
+
include?: string[];
|
|
2903
|
+
}
|
|
2904
|
+
|
|
2905
|
+
/**
|
|
2906
|
+
* Get a specific event subscription by ID.
|
|
2907
|
+
*
|
|
2908
|
+
* @remarks
|
|
2909
|
+
* Fetches a single event subscription from `/api/v3.0/eventSubscriptions/{id}`.
|
|
2910
|
+
*
|
|
2911
|
+
* For more details, see the
|
|
2912
|
+
* [EEN API Documentation](https://developer.eagleeyenetworks.com/reference/geteventsubscription).
|
|
2913
|
+
*
|
|
2914
|
+
* @param subscriptionId - The unique identifier of the subscription to fetch
|
|
2915
|
+
* @returns A Result containing the event subscription or an error
|
|
2916
|
+
*
|
|
2917
|
+
* @example
|
|
2918
|
+
* ```typescript
|
|
2919
|
+
* import { getEventSubscription } from 'een-api-toolkit'
|
|
2920
|
+
*
|
|
2921
|
+
* const { data, error } = await getEventSubscription('f3d6f55d5ba546168758a309508f4419')
|
|
2922
|
+
* if (data) {
|
|
2923
|
+
* console.log(`Subscription: ${data.id}`)
|
|
2924
|
+
* if (data.deliveryConfig.type === 'serverSentEvents.v1') {
|
|
2925
|
+
* console.log(`SSE URL: ${data.deliveryConfig.sseUrl}`)
|
|
2926
|
+
* }
|
|
2927
|
+
* }
|
|
2928
|
+
* ```
|
|
2929
|
+
*
|
|
2930
|
+
* @category EventSubscriptions
|
|
2931
|
+
*/
|
|
2932
|
+
export declare function getEventSubscription(subscriptionId: string): Promise<Result<EventSubscription>>;
|
|
2933
|
+
|
|
2934
|
+
/**
|
|
2935
|
+
* Get a specific file by ID.
|
|
2936
|
+
*
|
|
2937
|
+
* @remarks
|
|
2938
|
+
* Fetches a single file's metadata from `/api/v3.0/files/{fileId}`.
|
|
2939
|
+
* Use this to get file details before downloading.
|
|
2940
|
+
*
|
|
2941
|
+
* For more details, see the
|
|
2942
|
+
* [EEN API Documentation](https://developer.eagleeyenetworks.com/reference/getfile).
|
|
2943
|
+
*
|
|
2944
|
+
* @param fileId - The unique identifier of the file to fetch
|
|
2945
|
+
* @param params - Optional parameters (e.g., include additional fields)
|
|
2946
|
+
* @returns A Result containing the file or an error
|
|
2947
|
+
*
|
|
2948
|
+
* @example
|
|
2949
|
+
* ```typescript
|
|
2950
|
+
* import { getFile } from 'een-api-toolkit'
|
|
2951
|
+
*
|
|
2952
|
+
* const { data, error } = await getFile('file-123')
|
|
2953
|
+
*
|
|
2954
|
+
* if (error) {
|
|
2955
|
+
* if (error.code === 'NOT_FOUND') {
|
|
2956
|
+
* console.log('File not found')
|
|
2957
|
+
* }
|
|
2958
|
+
* return
|
|
2959
|
+
* }
|
|
2960
|
+
*
|
|
2961
|
+
* console.log(`File: ${data.name} (${data.size} bytes)`)
|
|
2962
|
+
* ```
|
|
2963
|
+
*
|
|
2964
|
+
* @category Files
|
|
2965
|
+
*/
|
|
2966
|
+
export declare function getFile(fileId: string, params?: GetFileParams): Promise<Result<EenFile>>;
|
|
2967
|
+
|
|
2968
|
+
/**
|
|
2969
|
+
* Parameters for getting a single file.
|
|
2273
2970
|
*
|
|
2274
2971
|
* @remarks
|
|
2275
|
-
*
|
|
2276
|
-
*
|
|
2277
|
-
* @example
|
|
2278
|
-
* ```typescript
|
|
2279
|
-
* import { getEvent } from 'een-api-toolkit'
|
|
2972
|
+
* Use to fetch file metadata before downloading.
|
|
2280
2973
|
*
|
|
2281
|
-
*
|
|
2282
|
-
* include: ['data.een.objectDetection.v1', 'data.een.fullFrameImageUrl.v1']
|
|
2283
|
-
* })
|
|
2284
|
-
* ```
|
|
2285
|
-
*
|
|
2286
|
-
* @category Events
|
|
2974
|
+
* @category Files
|
|
2287
2975
|
*/
|
|
2288
|
-
export declare interface
|
|
2289
|
-
/**
|
|
2290
|
-
|
|
2976
|
+
export declare interface GetFileParams {
|
|
2977
|
+
/**
|
|
2978
|
+
* Additional fields to include in the response.
|
|
2979
|
+
* Valid values: accountId, publicShare, notes, createTimestamp,
|
|
2980
|
+
* updateTimestamp, size, metadata, tags, childCount, details
|
|
2981
|
+
*/
|
|
2982
|
+
include?: FileIncludeField[];
|
|
2291
2983
|
}
|
|
2292
2984
|
|
|
2293
2985
|
/**
|
|
2294
|
-
* Get a specific
|
|
2986
|
+
* Get a specific job by ID.
|
|
2295
2987
|
*
|
|
2296
2988
|
* @remarks
|
|
2297
|
-
* Fetches a single
|
|
2989
|
+
* Fetches a single job from `/api/v3.0/jobs/{jobId}`. Use this to poll
|
|
2990
|
+
* for job completion after creating an export.
|
|
2298
2991
|
*
|
|
2299
2992
|
* For more details, see the
|
|
2300
|
-
* [EEN API Documentation](https://developer.eagleeyenetworks.com/reference/
|
|
2993
|
+
* [EEN API Documentation](https://developer.eagleeyenetworks.com/reference/getjob).
|
|
2301
2994
|
*
|
|
2302
|
-
* @param
|
|
2303
|
-
* @
|
|
2995
|
+
* @param jobId - The unique identifier of the job to fetch
|
|
2996
|
+
* @param params - Optional parameters (e.g., include additional fields)
|
|
2997
|
+
* @returns A Result containing the job or an error
|
|
2304
2998
|
*
|
|
2305
2999
|
* @example
|
|
2306
3000
|
* ```typescript
|
|
2307
|
-
* import {
|
|
3001
|
+
* import { getJob } from 'een-api-toolkit'
|
|
2308
3002
|
*
|
|
2309
|
-
* const { data, error } = await
|
|
2310
|
-
*
|
|
2311
|
-
*
|
|
2312
|
-
* if (
|
|
2313
|
-
* console.log(
|
|
3003
|
+
* const { data, error } = await getJob('job-123')
|
|
3004
|
+
*
|
|
3005
|
+
* if (error) {
|
|
3006
|
+
* if (error.code === 'NOT_FOUND') {
|
|
3007
|
+
* console.log('Job not found')
|
|
2314
3008
|
* }
|
|
3009
|
+
* return
|
|
3010
|
+
* }
|
|
3011
|
+
*
|
|
3012
|
+
* console.log(`Job state: ${data.state}`)
|
|
3013
|
+
* if (data.state === 'started') {
|
|
3014
|
+
* console.log(`Progress: ${data.progress}%`)
|
|
3015
|
+
* }
|
|
3016
|
+
* if (data.state === 'success') {
|
|
3017
|
+
* const fileUrl = data.result?.intervals?.[0]?.files?.[0]?.url
|
|
3018
|
+
* const fileId = fileUrl?.substring(fileUrl.lastIndexOf('/') + 1)
|
|
3019
|
+
* console.log(`File ID: ${fileId}`)
|
|
2315
3020
|
* }
|
|
2316
3021
|
* ```
|
|
2317
3022
|
*
|
|
2318
|
-
* @category
|
|
3023
|
+
* @category Jobs
|
|
2319
3024
|
*/
|
|
2320
|
-
export declare function
|
|
3025
|
+
export declare function getJob(jobId: string, params?: GetJobParams): Promise<Result<Job>>;
|
|
3026
|
+
|
|
3027
|
+
/**
|
|
3028
|
+
* Parameters for getting a single job.
|
|
3029
|
+
*
|
|
3030
|
+
* @remarks
|
|
3031
|
+
* Use to fetch a specific job by ID, typically for polling job status.
|
|
3032
|
+
*
|
|
3033
|
+
* @example
|
|
3034
|
+
* ```typescript
|
|
3035
|
+
* import { getJob } from 'een-api-toolkit'
|
|
3036
|
+
*
|
|
3037
|
+
* // Poll for job completion
|
|
3038
|
+
* const { data, error } = await getJob('job-123')
|
|
3039
|
+
* if (data?.state === 'success') {
|
|
3040
|
+
* const fileUrl = data.result?.intervals?.[0]?.files?.[0]?.url
|
|
3041
|
+
* const fileId = fileUrl?.substring(fileUrl.lastIndexOf('/') + 1)
|
|
3042
|
+
* console.log('Job completed! File ID:', fileId)
|
|
3043
|
+
* }
|
|
3044
|
+
* ```
|
|
3045
|
+
*
|
|
3046
|
+
* @category Jobs
|
|
3047
|
+
*/
|
|
3048
|
+
export declare interface GetJobParams {
|
|
3049
|
+
/** Additional fields to include in the response */
|
|
3050
|
+
include?: string[];
|
|
3051
|
+
}
|
|
2321
3052
|
|
|
2322
3053
|
/**
|
|
2323
3054
|
* Get a specific layout by ID.
|
|
@@ -2916,6 +3647,163 @@ export declare function initEenToolkit(options?: EenToolkitConfig): void;
|
|
|
2916
3647
|
*/
|
|
2917
3648
|
export declare function initMediaSession(): Promise<Result<MediaSessionResult>>;
|
|
2918
3649
|
|
|
3650
|
+
/**
|
|
3651
|
+
* Job entity from EEN API v3.0.
|
|
3652
|
+
*
|
|
3653
|
+
* @remarks
|
|
3654
|
+
* Represents an asynchronous job in the Eagle Eye Networks platform.
|
|
3655
|
+
* Jobs are used for long-running operations like video exports.
|
|
3656
|
+
*
|
|
3657
|
+
* Note: Some fields like name and timestamps are nested in the `arguments`
|
|
3658
|
+
* and `result` objects. Use helper properties or access them directly:
|
|
3659
|
+
* - Name: `job.arguments?.originalRequest?.name`
|
|
3660
|
+
* - Request timestamps: `job.arguments?.originalRequest?.startTimestamp/endTimestamp`
|
|
3661
|
+
* - Result files: `job.result?.intervals?.[0]?.files`
|
|
3662
|
+
*
|
|
3663
|
+
* @example
|
|
3664
|
+
* ```typescript
|
|
3665
|
+
* import { listJobs, type Job } from 'een-api-toolkit'
|
|
3666
|
+
*
|
|
3667
|
+
* const { data, error } = await listJobs({ state__in: ['pending', 'started'] })
|
|
3668
|
+
* if (data) {
|
|
3669
|
+
* data.results.forEach((job: Job) => {
|
|
3670
|
+
* const name = job.arguments?.originalRequest?.name || job.id
|
|
3671
|
+
* console.log(`${name}: ${job.state}`)
|
|
3672
|
+
* })
|
|
3673
|
+
* }
|
|
3674
|
+
* ```
|
|
3675
|
+
*
|
|
3676
|
+
* @category Jobs
|
|
3677
|
+
*/
|
|
3678
|
+
export declare interface Job {
|
|
3679
|
+
/** Unique identifier for the job */
|
|
3680
|
+
id: string;
|
|
3681
|
+
/** Namespace of the job (e.g., 'media') */
|
|
3682
|
+
namespace?: string;
|
|
3683
|
+
/** Type of job (e.g., 'media.export') */
|
|
3684
|
+
type: string;
|
|
3685
|
+
/** ID of the user who created the job */
|
|
3686
|
+
userId: string;
|
|
3687
|
+
/** Current state of the job */
|
|
3688
|
+
state: JobState;
|
|
3689
|
+
/** Detailed state information */
|
|
3690
|
+
detailedState?: string | null;
|
|
3691
|
+
/** Progress as a decimal (0-1). Multiply by 100 for percentage. */
|
|
3692
|
+
progress?: number;
|
|
3693
|
+
/** Error details if the job failed */
|
|
3694
|
+
error?: string | null;
|
|
3695
|
+
/** Job arguments including the original request */
|
|
3696
|
+
arguments?: JobArguments;
|
|
3697
|
+
/** Job result including output files */
|
|
3698
|
+
result?: JobResult;
|
|
3699
|
+
/** ISO 8601 timestamp when the job was created */
|
|
3700
|
+
createTimestamp: string;
|
|
3701
|
+
/** ISO 8601 timestamp when the job was last updated */
|
|
3702
|
+
updateTimestamp?: string;
|
|
3703
|
+
/** ISO 8601 timestamp when the job is scheduled to expire */
|
|
3704
|
+
expireTimestamp?: string;
|
|
3705
|
+
/** ISO 8601 timestamp when the job is scheduled to run */
|
|
3706
|
+
scheduleTimestamp?: string | null;
|
|
3707
|
+
}
|
|
3708
|
+
|
|
3709
|
+
/**
|
|
3710
|
+
* Job arguments structure.
|
|
3711
|
+
*
|
|
3712
|
+
* @category Jobs
|
|
3713
|
+
*/
|
|
3714
|
+
declare interface JobArguments {
|
|
3715
|
+
/** Device ID the job operates on */
|
|
3716
|
+
deviceId?: string;
|
|
3717
|
+
/** Original request parameters */
|
|
3718
|
+
originalRequest?: JobOriginalRequest;
|
|
3719
|
+
}
|
|
3720
|
+
|
|
3721
|
+
/**
|
|
3722
|
+
* Original request stored in job arguments.
|
|
3723
|
+
*
|
|
3724
|
+
* @category Jobs
|
|
3725
|
+
*/
|
|
3726
|
+
declare interface JobOriginalRequest {
|
|
3727
|
+
/** Export type */
|
|
3728
|
+
type?: string;
|
|
3729
|
+
/** Name given to the export */
|
|
3730
|
+
name?: string;
|
|
3731
|
+
/** Target directory */
|
|
3732
|
+
directory?: string;
|
|
3733
|
+
/** Start timestamp of requested period */
|
|
3734
|
+
startTimestamp?: string;
|
|
3735
|
+
/** End timestamp of requested period */
|
|
3736
|
+
endTimestamp?: string;
|
|
3737
|
+
/** Additional notes */
|
|
3738
|
+
notes?: string | null;
|
|
3739
|
+
/** Tags for the export */
|
|
3740
|
+
tags?: string[] | null;
|
|
3741
|
+
}
|
|
3742
|
+
|
|
3743
|
+
/**
|
|
3744
|
+
* Job result structure.
|
|
3745
|
+
*
|
|
3746
|
+
* @category Jobs
|
|
3747
|
+
*/
|
|
3748
|
+
declare interface JobResult {
|
|
3749
|
+
/** Overall result state */
|
|
3750
|
+
state?: string;
|
|
3751
|
+
/** Error details if failed */
|
|
3752
|
+
error?: string | null;
|
|
3753
|
+
/** Result intervals (each may contain files) */
|
|
3754
|
+
intervals?: JobResultInterval[];
|
|
3755
|
+
}
|
|
3756
|
+
|
|
3757
|
+
/**
|
|
3758
|
+
* File info within a job result interval.
|
|
3759
|
+
*
|
|
3760
|
+
* @category Jobs
|
|
3761
|
+
*/
|
|
3762
|
+
declare interface JobResultFile {
|
|
3763
|
+
/** File name */
|
|
3764
|
+
name: string;
|
|
3765
|
+
/** File path/directory */
|
|
3766
|
+
path?: string;
|
|
3767
|
+
/** File size in bytes */
|
|
3768
|
+
size?: number;
|
|
3769
|
+
/** Start timestamp of the file content */
|
|
3770
|
+
startTimestamp?: string;
|
|
3771
|
+
/** End timestamp of the file content */
|
|
3772
|
+
endTimestamp?: string;
|
|
3773
|
+
/** URL to download/access the file */
|
|
3774
|
+
url?: string;
|
|
3775
|
+
/** File checksum */
|
|
3776
|
+
checksum?: string;
|
|
3777
|
+
}
|
|
3778
|
+
|
|
3779
|
+
/**
|
|
3780
|
+
* Interval within a job result.
|
|
3781
|
+
*
|
|
3782
|
+
* @category Jobs
|
|
3783
|
+
*/
|
|
3784
|
+
declare interface JobResultInterval {
|
|
3785
|
+
/** Start of this interval */
|
|
3786
|
+
startTimestamp?: string;
|
|
3787
|
+
/** End of this interval */
|
|
3788
|
+
endTimestamp?: string;
|
|
3789
|
+
/** State of this interval */
|
|
3790
|
+
state?: string;
|
|
3791
|
+
/** Files produced in this interval */
|
|
3792
|
+
files?: JobResultFile[];
|
|
3793
|
+
/** Error for this interval */
|
|
3794
|
+
error?: string | null;
|
|
3795
|
+
}
|
|
3796
|
+
|
|
3797
|
+
/**
|
|
3798
|
+
* Job states from EEN API v3.0.
|
|
3799
|
+
*
|
|
3800
|
+
* @remarks
|
|
3801
|
+
* Indicates the current state of an asynchronous job.
|
|
3802
|
+
*
|
|
3803
|
+
* @category Jobs
|
|
3804
|
+
*/
|
|
3805
|
+
export declare type JobState = 'pending' | 'started' | 'success' | 'failure' | 'revoked';
|
|
3806
|
+
|
|
2919
3807
|
/**
|
|
2920
3808
|
* Layout entity from EEN API v3.0.
|
|
2921
3809
|
*
|
|
@@ -3593,6 +4481,84 @@ export declare interface ListCamerasParams {
|
|
|
3593
4481
|
status__ne?: CameraStatus;
|
|
3594
4482
|
}
|
|
3595
4483
|
|
|
4484
|
+
/**
|
|
4485
|
+
* List downloads with optional pagination and filtering.
|
|
4486
|
+
*
|
|
4487
|
+
* @remarks
|
|
4488
|
+
* Fetches a paginated list of downloads from `/api/v3.0/downloads`. Supports
|
|
4489
|
+
* filtering by status, camera, and time range.
|
|
4490
|
+
*
|
|
4491
|
+
* For more details, see the
|
|
4492
|
+
* [EEN API Documentation](https://developer.eagleeyenetworks.com/reference/listdownloads).
|
|
4493
|
+
*
|
|
4494
|
+
* @param params - Optional pagination and filtering parameters
|
|
4495
|
+
* @returns A Result containing a paginated list of downloads or an error
|
|
4496
|
+
*
|
|
4497
|
+
* @example
|
|
4498
|
+
* ```typescript
|
|
4499
|
+
* import { listDownloads } from 'een-api-toolkit'
|
|
4500
|
+
*
|
|
4501
|
+
* // Basic usage
|
|
4502
|
+
* const { data, error } = await listDownloads()
|
|
4503
|
+
* if (data) {
|
|
4504
|
+
* console.log(`Found ${data.results.length} downloads`)
|
|
4505
|
+
* }
|
|
4506
|
+
*
|
|
4507
|
+
* // Filter by status
|
|
4508
|
+
* const { data } = await listDownloads({
|
|
4509
|
+
* status__in: ['available'],
|
|
4510
|
+
* pageSize: 50
|
|
4511
|
+
* })
|
|
4512
|
+
* ```
|
|
4513
|
+
*
|
|
4514
|
+
* @category Downloads
|
|
4515
|
+
*/
|
|
4516
|
+
export declare function listDownloads(params?: ListDownloadsParams): Promise<Result<PaginatedResult<Download>>>;
|
|
4517
|
+
|
|
4518
|
+
/**
|
|
4519
|
+
* Parameters for listing downloads.
|
|
4520
|
+
*
|
|
4521
|
+
* @remarks
|
|
4522
|
+
* Supports filtering by status, camera, and time range.
|
|
4523
|
+
*
|
|
4524
|
+
* @example
|
|
4525
|
+
* ```typescript
|
|
4526
|
+
* import { listDownloads } from 'een-api-toolkit'
|
|
4527
|
+
*
|
|
4528
|
+
* // Get available downloads
|
|
4529
|
+
* const { data } = await listDownloads({
|
|
4530
|
+
* status__in: ['available'],
|
|
4531
|
+
* pageSize: 50
|
|
4532
|
+
* })
|
|
4533
|
+
* ```
|
|
4534
|
+
*
|
|
4535
|
+
* @category Downloads
|
|
4536
|
+
*/
|
|
4537
|
+
export declare interface ListDownloadsParams {
|
|
4538
|
+
/** Number of results per page (default: 100, max: 1000) */
|
|
4539
|
+
pageSize?: number;
|
|
4540
|
+
/** Token for fetching a specific page */
|
|
4541
|
+
pageToken?: string;
|
|
4542
|
+
/** Filter by download status (any match) */
|
|
4543
|
+
status__in?: DownloadStatus[];
|
|
4544
|
+
/** Filter by camera ID */
|
|
4545
|
+
cameraId?: string;
|
|
4546
|
+
/** Filter by camera IDs (any match) */
|
|
4547
|
+
cameraId__in?: string[];
|
|
4548
|
+
/** Filter by job ID */
|
|
4549
|
+
jobId?: string;
|
|
4550
|
+
/** Filter by file ID */
|
|
4551
|
+
fileId?: string;
|
|
4552
|
+
/** Filter by downloads created after this timestamp (ISO 8601) */
|
|
4553
|
+
createTimestamp__gte?: string;
|
|
4554
|
+
/** Filter by downloads created before this timestamp (ISO 8601) */
|
|
4555
|
+
createTimestamp__lte?: string;
|
|
4556
|
+
/** Full-text search query */
|
|
4557
|
+
q?: string;
|
|
4558
|
+
/** Fields to sort by (prefix with - for descending) */
|
|
4559
|
+
sort?: string[];
|
|
4560
|
+
}
|
|
4561
|
+
|
|
3596
4562
|
/**
|
|
3597
4563
|
* List event alert condition rules with optional filters and pagination.
|
|
3598
4564
|
*
|
|
@@ -4075,6 +5041,184 @@ export declare interface ListFeedsResult {
|
|
|
4075
5041
|
totalSize?: number;
|
|
4076
5042
|
}
|
|
4077
5043
|
|
|
5044
|
+
/**
|
|
5045
|
+
* List files with optional pagination and filtering.
|
|
5046
|
+
*
|
|
5047
|
+
* @remarks
|
|
5048
|
+
* Fetches a paginated list of files from `/api/v3.0/files`. Supports
|
|
5049
|
+
* filtering by type, camera, and time range.
|
|
5050
|
+
*
|
|
5051
|
+
* For more details, see the
|
|
5052
|
+
* [EEN API Documentation](https://developer.eagleeyenetworks.com/reference/listfiles).
|
|
5053
|
+
*
|
|
5054
|
+
* @param params - Optional pagination and filtering parameters
|
|
5055
|
+
* @returns A Result containing a paginated list of files or an error
|
|
5056
|
+
*
|
|
5057
|
+
* @example
|
|
5058
|
+
* ```typescript
|
|
5059
|
+
* import { listFiles } from 'een-api-toolkit'
|
|
5060
|
+
*
|
|
5061
|
+
* // Basic usage
|
|
5062
|
+
* const { data, error } = await listFiles()
|
|
5063
|
+
* if (data) {
|
|
5064
|
+
* console.log(`Found ${data.results.length} files`)
|
|
5065
|
+
* }
|
|
5066
|
+
*
|
|
5067
|
+
* // Filter by type
|
|
5068
|
+
* const { data } = await listFiles({
|
|
5069
|
+
* type__in: ['export'],
|
|
5070
|
+
* pageSize: 50
|
|
5071
|
+
* })
|
|
5072
|
+
*
|
|
5073
|
+
* // Files for a specific camera
|
|
5074
|
+
* const { data: cameraFiles } = await listFiles({
|
|
5075
|
+
* cameraId: 'camera-123'
|
|
5076
|
+
* })
|
|
5077
|
+
* ```
|
|
5078
|
+
*
|
|
5079
|
+
* @category Files
|
|
5080
|
+
*/
|
|
5081
|
+
export declare function listFiles(params?: ListFilesParams): Promise<Result<PaginatedResult<EenFile>>>;
|
|
5082
|
+
|
|
5083
|
+
/**
|
|
5084
|
+
* Parameters for listing files.
|
|
5085
|
+
*
|
|
5086
|
+
* @remarks
|
|
5087
|
+
* Supports filtering by type, camera, and time range.
|
|
5088
|
+
*
|
|
5089
|
+
* @example
|
|
5090
|
+
* ```typescript
|
|
5091
|
+
* import { listFiles } from 'een-api-toolkit'
|
|
5092
|
+
*
|
|
5093
|
+
* // Get export files
|
|
5094
|
+
* const { data } = await listFiles({
|
|
5095
|
+
* type__in: ['export'],
|
|
5096
|
+
* pageSize: 50
|
|
5097
|
+
* })
|
|
5098
|
+
*
|
|
5099
|
+
* // Get files for a specific camera
|
|
5100
|
+
* const { data: cameraFiles } = await listFiles({
|
|
5101
|
+
* cameraId: 'camera-123'
|
|
5102
|
+
* })
|
|
5103
|
+
* ```
|
|
5104
|
+
*
|
|
5105
|
+
* @category Files
|
|
5106
|
+
*/
|
|
5107
|
+
export declare interface ListFilesParams {
|
|
5108
|
+
/** Number of results per page (default: 100, max: 1000) */
|
|
5109
|
+
pageSize?: number;
|
|
5110
|
+
/** Token for fetching a specific page */
|
|
5111
|
+
pageToken?: string;
|
|
5112
|
+
/**
|
|
5113
|
+
* Additional fields to include in the response.
|
|
5114
|
+
* Valid values: accountId, publicShare, notes, createTimestamp,
|
|
5115
|
+
* updateTimestamp, size, metadata, tags, childCount, details
|
|
5116
|
+
*/
|
|
5117
|
+
include?: FileIncludeField[];
|
|
5118
|
+
/** Filter by file types (any match) */
|
|
5119
|
+
type__in?: FileType[];
|
|
5120
|
+
/** Filter by camera ID */
|
|
5121
|
+
cameraId?: string;
|
|
5122
|
+
/** Filter by camera IDs (any match) */
|
|
5123
|
+
cameraId__in?: string[];
|
|
5124
|
+
/** Filter by job ID */
|
|
5125
|
+
jobId?: string;
|
|
5126
|
+
/** Filter by files created after this timestamp (ISO 8601) */
|
|
5127
|
+
createTimestamp__gte?: string;
|
|
5128
|
+
/** Filter by files created before this timestamp (ISO 8601) */
|
|
5129
|
+
createTimestamp__lte?: string;
|
|
5130
|
+
/** Filter by tags (all must match) */
|
|
5131
|
+
tags__contains?: string[];
|
|
5132
|
+
/** Full-text search query */
|
|
5133
|
+
q?: string;
|
|
5134
|
+
/** Fields to sort by (prefix with - for descending) */
|
|
5135
|
+
sort?: string[];
|
|
5136
|
+
}
|
|
5137
|
+
|
|
5138
|
+
/**
|
|
5139
|
+
* List jobs with optional pagination and filtering.
|
|
5140
|
+
*
|
|
5141
|
+
* @remarks
|
|
5142
|
+
* Fetches a paginated list of jobs from `/api/v3.0/jobs`. Supports
|
|
5143
|
+
* filtering by state, type, and time range.
|
|
5144
|
+
*
|
|
5145
|
+
* For more details, see the
|
|
5146
|
+
* [EEN API Documentation](https://developer.eagleeyenetworks.com/reference/listjobs).
|
|
5147
|
+
*
|
|
5148
|
+
* @param params - Optional pagination and filtering parameters
|
|
5149
|
+
* @returns A Result containing a paginated list of jobs or an error
|
|
5150
|
+
*
|
|
5151
|
+
* @example
|
|
5152
|
+
* ```typescript
|
|
5153
|
+
* import { listJobs } from 'een-api-toolkit'
|
|
5154
|
+
*
|
|
5155
|
+
* // Basic usage
|
|
5156
|
+
* const { data, error } = await listJobs()
|
|
5157
|
+
* if (data) {
|
|
5158
|
+
* console.log(`Found ${data.results.length} jobs`)
|
|
5159
|
+
* }
|
|
5160
|
+
*
|
|
5161
|
+
* // Filter by state
|
|
5162
|
+
* const { data } = await listJobs({
|
|
5163
|
+
* state__in: ['pending', 'started'],
|
|
5164
|
+
* pageSize: 50
|
|
5165
|
+
* })
|
|
5166
|
+
*
|
|
5167
|
+
* // Get export jobs only
|
|
5168
|
+
* const { data: exports } = await listJobs({
|
|
5169
|
+
* type: 'export'
|
|
5170
|
+
* })
|
|
5171
|
+
* ```
|
|
5172
|
+
*
|
|
5173
|
+
* @category Jobs
|
|
5174
|
+
*/
|
|
5175
|
+
export declare function listJobs(params?: ListJobsParams): Promise<Result<PaginatedResult<Job>>>;
|
|
5176
|
+
|
|
5177
|
+
/**
|
|
5178
|
+
* Parameters for listing jobs.
|
|
5179
|
+
*
|
|
5180
|
+
* @remarks
|
|
5181
|
+
* Supports filtering by state, type, and time range.
|
|
5182
|
+
*
|
|
5183
|
+
* @example
|
|
5184
|
+
* ```typescript
|
|
5185
|
+
* import { listJobs } from 'een-api-toolkit'
|
|
5186
|
+
*
|
|
5187
|
+
* // Get pending and started jobs
|
|
5188
|
+
* const { data } = await listJobs({
|
|
5189
|
+
* state__in: ['pending', 'started'],
|
|
5190
|
+
* pageSize: 50
|
|
5191
|
+
* })
|
|
5192
|
+
*
|
|
5193
|
+
* // Get export jobs
|
|
5194
|
+
* const { data: exports } = await listJobs({
|
|
5195
|
+
* type: 'export'
|
|
5196
|
+
* })
|
|
5197
|
+
* ```
|
|
5198
|
+
*
|
|
5199
|
+
* @category Jobs
|
|
5200
|
+
*/
|
|
5201
|
+
export declare interface ListJobsParams {
|
|
5202
|
+
/** Number of results per page (default: 100, max: 1000) */
|
|
5203
|
+
pageSize?: number;
|
|
5204
|
+
/** Token for fetching a specific page */
|
|
5205
|
+
pageToken?: string;
|
|
5206
|
+
/** Filter by job states (any match) */
|
|
5207
|
+
state__in?: JobState[];
|
|
5208
|
+
/** Filter by job type */
|
|
5209
|
+
type?: string;
|
|
5210
|
+
/** Filter by job types (any match) */
|
|
5211
|
+
type__in?: string[];
|
|
5212
|
+
/** Filter by jobs created after this timestamp (ISO 8601) */
|
|
5213
|
+
createTimestamp__gte?: string;
|
|
5214
|
+
/** Filter by jobs created before this timestamp (ISO 8601) */
|
|
5215
|
+
createTimestamp__lte?: string;
|
|
5216
|
+
/** Filter by user ID */
|
|
5217
|
+
userId?: string;
|
|
5218
|
+
/** Fields to sort by (prefix with - for descending) */
|
|
5219
|
+
sort?: string[];
|
|
5220
|
+
}
|
|
5221
|
+
|
|
4078
5222
|
/**
|
|
4079
5223
|
* Valid include options for listing layouts.
|
|
4080
5224
|
*
|