Files
frigate/frigate/api/defs/query/events_query_parameters.py
T
Nicolas MowenandGitHub 4ee12e6237
CI / AMD64 Build (push) Waiting to run
CI / ARM Build (push) Waiting to run
CI / AMD64 Extra Build (push) Blocked by required conditions
CI / ARM Extra Build (push) Blocked by required conditions
CI / Synaptics Build (push) Blocked by required conditions
CI / Assemble and push default build (push) Blocked by required conditions
CI / Jetson Jetpack 6 (push) Waiting to run
Increase ruff coverage (#23644)
* Pin ruff

* Add python upgrade fixes

This enables python upgrade checks in ruff to look for deprecated types and patterns. This namely fixes:
- usage of deprecated `Typing` which is now built in
- some specific exceptions which are caught and have new aliases

Some specific UP checks were also ignored as they are stylistic / unimportant and likely to cause bugs

* Remove async blocking calls

Use asyncio.to_thread on two remaining blocking calls to fix hanging event thread loop. Enable this specific rule to block it in the future.

* Use proper logging mechanism

* Correctly format logs

* Raise with context

When raising an exception include the from context to improve debugging

* Cleanup
2026-07-06 12:28:02 -05:00

82 lines
2.5 KiB
Python

from pydantic import BaseModel, Field
DEFAULT_TIME_RANGE = "00:00,24:00"
class EventsQueryParams(BaseModel):
camera: str | None = "all"
cameras: str | None = "all"
label: str | None = "all"
labels: str | None = "all"
sub_label: str | None = "all"
sub_labels: str | None = "all"
attributes: str | None = "all"
zone: str | None = "all"
zones: str | None = "all"
limit: int | None = 100
after: float | None = None
before: float | None = None
time_range: str | None = DEFAULT_TIME_RANGE
has_clip: int | None = None
has_snapshot: int | None = None
in_progress: int | None = None
include_thumbnails: int | None = Field(
1,
description=(
"Deprecated. Thumbnail data is no longer included in the response. "
"Use the /api/events/:event_id/thumbnail.:extension endpoint instead."
),
deprecated=True,
)
favorites: int | None = None
min_score: float | None = None
max_score: float | None = None
min_speed: float | None = None
max_speed: float | None = None
recognized_license_plate: str | None = "all"
is_submitted: int | None = None
min_length: float | None = None
max_length: float | None = None
event_id: str | None = None
sort: str | None = None
timezone: str | None = "utc"
class EventsSearchQueryParams(BaseModel):
query: str | None = None
event_id: str | None = None
search_type: str | None = "thumbnail"
include_thumbnails: int | None = Field(
1,
description=(
"Deprecated. Thumbnail data is no longer included in the response. "
"Use the /api/events/:event_id/thumbnail.:extension endpoint instead."
),
deprecated=True,
)
limit: int | None = 50
cameras: str | None = "all"
labels: str | None = "all"
sub_labels: str | None = "all"
attributes: str | None = "all"
zones: str | None = "all"
after: float | None = None
before: float | None = None
time_range: str | None = DEFAULT_TIME_RANGE
has_clip: bool | None = None
has_snapshot: bool | None = None
is_submitted: bool | None = None
timezone: str | None = "utc"
min_score: float | None = None
max_score: float | None = None
min_speed: float | None = None
max_speed: float | None = None
recognized_license_plate: str | None = "all"
sort: str | None = None
class EventsSummaryQueryParams(BaseModel):
timezone: str | None = "utc"
has_clip: int | None = None
has_snapshot: int | None = None