예제 #1
0
        public static async Task <MessageModel> RepostWithPic(long id, string status, MediaModel media, RepostType is_comment = RepostType.None)
        {
            Dictionary <string, HttpContent> param = new Dictionary <string, HttpContent>()
            {
                { nameof(status), new StringContent(string.IsNullOrEmpty(status) ? "转发微博" : status) },
                { nameof(id), new StringContent(id.ToString()) },
                { nameof(is_comment), new StringContent(is_comment.ToString("D")) },
                { nameof(media), new StringContent(media.ToString()) },
                { "source", new StringContent("211160679") },
                { "from", new StringContent("1055095010") }
            };

            return(JsonConvert.DeserializeObject <MessageModel>(await HttpHelper.PostAsync("https://api.weibo.cn/2/statuses/repost", param)));
        }
예제 #2
0
        public static async Task <CommentModel> PostCommentWithPic(long id, string comment, MediaModel media, bool comment_ori = false)
        {
            Dictionary <string, HttpContent> param = new Dictionary <string, HttpContent>()
            {
                { nameof(id), new StringContent(id.ToString()) },
                { nameof(comment), new StringContent(comment) },
                { nameof(comment_ori), new StringContent(comment_ori ? "1" : "0") },
                { nameof(media), new StringContent(media.ToString()) },
                { "source", new StringContent("211160679") },
                { "from", new StringContent("1055095010") }
            };

            return(JsonConvert.DeserializeObject <CommentModel>(await HttpHelper.PostAsync("https://api.weibo.cn/2/comments/create", param)));
        }