private async void UpdateStatus(string text, string pathToImage) { try { if (text == null && pathToImage == null) { return; } string mediaId = string.Empty; if (pathToImage != null) { _url = "https://upload.twitter.com/1.1/media/upload.json"; _aPIservice = new APIservice(); _mediaContent = new MediaContent(); var mdeiaContent = _mediaContent.MediaUpload(pathToImage, "media"); var resp = JsonConvert.DeserializeObject <User>(await _aPIservice.PostResponse(_url, null, mdeiaContent)); mediaId = resp.media_id_string; } _url = "https://api.twitter.com/1.1/statuses/update.json"; _aPIservice = new APIservice(); var data = new Dictionary <string, string> { { "status", text }, { "trim_user", "1" }, { "media_ids", mediaId } }; string response = await _aPIservice.PostResponse(_url, data, null); if (response != null) { DisplayAlert("Successful", "Your status is uploaded", "ok"); return; } }catch (Exception e) { } }
private async Task Update(Dictionary <string, string> data) { var url = "https://api.twitter.com/1.1/account/update_profile.json"; _aPIservice = new APIservice(); if (await _aPIservice.PostResponse(url, data, null) != null) { DisplayAlert("Successful", "User Profile updated", "OK"); } }
public override async void CreateOrDestroyUser(object obj) { string Uname = (string)obj.GetType().GetProperty("Uname").GetValue(obj); _aPIservice = new APIservice(); _url = "https://api.twitter.com/1.1/friendships/create.json"; Dictionary <string, string> data = new Dictionary <string, string> { { "screen_name", Uname }, { "follow", "1" } }; if (await _aPIservice.PostResponse(_url, data, null) != null) { DisplayFlashingMessage("user followed successful"); } }
private async Task UploadProfileMedia(string ImagePath, string url) { _aPIservice = new APIservice(); _mediaContent = new MediaContent(); MultipartFormDataContent multipartContent; if (flag == true) { multipartContent = _mediaContent.MediaUpload(ImagePath, "banner"); } else { multipartContent = _mediaContent.MediaUpload(ImagePath, "image"); } if (await _aPIservice.PostResponse(url, null, multipartContent) != null) { DisplayAlert("Successful", "User Profile updated", "OK"); } }