frontend: update listRooms and getRecordings methods in HttpService to improve pagination handling
This commit is contained in:
parent
6b15128af2
commit
aa13385c86
@ -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);
|
||||
|
||||
@ -30,7 +30,14 @@ export class HttpService {
|
||||
return this.deleteRequest(`${this.API_PATH_PREFIX}/rooms/${roomId}`);
|
||||
}
|
||||
|
||||
listRooms(fields?: string): Promise<MeetRoom[]> {
|
||||
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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user