当前位置: 首页>>代码示例>>C#>>正文


C# IUserSession.GetFriendsIDs方法代码示例

本文整理汇总了C#中IUserSession.GetFriendsIDs方法的典型用法代码示例。如果您正苦于以下问题:C# IUserSession.GetFriendsIDs方法的具体用法?C# IUserSession.GetFriendsIDs怎么用?C# IUserSession.GetFriendsIDs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IUserSession的用法示例。


在下文中一共展示了IUserSession.GetFriendsIDs方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DoFriendsFollowersTest

        public async Task<bool> DoFriendsFollowersTest(IUserSession session, List<int> testSeq)
        {
            var successStatus = true;
            try
            {
                // 1
                if (testSeq.Contains(1))
                {
                    ConsoleOutput.PrintMessage("6.1 FriendsFollowers\\GetFriendsIDs", ConsoleColor.Gray);

                    long nextcursor = -1;
                    var ffListCount = 0;

                    do
                    {
                        var ff1List = await session.GetFriendsIDs(cursor: nextcursor);
                        if (ff1List.twitterFaulted)
                        {
                            successStatus = false;
                            break;
                        };
                        nextcursor = ff1List.next_cursor;
                        ConsoleOutput.PrintMessage(String.Format("Previous cursor: {0} Next cursor: {1}",
                            ff1List.previous_cursor, ff1List.next_cursor));
                        foreach (var l in ff1List.UserIDs)
                        {
                            ffListCount++;
                            ConsoleOutput.PrintMessage(String.Format("User ID: {0}", l ));
                        }
                    } while (nextcursor != 0);

                    ConsoleOutput.PrintMessage(String.Format("Total Friends List Count: {0}",
                       ffListCount));
                }

                // 2
                if (testSeq.Contains(2))
                {
                    ConsoleOutput.PrintMessage("6.2 FriendsFollowers\\GetFollowersIDs", ConsoleColor.Gray);

                    long nextcursor = -1;
                    var ff2ListCount = 0;

                    do
                    {
                        var ff2List = await session.GetFollowersIDs(cursor: nextcursor);
                        if (ff2List.twitterFaulted)
                        {
                            successStatus = false;
                            break;
                        };
                        nextcursor = ff2List.next_cursor;
                        ConsoleOutput.PrintMessage(String.Format("Previous cursor: {0} Next cursor: {1}",
                            ff2List.previous_cursor, ff2List.next_cursor));
                        foreach (var l in ff2List.UserIDs)
                        {
                            ff2ListCount++;
                            ConsoleOutput.PrintMessage(String.Format("User ID: {0}", l));
                        }
                    } while (nextcursor != 0);

                    ConsoleOutput.PrintMessage(String.Format("Total Followers List Count: {0}",
                       ff2ListCount));
                }

                // 3
                if (testSeq.Contains(3))
                {
                    ConsoleOutput.PrintMessage("6.3 FriendsFollowers\\GetFriendships", ConsoleColor.Gray);
                    var ff3 = await session.GetFriendships(new List<string>{"katyperry","shiftkey"});

                    if (ff3.OK)
                    {
                        foreach (var t in ff3)
                        {
                            ConsoleOutput.PrintMessage(
                                String.Format("Name: {0} // UserID: {1}", t.ScreenName, t.UserId));
                            foreach (var c in t.Connections)
                            {
                                ConsoleOutput.PrintMessage(
                                String.Format("Connection: {0}", c.ToString()));
                            }
                        }
                    }
                    else
                        successStatus = false;
                }


                // 4
                if (testSeq.Contains(4))
                {
                    ConsoleOutput.PrintMessage("6.4 FriendsFollowers\\GetFriendshipRequestsIncoming", ConsoleColor.Gray);

                    long nextcursor = -1;
                    var ff4ListCount = 0;

                    do
                    {
                        var ff4List = await session.GetFriendshipRequestsIncoming(cursor: nextcursor);
//.........这里部分代码省略.........
开发者ID:gerryaobrien,项目名称:BoxKite.Twitter,代码行数:101,代码来源:06FriendsFollowersLiveFireTests.cs


注:本文中的IUserSession.GetFriendsIDs方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。