Updated documentation for the review/summary endpoint

This commit is contained in:
Rui Alves 2024-10-10 19:20:10 +01:00
parent ce17f0cfe3
commit eda00efb01
2 changed files with 86 additions and 5 deletions

View File

@ -277,7 +277,8 @@ paths:
description: Successful Response description: Successful Response
content: content:
application/json: application/json:
schema: { } schema:
$ref: '#/components/schemas/ReviewSummaryResponse'
'422': '422':
description: Validation Error description: Validation Error
content: content:
@ -2368,14 +2369,14 @@ paths:
required: false required: false
schema: schema:
type: number type: number
default: 1728577904.036181 default: 1728580419.15206
title: After title: After
- name: before - name: before
in: query in: query
required: false required: false
schema: schema:
type: number type: number
default: 1728581504.0362 default: 1728584019.152614
title: Before title: Before
responses: responses:
'200': '200':
@ -3186,6 +3187,40 @@ components:
required: required:
- password - password
title: AppPutPasswordBody title: AppPutPasswordBody
DayReview:
properties:
day:
type: string
format: date-time
title: Day
reviewed_alert:
type: integer
title: Reviewed Alert
reviewed_detection:
type: integer
title: Reviewed Detection
reviewed_motion:
type: integer
title: Reviewed Motion
total_alert:
type: integer
title: Total Alert
total_detection:
type: integer
title: Total Detection
total_motion:
type: integer
title: Total Motion
type: object
required:
- day
- reviewed_alert
- reviewed_detection
- reviewed_motion
- total_alert
- total_detection
- total_motion
title: DayReview
EventsCreateBody: EventsCreateBody:
properties: properties:
source_type: source_type:
@ -3280,6 +3315,35 @@ components:
title: Detail title: Detail
type: object type: object
title: HTTPValidationError title: HTTPValidationError
Last24HoursReview:
properties:
reviewed_alert:
type: integer
title: Reviewed Alert
reviewed_detection:
type: integer
title: Reviewed Detection
reviewed_motion:
type: integer
title: Reviewed Motion
total_alert:
type: integer
title: Total Alert
total_detection:
type: integer
title: Total Detection
total_motion:
type: integer
title: Total Motion
type: object
required:
- reviewed_alert
- reviewed_detection
- reviewed_motion
- total_alert
- total_detection
- total_motion
title: Last24HoursReview
RegenerateDescriptionEnum: RegenerateDescriptionEnum:
type: string type: string
enum: enum:
@ -3323,6 +3387,20 @@ components:
- thumb_path - thumb_path
- data - data
title: ReviewSegmentResponse title: ReviewSegmentResponse
ReviewSummaryResponse:
properties:
last24Hours:
$ref: '#/components/schemas/Last24HoursReview'
root:
additionalProperties:
$ref: '#/components/schemas/DayReview'
type: object
title: Root
type: object
required:
- last24Hours
- root
title: ReviewSummaryResponse
SeverityEnum: SeverityEnum:
type: string type: string
enum: enum:

View File

@ -17,7 +17,10 @@ from frigate.api.defs.review_query_parameters import (
ReviewQueryParams, ReviewQueryParams,
ReviewSummaryQueryParams, ReviewSummaryQueryParams,
) )
from frigate.api.defs.review_responses import ReviewSegmentResponse from frigate.api.defs.review_responses import (
ReviewSegmentResponse,
ReviewSummaryResponse,
)
from frigate.api.defs.tags import Tags from frigate.api.defs.tags import Tags
from frigate.models import Recordings, ReviewSegment from frigate.models import Recordings, ReviewSegment
from frigate.util.builtin import get_tz_modifiers from frigate.util.builtin import get_tz_modifiers
@ -103,7 +106,7 @@ def review(params: ReviewQueryParams = Depends()):
return JSONResponse(content=[r for r in review]) return JSONResponse(content=[r for r in review])
@router.get("/review/summary") @router.get("/review/summary", response_model=ReviewSummaryResponse)
def review_summary(params: ReviewSummaryQueryParams = Depends()): def review_summary(params: ReviewSummaryQueryParams = Depends()):
hour_modifier, minute_modifier, seconds_offset = get_tz_modifiers(params.timezone) hour_modifier, minute_modifier, seconds_offset = get_tz_modifiers(params.timezone)
day_ago = (datetime.datetime.now() - datetime.timedelta(hours=24)).timestamp() day_ago = (datetime.datetime.now() - datetime.timedelta(hours=24)).timestamp()