Пример #1
0
 public static async Task<object> ReadTimestamp()
 {
     try
     {
         var sampleFile = await localFolder.GetFileAsync("Musiques.txt");
         var timestamp = await FileIO.ReadTextAsync(sampleFile);
         test = (Music) JsonConvert.DeserializeObject(timestamp, new Music().GetType());
         return test;
         // Data is contained in timestamp
     }
     catch (Exception)
     {
         // Timestamp not found
     }
     return null;
 }
Пример #2
0
        public async Task<String> SetRate(Music myObj, string sha256, string id, int note)
        {
            var request = (HttpWebRequest) WebRequest.Create(ApiUrl + "musics/" + myObj.id + "/note/" + note);

            var postData = "secureKey=" + sha256 + "&user_id=" + id;
            return await GetHttpPostResponse(request, postData);
        }
Пример #3
0
        public async Task<String> UpdatePlaylist(Playlist thePlaylist, Music theMusic, string sha256, User myUser)
        {
            var request = (HttpWebRequest) WebRequest.Create(ApiUrl + "musics/addtoplaylist");

            var postData = "id=" + theMusic.id + "&playlist_id=" + thePlaylist.id + "&secureKey=" + sha256 + "&user_id=" +
                           myUser.id;
            return await GetHttpPostResponse(request, postData);
        }
Пример #4
0
        public async Task<String> SaveCart(Music theMusic, Album theAlbum, string sha256, User myUser)
        {
            var request = (HttpWebRequest) WebRequest.Create(ApiUrl + "carts/save");

            var postData = "";
            if (theMusic != null)
                postData = "cart[user_id]=" + myUser.id + "&cart[typeObj]=" + "Music" + "&cart[obj_id]=" + theMusic.id +
                           "&secureKey=" + sha256 + "&user_id=" + myUser.id;
            else if (theAlbum != null)
                postData = "cart[user_id]=" + myUser.id + "&cart[typeObj]=" + "Album" + "&cart[obj_id]=" + theAlbum.id +
                           "&secureKey=" + sha256 + "&user_id=" + myUser.id;
            return await GetHttpPostResponse(request, postData);
        }
Пример #5
0
 public async Task<string> DeleteMusicFromPlaylist(Playlist myPlaylist, Music theMusic, string sha256,
     User myUser)
 {
     var request =
         (HttpWebRequest)
             WebRequest.Create(ApiUrl + "musics/delfromplaylist?id=" + theMusic.id + "&playlist_id=" +
                               myPlaylist.id + "&secureKey=" + sha256 + "&user_id=" + myUser.id);
     return await DoRequest(request);
 }