backend: Add recording fields parameter and enhance pagination in getRecordings response
This commit is contained in:
parent
5e11be08b4
commit
754dd3bd35
@ -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'
|
||||
@ -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
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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'
|
||||
|
||||
@ -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}`);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user