Created
June 19, 2018 12:28
-
-
Save Sampath-Lokuge/1ee0fd72a2ce28be9ae7e00f122f8a9d to your computer and use it in GitHub Desktop.
playlist-provider.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from '@angular/core'; | |
import { HttpWrapper } from '../providers'; | |
import { AppSetting } from '../../app/app.settings'; | |
import { Observable } from 'rxjs/Observable'; | |
import { OrderPlaylistMediaItem } from '../../models/OrderPlaylistMediaItem'; | |
import { BehaviorSubject } from 'rxjs'; | |
@Injectable() | |
export class PlayListProvider { | |
playlistUpdates: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false); | |
constructor(private http: HttpWrapper, private global: AppSetting, ) { | |
} | |
//create Media Playlist | |
createMediaPlaylist(name: string): Observable<any> { | |
return this.http.get("createmediaplaylist/" + name); | |
} | |
//get Distributor Play lists | |
getDistributorPlaylists(): Observable<any> { | |
return this.http.get("getdistributorplaylists/" + this.global.LANGUAGEID + "/" + this.global.COUNTRYID); | |
} | |
//get Corporate Play lists | |
getCorporatePlaylists(): Observable<any> { | |
return this.http.get("GetCorporatePlaylists/" + this.global.webStoreId + "/" + this.global.LANGUAGEID + "/" + this.global.COUNTRYID); | |
} | |
//delete Distributor Playlist | |
deleteDistributorPlaylist(playlistid: number): Observable<any> { | |
return this.http.get("deletemediaplaylist/" + playlistid + "/"); | |
} | |
//update Playlist Name | |
updatePlaylistName(playlistId: number, newName: string): Observable<any> { | |
return this.http.get("updateplaylistname/" + playlistId + "/" + newName); | |
} | |
//add Media Item To Playlist | |
addMediaItemToPlaylist(mediaId: number, playlistId: number): Observable<any> { | |
return this.http.get("addmediatoplaylist/" + mediaId + "/" + playlistId); | |
} | |
//remove Media Item from Playlist | |
removeMediaItemFromPlaylist(mediaId: number, playlistId: number): Observable<any> { | |
return this.http.get("RemoveMediaFromPlaylist/" + mediaId + "/" + playlistId); | |
} | |
//get Playlist Media Items | |
getPlaylistMediaItems(playlistId: number): Observable<any> { | |
return this.http.get("GetPlaylistMedia/" + playlistId + "/" + this.global.LANGUAGEID + "/" + this.global.COUNTRYID); | |
} | |
//order Playlist Media Item | |
orderPlaylistMediaItem(data: OrderPlaylistMediaItem): Observable<any> { | |
return this.http.post("orderplaylistmedia/", data); | |
} | |
//add Media To Favorites | |
addMediaToFavorites(mediaId: number) { | |
console.log("ID", mediaId); | |
return this.http.get("addmediatofavorites/" + mediaId); | |
} | |
//get Favorites | |
getFavorites(): Observable<any> { | |
return this.http.get(`GetFavoriteMedia/${this.global.LANGUAGEID}/${this.global.COUNTRYID}`); | |
} | |
//playlist Trigger Update | |
playlistTriggerUpdate() { | |
this.playlistUpdates.next(true); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment