public string createAccount(string user, String password, string nickname) { string result = null; if (user == "" || password == "") { return(null); } bool _result = IsValidEmail(user); if (_result == false) { return(null); } string _url = serverBaseUrl + "/auth/signup"; string user_email = user; string user_password = password; string user_nickname = nickname; string _password = System.Web.HttpUtility.UrlEncode(password); string _parms = "email" + "=" + user_email + "&" + "password" + "=" + _password + "&" + "nickname" + "=" + user_nickname + "&" + "apikey" + "=" + APIKEY; WebPostHelper _webPos = new WebPostHelper(); var response = _webPos.doPost(_url, _parms, null); session_token = getSessionToken(response); return(session_token); }
public string auth_login(string user, string password) { string result = ""; string email = user; user = System.Web.HttpUtility.UrlEncode(user); password = System.Web.HttpUtility.UrlEncode(password); Dictionary <string, object> _args = new Dictionary <string, object>(); { _args.Add("apikey", APIKEY); _args.Add("email", email); _args.Add("password", password); }; var postData = "apikey=" + APIKEY + "&email=" + email + "&password="******"/pio_auth/login"; var post = new WebPostHelper(); post.doPost(uri, postData, ""); var response = JsonConvert.DeserializeObject <MR_auth_login>(post.getContent()); group_id = response.groups.First().group_id; session_token = response.session_token; return(session_token); }
// last_update_time ??? public void posts_update(string session_token, string group_id, string post_id, string attachment_id_array, string type, string event_type, string favorite, DateTime last_update_time, string email_list, string title, string sender) { log.Info("start Post_update"); string _re = null; string _post_id = post_id; _post_id = System.Web.HttpUtility.UrlEncode(_post_id); session_token = System.Web.HttpUtility.UrlEncode(session_token); group_id = System.Web.HttpUtility.UrlEncode(group_id); attachment_id_array = System.Web.HttpUtility.UrlEncode(attachment_id_array); event_type = System.Web.HttpUtility.UrlEncode(event_type); favorite = System.Web.HttpUtility.UrlEncode(favorite); var lastUpdateTime = last_update_time.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ"); var emailList = HttpUtility.UrlEncode(email_list); sender = HttpUtility.UrlEncode(sender); title = HttpUtility.UrlEncode(title); string _url = postServiceClass.serverBaseUrl + "/pio_posts/update"; DateTime _update = DateTime.UtcNow; string _dateStr = _update.ToString(@"yyyy-MM-ddTHH\:mm\:ssZ"); string _parms = "post_id" + "=" + _post_id + "&" + "apikey" + "=" + APIKEY + "&" + "session_token" + "=" + session_token + "&" + "type" + "=" + type + "&" + "group_id=" + group_id + "&" + "favorite" + "=" + favorite + "&" + "update_time" + "=" + _dateStr + "&" + "event_type" + "=" + event_type + "&" + "last_update_time" + "=" + lastUpdateTime + "&" + "shared_email_list" + "=" + emailList + "&"; if (attachment_id_array != null) { _parms += "attachment_id_array" + "=" + attachment_id_array + "&"; } if (!string.IsNullOrEmpty(sender)) { _parms += "sender_name=" + sender + "&"; } if (!string.IsNullOrEmpty(title)) { _parms += "title=" + title; } WebPostHelper _webPos = new WebPostHelper(); _webPos.doPost(_url, _parms, null); }
public void tuneOnSharedcode(string session_token, string post_id) { bool result = false; if (session_token == "" || post_id == "") { throw new ArgumentNullException(); } string _url = serverBaseUrl + "/pio_posts/tuneon_sharedcode"; string _parms = "post_id" + "=" + post_id + "&" + "session_token" + "=" + HttpUtility.UrlEncode(session_token) + "&" + "apikey" + "=" + APIKEY; WebPostHelper _webPos = new WebPostHelper(); _webPos.doPost(_url, _parms, null); }
public static void sendFavoriteEmail(string sessionToken, string apikey, ICollection <string> recipients, string shareCode, string sender, string title, string msg) { var _url = serverBaseUrl + "/pio_posts/send_favorite_email"; var postData = string.Format("apikey={0}&session_token={1}&shared_email_list={2}&shared_code={3}&sender_name={4}&title={5}&content={6}", HttpUtility.UrlEncode(apikey), HttpUtility.UrlEncode(sessionToken), HttpUtility.UrlEncode(joinToJsonList(recipients)), HttpUtility.UrlEncode(shareCode), sender != null ? HttpUtility.UrlEncode(sender) : "", title != null ? HttpUtility.UrlEncode(title) : "", msg != null ? HttpUtility.UrlEncode(msg) : ""); var post = new WebPostHelper(); post.doPost(_url, postData, null); }
public string renewSharedcode(string session_token, string post_id) { string result = null; if (session_token == "" || post_id == "") { return(null); } string _url = serverBaseUrl + "/pio_posts/renew_sharedcode"; string _post_id = System.Web.HttpUtility.UrlEncode(post_id); string _session_token = System.Web.HttpUtility.UrlEncode(session_token); string _parms = "post_id" + "=" + _post_id + "&" + "session_token" + "=" + session_token + "&" + "apikey" + "=" + APIKEY; WebPostHelper _webPos = new WebPostHelper(); var response = _webPos.doPost(_url, _parms, null); var results = JsonConvert.DeserializeObject <dynamic>(response); return(results.shared_code.ToString()); }
public string posts_new(string session_token, string group_id, string content, string attachment_id_array, string preview, string type, string coverAttach, string share_email_list, string event_type, string favorite, string post_id, string title) { log.Info("start Post_new"); string _re = null; post_id = System.Web.HttpUtility.UrlEncode(post_id); session_token = System.Web.HttpUtility.UrlEncode(session_token); group_id = System.Web.HttpUtility.UrlEncode(group_id); content = System.Web.HttpUtility.UrlEncode(content); attachment_id_array = System.Web.HttpUtility.UrlEncode(attachment_id_array); preview = System.Web.HttpUtility.UrlEncode(preview); share_email_list = System.Web.HttpUtility.UrlEncode(share_email_list); event_type = System.Web.HttpUtility.UrlEncode(event_type); favorite = System.Web.HttpUtility.UrlEncode(favorite); title = System.Web.HttpUtility.UrlEncode(title); string _url = postServiceClass.serverBaseUrl + "/pio_posts/new"; string _parms = "post_id" + "=" + post_id + "&" + "apikey" + "=" + APIKEY + "&" + "session_token" + "=" + session_token + "&" + "content" + "=" + content + "&" + "type" + "=" + type + "&" + "favorite" + "=" + favorite + "&" + "event_type" + "=" + event_type + "&"; if (share_email_list != string.Empty) { _parms += "shared_email_list" + "=" + share_email_list + "&"; } if (attachment_id_array != string.Empty) { _parms += "attachment_id_array" + "=" + attachment_id_array + "&"; } if (preview != string.Empty) { _parms += "preview" + "=" + preview + "&"; } if (!string.IsNullOrEmpty(title)) { _parms += "title=" + title + "&"; } if (type == "image") { if (coverAttach != string.Empty) { _parms += "cover_attach" + "=" + coverAttach + "&"; } } _parms += "group_id" + "=" + group_id; WebPostHelper _webPos = new WebPostHelper(); return(_webPos.doPost(_url, _parms, null)); }