Exemplo n.º 1
0
        public async Task<String> Purchase(string sha256, User myUser)
        {
            var request = (HttpWebRequest) WebRequest.Create(ApiUrl + "purchases/buycart");

            var postData = "paypal[]=" + "&secureKey=" + sha256 + "&user_id=" + myUser.id;
            return await GetHttpPostResponse(request, postData);
        }
Exemplo n.º 2
0
 public async Task<String> PurchasePack(int id, double donate, double artiste, double assoc, double site,
     string sha256, User myUser, int idFriend)
 {
     var request = (HttpWebRequest) WebRequest.Create(ApiUrl + "purchases/buypack");
     string postData = "";
     if (idFriend == -1)
     {
         postData = "pack_id=" + id + "&amount=" + donate + "&artist=" + artiste + "&association=" + assoc + "&website=" + site + "&paypal=" + "&secureKey=" + sha256 + "&user_id=" + myUser.id;
     }
     else
     {
         postData = "pack_id=" + id + "&amount=" + donate + "&artist=" + artiste + "&association=" + assoc + "&website=" + site + "&paypal=" +"gift_user_id=" + idFriend + "&secureKey=" + sha256 + "&user_id=" + myUser.id;
         
     }
     return await GetHttpPostResponse(request, postData);
 }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
0
        public async Task<String> SavePlaylist(Playlist thePlaylist, string sha256, User myUser)
        {
            var request = (HttpWebRequest) WebRequest.Create(ApiUrl + "playlists/save");

            var postData = "playlist[user_id]=" + myUser.id + "&playlist[name]=" + thePlaylist.name + "&secureKey=" +
                           sha256 + "&user_id=" + myUser.id;
            return await GetHttpPostResponse(request, postData);
        }
Exemplo n.º 5
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);
        }
Exemplo n.º 6
0
        public async Task<String> UpdateNamePlaylist(Playlist thePlaylist, string sha256, User myUser)
        {
            var test = new int[thePlaylist.musics.Count];
            var en = "[";
            for (var i = 0; i < thePlaylist.musics.Count; i++)
            {
                test[i] = thePlaylist.musics[i].id;
                if (i == thePlaylist.musics.Count - 1)
                    en += thePlaylist.musics[i].id;
                else
                    en += thePlaylist.musics[i].id + ",";
            }
            en += "]";
            var request = (HttpWebRequest) WebRequest.Create(ApiUrl + "playlists/update");

            var postData = "id=" + thePlaylist.id + "&playlist[name]=" + thePlaylist.name + "&playlist[music]=" + en +
                           "&secureKey=" + sha256 + "&user_id=" +
                           myUser.id;
            return await GetHttpPostResponse(request, postData);
        }
Exemplo n.º 7
0
 public async Task<String> SendTweet(string message, User myUser, string sha256)
 {
     var request = (HttpWebRequest) WebRequest.Create(ApiUrl + "tweets/save");
     var postData = "tweet[user_id]=" + myUser.id + "&tweet[msg]=" + message + "&secureKey=" + sha256 +
                    "&user_id=" + myUser.id;
     return await GetHttpPostResponse(request, postData);
 }
Exemplo n.º 8
0
 public async Task<object> GetItemFromCarts(object myObject, string sha256, User myUser)
 {
     var request =
         (HttpWebRequest)
             WebRequest.Create(ApiUrl + "carts/my_cart?secureKey=" + sha256 + "&user_id=" + myUser.id);
     return await DoRequestForObject(myObject, request);
 }
Exemplo n.º 9
0
 public async Task<object> GetConversation(User FriendUser, string sha256, User myUser, object myObject)
 {
     var request =
         (HttpWebRequest)
             WebRequest.Create(ApiUrl + "messages/conversation/" + FriendUser.id + "?secureKey=" + sha256 +
                               "&user_id=" + myUser.id);
     return await DoRequestForObject(myObject, request);
 }
Exemplo n.º 10
0
 public async Task<String> Update(User myUser, string sha256)
 {
     var request = (HttpWebRequest) WebRequest.Create(ApiUrl + "users/update/");
     var postData = "user[email]=" + myUser.email + "&user[username]=" + myUser.username + "&user[birthday]=" +
                    myUser.birthday
                    + "&user[language]=" + myUser.language + "&user[fname]=" + myUser.fname + "&user[lname]=" +
                    myUser.lname + "&user[description]=" + myUser.description
                    + "&user[phoneNumber]=" + myUser.phoneNumber + "&address[numberStreet]=" +
                    myUser.address.NumberStreet + "&address[complement]=" + myUser.address.Complement
                    + "&address[street]=" + myUser.address.Street
                    + "&address[city]=" + myUser.address.City + "&address[country]=" + myUser.address.Country +
                    "&address[zipcode]=" + myUser.address.Zipcode
                    + "&secureKey=" + sha256 + "&user_id=" + myUser.id;
     return await GetHttpPostResponse(request, postData);
 }
Exemplo n.º 11
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);
 }
Exemplo n.º 12
0
 public async Task<string> DeletePlaylist(Playlist myPlaylist, string sha256, User myUser)
 {
     var request =
         (HttpWebRequest)
             WebRequest.Create(ApiUrl + "playlists/destroy?id=" + myPlaylist.id + "&secureKey=" + sha256 +
                               "&user_id=" + myUser.id);
     return await DoRequest(request);
 }
Exemplo n.º 13
0
 public async Task<string> DeleteFromCart(Carts myCart, string sha256, User myUser)
 {
     var request =
         (HttpWebRequest)
             WebRequest.Create(ApiUrl + "carts/destroy?id=" + myCart.id + "&secureKey=" + sha256 + "&user_id=" +
                               myUser.id);
     return await DoRequest(request);
 }
Exemplo n.º 14
0
        public async Task<String> SaveMessage(string msg, string dest_id, string sha256, User myUser)
        {
            var request = (HttpWebRequest) WebRequest.Create(ApiUrl + "messages/save");

            var postData = "message[user_id]=" + myUser.id + "&message[dest_id]=" + dest_id + "&message[msg]=" +
                           msg + "&secureKey=" + sha256 + "&user_id=" + myUser.id;
            return await GetHttpPostResponse(request, postData);
        }
Exemplo n.º 15
0
 public async Task<String> SendComment(string message, Album myAlbum, News myNews, string sha256, User myUser)
 {
     if (myAlbum != null)
     {
         var request = (HttpWebRequest) WebRequest.Create(ApiUrl + "albums/addcomment/" + myAlbum.id);
         var postData = "content=" + message + "&secureKey=" + sha256 + "&user_id=" + myUser.id;
         return await GetHttpPostResponse(request, postData);
     }
     if (myNews != null)
     {
         var request = (HttpWebRequest) WebRequest.Create(ApiUrl + "news/addcomment/" + myNews.id);
         var postData = "content=" + message + "&secureKey=" + sha256 + "&user_id=" + myUser.id;
         return await GetHttpPostResponse(request, postData);
     }
     return null;
 }
Exemplo n.º 16
0
        public async Task<String> Save(User myUser, string sha256, string password)
        {
            var request = (HttpWebRequest) WebRequest.Create(ApiUrl + "users/save");
            var postData =
                "&user[email]=" + myUser.email +
                "&user[password]=" + password +
                "&user[username]=" + myUser.username +
                "&user[birthday]=" + myUser.birthday +
                "&user[language]=" + "fr" +
                "&user[fname]=" + myUser.fname +
                "&user[lname]=" + myUser.lname +
                //"&user[description]=" + myUser.description +
                "&user[phoneNumber]=" + myUser.phoneNumber;

            if (myUser.address != null)
            {
                postData += "&address[numberStreet]=" + myUser.address.NumberStreet +
                            "&address[complement]=" + myUser.address.Complement +
                            "&address[street]=" + myUser.address.Street +
                            "&address[city]=" + myUser.address.City +
                            "&address[country]=" + myUser.address.Country +
                            "&address[zipcode]=" + myUser.address.Zipcode;
            }
            return await GetHttpPostResponse(request, postData);
        }
Exemplo n.º 17
0
 public async Task<object> GetSecureNews(object myObject, string element, string id, string sha256,
     User user)
 {
     var request =
         (HttpWebRequest)
             WebRequest.Create(ApiUrl + element + "/" + id + "?secureKey=" + sha256 + "&user_id=" + user.id + "&language=" + user.language);
     return await DoRequestForObject(myObject, request);
 }