frontend: update getRecordings method to accept filters and improve query parameters
This commit is contained in:
parent
e039e48e06
commit
777b2da6cd
@ -6,7 +6,12 @@ import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { ContextService, HttpService } from '@lib/services';
|
||||
import { ActionService, MeetRecordingInfo, OpenViduComponentsUiModule } from 'shared-meet-components';
|
||||
import {
|
||||
ActionService,
|
||||
MeetRecordingFilters,
|
||||
MeetRecordingInfo,
|
||||
OpenViduComponentsUiModule
|
||||
} from 'shared-meet-components';
|
||||
|
||||
@Component({
|
||||
selector: 'app-room-recordings',
|
||||
@ -99,7 +104,11 @@ export class RoomRecordingsComponent implements OnInit {
|
||||
|
||||
private async loadRecordings() {
|
||||
try {
|
||||
const response = await this.httpService.getRecordings(this.nextPageToken);
|
||||
const recordingFilters: MeetRecordingFilters = {
|
||||
roomId: this.roomId,
|
||||
nextPageToken: this.nextPageToken
|
||||
};
|
||||
const response = await this.httpService.getRecordings(recordingFilters);
|
||||
this.recordings.push(...response.recordings);
|
||||
this.recordings = this.sortRecordingsByDate(this.recordings);
|
||||
this.nextPageToken = response.pagination.nextPageToken;
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import {
|
||||
MeetRecordingFilters,
|
||||
MeetRecordingInfo,
|
||||
MeetRoom,
|
||||
MeetRoomOptions,
|
||||
@ -114,7 +115,7 @@ export class HttpService {
|
||||
return `${this.API_PATH_PREFIX}/recordings/${recordingId}/media`;
|
||||
}
|
||||
|
||||
getRecordings(nextPageToken?: string): Promise<{
|
||||
getRecordings(filters?: MeetRecordingFilters): Promise<{
|
||||
recordings: MeetRecordingInfo[];
|
||||
pagination: {
|
||||
isTruncated: boolean;
|
||||
@ -124,8 +125,22 @@ export class HttpService {
|
||||
}> {
|
||||
let path = `${this.API_PATH_PREFIX}/recordings`;
|
||||
|
||||
if (nextPageToken) {
|
||||
path += `?nextPageToken=${nextPageToken}`;
|
||||
if (filters) {
|
||||
const params = new URLSearchParams();
|
||||
if (filters.maxItems) {
|
||||
params.append('maxItems', filters.maxItems.toString());
|
||||
}
|
||||
if (filters.nextPageToken) {
|
||||
params.append('nextPageToken', filters.nextPageToken);
|
||||
}
|
||||
if (filters.roomId) {
|
||||
params.append('roomId', filters.roomId);
|
||||
}
|
||||
if (filters.fields) {
|
||||
params.append('fields', filters.fields);
|
||||
}
|
||||
|
||||
path += `?${params.toString()}`;
|
||||
}
|
||||
|
||||
return this.getRequest(path);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user