Example #1
0
        //public CommentTimelineList UpdateCommentByID(string statusid, string format, string status, string apiToken, string apiTokenSecret)
        //{
        //    SinaApiService myApi = new SinaApiService();
        //    string myResult = myApi.status_comment(statusid, status, format, consumerKey, consumerKeySecret, apiToken, apiTokenSecret);
        //    XDocument doc = XDocument.Parse(myResult);
        //    return CommentTimelineList.Parse(doc.Root);
        //}


        public string UpdateCommentByID(string statusid, string format, string status, string apiToken, string apiTokenSecret)
        {
            SinaApiService myApi    = new SinaApiService();
            string         myResult = myApi.status_comment(statusid, status, format, consumerKey, consumerKeySecret, apiToken, apiTokenSecret);

            return(myResult);
        }
Example #2
0
        public string Status_ReplyComment(string twitterid, string commentcontent, string commentid, string format, string apiToken, string apiTokenSecret)
        {
            SinaApiService myApi    = new SinaApiService();
            string         myResult = myApi.status_replycomment(twitterid, commentcontent, commentid, format, consumerKey, consumerKeySecret, apiToken, apiTokenSecret);

            return(myResult);
        }
Example #3
0
        public string Status_Delete(string twitterid, string format, string apiToken, string apiTokenSecret)
        {
            SinaApiService myApi    = new SinaApiService();
            string         myResult = myApi.status_destroy(twitterid, format, consumerKey, consumerKeySecret, apiToken, apiTokenSecret);

            return(myResult);
        }
Example #4
0
        public string UpdateStatus(string format, string status, string apiToken, string apiTokenSecret)
        {
            SinaApiService myApi    = new SinaApiService();
            string         myResult = myApi.statuses_update(format, status, consumerKey, consumerKeySecret, apiToken, apiTokenSecret);

            return(myResult);
        }
Example #5
0
        public string CreateFriendships(string userid, string format, string apiToken, string apiTokenSecret)
        {
            SinaApiService myApi    = new SinaApiService();
            string         myResult = myApi.create_friendships(userid, format, consumerKey, consumerKeySecret, apiToken, apiTokenSecret);

            return(myResult);
        }
Example #6
0
        public string ResetCount(string type, string format, string apiToken, string apiTokenSecret)
        {
            SinaApiService myApi    = new SinaApiService();
            string         myResult = myApi.reset_count(type, format, consumerKey, consumerKeySecret, apiToken, apiTokenSecret);

            return(myResult);
        }
Example #7
0
        public List <MentionList> GetMentions(string format, string apiToken, string apiTokenSecret)
        {
            SinaApiService myApi    = new SinaApiService();
            string         myResult = myApi.mentions(format, consumerKey, consumerKeySecret, apiToken, apiTokenSecret);
            XDocument      doc      = XDocument.Parse(myResult);

            return(MentionList.Parse(doc.Root));
        }
Example #8
0
        public List <CommentTimelineList> GetCommentTimeline(string format, string apiToken, string apiTokenSecret)
        {
            SinaApiService myApi    = new SinaApiService();
            string         myResult = myApi.comments_timeline(format, consumerKey, consumerKeySecret, apiToken, apiTokenSecret);
            XDocument      doc      = XDocument.Parse(myResult);

            return(CommentTimelineList.Parse(doc.Root));
        }
Example #9
0
        public List <FollowerList> GetFollower(string userid, int count, string format, string apiToken, string apiTokenSecret)
        {
            SinaApiService myApi    = new SinaApiService();
            string         myResult = myApi.get_followers(userid, count, format, consumerKey, consumerKeySecret, apiToken, apiTokenSecret);
            XDocument      doc      = XDocument.Parse(myResult);

            return(FollowerList.Parse(doc.Root));
        }
Example #10
0
        public UserList GetUserProfile(string userid, string format, string apiToken, string apiTokenSecret)
        {
            SinaApiService myApi    = new SinaApiService();
            string         myResult = myApi.GetUserProfile(userid, format, consumerKey, consumerKeySecret, apiToken, apiTokenSecret);
            XDocument      doc      = XDocument.Parse(myResult);

            return(UserList.Parse(doc.Root));
        }
Example #11
0
        public List <FriendTimelineList> GetUserTimeline(string userid, string format, string apiToken, string apiTokenSecret)
        {
            SinaApiService myApi    = new SinaApiService();
            string         myResult = myApi.user_timeline(userid, format, consumerKey, consumerKeySecret, apiToken, apiTokenSecret);
            XDocument      doc      = XDocument.Parse(myResult);

            return(FriendTimelineList.Parse(doc.Root));
        }
Example #12
0
        // + "?type=" + type + "&language=" + language
        public List <EmotionList> GetEmotions(string type, string format, string apiToken, string apiTokenSecret)
        {
            SinaApiService myApi    = new SinaApiService();
            string         myResult = myApi.GetEmotions(type, "cnname", format, consumerKey, consumerKeySecret, apiToken, apiTokenSecret);
            XDocument      doc      = XDocument.Parse(myResult);

            return(EmotionList.Parse(doc.Root));
        }
Example #13
0
        public FavoriteList DeleteFavorite(string statusid, string format, string apiToken, string apiTokenSecret)
        {
            SinaApiService myApi    = new SinaApiService();
            string         myResult = myApi.delete_favorite(statusid, format, consumerKey, consumerKeySecret, apiToken, apiTokenSecret);
            XDocument      doc      = XDocument.Parse(myResult);

            return(FavoriteList.Parse(doc.Root, 1));
        }
Example #14
0
        public string RepostStatus(string statusid, string status, int isComment, string format, string apiToken, string apiTokenSecret)
        {
            SinaApiService myApi = new SinaApiService();

            string myResult = myApi.status_repost(statusid, status, isComment, format, consumerKey, consumerKeySecret, apiToken, apiTokenSecret);

            return(myResult);
        }
Example #15
0
        public List <DirectMessageList> GetDirectMessages(string format, string apiToken, string apiTokenSecret)
        {
            SinaApiService myApi    = new SinaApiService();
            string         myResult = myApi.direct_messages(format, consumerKey, consumerKeySecret, apiToken, apiTokenSecret);
            XDocument      doc      = XDocument.Parse(myResult);

            return(DirectMessageList.Parse(doc.Root));
        }
Example #16
0
        public UnreadMessageList GetUnreaderMessage(string sinceid, string format, string apiToken, string apiTokenSecret)
        {
            SinaApiService myApi    = new SinaApiService();
            string         myResult = myApi.unread_message(sinceid, format, consumerKey, consumerKeySecret, apiToken, apiTokenSecret);
            XDocument      doc      = XDocument.Parse(myResult);

            return(UnreadMessageList.Parse(doc.Root));
        }
Example #17
0
        public UserList VerifyCredentials(string format, string apiToken, string apiTokenSecret)
        {
            SinaApiService myApi    = new SinaApiService();
            string         myResult = myApi.VerifyCredentials(format, consumerKey, consumerKeySecret, apiToken, apiTokenSecret);

            XDocument doc = XDocument.Parse(myResult);

            //return UserList.Parse(doc);
            return(UserList.Parse(doc.Root));
        }
Example #18
0
        public List <TokenKeyCollection> GetToken(string userID, string pwd)
        {
            SinaApiService myApi = new SinaApiService();
            List <string>  strKey;

            strKey = myApi.GetToken(userID, pwd);
            List <TokenKeyCollection> myResults = new List <TokenKeyCollection>();

            myResults.Add(new TokenKeyCollection(strKey[0].ToString(), strKey[1].ToString()));

            return(myResults);
        }
Example #19
0
 /// <summary>
 /// 获取粉丝列表
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public static SinaMUserList GetFollowerList(long id)
 {
     try
     {
         oAuthSina      oauth = SinaBase.oAuth();
         SinaApiService sina  = new SinaApiService();
         string         json  = sina.followers(oauth, id);
         return(HttpUtil.ParseJson <SinaMUserList>(json));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #20
0
 /// <summary>
 /// 获取指定用户信息
 /// </summary>
 /// <param name="uid">用户Id</param>
 /// <returns></returns>
 public static SinaMUser GetUser(long uid)
 {
     try
     {
         oAuthSina      oauth = SinaBase.oAuth();
         SinaApiService sina  = new SinaApiService();
         string         json  = sina.users_show(oauth, uid);
         return(HttpUtil.ParseJson <SinaMUser>(json));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #21
0
 /// <summary>
 /// 根据微博ID获取单条微博内容
 /// </summary>
 /// <param name="id">需要获取的微博ID。</param>
 /// <returns></returns>
 public static SinaMStatus Show(long id)
 {
     try
     {
         oAuthSina      oauth = SinaBase.oAuth();
         SinaApiService sina  = new SinaApiService();
         string         json  = sina.statuses_show(oauth, id);
         return(HttpUtil.ParseJson <SinaMStatus>(json));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #22
0
 /// <summary>
 /// 返回用户最新发表的微博消息列表
 /// </summary>
 /// <returns></returns>
 public static SinaMStatusList UserTimeLine()
 {
     try
     {
         oAuthSina      oauth = SinaBase.oAuth();
         SinaApiService sina  = new SinaApiService();
         string         json  = sina.statuses_user_timeline(oauth);
         return(HttpUtil.ParseJson <SinaMStatusList>(json));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #23
0
 /// <summary>
 /// 批量获取用户的基本信息
 /// <para>高级接口(需要授权)</para>
 /// </summary>
 /// <param name="uids">需要查询的用户ID</param>
 /// <returns></returns>
 public static SinaMUserList GetUsersShowBatch(string[] ids)
 {
     try
     {
         oAuthSina      oauth = SinaBase.oAuth();
         SinaApiService sina  = new SinaApiService();
         long           uid   = GetUserId();
         string         json  = sina.users_show_batch(oauth, ids);
         return(HttpUtil.ParseJson <SinaMUserList>(json));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #24
0
 /// <summary>
 /// 发送微博信息(带图片)
 /// </summary>
 /// <param name="strSatus">信息内容</param>
 /// <param name="filePath">图片实际地址</param>
 public static bool Update(string strStatus, string filePath)
 {
     try
     {
         oAuthSina      oauth  = SinaBase.oAuth();
         SinaApiService sina   = new SinaApiService();
         string         json   = sina.statuses_upload(oauth, strStatus, filePath);
         var            status = HttpUtil.ParseJson <SinaMStatus>(json);
         return(status != null && status.id > 0);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #25
0
 /// <summary>
 /// 取消关注一个用户
 /// </summary>
 /// <param name="uid">需要关注的用户</param>
 /// <returns></returns>
 public static bool FriendshipsDestroy(long uid)
 {
     try
     {
         oAuthSina      oauth = SinaBase.oAuth();
         SinaApiService sina  = new SinaApiService();
         string         json  = sina.friendships_destroy(oauth);
         var            user  = HttpUtil.ParseJson <SinaMUser>(json);
         return(user != null && user.id > 0);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #26
0
 /// <summary>
 /// OAuth授权之后,获取授权用户的UID
 /// <para>1. 用户OAuth授权之后获取用户UID,作用相当于旧版接口的(account/verify_credentials)</para>
 /// <para>2. 此接口不计入访问频次中</para>
 /// </summary>
 /// <returns></returns>
 public static long GetUserId()
 {
     try
     {
         oAuthSina      oauth = SinaBase.oAuth();
         SinaApiService sina  = new SinaApiService();
         Dictionary <string, object> dicUser = HttpUtil.ParseJson <Dictionary <string, object> >(sina.account_get_uid(oauth));
         long user_id = long.TryParse(HttpUtil.GetDicValue(dicUser, "uid"), out user_id) ? user_id : 0;
         return(user_id);
     }
     catch (Exception ex)
     {
         ApiLogHelper.Append(ex);
         throw ex;
     }
 }