Skip to main content

TypeScript Models And Configuration

This page covers the request, response, and configuration models that TypeScript SDK users work with directly.

Import Pattern​

Import these classes from the package root.

import { EOIAddStreamInputs, EOIRegion, EOIStreamInfo } from "eyesonit-typescript-sdk";

Building Detection Configurations​

The main detection-building classes are:

  • EOIRegion
  • EOIVertex
  • EOIDetectionConfig
  • EOIObjectDescription
  • EOIDetectionCondition
  • EOIMotionDetection
  • EOILine

Example:

import {
EOIRegion,
EOIVertex,
EOIDetectionConfig,
EOIObjectDescription,
EOIDetectionCondition,
} from "eyesonit-typescript-sdk";

const region = new EOIRegion();
region.name = "Front Gate";
region.polygon = [
new EOIVertex(0, 0),
new EOIVertex(1920, 0),
new EOIVertex(1920, 1080),
new EOIVertex(0, 1080),
];

const config = EOIDetectionConfig.default();
config.class_name = "vehicle";
config.class_threshold = 30;
config.use_object_type_detection = true;
config.use_natural_language = true;
config.use_face_recognition = false;
config.use_similarity_detection = false;
config.object_descriptions = [
new EOIObjectDescription("white delivery truck", false, true, 75),
new EOIObjectDescription("road and buildings", true, false),
];
config.conditions = [
new EOIDetectionCondition("count_greater_than", 0),
];

region.detection_configs = [config];
Construction Style

Create EOIRegion and EOIDetectionConfig objects first, then assign properties.

Request Models​

Image And Stream Requests​

ClassPurposeImportant Fields
EOIProcessImageInputsProcess one base64 imagebase64Image, regions, return_image, effects
EOIAddStreamInputsRegister a stream for monitoringstream_url, name, frame_rate, index_for_search, search_index_types, regions, lines, notification, recording, effects
EOIMonitorStreamInputsStart monitoring a streamstreamUrl, durationSeconds
EOIProcessVideoInputsSubmit a video-processing jobname, input_video_path, rotate_video, output_video_path, frame_rate, regions, lines, real_time, recording, effects, video_start_local_time, start_seconds, end_seconds, mode, base_image_path, plugins, validation
EOIUpdateConfigInputsWrapper for /update_config payloadsbody

Search Requests​

EOISearchInputs is the shared base class for live and archive search. Its fields are:

  • class_name
  • search_type
  • object_description
  • face_match_type
  • face_person_id
  • face_group_id
  • alert_threshold
  • similarity
  • stream_list

Derived classes:

ClassAdds
EOIArchiveSearchInputsstart_date_time, end_date_time
EOILiveSearchInputsduration_seconds, notification
EOIUpdateLiveSearchInputssearch_id for pause/resume/cancel

Face Recognition Requests​

ClassPurposeImportant Fields
EOIAddFacerecGroupInputsCreate a face-recognition groupgroup_id, group_name, group_description
EOIAddFacerecPersonInputsCreate a person profileperson_id, person_display_name, person_groups, person_images
EOIAddFacerecPeopleInputsBulk import people from a filefile_path

EOIAddFacerecPersonInputs also includes:

  • addImageBase64(image: string, file_path: string)

That helper adds an image record and sets capture_time to the current timestamp.

Configuration And Helper Models​

Notifications, Recording, And Effects​

ClassFields
EOINotificationphone_number, include_image, plus server-returned alerting, rest_url, last_detection
EOIRecordingenabled, record_with_alert, record_with_detection, record_with_motion, record_combined_confidence_threshold, save_detection_data, save_original_copy, recording_folder, output_file_name, include_stream_name, video_recording, image_recording
EOIVideoRecordingenabled, record_all_frames
EOIImageRecordingenabled, record_full_frame, record_object_bounds, record_all_frames, frame_record_interval
EOIEffectsoverlay and output flags such as show_motion, show_bounding_boxes, show_bounding_box_labels, show_lines, show_regions, show_preliminary_detections, show_validated_detections, blur_non_validated_detections, show_confidence_levels, show_object_count, show_frame_number, show_track_id, show_alert_text, font_scale

Face Recognition And Similarity​

ClassFields
EOIFaceRecognitionConfigmatch_type, match_threshold, person, group
EOISimilarityConfigimages
EOISimilarityImageseed_id, image, alert, threshold

Supported face recognition match types are:

  • person
  • group
  • all_faces

EOISimilarityImage.fromJsonObj(...) also supports image_path, which is read from disk and converted to base64 before the request is built.

Video Validation​

EOIValidation and EOIValidationTrigger are used by EOIProcessVideoInputs.validation.

Fields:

  • EOIValidation.triggers
  • EOIValidationTrigger.class_name
  • EOIValidationTrigger.start_seconds
  • EOIValidationTrigger.end_seconds

Response And Result Models​

The most commonly consumed response payload models are:

ClassWhat It Represents
EOIStreamInfostream details returned by stream APIs
EOIImageDetectionone image-processing detection result
EOIVideoDetectionone video or monitored-stream detection result
EOIDetectionObjectone detected object with class, prompt, face, or similarity metadata
EOISearchResultone archive-search result
EOIFaceDetectionObjectface-recognition match details
EOISimilarityDetectionObjectsimilarity match confidence
EOIBoundingBoxobject bounds
EOILastDetectionInfonotification-side last-detection metadata

Useful helpers on detection/result models include:

  • EOIImageDetection.getDetectedObjects()
  • EOIImageDetection.getMaxConfidenceForDescription(description)
  • EOIImageDetection.getMaxConfidenceDescription()
  • EOIVideoDetection.getDetectedObjects()
  • EOIVideoDetection.getMaxConfidenceDescription()
  • EOIDetectionObject.getConfidenceForDescription(description)
  • EOIDetectionObject.getMaxConfidenceDescription()

Defaults And Factory Helpers​

Convenience helpers:

  • EOIDetectionConfig.default()
  • EOIMotionDetection.default()
  • EOIFaceRecognitionConfig.default()
  • EOISimilarityConfig.default()
  • EOISimilarityImage.default()
  • EOIImageRecording.noImageRecording()
  • EOIVideoRecording.noVideoRecording()

Use them when you want a valid starting object and then override only the fields you care about.

Validation Rules​

The SDK-side validator enforces these constraints before a request is sent:

  • stream_url must be non-empty
  • stream names, region names, and line names must be at least 3 characters
  • polygons must contain at least 3 vertices
  • lines must contain at least 2 vertices
  • vertex coordinates cannot be negative
  • valid object classes are person, vehicle, bag, animal, and unknown
  • object_size must be at least 100 when specified
  • video and stream frame_rate must be at least 1
  • motion detection threshold must be at least 10
  • live search alert_threshold must be greater than 0 and less than 100
  • search_id for live-search updates must be -1 or greater than 0
  • archive search dates must be valid ISO date-times on or after 2020-01-01T00:00:00Z
  • group and person IDs for face recognition must be present for the selected match mode
  • similarity configs must include at least one valid EOISimilarityImage

API Notes​

  • EyesOnItAPI.updateConfig(...) accepts EOIUpdateConfigInputs, and the nested body payload should match the configuration accepted by your EyesOnIt server.
  • The response wrappers all flatten the raw EOIResponse into typed fields instead of exposing data directly.
  • processImage(...) injects the request image into the API body as file.
  • removeStream(...), stopMonitoringStream(...), getStreamDetails(...), getLastDetectionInfo(...), and getVideoFrame(...) take raw string arguments.