1 | import { AlarmHelpersConfig, Camera, Context, Event, Geofence, GeofenceUser, Location, NotificationCreate, Topic, User } from './utils/types';
|
2 | export default class AlarmHelpers {
|
3 | context: Context;
|
4 | config: any;
|
5 | notificationUri?: string;
|
6 | constructor(config: AlarmHelpersConfig);
|
7 | /**
|
8 | * Returns the webhookId of the event.
|
9 | */
|
10 | webhookId(): number | undefined;
|
11 | /**
|
12 | * Returns the id of the company.
|
13 | */
|
14 | companyId(): number | undefined;
|
15 | /**
|
16 | * Returns all information about the location.
|
17 | */
|
18 | location(): Location | undefined;
|
19 | /**
|
20 | * Returns the name of the location.
|
21 | */
|
22 | locationName(): string | undefined;
|
23 | /**
|
24 | * Returns the id of the location.
|
25 | */
|
26 | locationId(): number | undefined;
|
27 | /**
|
28 | * Returns the timezone of the location.
|
29 | */
|
30 | timezone(): string;
|
31 | /**
|
32 | * Returns all information about the camera.
|
33 | */
|
34 | camera(): Camera | undefined;
|
35 | /**
|
36 | * Returns the name of the camera.
|
37 | */
|
38 | cameraName(): string | undefined;
|
39 | /**
|
40 | * Returns the id of the camera.
|
41 | */
|
42 | cameraId(): number | undefined;
|
43 | /**
|
44 | * Returns all information about the geofence.
|
45 | */
|
46 | geofence(): Geofence | undefined;
|
47 | /**
|
48 | * Returns the status of the geofence.
|
49 | */
|
50 | geofenceStatus(): string | undefined;
|
51 | /**
|
52 | * Returns all information about each user on the geofence.
|
53 | */
|
54 | geofenceUsers(): GeofenceUser[] | undefined;
|
55 | /**
|
56 | * Returns the presence of each user on the geofence.
|
57 | */
|
58 | geofenceUsersPresence(): string[] | undefined;
|
59 | /**
|
60 | * Returns the device of each user on the geofence.
|
61 | */
|
62 | geofenceUsersDevice(): string[] | undefined;
|
63 | /**
|
64 | * Returns all information about each user on the company.
|
65 | */
|
66 | users(): User[] | undefined;
|
67 | /**
|
68 | * Returns the id of each user on the company.
|
69 | */
|
70 | userIds(): number[] | undefined;
|
71 | /**
|
72 | * Returns the name of each user on the company.
|
73 | */
|
74 | userNames(): string[] | undefined;
|
75 | /**
|
76 | * Returns the email of each user on the company.
|
77 | */
|
78 | userEmails(): string[] | undefined;
|
79 | /**
|
80 | * Returns the eventId of the event.
|
81 | */
|
82 | eventId(): string | undefined;
|
83 | /**
|
84 | * Returns all information about the event.
|
85 | */
|
86 | event(): Event | undefined;
|
87 | /**
|
88 | * Returns the id of the identity associated with the event if it exists.
|
89 | */
|
90 | identityId(): number | undefined;
|
91 | /**
|
92 | * Returns the identity name associated with the event if it exists.
|
93 | */
|
94 | identityName(): string | undefined;
|
95 | /**
|
96 | * Returns the topic of the event.
|
97 | */
|
98 | topic(): Topic | undefined;
|
99 | /**
|
100 | * Returns the timestamp of the event.
|
101 | */
|
102 | timestamp(): string | undefined;
|
103 | /**
|
104 | * Returns the tagged feature of the event if it exists.
|
105 | */
|
106 | feature(): string | undefined;
|
107 | /**
|
108 | * Returns the bounding box of the event if it exists.
|
109 | */
|
110 | boundingBox(): object | undefined;
|
111 | /**
|
112 | * Returns the image url of the event.
|
113 | */
|
114 | image(): string | undefined;
|
115 | /**
|
116 | * Checks if the the event was tagged with a 'face' feature.
|
117 | */
|
118 | faceDetected(): boolean;
|
119 | /**
|
120 | * Checks if the the event was tagged with a 'person' feature.
|
121 | */
|
122 | personDetected(): boolean;
|
123 | /**
|
124 | * Checks if the the event was tagged with a 'car' feature.
|
125 | */
|
126 | carDetected(): boolean;
|
127 | /**
|
128 | * Checks if the the event was tagged with a 'person' feature and that the confidence
|
129 | * was greater than the input confidence.
|
130 | */
|
131 | personDetectedWithConfidence(confidence: number): boolean;
|
132 | /**
|
133 | * Checks whether the location id in the alarm configuration matches the location id in
|
134 | * the event.
|
135 | */
|
136 | matchesLocation(): boolean;
|
137 | /**
|
138 | * Checks whether the geofence status in the alarm configuration matches the geofence status
|
139 | * in the event.
|
140 | */
|
141 | matchesGeofenceStatus(): boolean;
|
142 | /**
|
143 | * Checks whether the camera(s) id(s) in the alarm configuration matches the camera id
|
144 | * in the event.
|
145 | */
|
146 | matchesCameras(): boolean;
|
147 | /**
|
148 | * Checks whether the feature in the alarm configuration matches the feature in the event.
|
149 | */
|
150 | matchesFeature(): boolean;
|
151 | /**
|
152 | * Checks whether the identity(s) id(s) in the alarm configuration matches the identity id
|
153 | * in the event.
|
154 | */
|
155 | matchesIdentities(): boolean;
|
156 | /**
|
157 | * Gets the current time in military time and the current day and checks it against the
|
158 | * schedule that may be specified in the alarm configuration. This can be useful when
|
159 | * choosing whether to trigger a script based on the schedule.
|
160 | */
|
161 | inSchedule(): boolean;
|
162 | /**
|
163 | * Formats the timestamp sent in the event to be ISO8601 format.
|
164 | */
|
165 | formattedTimestamp(): string;
|
166 | /**
|
167 | * Sends a notification to the Nirovision notification service or another specified service.
|
168 | * Generally this function will always want to be used as the final step of the script, after
|
169 | * the conditions of the script have been met and the desired notification has been constructed.
|
170 | */
|
171 | sendNotification(notification: NotificationCreate): Promise<any>;
|
172 | }
|