/// <summary> /// 转发一条微博 /// </summary> /// <param name="id">要转发的微博ID。</param> /// <param name="status">添加的转发文本,内容不超过140个汉字,不填则默认为“转发微博”。</param> /// <param name="is_comment">是否在转发的同时发表评论,0:否、1:评论给当前微博、2:评论给原微博、3:都评论,默认为0 。</param> /// <returns></returns> public static async Task <MessageModel> Repost(long id, string status, 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")) }, }; return(JsonConvert.DeserializeObject <MessageModel>(await HttpHelper.PostAsync(Constants.REPOST, param))); }
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))); }