public static IEnumerable <TwitterStatus> Search(TweetSearchOption option) { List <TwitterStatus> returns = new List <TwitterStatus>(); IEnumerable <TwitterStatus> searchResult = TwitterApi.Search(option); char[] invalidChara = Path.GetInvalidFileNameChars(); string queryFileName = option.Query + "_" + DateTime.Now.ToString("yyMMdd_HHmm") + ".json"; foreach (char c in invalidChara) { queryFileName = queryFileName.Replace(c, Strings.StrConv(c.ToString(), VbStrConv.Wide)[0]); } if (!Directory.Exists("検索結果/")) { Directory.CreateDirectory("検索結果"); } using (StreamWriter writer = new StreamWriter("検索結果/" + queryFileName)) { writer.WriteLine(JsonConvert.SerializeObject(searchResult, Formatting.Indented)); } returns = returns.Concat(searchResult).ToList(); return(returns); }
/// <summary> /// Use OAuth2 Bearer To do read-only GET query /// </summary> /// <param name="url">URL to call</param> /// <param name="parameters">Params to send</param> /// <returns></returns> public async Task<HttpResponseMessage> GetAsync(string url, SortedDictionary<string, string> parameters) { // ensure we have a bearerToken before progressing if (clientID != null && clientSecret != null && bearerToken == null) { await this.StartApplicationOnlyAuth(); } if (bearerToken == null) return null; var querystring = parameters.Aggregate("", (current, entry) => current + (entry.Key + "=" + entry.Value + "&")); var oauth2 = String.Format("Bearer {0}", bearerToken); var fullUrl = url; var handler = new HttpClientHandler(); if (handler.SupportsAutomaticDecompression) { handler.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate; } var client = new HttpClient(handler); client.DefaultRequestHeaders.Add("Authorization", oauth2); client.DefaultRequestHeaders.Add("User-Agent", TwitterApi.UserAgent()); if (!string.IsNullOrWhiteSpace(querystring)) fullUrl += "?" + querystring.TrimLastChar(); var download = client.GetAsync(fullUrl).ToObservable().Timeout(TimeSpan.FromSeconds(waitTimeoutSeconds)); return await download; }
public TwitterService() { const string consumerKey = "ZScn2AEIQrfC48Zlw"; const string consumerSecret = "8gKdPBwUfZCQfUiyeFeEwVBQiV3q50wIOrIjoCxa2Q"; TwitterApi = new TwitterApi(consumerKey, consumerSecret); }
private static async Task <string> PostData(string url, string authdata, string content = null) { try { var handler = new HttpClientHandler(); if (handler.SupportsAutomaticDecompression) { handler.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate; } var client = new HttpClient(handler); var request = new HttpRequestMessage(HttpMethod.Post, new Uri(url)); request.Headers.Add("Accept-Encoding", "identity"); request.Headers.Add("User-Agent", TwitterApi.UserAgent()); request.Headers.Add("Authorization", authdata); if (content != null) { request.Content = new StringContent(content, Encoding.UTF8, "application/x-www-form-urlencoded"); } var response = await client.SendAsync(request); var clientresponse = response.Content.ReadAsStringAsync().ToObservable().Timeout(TimeSpan.FromSeconds(30)); return(await clientresponse); } catch (Exception e) { return(e.Message); } }
protected TwitterCommandBase(TwitterApi twitterApi, string command) { this._TwitterApi = twitterApi; this._CommandBaseUri = TwitterApi.ApiBaseUri + "/" + this._TwitterApi.ApiVersion.ToString("D") + "/" + command; }
public LoginProgressForm(TwitterApi login) { Login = login; authorizationUrlString = "https://api.twitter.com/oauth/authorize?oauth_token=" + login.OAuth.User.Token; InitializeComponent(); }
/// <summary> /// Using client(consumer) id and key, start a 'readonly' Application-auth'd session /// </summary> /// <remarks>ref: https://dev.twitter.com/docs/api/1.1/post/oauth2/invalidate_token </remarks> public static async Task <bool> StopApplicationOnlyAuth(this IApplicationSession appsession) { if (string.IsNullOrEmpty(appsession.clientID)) { throw new ArgumentException("Twitter Consumer Key is required for Application only Auth"); } if (string.IsNullOrEmpty(appsession.clientSecret)) { throw new ArgumentException("Twitter Consumer Secret is required for Application only Auth"); } // ref: https://dev.twitter.com/docs/auth/application-only-auth // and ref: http://tools.ietf.org/html/rfc6749#section-4.4 // and ref: https://dev.twitter.com/docs/api/1.1/post/oauth2/invalidate_token var oAuth2TokenUrlPostRequestRfc6749 = new SortedDictionary <string, string> { { "access_token", appsession.bearerToken } }; var result = await appsession.PostAsync(TwitterApi.OAuth2TokenRevokeUrl(), oAuth2TokenUrlPostRequestRfc6749, forInitialAuth : true); if (!result.IsSuccessStatusCode) { return(false); } var content = await result.Content.ReadAsStringAsync(); var jresponse = JObject.Parse(content); appsession.bearerToken = (string)jresponse["access_token"]; appsession.IsActive = false; return(true); }
/// <summary> /// Removes the uploaded profile banner for the authenticating user. Returns HTTP 20x upon success. /// </summary> /// <param name="fileName">file name for upload</param> /// <param name="imageContentStream">Stream of image content</param> /// <param name="bannerWidth">The width of the preferred section of the image being uploaded in pixels. Use with height, offset_left, and offset_top to select the desired region of the image to use.</param> /// <param name="bannerHeight">The height of the preferred section of the image being uploaded in pixels. Use with width, offset_left, and offset_top to select the desired region of the image to use.</param> /// <param name="bannerLeftOffset">The number of pixels by which to offset the uploaded image from the left. Use with height, width, and offset_top to select the desired region of the image to use.</param> /// <param name="bannerTopOffset">The number of pixels by which to offset the uploaded image from the top. Use with height, width, and offset_left to select the desired region of the image to use.</param> /// <remarks> ref: https://dev.twitter.com/docs/api/1.1/post/account/update_profile_banner </remarks> public static async Task <TwitterSuccess> ChangeProfileBanner(this IUserSession session, string fileName, Stream imageContentStream, int bannerWidth = 0, int bannerHeight = 0, int bannerLeftOffset = 0, int bannerTopOffset = 0) { var parameters = new TwitterParametersCollection(); if (bannerWidth != 0) { parameters.Add("width", bannerWidth.ToString()); } if (bannerHeight != 0) { parameters.Add("height", bannerWidth.ToString()); } if (bannerLeftOffset != 0) { parameters.Add("offset_left", bannerWidth.ToString()); } if (bannerTopOffset != 0) { parameters.Add("offset_top", bannerWidth.ToString()); } return(await session.PostFileAsync(TwitterApi.Resolve("/1.1/account/update_profile_banner.json"), parameters, fileName, "banner", srImage : imageContentStream) .ContinueWith(c => c.MapToTwitterSuccess())); }
/// <summary> /// Returns the current configuration used by Twitter including twitter.com slugs which are not usernames, maximum photo resolutions, and t.co URL lengths. /// </summary> /// <returns></returns> /// <remarks> ref: https://dev.twitter.com/rest/reference/get/help/configuration </remarks> public async static Task <Configuration> GetConfiguration(this IUserSession session) { var parameters = new TwitterParametersCollection(); parameters.Create(); return(await session.GetAsync(TwitterApi.Resolve("/1.1/help/configuration.json"), parameters).ContinueWith(c => c.MapToSingle <Configuration>())); }
/// <summary> /// Removes the uploaded profile banner for the authenticating user. Returns HTTP 200 upon success. /// </summary> /// <remarks> ref: https://dev.twitter.com/docs/api/1.1/post/account/remove_profile_banner </remarks> public static async Task <TwitterSuccess> DeleteProfileBanner(this IUserSession session) { var parameters = new TwitterParametersCollection(); return(await session.PostAsync(TwitterApi.Resolve("/1.1/account/remove_profile_banner.json"), parameters) .ContinueWith(c => c.MapToTwitterSuccess())); }
/// <summary> /// Updates the authenticating user's profile image. /// </summary> /// <param name="fileName">file name for upload</param> /// <param name="imageContent">byte array of image content</param> /// <remarks> ref: https://dev.twitter.com/docs/api/1.1/post/account/update_profile_image </remarks> public static async Task <User> ChangeAccountProfileImage(this IUserSession session, string fileName, byte[] imageContent) { var parameters = new TwitterParametersCollection(); return(await session.PostFileAsync(TwitterApi.Resolve("/1.1/account/update_profile_image.json"), parameters, fileName, "image", imageContent) .ContinueWith(c => c.MapToSingle <User>())); }
/// <summary> /// Returns settings (including current trend, geo and sleep time information) for the authenticating user. /// </summary> /// <remarks> ref: https://dev.twitter.com/docs/api/1.1/get/account/settings </remarks> public static async Task <AccountSettings> GetAccountSettings(this IUserSession session) { var parameters = new TwitterParametersCollection(); return(await session.GetAsync(TwitterApi.Resolve("/1.1/account/settings.json"), parameters) .ContinueWith(c => c.MapToSingle <AccountSettings>())); }
private static async Task TweetMessage() { TwitterApi twitter = new TwitterApi(ConsumerKey, ConsumerKeySecret, AccessToken, AccessTokenSecret); string[] txtTweets = File.ReadAllText("Tweets\\SriRamMandir.txt").Split(('\n')); int count = 0; List <int> lst = new List <int>(); foreach (string twt in txtTweets) { string msg = $"{tags} {twt}"; if (msg.Length > 280) { Console.WriteLine("Message {0} is too long.", ++count); lst.Add(count); //Console.WriteLine("{0} is more than 280 chars.", msg); //msg = msg.Substring(279); } else { string response = await twitter.Tweet(msg); Console.WriteLine(response); } } int[] array = lst.ToArray(); }
/// <summary> /// Use OAuth1.0a auth to do more intensive POST /// </summary> /// <param name="url">URL to call</param> /// <param name="parameters">Params to send</param> /// <returns></returns> public async Task <HttpResponseMessage> PostAsync(string url, SortedDictionary <string, string> parameters) { if (TwitterCredentials == TwitterCredentials.Null || TwitterCredentials.Valid == false) { throw new ArgumentException("TwitterCredentials must be specified and validated"); } var oauth1aAuthheader = BuildAuthenticatedResult(url, parameters, "POST"); var handler = new HttpClientHandler(); if (handler.SupportsAutomaticDecompression) { handler.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate; } var client = new HttpClient(handler); client.DefaultRequestHeaders.Add("Authorization", oauth1aAuthheader.Header); client.DefaultRequestHeaders.Add("User-Agent", TwitterApi.UserAgent()); var content = parameters.Aggregate(string.Empty, (current, e) => current + string.Format("{0}={1}&", e.Key, Uri.EscapeDataString(e.Value))); var data = new StringContent(content, Encoding.UTF8, "application/x-www-form-urlencoded"); var download = client.PostAsync(url, data).ToObservable().Timeout(TimeSpan.FromSeconds(waitTimeoutSeconds)); var clientdownload = await download; return(clientdownload); }
public MainWindow() { InitializeComponent(); var keys = XElement.Load(".\\Keys.xml"); TwitterApi = new TwitterApi(keys.Element("consumerKey").Value, keys.Element("consumerSecret").Value, keys.Element("token").Value, keys.Element("tokenSecret").Value); this.TimelineTimer = new Timer(state => { var task = new Task(this.UpdateHomeTimeline); task.Start((TaskScheduler)state); }, TaskScheduler.FromCurrentSynchronizationContext(), 90000, 90000); this.RefreshHomeTimeline.Click += (sender, args) => { if (String.IsNullOrWhiteSpace(this.SinceId)) return; this.UpdateHomeTimeline(); }; var bgWorker = new BackgroundWorker(); bgWorker.DoWork += (sender, args) => { if (!this.TwitterApi.AccountCommand.VerifyCredentials(out this.AuthenticatedUser)) return; }; bgWorker.RunWorkerCompleted += (sender, args) => { if (this.AuthenticatedUser == null) return; this.ProfileImage.Source = new BitmapImage(new Uri("https://si0.twimg.com/profile_images/1943624052/1cc1blmkl7yg2ud3b8ke_bigger.jpeg")); this.UserInfoStackPanel.Children.Add(new TextBlock(new Run(this.AuthenticatedUser.Name))); this.UserInfoStackPanel.Children.Add(new TextBlock(new Run(this.AuthenticatedUser.Location))); this.UserInfoStackPanel.Children.Add(new TextBlock(new Run(this.AuthenticatedUser.Description))); this.StatisticInfo.Children.Add(new TextBlock(new Run(this.AuthenticatedUser.StatusesCount.ToString())) { HorizontalAlignment = HorizontalAlignment.Center }); this.StatisticInfo.Children.Add(new TextBlock(new Run(this.AuthenticatedUser.FollowersCount.ToString())) { HorizontalAlignment = HorizontalAlignment.Center }); this.StatisticInfo.Children.Add(new TextBlock(new Run(this.AuthenticatedUser.FriendsCount.ToString())) { HorizontalAlignment = HorizontalAlignment.Center }); this.StatisticInfo.Children.Add(new TextBlock(new Run("Tweets")) { HorizontalAlignment = HorizontalAlignment.Center }); this.StatisticInfo.Children.Add(new TextBlock(new Run("Followers")) { HorizontalAlignment = HorizontalAlignment.Center }); this.StatisticInfo.Children.Add(new TextBlock(new Run("Following")) { HorizontalAlignment = HorizontalAlignment.Center }); this.UpdateHomeTimeline(); }; bgWorker.RunWorkerAsync(); this.SendTweet.Click += (sender, args) => { this.TwitterApi.TweetCommand.Update(this.NewTweetBox.Text); this.NewTweetBox.Clear(); }; }
public MobypictureApi(TwitterApi twitterApi) { var handler = twitterApi.CreateOAuthEchoHandler(AuthServiceProvider, OAuthRealm); this.http = Networking.CreateHttpClient(handler); this.http.Timeout = Networking.UploadImageTimeout; }
private void Share_Tap(object sender, GestureEventArgs e) { Indicator.SetLoadingIndicator(this, "Sending tweet"); var activite = App.DataContext.CurrentActivity; byte[] imageBytes; using (MemoryStream ms = new MemoryStream()) { WriteableBitmap btmMap = new WriteableBitmap(activite.Image); btmMap.SaveJpeg(ms, activite.Image.PixelWidth, activite.Image.PixelHeight, 0, 100); imageBytes = ms.ToArray(); } App.DataContext.IsLoading = true; TaskFactory s = new TaskFactory(); s.StartNew( () => { TwitterApi.PostMessageWithImageToTwitter( App.DataContext.CurrentActivity.ActivityType.Type + " " + App.DataContext.CurrentActivity.TimeStamp, imageBytes); }); }
/// <summary> /// Returns detailed information about the relationship between two arbitrary users. /// </summary> /// <param name="sourceScreenName">The user_id of the subject user.</param> /// <param name="sourceId">The screen_name of the subject user.</param> /// <param name="targetId">The user_id of the target user.</param> /// <param name="targetScreenName">The screen_name of the target user.</param> /// <returns></returns> /// <remarks> ref: https://api.twitter.com/1.1/friendships/show.json </remarks> public async static Task <UserStatus> GetFriendship(this IUserSession session, string sourceScreenName = "", string targetScreenName = "", int sourceId = 0, int targetId = 0) { var parameters = new TwitterParametersCollection(); if (!string.IsNullOrWhiteSpace(sourceScreenName)) { parameters.Add("source_screen_name", sourceScreenName); } if (sourceId != 0) { parameters.Add("source_id", sourceId.ToString()); } if (!string.IsNullOrWhiteSpace(targetScreenName)) { parameters.Add("target_screen_name", targetScreenName); } if (targetId != 0) { parameters.Add("target_id", targetId.ToString()); } if (parameters.EnsureAllArePresent(new [] { "source_screen_name", "source_id", "target_screen_name", "target_id" }).IsFalse()) { return(session.MapParameterError <UserStatus>( "source_screen_name, source_id, target_screen_name and target_id are all required")); } return(await session.PostAsync(TwitterApi.Resolve("/1.1/friendships/show.json"), parameters) .ContinueWith(c => c.MapToSingle <UserStatus>())); }
/// <summary> /// Returns detailed information about the relationship between two arbitrary users. /// </summary> /// <param name="sourceScreenName">The user_id of the subject user.</param> /// <param name="sourceId">The screen_name of the subject user.</param> /// <param name="targetId">The user_id of the target user.</param> /// <param name="targetScreenName">The screen_name of the target user.</param> /// <returns></returns> /// <remarks> ref: https://api.twitter.com/1.1/friendships/show.json </remarks> public async static Task <UserStatus> GetFriendship(this ITwitterSession session, string sourceScreenName = "", string targetScreenName = "", int sourceId = 0, int targetId = 0) { var parameters = new TwitterParametersCollection(); if (!string.IsNullOrWhiteSpace(sourceScreenName)) { parameters.Add("source_screen_name", sourceScreenName); } if (sourceId != 0) { parameters.Add("source_id", sourceId.ToString()); } if (!string.IsNullOrWhiteSpace(targetScreenName)) { parameters.Add("target_screen_name", targetScreenName); } if (targetId != 0) { parameters.Add("target_id", targetId.ToString()); } return(await session.GetAsync(TwitterApi.Resolve("/1.1/friendships/show.json"), parameters) .ContinueWith(c => c.MapToSingle <UserStatus>())); }
/// <summary> /// Returns the locations that Twitter has trending topic information for. /// </summary> /// <returns></returns> /// <remarks> ref: https://dev.twitter.com/docs/api/1.1/get/trends/available </remarks> public static async Task <TwitterResponseCollection <TrendsAvailableLocationsResponse> > GetTrendsAvailableLocations(this ITwitterSession session) { var parameters = new TwitterParametersCollection(); return(await session.GetAsync(TwitterApi.Resolve("/1.1/trends/available.json"), parameters) .ContinueWith(c => c.MapToMany <TrendsAvailableLocationsResponse>())); }
/// <summary> /// Sets values that users are able to set under the "Account" tab of their settings page. Only the parameters specified will be updated. /// </summary> /// <param name="name">Full name associated with the profile. Maximum of 20 characters.</param> /// <param name="profileUrl">URL associated with the profile. Will be prepended with "http://" if not present. Maximum of 100 characters.</param> /// <param name="location">The city or country describing where the user of the account is located.</param> /// <param name="description">A description of the user owning the account. Maximum of 160 characters.</param> /// <remarks> ref: https://dev.twitter.com/docs/api/1.1/post/account/update_profile </remarks> public static async Task <User> ChangeAccountProfile(this IUserSession session, string name = "", string profileUrl = "", string location = "", string description = "") { var parameters = new TwitterParametersCollection(); parameters.Create(include_entities: true, skip_status: true); // first 20 chars if (!string.IsNullOrWhiteSpace(name)) { parameters.Add("name", name.TrimAndTruncate(20)); } // first 100 chars if (!string.IsNullOrWhiteSpace(profileUrl)) { parameters.Add("purl", profileUrl.TrimAndTruncate(100)); } // first 30 chars if (!string.IsNullOrWhiteSpace(location)) { parameters.Add("location", location.TrimAndTruncate(30)); } // first 160 chars if (!string.IsNullOrWhiteSpace(description)) { parameters.Add("description", description.TrimAndTruncate(160)); } return(await session.PostAsync(TwitterApi.Resolve("/1.1/account/update_profile.json"), parameters) .ContinueWith(c => c.MapToSingle <User>())); }
/// <summary> /// Returns the authenticated user's saved search queries. /// </summary> /// <returns></returns> /// <remarks> ref: https://dev.twitter.com/docs/api/1.1/get/saved_searches/list </remarks> public async static Task <TwitterResponseCollection <SavedSearch> > GetSavedSearches(this IUserSession session) { var parameters = new TwitterParametersCollection(); return(await session.GetAsync(TwitterApi.Resolve("/1.1/saved_searches/list.json"), parameters) .ContinueWith(c => c.MapToMany <SavedSearch>())); }
private void MainForm_Load(object sender, EventArgs e) { settings = new IniSettings(new FileInfo("BlockThemAll.ini")); loginTemp = TwitterApi.Login(settings); ProcessTwitterLogin(); SetProgressLabel(workStatus.ToString()); foreach (KeyValuePair <string, Dictionary <string, object> > item in settings) { if (item.Key.Equals("Authenticate")) { continue; } loginTemp = TwitterApi.Login(settings, item.Key); ProcessTwitterLogin(item.Key); } CredentialManager.Instance.SelectCredential("Default"); if (CredentialManager.Instance.Status == UserStatus.LOGIN_SUCCESS) { RefreshMyInfo(); } }
/// <summary> /// Use OAuth1.0a auth to do more intensive reads /// </summary> /// <param name="url">URL to call</param> /// <param name="parameters">Params to send</param> /// <returns></returns> public new async Task <HttpResponseMessage> GetAsync(string url, SortedDictionary <string, string> parameters) { if (TwitterCredentials == TwitterCredentials.Null || TwitterCredentials.Valid == false) { throw new ArgumentException("TwitterCredentials must be specified and validated"); } var querystring = parameters.Aggregate("", (current, entry) => current + (entry.Key + "=" + entry.Value + "&")); var oauth1aAuthheader = BuildAuthenticatedResult(url, parameters, "GET"); var fullUrl = url; var handler = new HttpClientHandler(); if (handler.SupportsAutomaticDecompression) { handler.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate; } var client = new HttpClient(handler); client.DefaultRequestHeaders.Add("Authorization", oauth1aAuthheader.Header); client.DefaultRequestHeaders.Add("User-Agent", TwitterApi.UserAgent()); if (!string.IsNullOrWhiteSpace(querystring)) { fullUrl += "?" + querystring.Substring(0, querystring.Length - 1); } var download = client.GetAsync(fullUrl).ToObservable().Timeout(TimeSpan.FromSeconds(waitTimeoutSeconds)); var clientdownload = await download; return(clientdownload); }
/// <summary> /// Access to Twitter's suggested user list. This returns the list of suggested user categories. /// </summary> /// <returns></returns> /// <remarks> ref: https://dev.twitter.com/docs/api/1.1/get/users/suggestions </remarks> public static async Task <TwitterResponseCollection <SuggestedUsers> > GetSuggestedLists(this ITwitterSession session) { var parameters = new TwitterParametersCollection(); return(await session.GetAsync(TwitterApi.Resolve("/1.1/users/suggestions.json"), parameters) .ContinueWith(c => c.MapToMany <SuggestedUsers>())); }
protected void Page_Load(object sender, EventArgs e) { // Create Twitter API TwitterApi api = new TwitterApi( new ApiCallOptions { AuthorizationCallbackUri = new Uri( this.Request.Url, new VPathResolver().Resolve("~/User.aspx")) }); try { // Load current user // If the user has not yet connected to Twitter, this will // throw an AuthorizationRequiredException, handled below CachingContainer <ExtendedUser> extendedUserInfoCache = this.Session[UserInfoKey] as CachingContainer <ExtendedUser>; if (extendedUserInfoCache == null) { this.Session[UserInfoKey] = extendedUserInfoCache = new CachingContainer <ExtendedUser>(); } this.TwitterUser = extendedUserInfoCache.Load( TimeSpan.FromMinutes(5), () => { ExtendedUser user; if (api.VerifyCredentials(out user)) { return(user); } else { throw new BadCredentialsException(); } }); // Load user timeline CachingContainer <IList <Status> > userTimelineCache = this.Session[UserTimelineKey] as CachingContainer <IList <Status> >; if (userTimelineCache == null) { this.Session[UserTimelineKey] = userTimelineCache = new CachingContainer <IList <Status> >(); } this.UserTimeline = userTimelineCache.Load( TimeSpan.FromSeconds(30), () => api.UserTimeline()); } catch (BadCredentialsException) { this.Response.Redirect("~/Disconnect.aspx?error=badcredentials", true); } }
protected void Page_Load(object sender, EventArgs e) { // Redirect to User page if user is already authorized with Twitter if (TwitterApi.IsAuthorized()) { this.Response.Redirect("~/User.aspx"); } }
/// <summary> /// Returns all the information about a known place. /// </summary> /// <param name="placeId">A place in the world.</param> /// <returns></returns> /// <remarks> ref: https://dev.twitter.com/docs/api/1.1/get/geo/id/%3Aplace_id </remarks> public static async Task <Place> GetPlaceInfo(this IUserSession session, string placeId) { var parameters = new SortedDictionary <string, string>(); var url = TwitterApi.Resolve("/1.1/geo/id/{0}.json", placeId); return(await session.GetAsync(url, parameters) .ContinueWith(c => c.MapToSingle <Place>())); }
/// <summary> /// Retrieve the information for the saved search represented by the given id. /// </summary> /// <param name="id">The ID of the saved search.</param> /// <returns></returns> /// <remarks> ref: https://dev.twitter.com/docs/api/1.1/get/saved_searches/show/%3Aid </remarks> public async static Task <SavedSearch> GetSaveASearch(this IUserSession session, string id) { var parameters = new TwitterParametersCollection(); var url = TwitterApi.Resolve("/1.1/saved_searches/show/{0}.json", id); return(await session.GetAsync(url, parameters) .ContinueWith(c => c.MapToSingle <SavedSearch>())); }
/// <summary> /// Access the users in a given category of the Twitter suggested user list. /// </summary> /// <param name="slug">The short name of list or a category returned by GetSuggestedList</param> /// <returns></returns> /// <remarks> ref: https://dev.twitter.com/docs/api/1.1/get/users/suggestions/%3Aslug </remarks> public static async Task <SuggestedUsers> GetSuggestedUsers(this ITwitterSession session, string slug) { var parameters = new TwitterParametersCollection(); var url = TwitterApi.Resolve("/1.1/users/suggestions/{0}.json", slug); return(await session.GetAsync(url, parameters) .ContinueWith(c => c.MapToSingle <SuggestedUsers>())); }
/// <summary> /// Returns the current rate limits for methods belonging to the specified resource families. /// </summary> /// <returns></returns> /// <remarks> ref: https://dev.twitter.com/docs/api/1.1/get/application/rate_limit_status </remarks> public static async Task <ApiRateStatusResponse> GetCurrentApiStatus(this ITwitterSession session) { var parameters = new SortedDictionary <string, string>(); var url = TwitterApi.Resolve("/1.1/application/rate_limit_status.json"); var c = session.GetAsync(url, parameters); return(await c.MapToApiRateLimits()); }
public TwitterFeedViewModel(TwitterApi.TwitterApi twitterApi) { _twitterApi = twitterApi; Items = new ObservableCollection<TweetViewItem>(); }