/// <summary> /// 发送一条广播 /// </summary> /// <param name="text">广播文本内容</param> /// <param name="recTitle">(可选)推荐网址的标题</param> /// <param name="recUrl">(可选)推荐网址的href</param> /// <param name="recDesc">(可选)推荐网址的描述</param> /// <param name="rec_image">(可选)推荐网址的附图url</param> /// <param name="imagePath">(可选)我说的图路径(有image的情况下rec系列参数都会被忽略)</param> /// <returns>广播信息</returns> public static ShuoInfo ShuoPostShuo(string text, string recTitle = null, string recUrl = null, string recDesc = null, string recImage = null, string imagePath = null) { string url = Utilities.CreateUrl(Common.SHUOPOST); FormData fd = new FormData(); fd.AddParam("text", text); fd.AddParam("rec_title", recTitle); fd.AddParam("rec_url", recUrl); fd.AddParam("rec_desc", recDesc); fd.AddParam("rec_image", recImage); fd.AddParam("image", "image/jpeg", imagePath); string result = Utilities.RequestPostFile(url, fd.GetBytes()); return (ShuoInfo)Utilities.JsonDeserialize<ShuoInfo>(result); }
/// <summary> /// 用户更新某篇笔记 /// </summary> /// <param name="id">图书id</param> /// <param name="content">笔记内容(多余15字)</param> /// <param name="page">(page/chapter)页码</param> /// <param name="chapter">(page/chapter)章节名</param> /// <param name="privacy">(可选)隐私设置(值为'private'为设置仅自己可见)</param> /// <param name="imagePath">(可选)图片路径</param> /// <returns>图书笔记</returns> public static BkAnnotation BkRefreshAnno(string id, string content, int? page = null, string chapter = null, string privacy = null, List<string> imagePath = null) { string url = Utilities.CreateUrl(Common.BKANNOOP_ID, id); FormData fd = new FormData(); fd.AddParam("content", content); fd.AddParam("page", page); fd.AddParam("chapter", chapter); fd.AddParam("privacy", privacy); if (imagePath != null) { for (int i = 0; i < imagePath.Count; i++) fd.AddParam((i + 1).ToString(), "image/jpeg", imagePath[i]); } string result = Utilities.RequestPutFile(url, fd.GetBytes()); return (BkAnnotation)Utilities.JsonDeserialize<BkAnnotation>(result); }
/// <summary> /// 上传照片 /// </summary> /// <param name="id">相册id</param> /// <param name="imagePath">照片路径</param> /// <param name="desc">(可选)照片描述</param> /// <returns>照片信息</returns> public static PhoInfo PhoPostPhoto(string id, string imagePath, string desc = null) { string url = Utilities.CreateUrl(Common.PHOALBUMOP_ID, id); FormData fd = new FormData(); fd.AddParam("desc", desc); fd.AddParam("image", "image/jpeg", imagePath); string result = Utilities.RequestPostFile(url, fd.GetBytes()); return (PhoInfo)Utilities.JsonDeserialize<PhoInfo>(result); }
/// <summary> /// 更新一条日记 /// </summary> /// <param name="id">日记id</param> /// <param name="title">日记标题</param> /// <param name="privacy">隐私控制(public, friend, private)</param> /// <param name="canReply">是否允许回复</param> /// <param name="content">日记内容, 使用"<图片p_pid>"伪tag引用图片, 如果含链接, 使用html的链接标签格式, 或者直接使用网址</param> /// <param name="pids">(可选)上传的图片pid本地编号</param> /// <param name="layoutPid">(可选)对应pid的排版</param> /// <param name="descPid">(可选)对应pid的图注</param> /// <param name="imagePid">(可选)对应pid的图片内容</param> /// <returns>日记信息</returns> public static NoteInfo NoteRefreshNote(string id, string title, string privacy, bool canReply, string content, List<int> pids = null, List<string> layoutPid = null, List<string> descPid = null, List<string> imagePid = null) { string url = Utilities.CreateUrl(Common.NOTEOP_ID, id); FormData fd = new FormData(); fd.AddParam("title", title); fd.AddParam("privacy", privacy); fd.AddParam("can_reply", canReply); fd.AddParam("content", content); if (pids != null) { StringBuilder builder = new StringBuilder(); for (int i = 0; i < pids.Count; i++) builder.Append(String.Concat(",p_", pids[i].ToString())); fd.AddParam("pids", builder.Remove(0, 1).ToString()); } if (layoutPid != null) { for (int i = 0; i < layoutPid.Count; i++) fd.AddParam(String.Concat("layout_", pids[i]), layoutPid[i]); } if (descPid != null) { for (int i = 0; i < descPid.Count; i++) fd.AddParam(String.Concat("desc_", pids[i]), descPid[i]); } if (imagePid != null) { for (int i = 0; i < imagePid.Count; i++) fd.AddParam(String.Concat("image_", pids[i]), "image/jpeg", imagePid[i]); } string result = Utilities.RequestPutFile(url, fd.GetBytes()); return (NoteInfo)Utilities.JsonDeserialize<NoteInfo>(result); }