From aa13385c8698662aa881bf21543cea5e2f342fa1 Mon Sep 17 00:00:00 2001 From: juancarmore Date: Fri, 23 May 2025 12:58:56 +0200 Subject: [PATCH] frontend: update listRooms and getRecordings methods in HttpService to improve pagination handling --- .../pages/console/rooms/rooms.component.ts | 2 +- .../src/lib/services/http/http.service.ts | 26 ++++++++++++++++--- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/frontend/projects/shared-meet-components/src/lib/pages/console/rooms/rooms.component.ts b/frontend/projects/shared-meet-components/src/lib/pages/console/rooms/rooms.component.ts index de7179a..ad57b92 100644 --- a/frontend/projects/shared-meet-components/src/lib/pages/console/rooms/rooms.component.ts +++ b/frontend/projects/shared-meet-components/src/lib/pages/console/rooms/rooms.component.ts @@ -46,7 +46,7 @@ export class RoomsComponent implements OnInit { async ngOnInit() { try { - const rooms = await this.roomService.listRooms(); + const { rooms } = await this.roomService.listRooms(); this.createdRooms = rooms; } catch (error) { console.error('Error fetching room preferences', error); diff --git a/frontend/projects/shared-meet-components/src/lib/services/http/http.service.ts b/frontend/projects/shared-meet-components/src/lib/services/http/http.service.ts index 56a787b..90f9a32 100644 --- a/frontend/projects/shared-meet-components/src/lib/services/http/http.service.ts +++ b/frontend/projects/shared-meet-components/src/lib/services/http/http.service.ts @@ -30,7 +30,14 @@ export class HttpService { return this.deleteRequest(`${this.API_PATH_PREFIX}/rooms/${roomId}`); } - listRooms(fields?: string): Promise { + listRooms(fields?: string): Promise<{ + rooms: MeetRoom[]; + pagination: { + isTruncated: boolean; + nextPageToken?: string; + maxItems: number; + }; + }> { let path = `${this.API_PATH_PREFIX}/rooms/`; if (fields) { path += `?fields=${encodeURIComponent(fields)}`; @@ -108,11 +115,22 @@ export class HttpService { return this.postRequest(`${this.INTERNAL_API_PATH_PREFIX}/rooms/${roomId}/recording-token`, { secret }); } - getRecordings(continuationToken?: string): Promise<{ recordings: MeetRecordingInfo[]; continuationToken: string }> { + getRecordingMediaUrl(recordingId: string): string { + return `${this.API_PATH_PREFIX}/recordings/${recordingId}/media`; + } + + getRecordings(nextPageToken?: string): Promise<{ + recordings: MeetRecordingInfo[]; + pagination: { + isTruncated: boolean; + nextPageToken?: string; + maxItems: number; + }; + }> { let path = `${this.API_PATH_PREFIX}/recordings`; - if (continuationToken) { - path += `?continuationToken=${continuationToken}`; + if (nextPageToken) { + path += `?nextPageToken=${nextPageToken}`; } return this.getRequest(path);