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() {
|
async ngOnInit() {
|
||||||
try {
|
try {
|
||||||
const rooms = await this.roomService.listRooms();
|
const { rooms } = await this.roomService.listRooms();
|
||||||
this.createdRooms = rooms;
|
this.createdRooms = rooms;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error fetching room preferences', error);
|
console.error('Error fetching room preferences', error);
|
||||||
|
|||||||
@ -30,7 +30,14 @@ export class HttpService {
|
|||||||
return this.deleteRequest(`${this.API_PATH_PREFIX}/rooms/${roomId}`);
|
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/`;
|
let path = `${this.API_PATH_PREFIX}/rooms/`;
|
||||||
if (fields) {
|
if (fields) {
|
||||||
path += `?fields=${encodeURIComponent(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 });
|
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`;
|
let path = `${this.API_PATH_PREFIX}/recordings`;
|
||||||
|
|
||||||
if (continuationToken) {
|
if (nextPageToken) {
|
||||||
path += `?continuationToken=${continuationToken}`;
|
path += `?nextPageToken=${nextPageToken}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.getRequest(path);
|
return this.getRequest(path);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user