Exemplo n.º 1
0
        private void AddStreamFilterOptionsToRequest(FilterStreamOptions options, RestRequest request)
        {
            if (options.Delimited)
            {
                request.AddParameter("delimited", "length");
            }

            request.AddParameter("stall_warnings", options.StallWarnings.ToString().ToLower());
            request.AddParameter("filter_level", options.FilterLevel.ToString().ToLower());

            if (!String.IsNullOrEmpty(options.Language))
            {
                request.AddParameter("language", options.Language);
            }

            if (options.Follow != null && options.Follow.Any())
            {
                request.AddParameter("follow", ToCommaSeparatedString <long>(options.Follow));
            }

            if (options.Track != null && options.Track.Any())
            {
                request.AddParameter("track", ToCommaSeparatedString <string>(options.Track));
            }

            if (options.Locations != null && options.Locations.Length > 0)
            {
                request.AddParameter("locations", ToCommaSeparatedString(options.Locations));
            }

            request.AddParameter("with", options.With.ToString().ToLower());
            request.AddParameter("replies", options.Replies.ToString().ToLower());
            request.AddParameter("stringify_friend_id", options.StringifyFriendIds.ToString().ToLower());
        }
Exemplo n.º 2
0
        private void WithHammockPublicStreaming <T>(StreamOptions streamOptions, FilterStreamOptions options, Action <T, TwitterResponse> action, string path) where T : class
#endif
        {
            var request = PrepareHammockQuery(path);

            AddStreamFilterOptionsToRequest(options, request);

#if !WINDOWS_PHONE
            return
                (#endif
            WithHammockStreamingImpl(_publicStreamsClient, request, streamOptions, action));
        }
Exemplo n.º 3
0
 private IAsyncResult WithHammockUserStreaming <T>(StreamOptions streamOptions, FilterStreamOptions options, Action <T, TwitterResponse> action, string path) where T : class
Exemplo n.º 4
0
        public virtual void StreamUser(Action <TwitterStreamArtifact, TwitterResponse> action, FilterStreamOptions options)
#endif
        {
            var streamOptions = new StreamOptions {
                ResultsPerCallback = 1
            };

#if !WINDOWS_PHONE
            return
                (#endif
            WithHammockUserStreaming(streamOptions, options, action, "user.json"));
        }
Exemplo n.º 5
0
        /// <summary>
        /// Accesses an asynchronous Twitter user stream indefinitely, until terminated.
        /// </summary>
        /// <seealso href="http://dev.twitter.com/pages/user_streams" />
        /// <param name="action"></param>
        /// <returns></returns>
#if !WINDOWS_PHONE
        public virtual IAsyncResult StreamUser(Action <TwitterStreamArtifact, TwitterResponse> action, FilterStreamOptions options)