Example #1
0
        /// <summary>
        /// 在已知道Access Token和Access Secret情况下调用API的示例 
        /// </summary>
        public static void Test()
        {
            //实例化OAuth对象
            string appKey = "3ab2872742234704925c33dec507f9bb";
            string appSecret = "f6cd03eb8734e8f64b98bef6ce8d546a";
            OAuth oauth = new OAuth(appKey, appSecret);
            oauth.Token = "91c8a7555f694dd3bd7a55178dfa952d";            //Access Token
            oauth.TokenSecret = "2e01aa675faf5764d59564537f142f51";      //Access Secret

            //根据OAuth对象实例化API接口
            Timeline api = new Timeline(oauth);
            var data = api.GetPublicTimeline(0, 10);

            Twitter twitter = new Twitter(oauth);
            //var data2 = twitter.Add("铁盒的钥匙我找不到!沉在盒子里的是你给我的快乐,我很想记得,可是我记不得", @"C:\Users\hooyes\Pictures\58.gif", "127.0.0.1");
            var data2 = twitter.Add("让我们半兽人的眼神单纯。", "207.6.14.22");
            if (data2.Ret == 0)
             {
                 //删除刚发的微博
                 Console.WriteLine("发布成功");
             }
             else
             {
                 Console.WriteLine("发布失败");
             }

             Console.ReadLine();
        }