diff --git a/backend/openapi/components/parameters/recording-fields.yaml b/backend/openapi/components/parameters/recording-fields.yaml new file mode 100644 index 0000000..438ab22 --- /dev/null +++ b/backend/openapi/components/parameters/recording-fields.yaml @@ -0,0 +1,9 @@ +name: fields +in: query +description: > + The fields to retrieve from the recording. + Comma-separated list of fields to include in the response. +required: false +schema: + type: string + example: 'recordingId,roomId' \ No newline at end of file diff --git a/backend/openapi/components/responses/success-get-recordings.yaml b/backend/openapi/components/responses/success-get-recordings.yaml index ed1a316..774d83f 100644 --- a/backend/openapi/components/responses/success-get-recordings.yaml +++ b/backend/openapi/components/responses/success-get-recordings.yaml @@ -12,7 +12,7 @@ content: $ref: '../schemas/meet-pagination.yaml' examples: successful_recording_retrieval: - summary: Successfully retrieved a list of recordings + summary: Full recording details response with multiple recordings value: recordings: - recordingId: 'room-123--EG_XYZ--XX445' @@ -24,13 +24,6 @@ content: duration: 3.6 size: 1024 details: 'Stopped using API' - pagination: - isTruncated: false - - paginated_recording_list: - summary: A paginated response indicating more recordings are available - value: - recordings: - recordingId: 'room-456--EG_ZYX--XX678' roomId: 'room-456' status: 'COMPLETE' @@ -41,12 +34,30 @@ content: size: 2048 details: 'Recording completed successfully' pagination: - isTruncated: true - nextPageToken: 'NEXT_PAGE_ABC123' + isTruncated: false + maxItems: 10 - no_recordings_found: - summary: No recordings found for the given query + fields=recordingId: + summary: Response with only recordingId for each recording value: - recordings: [] + recordings: + - recordingId: 'room-123--EG_XYZ--XX445' + - recordingId: 'room-456--EG_ZYX--XX678' pagination: isTruncated: false + maxItems: 10 + fields=recordingId,roomId,status,size: + summary: Recording details including recordingId, roomId, status, and size + value: + recordings: + - recordingId: 'room-123--EG_XYZ--XX445' + roomId: 'room-123' + status: 'ACTIVE' + size: 1024 + - recordingId: 'room-456--EG_ZYX--XX678' + roomId: 'room-456' + status: 'COMPLETE' + size: 2048 + pagination: + isTruncated: false + maxItems: 10 diff --git a/backend/openapi/components/schemas/meet-pagination.yaml b/backend/openapi/components/schemas/meet-pagination.yaml index 8c7c1f8..802830a 100644 --- a/backend/openapi/components/schemas/meet-pagination.yaml +++ b/backend/openapi/components/schemas/meet-pagination.yaml @@ -8,3 +8,8 @@ properties: nextPageToken: type: [string, 'null'] description: The token to retrieve the next page of recordings. + maxItems: + type: integer + description: > + Maximum number of rooms returned in a single response page. + Corresponds to the `maxItems` query parameter in the request. diff --git a/backend/openapi/paths/recordings.yaml b/backend/openapi/paths/recordings.yaml index ccafe9f..2d1f2ac 100644 --- a/backend/openapi/paths/recordings.yaml +++ b/backend/openapi/paths/recordings.yaml @@ -32,6 +32,7 @@ # > ⚠️ **Note:** Using this filter may impact performance for large datasets. # schema: # type: string + - $ref: '../components/parameters/recording-fields.yaml' - $ref: '../components/parameters/room-id.yaml' - $ref: '../components/parameters/max-items.yaml' - $ref: '../components/parameters/next-page-token.yaml' diff --git a/backend/src/controllers/recording.controller.ts b/backend/src/controllers/recording.controller.ts index aa63dba..d3f4e95 100644 --- a/backend/src/controllers/recording.controller.ts +++ b/backend/src/controllers/recording.controller.ts @@ -36,8 +36,17 @@ export const getRecordings = async (req: Request, res: Response) => { logger.verbose('Getting all recordings'); try { - const response = await recordingService.getAllRecordings(queryParams); - return res.status(200).json(response); + const { recordings, isTruncated, nextPageToken } = await recordingService.getAllRecordings(queryParams); + const maxItems = Number(queryParams.maxItems); + + return res.status(200).json({ + recordings, + pagination: { + isTruncated, + nextPageToken, + maxItems + } + }); } catch (error) { if (error instanceof OpenViduMeetError) { logger.error(`Error getting all recordings: ${error.message}`);