static string invite_cmd = _HostIP + "/label/invite"; //?label_id="; //...&recipients=... #endregion public static string inviteShared(string label_id, string name, string message, string recipients_json) { string result = null; if (label_id == "" || label_id == null) { return(null); } string _url = invite_cmd; string _label_id = System.Web.HttpUtility.UrlEncode(label_id); string _name = System.Web.HttpUtility.UrlEncode(name); string _parms = "msg" + "=" + message + "&" + "label_id" + "=" + _label_id + "&" + "recipients" + "=" + recipients_json + "&" + "sender" + "=" + _name; WebPostHelper _webPos = new WebPostHelper(); bool _isOK = _webPos.doPost(_url, _parms, null); if (_isOK) { string _r = _webPos.getContent(); // var results = JsonConvert.DeserializeObject<dynamic>(_r); result = _r; } else { result = null; } return(result); }
//--- using Refresh token to get the Access token private bool get_accesstokenfromrefreshtoken() { string _url = "https://accounts.google.com/o/oauth2/token"; string _parms = "refresh_token" + "=" + RefreshKey_real + "&" + "client_id" + "=" + clientID + "&" + "client_secret" + "=" + clientSecret + "&" + "grant_type" + "=" + "refresh_token"; WebPostHelper _webPos = new WebPostHelper(); bool _isOK = _webPos.doPost(_url, _parms, null); if (_isOK) { string _r = _webPos.getContent(); access_token = parseAccessToken(_r); // accesstoken = access_token; } return(_isOK); }
public MR_posts_new 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) { log.Info("start Post_new"); MR_posts_new _re = null; string post_id = genGuid(); 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); try { string _url = "https://develop.waveface.com:443/v3" + "/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 (type == "image") { if (coverAttach != string.Empty) { _parms += "cover_attach" + "=" + coverAttach + "&"; } } _parms += "group_id" + "=" + group_id; WebPostHelper _webPos = new WebPostHelper(); bool _isOK = _webPos.doPost(_url, _parms, null); if (!_isOK) { return(null); } string _r = _webPos.getContent(); _responseMessage = _r; MR_posts_new _ret = JsonConvert.DeserializeObject <MR_posts_new>(_r); return(_ret); } catch (WebException _e) { if (_e.Status == WebExceptionStatus.ProtocolError) { HttpWebResponse _res = (HttpWebResponse)_e.Response; log.Error("Create POst_new, failed: " + _e.Data); log.Error("HttpWebResponse, return: " + _res); } } catch (Exception _e) { log.Error("Create POst_new, failed: " + _e.Data); } return(_re); }
public MR_posts_new 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) { log.Info("start Post_new"); MR_posts_new _re = null; string post_id=genGuid(); 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); try { string _url = "https://develop.waveface.com:443/v3" + "/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 (type == "image") { if (coverAttach != string.Empty) { _parms += "cover_attach" + "=" + coverAttach + "&"; } } _parms += "group_id" + "=" + group_id; WebPostHelper _webPos = new WebPostHelper(); bool _isOK = _webPos.doPost(_url, _parms, null); if (!_isOK) return null; string _r = _webPos.getContent(); _responseMessage = _r; MR_posts_new _ret = JsonConvert.DeserializeObject<MR_posts_new>(_r); return _ret; } catch (WebException _e) { if (_e.Status == WebExceptionStatus.ProtocolError) { HttpWebResponse _res = (HttpWebResponse)_e.Response; log.Error("Create POst_new, failed: " + _e.Data); log.Error("HttpWebResponse, return: " + _res); } } catch (Exception _e) { log.Error("Create POst_new, failed: " + _e.Data); } return _re; }