- private extractVideos(body: any) {
- const videos_json = body.data;
- const totalVideos = body.total;
- const videos = [];
- for (const video_json of videos_json) {
- videos.push(new Video(video_json));
+ loadCompleteDescription (descriptionPath: string) {
+ return this.authHttp
+ .get(API_URL + descriptionPath)
+ .map(res => res['description'])
+ .catch((res) => this.restExtractor.handleError(res))
+ }
+
+ setVideoLike (id: number) {
+ return this.setVideoRate(id, 'like')
+ }
+
+ setVideoDislike (id: number) {
+ return this.setVideoRate(id, 'dislike')
+ }
+
+ getUserVideoRating (id: number): Observable<UserVideoRate> {
+ const url = UserService.BASE_USERS_URL + 'me/videos/' + id + '/rating'
+
+ return this.authHttp
+ .get(url)
+ .catch(res => this.restExtractor.handleError(res))
+ }
+
+ private videoPaginationToRestPagination (videoPagination: VideoPagination) {
+ const start: number = (videoPagination.currentPage - 1) * videoPagination.itemsPerPage
+ const count: number = videoPagination.itemsPerPage
+
+ return { start, count }
+ }
+
+ private setVideoRate (id: number, rateType: VideoRateType) {
+ const url = VideoService.BASE_VIDEO_URL + id + '/rate'
+ const body: UserVideoRateUpdate = {
+ rating: rateType