Exemple #1
0
        internal static IEnumerable <T> Enumerate(TokensBase tokens, string apiName, EnumerateMode mode, IDictionary <string, object> parameters)
        {
            var r = tokens.AccessApi <Cursored <T> >(MethodType.Get, apiName, parameters);

            while (true)
            {
                foreach (var i in r)
                {
                    yield return(i);
                }
                var next = mode == EnumerateMode.Next ? r.NextCursor : r.PreviousCursor;
                if (next == 0)
                {
                    break;
                }
                parameters["cursor"] = next;
                r = tokens.AccessApi <Cursored <T> >(MethodType.Get, apiName, parameters);
            }
        }
Exemple #2
0
 /// <summary>
 /// <para>Enumerates user IDs for every user following the specified user.</para>
 /// <para>At this time, results are ordered with the most recent following first; however, this ordering is subject to unannounced change and eventual consistency issues.</para>
 /// <para>Results are given in groups of 5,000 user IDs and multiple "pages" of results can be navigated through using the next_cursor value in subsequent requests.</para>
 /// <para>This method is especially powerful when used in conjunction with GET users/lookup, a method that allows you to convert user IDs into full user objects in bulk.</para>
 /// <para>Available parameters:</para>
 /// <para>- <c>long</c> user_id (optional)</para>
 /// <para>- <c>string</c> screen_name (optional)</para>
 /// <para>- <c>int</c> count (optional)</para>
 /// <para>- <c>long</c> cursor (optional)</para>
 /// </summary>
 /// <param name="mode">Specify whether enumerating goes to the next page or the previous.</param>
 /// <param name="parameters">The parameters.</param>
 /// <returns>The IDs.</returns>
 public IEnumerable <long> EnumerateIds(EnumerateMode mode, IDictionary <string, object> parameters)
 {
     return(Cursored <long> .Enumerate(this.Tokens, "followers/ids", mode, parameters));
 }
Exemple #3
0
 /// <summary>
 /// <para>Enumerates user IDs for every user following the specified user.</para>
 /// <para>At this time, results are ordered with the most recent following first; however, this ordering is subject to unannounced change and eventual consistency issues.</para>
 /// <para>Results are given in groups of 5,000 user IDs and multiple "pages" of results can be navigated through using the next_cursor value in subsequent requests.</para>
 /// <para>This method is especially powerful when used in conjunction with GET users/lookup, a method that allows you to convert user IDs into full user objects in bulk.</para>
 /// <para>Available parameters:</para>
 /// <para>- <c>long</c> user_id (optional)</para>
 /// <para>- <c>string</c> screen_name (optional)</para>
 /// <para>- <c>int</c> count (optional)</para>
 /// <para>- <c>long</c> cursor (optional)</para>
 /// </summary>
 /// <param name="mode">Specify whether enumerating goes to the next page or the previous.</param>
 /// <param name="parameters">The parameters.</param>
 /// <returns>The IDs.</returns>
 public IEnumerable <long> EnumerateIds(EnumerateMode mode, params Expression <Func <string, object> >[] parameters)
 {
     return(Cursored <long> .Enumerate(this.Tokens, "followers/ids", mode, parameters));
 }
Exemple #4
0
 /// <summary>
 /// <para>Enumerates a collection of up to 100 user IDs belonging to users who have retweeted the tweet specified by the id parameter.</para>
 /// <para>This method offers similar data to GET statuses/retweets/:id and replaces API v1's GET statuses/:id/retweeted_by/ids method.</para>
 /// <para>Available parameters:</para>
 /// <para>- <c>long</c> id (required)</para>
 /// <para>- <c>long</c> cursor (semi-optional)</para>
 /// <para>Don't use stringify_ids</para>
 /// </summary>
 /// <param name="mode">Specify whether enumerating goes to the next page or the previous.</param>
 /// <param name="parameters">The parameters.</param>
 /// <returns>The IDs.</returns>
 public IEnumerable <long> EnumerateRetweetersIds <T>(EnumerateMode mode, T parameters)
 {
     return(Cursored <long> .Enumerate <T>(this.Tokens, "statuses/retweeters/ids", mode, parameters));
 }
Exemple #5
0
        internal static IEnumerable <T> EnumerateImpl(TokensBase tokens, string apiName, EnumerateMode mode, IEnumerable <KeyValuePair <string, object> > parameters)
        {
            var prmList = parameters.ToList();
            var r       = tokens.AccessApiImpl <Cursored <T> >(MethodType.Get, apiName, prmList, "");

            while (true)
            {
                foreach (var i in r)
                {
                    yield return(i);
                }
                var next = mode == EnumerateMode.Next ? r.NextCursor : r.PreviousCursor;
                if (next == 0)
                {
                    break;
                }
                prmList.RemoveAll(kvp => kvp.Key == "cursor");
                prmList.Add(new KeyValuePair <string, object>("cursor", next));
                r = tokens.AccessApiImpl <Cursored <T> >(MethodType.Get, apiName, prmList, "");
            }
        }
Exemple #6
0
        internal static IEnumerable <T> Enumerate(TokensBase tokens, string apiName, EnumerateMode mode, object parameters)
        {
            var p = InternalUtils.ResolveObject(parameters);

            return(EnumerateImpl(tokens, apiName, mode, p));
        }
Exemple #7
0
 public IEnumerable <User> EnumerateSubscriptions <T>(EnumerateMode mode, T parameters)
 {
     return(Cursored <User> .Enumerate <T>(this.Tokens, "lists/subscriptions", mode, parameters));
 }
Exemple #8
0
 /// <summary>
 /// <para>Enumerates user objects for users following the specified user.</para>
 /// <para>At this time, results are ordered with the most recent following first; however, this ordering is subject to unannounced change and eventual consistency issues.</para>
 /// <para>Results are given in groups of 20 users and multiple "pages" of results can be navigated through using the next_cursor value in subsequent requests.</para>
 /// <para>Note: Either a screen_name or a user_id should be provided.</para>
 /// <para>Available parameters:</para>
 /// <para>- <c>long</c> id (optional)</para>
 /// <para>- <c>string</c> screen_name (optional)</para>
 /// <para>- <c>bool</c> include_entities (optional)</para>
 /// <para>- <c>bool</c> skip_status (optional)</para>
 /// <para>- <c>long</c> cursor (optional)</para>
 /// </summary>
 /// <param name="mode">Specify whether enumerating goes to the next page or the previous.</param>
 /// <param name="parameters">The parameters.</param>
 /// <returns>The users.</returns>
 public IEnumerable <User> EnumerateList(EnumerateMode mode, IDictionary <string, object> parameters)
 {
     return(Cursored <User> .Enumerate(this.Tokens, "followers/list", mode, parameters));
 }
Exemple #9
0
 /// <summary>
 /// <para>Enumerate numeric IDs for every protected user for whom the authenticating user has a pending follow request.</para>
 /// <para>Available parameters: </para>
 /// <para>- <c>long</c> cursor (semi-optional)</para>
 /// </summary>
 /// <param name="mode">Specify whether enumerating goes to the next page or the previous.</param>
 /// <param name="parameters">The parameters.</param>
 /// <returns>The IDs.</returns>
 public IEnumerable <long> EnumerateOutgoing <T>(EnumerateMode mode, T parameters)
 {
     return(Cursored <long> .Enumerate <T>(this.Tokens, "friendships/outgoing", mode, parameters));
 }
Exemple #10
0
 /// <summary>
 /// <para>Enumerate numeric IDs for every protected user for whom the authenticating user has a pending follow request.</para>
 /// <para>Available parameters: </para>
 /// <para>- <c>long</c> cursor (semi-optional)</para>
 /// </summary>
 /// <param name="mode">Specify whether enumerating goes to the next page or the previous.</param>
 /// <param name="parameters">The parameters.</param>
 /// <returns>The IDs.</returns>
 public IEnumerable <long> EnumerateOutgoing(EnumerateMode mode, IDictionary <string, object> parameters)
 {
     return(Cursored <long> .Enumerate(this.Tokens, "friendships/outgoing", mode, parameters));
 }
Exemple #11
0
 /// <summary>
 /// <para>Enumerate numeric IDs for every protected user for whom the authenticating user has a pending follow request.</para>
 /// <para>Available parameters: </para>
 /// <para>- <c>long</c> cursor (semi-optional)</para>
 /// </summary>
 /// <param name="mode">Specify whether enumerating goes to the next page or the previous.</param>
 /// <param name="parameters">The parameters.</param>
 /// <returns>The IDs.</returns>
 public IEnumerable <long> EnumerateOutgoing(EnumerateMode mode, params Expression <Func <string, object> >[] parameters)
 {
     return(Cursored <long> .Enumerate(this.Tokens, "friendships/outgoing", mode, parameters));
 }
Exemple #12
0
 public IEnumerable <User> Enumerate <T>(EnumerateMode mode, T parameters)
 {
     return(Cursored <User> .Enumerate <T>(this.Tokens, "lists/members", mode, parameters));
 }
Exemple #13
0
 public IEnumerable <User> Enumerate(EnumerateMode mode, IDictionary <string, object> parameters)
 {
     return(Cursored <User> .Enumerate(this.Tokens, "lists/members", mode, parameters));
 }
Exemple #14
0
 /// <summary>
 /// <para>Returns the members of the specified list. Private list members will only be shown if the authenticated user owns the specified list.</para>
 /// <para>Note: Either a list_id or a slug is required. If providing a list_slug, an owner_screen_name or owner_id is also required.</para>
 /// <para>The response from the API will include a previous_cursor and next_cursor to allow paging back and forth. See Using cursors to navigate collections for more information.</para>
 /// <para>Avaliable parameters: </para>
 /// <para><paramref name="long list_id (required)"/> : The numerical id of the list.</para>
 /// <para><paramref name="string slug (required)"/> : You can identify a list by its slug instead of its numerical id. If you decide to do so, note that you'll also have to specify the list owner using the owner_id or owner_screen_name parameters.</para>
 /// <para><paramref name="string owner_sereen_name (optional)"/> : The screen name of the user who owns the list being requested by a slug.</para>
 /// <para><paramref name="long owner_id (optional)"/> : The user ID of the user who owns the list being requested by a slug.</para>
 /// <para><paramref name="long cursor (optional)"/> : The first cursor. If not be specified, enumerating starts from the first page.</para>
 /// </summary>
 /// <returns>
 /// Users.
 /// </returns>
 /// <see cref="https://dev.twitter.com/docs/misc/cursoring"/>
 /// <param name='mode'>
 /// <para> Specify whether enumerating goes to the next page or the previous.</para>
 /// </param>
 /// <param name='parameters'>
 /// Parameters.
 /// </param>
 public IEnumerable <User> Enumerate(EnumerateMode mode, params Expression <Func <string, object> >[] parameters)
 {
     return(Cursored <User> .Enumerate(this.Tokens, "lists/members", mode, parameters));
 }
Exemple #15
0
 /// <summary>
 /// <para>Enumerates user IDs for every user following the specified user.</para>
 /// <para>At this time, results are ordered with the most recent following first; however, this ordering is subject to unannounced change and eventual consistency issues.</para>
 /// <para>Results are given in groups of 5,000 user IDs and multiple "pages" of results can be navigated through using the next_cursor value in subsequent requests.</para>
 /// <para>This method is especially powerful when used in conjunction with GET users/lookup, a method that allows you to convert user IDs into full user objects in bulk.</para>
 /// <para>Available parameters:</para>
 /// <para>- <c>long</c> user_id (optional)</para>
 /// <para>- <c>string</c> screen_name (optional)</para>
 /// <para>- <c>int</c> count (optional)</para>
 /// <para>- <c>long</c> cursor (optional)</para>
 /// </summary>
 /// <param name="mode">Specify whether enumerating goes to the next page or the previous.</param>
 /// <param name="parameters">The parameters.</param>
 /// <returns>The IDs.</returns>
 public IEnumerable <long> EnumerateIds <T>(EnumerateMode mode, T parameters)
 {
     return(Cursored <long> .Enumerate <T>(this.Tokens, "followers/ids", mode, parameters));
 }
Exemple #16
0
 /// <summary>
 /// <para>Enumerates user objects for users following the specified user.</para>
 /// <para>At this time, results are ordered with the most recent following first; however, this ordering is subject to unannounced change and eventual consistency issues.</para>
 /// <para>Results are given in groups of 20 users and multiple "pages" of results can be navigated through using the next_cursor value in subsequent requests.</para>
 /// <para>Note: Either a screen_name or a user_id should be provided.</para>
 /// <para>Available parameters:</para>
 /// <para>- <c>long</c> id (optional)</para>
 /// <para>- <c>string</c> screen_name (optional)</para>
 /// <para>- <c>bool</c> include_entities (optional)</para>
 /// <para>- <c>bool</c> skip_status (optional)</para>
 /// <para>- <c>long</c> cursor (optional)</para>
 /// </summary>
 /// <param name="mode">Specify whether enumerating goes to the next page or the previous.</param>
 /// <param name="parameters">The parameters.</param>
 /// <returns>The users.</returns>
 public IEnumerable <User> EnumerateList(EnumerateMode mode, params Expression <Func <string, object> >[] parameters)
 {
     return(Cursored <User> .Enumerate(this.Tokens, "followers/list", mode, parameters));
 }
Exemple #17
0
        internal static IEnumerable <T> Enumerate(TokensBase tokens, string apiName, EnumerateMode mode, params Expression <Func <string, object> >[] parameters)
        {
            var p = InternalUtils.ExpressionsToDictionary(parameters);

            return(EnumerateImpl(tokens, apiName, mode, p));
        }
Exemple #18
0
 /// <summary>
 /// <para>Enumerates user objects for users following the specified user.</para>
 /// <para>At this time, results are ordered with the most recent following first; however, this ordering is subject to unannounced change and eventual consistency issues.</para>
 /// <para>Results are given in groups of 20 users and multiple "pages" of results can be navigated through using the next_cursor value in subsequent requests.</para>
 /// <para>Note: Either a screen_name or a user_id should be provided.</para>
 /// <para>Available parameters:</para>
 /// <para>- <c>long</c> id (optional)</para>
 /// <para>- <c>string</c> screen_name (optional)</para>
 /// <para>- <c>bool</c> include_entities (optional)</para>
 /// <para>- <c>bool</c> skip_status (optional)</para>
 /// <para>- <c>long</c> cursor (optional)</para>
 /// </summary>
 /// <param name="mode">Specify whether enumerating goes to the next page or the previous.</param>
 /// <param name="parameters">The parameters.</param>
 /// <returns>The users.</returns>
 public IEnumerable <User> EnumerateList <T>(EnumerateMode mode, T parameters)
 {
     return(Cursored <User> .Enumerate <T>(this.Tokens, "followers/list", mode, parameters));
 }
Exemple #19
0
 internal static IEnumerable <T> Enumerate(TokensBase tokens, string apiName, EnumerateMode mode, IDictionary <string, object> parameters)
 {
     return(EnumerateImpl(tokens, apiName, mode, parameters));
 }