public void onRequestReceived(MessageApi.Message msg) { Console.WriteLine(nom + " :: " + "Requete recu de type : " + msg.sujetMsg.ToString() + " id : " + msg.id); msg.creerReponse(Message.MessageSujet.ReponseOk); msg.repondre(); }
private static MessageApi Create_Usr(string depId, string Name, string userId, string mobile) { MessageApi mm = new MessageApi(); User us = new User(); us.department = depId; us.name = Name; us.userid = userId; us.mobile = mobile; string data = MyUtility.GetJsonFromObj(us); string accss = MyUtility.GetGroupAccess(); RequestContainer req = new RequestContainer("https://qyapi.weixin.qq.com/cgi-bin/user/create?access_token=" + accss); req.RequestObj.Method = "POST"; req.RequestObj.ContentType = "application/Json"; req.SetRequestContent(data); HttpWebResponse rep = req.GetResponse(); string x = req.GetResponseContent(rep); dynamic dy = MyUtility.GetObjFromJson <dynamic>(x); if (dy.errcode == 0) { mm.code = "0"; mm.txt = ""; return(mm); } else { mm.code = "404"; mm.txt = dy.errmsg; return(mm); } }
public LibretroApi(string dllPath, string corePath) { InstanceName = "libretro_" + Guid.NewGuid().ToString(); var pipeName = InstanceName; instanceDll = new InstanceDll(dllPath); instanceDllCore = new InstanceDll(corePath); var dllinit = (DllInit)Marshal.GetDelegateForFunctionPointer(instanceDll.GetProcAddress("DllInit"), typeof(DllInit)); Message = (MessageApi)Marshal.GetDelegateForFunctionPointer(instanceDll.GetProcAddress("Message"), typeof(MessageApi)); _copyBuffer = (BufferApi)Marshal.GetDelegateForFunctionPointer(instanceDll.GetProcAddress("CopyBuffer"), typeof(BufferApi)); _setBuffer = (BufferApi)Marshal.GetDelegateForFunctionPointer(instanceDll.GetProcAddress("SetBuffer"), typeof(BufferApi)); SetVariable = (SetVariableApi)Marshal.GetDelegateForFunctionPointer(instanceDll.GetProcAddress("SetVariable"), typeof(SetVariableApi)); comm = (CommStruct *)dllinit(instanceDllCore.HModule).ToPointer(); //TODO: (stash function pointers locally and thunk to IntPtr) //ALSO: this should be done by the core, I think, not the API. No smarts should be in here comm->env.retro_perf_callback.get_cpu_features = IntPtr.Zero; //retro_perf_callback.get_cpu_features = new LibRetro.retro_get_cpu_features_t(() => (ulong)( // (Win32PInvokes.IsProcessorFeaturePresent(Win32PInvokes.ProcessorFeature.InstructionsXMMIAvailable) ? LibRetro.RETRO_SIMD.SSE : 0) | // (Win32PInvokes.IsProcessorFeaturePresent(Win32PInvokes.ProcessorFeature.InstructionsXMMI64Available) ? LibRetro.RETRO_SIMD.SSE2 : 0) | // (Win32PInvokes.IsProcessorFeaturePresent(Win32PInvokes.ProcessorFeature.InstructionsSSE3Available) ? LibRetro.RETRO_SIMD.SSE3 : 0) | // (Win32PInvokes.IsProcessorFeaturePresent(Win32PInvokes.ProcessorFeature.InstructionsMMXAvailable) ? LibRetro.RETRO_SIMD.MMX : 0) // )); //retro_perf_callback.get_perf_counter = new LibRetro.retro_perf_get_counter_t(() => System.Diagnostics.Stopwatch.GetTimestamp()); //retro_perf_callback.get_time_usec = new LibRetro.retro_perf_get_time_usec_t(() => DateTime.Now.Ticks / 10); //retro_perf_callback.perf_log = new LibRetro.retro_perf_log_t(() => { }); //retro_perf_callback.perf_register = new LibRetro.retro_perf_register_t((ref LibRetro.retro_perf_counter counter) => { }); //retro_perf_callback.perf_start = new LibRetro.retro_perf_start_t((ref LibRetro.retro_perf_counter counter) => { }); //retro_perf_callback.perf_stop = new LibRetro.retro_perf_stop_t((ref LibRetro.retro_perf_counter counter) => { }); }
//private static bool Exist_Usr(string id) { // string accss = MyUtility.GetGroupAccess(); // RequestContainer req = new RequestContainer("https://qyapi.weixin.qq.com/cgi-bin/user/get?access_token=" + accss + "&userid=" + id); // HttpWebResponse rep = req.GetResponse(); // string a = req.GetResponseContent(rep); // dynamic ss = MyUtility.GetObjFromJson<dynamic>(a); // if (ss.errcode == 60111) // { // return false; // } // else if (ss.errcode == 0) // { // return true; // } // else { // return false; // } //} private static MessageApi Exist_Par(string str) { MessageApi mm = new MessageApi(); string id = ""; string[] ss = str.Split('/'); List <Department> dep = getTree(); for (int i = 0; i < ss.Length; i++) { if (i == 0) { if (ss[0] != get_ParName("1", dep)) { mm.code = "404"; mm.txt = "部门输入错误" + ss[0]; return(mm); } else { id = "1"; } } else { id = get_ParId(id, ss[i], dep); } } mm.code = "0"; mm.txt = id; return(mm); }
public async Task <MessageResult> SendMessage(String access, String receiver, String content) { var api = new MessageApi(); var result = await api.SendMessage(access, receiver, content); return(result); }
public string Mylogin(string UserName, string PassWord) { MessageApi mm = new MessageApi(); try { if (s == null) { s = new Service(Tm); } DataTable dll = s.sqlhelper.GetDataTable("select * from " + "APISERVER" + ".users where \"USERNAME\"='" + UserName + "' and \"PASSWORD\"='" + PassWord + "'"); if (dll.Rows.Count == 0) { mm.code = "201"; mm.txt = "账号或密码错误!!"; return(MyUtility.GetJsonFromObj(mm)); } else { HttpContext.Session["UserName"] = dll.Select("1=1 ")[0]["USERNAME"].ToString(); string a = HttpContext.Session["UserName"].ToString(); mm.code = "0"; mm.txt = "登陆成功!!"; return(MyUtility.GetJsonFromObj(mm)); } } catch (Exception ex) { mm.code = "400"; mm.txt = ex.Message; return(MyUtility.GetJsonFromObj(mm)); } }
public void WxAppCard(string messageId, string appId, string openId, string title, string pagePath, string wxAppId, string imageId, PerformContext context = null) { var messageStatus = new MessageStatus(_redis, messageId); messageStatus.Sended(openId); context.WriteLine("向用户「{0}」@「{1}」发送小程序卡片...", openId, appId); var accessToken = _redis.StringGet(CacheKey.UserAccessTokenPrefix + appId); if (accessToken.HasValue) { var resp = MessageApi.SendWxAppCard(accessToken, openId, title, wxAppId, pagePath, imageId); if (resp.ErrCode == 0) { messageStatus.Success(openId); context.WriteLine("消息发送成功..."); } else { messageStatus.SendError(openId); context.WriteLine("消息发送失败:{0}...", resp.ErrMsg); throw new ServiceException(resp.ErrCode, resp.ErrMsg); } } else { messageStatus.SendError(openId); context.WriteLine("消息发送失败:无法获取AccessToken..."); throw new ServiceException(-1, "消息发送失败:无法获取AccessToken..."); } }
public async Task <ChatsResult> GetChats(string access, string request, Boolean autoCache = false) { var api = new MessageApi(); var result = await api.GetChats(access, request, autoCache); return(result); }
public void News(string messageId, string appId, string openId, string title, string description, string url, string picUrl, bool isWxApp, PerformContext context) { var messageStatus = new MessageStatus(_redis, messageId); messageStatus.Sended(openId); context.WriteLine("向用户「{0}」@「{1}」发送图文消息...", openId, appId); var accessToken = _redis.StringGet(CacheKey.UserAccessTokenPrefix + appId); if (accessToken.HasValue) { var resp = MessageApi.SendNews(accessToken, openId, title, description, url, picUrl, isWxApp); if (resp.ErrCode == 0) { messageStatus.Success(openId); context.WriteLine("消息发送成功..."); } else { messageStatus.SendError(openId); context.WriteLine("消息发送失败:{0}...", resp.ErrMsg); throw new ServiceException(resp.ErrCode, resp.ErrMsg); } } else { messageStatus.SendError(openId); context.WriteLine("消息发送失败:无法获取AccessToken..."); throw new ServiceException(-1, "消息发送失败:无法获取AccessToken..."); } }
public void Text(string messageId, string appId, string openId, string content, PerformContext context) { var messageStatus = new MessageStatus(_redis, messageId); messageStatus.Sended(openId); context.WriteLine("向用户「{0}」@「{1}」发送文本消息...", openId, appId); var accessToken = _redis.StringGet(CacheKey.UserAccessTokenPrefix + appId); if (accessToken.HasValue) { var resp = MessageApi.SendText(accessToken, openId, content); if (resp.ErrCode == 0) { messageStatus.Success(openId); context.WriteLine("消息发送成功..."); } else { messageStatus.SendError(openId); context.WriteLine("消息发送失败:{0}...", resp.ErrMsg); throw new ServiceException(resp.ErrCode, resp.ErrMsg); } } else { messageStatus.SendError(openId); context.WriteLine("消息发送失败:无法获取AccessToken..."); throw new ServiceException(-1, "消息发送失败:无法获取AccessToken..."); } }
/// <summary> /// 动态点赞通知,模板编号:579 /// </summary> /// <param name="toUser">接收者(用户)的 openid</param> /// <param name="templateId">消息模板Id</param> /// <param name="name">点赞用户,20个以内字符</param> /// <param name="date">点赞时间,4小时制时间格式(支持+年月日) 例如:15:01,或:2019年10月1日 15:01</param> /// <param name="page">点击模板卡片后的跳转页面,仅限本小程序内的页面。支持带参数,(示例index?foo=bar)。该字段不填则模板无跳转。</param> public static WxJsonResult SendGoodNotice(string toUser, string templateId, string name, string date, string page) { var data = new TemplateMessageData(); data.Add("name1", new TemplateMessageDataValue(name)); data.Add("date2", new TemplateMessageDataValue(date)); return(MessageApi.SendSubscribe(weixinAppId, toUser, templateId, data, page)); }
/// <summary> /// 取得群組內指定使用者資料 /// </summary> /// <param name="userid">指定使用者Id</param> ///<param name="GroupidOrRoomId">群組或對話ID</param> ///<param name="type">群組或對話</param> /// <returns></returns> public Task <UserProfile> Get_Group_UserProfileAsync(string userid, string GroupidOrRoomId, SourceType type) { if (type == SourceType.user) { throw new NotSupportedException("無法使用Source = User"); } return(MessageApi.Get_Group_UserProfileAsync(this.channelAccessToken, userid, GroupidOrRoomId, type)); }
/// <summary> /// 新的评论提醒 ,模板编号:484 /// </summary> /// <param name="toUser">接收者(用户)的 openid</param> /// <param name="templateId">消息模板Id</param> /// <param name="title">文章标题,20个以内字符</param> /// <param name="desc">评论内容,20个以内字符</param> /// <param name="date">评论时间,4小时制时间格式(支持+年月日) 例如:15:01,或:2019年10月1日 15:01</param> /// <param name="userNick">评论用户,20个以内字符</param> /// <param name="page"></param> public static WxJsonResult SendRemarkNotice(string toUser, string templateId, string title, string desc, string date, string userNick, string page) { var data = new TemplateMessageData(); data.Add("thing1", new TemplateMessageDataValue(title)); data.Add("thing2", new TemplateMessageDataValue(desc)); data.Add("time3", new TemplateMessageDataValue(date)); data.Add("thing5", new TemplateMessageDataValue(userNick)); return(MessageApi.SendSubscribe(weixinAppId, toUser, templateId, data, page)); }
/// <summary>取得大量使用者檔案</summary> /// <param name="userids"></param> /// <returns></returns> public async Task <List <UserProfile> > Get_User_datasAsync(List <string> userids) { List <UserProfile> oModel = new List <UserProfile>(); foreach (var userid in userids) { oModel.Add(await MessageApi.GetUserProfileAsync(this.channelAccessToken, userid)); } return(oModel); }
static void Main(string[] args) { MessageApi api = new MessageApi(); var greeting = api.Greet(); Console.WriteLine(greeting); Console.ReadKey(); }
/// <summary>取得大量使用者檔案</summary> /// <param name="userids"></param> /// <returns></returns> public List <UserProfile> Get_User_datas(List <string> userids) { List <UserProfile> oModel = new List <UserProfile>(); foreach (var userid in userids) { oModel.Add(MessageApi.GetUserProfile(this.channelAccessToken, userid)); } return(oModel); }
private static MessageApi createUser(string depId, string Name, string userId, string mobile) { MessageApi mm = new MessageApi(); User us = new User(); Regex reg = new Regex(@"^[1]+\d{10}"); if (depId == "" || Name == "" || userId == "") { mm.code = "404"; mm.txt = "用户信息不完善"; return(mm); } else if (!reg.IsMatch(userId)) { mm.code = "404"; mm.txt = "Id要11位电话号码"; return(mm); } else { if (Exist_Usr(userId)) { us.department = depId; us.name = Name; us.userid = userId; us.mobile = mobile; string data = MyUtility.GetJsonFromObj(us); string accss = MyUtility.GetGroupAccess(); RequestContainer req = new RequestContainer("https://qyapi.weixin.qq.com/cgi-bin/user/update?access_token=" + accss); req.RequestObj.Method = "POST"; req.RequestObj.ContentType = "application/Json"; req.SetRequestContent(data); HttpWebResponse rep = req.GetResponse(); string x = req.GetResponseContent(rep); dynamic dy = MyUtility.GetObjFromJson <dynamic>(x); if (dy.errcode == 0) { mm.code = "0"; mm.txt = ""; return(mm); } else { mm.code = "404"; mm.txt = dy.errmsg; return(mm); } } else { mm = Create_Usr(depId, Name, userId, mobile); return(mm); } } }
/// <summary> /// 離開對話或群組 /// </summary> /// <param name="sourceId">欲離開的對話或群組ID</param> /// <param name="type"></param> /// <returns></returns> public Task <bool> Leave_Room_Or_GroupAsync(string sourceId, SourceType type) { if (type == SourceType.user) { throw new NotSupportedException("無法使用 SourceType = User"); } else { return(MessageApi.Leave_Room_GroupAsync(this.channelAccessToken, sourceId, type)); } }
/// <summary>傳送訊息給多位使用者</summary> /// <param name="ToId"></param> /// <param name="message"></param> /// <returns></returns> public Task <string> SendMuticastMessageAsync(List <string> ToId, params Message[] message) { MulticastMessage oModel = new MulticastMessage() { to = ToId }; oModel.messages.AddRange(message); return(MessageApi.SendMessageActionAsync(this.channelAccessToken, PostMessageType.Multicast, oModel)); }
BufferApi _setBuffer; //TODO: consider making private and wrapping public LibsnesApi(string dllPath) { InstanceName = "libsneshawk_" + Guid.NewGuid().ToString(); instanceDll = new InstanceDll(dllPath); var dllinit = (DllInit)Marshal.GetDelegateForFunctionPointer(instanceDll.GetProcAddress("DllInit"), typeof(DllInit)); Message = (MessageApi)Marshal.GetDelegateForFunctionPointer(instanceDll.GetProcAddress("Message"), typeof(MessageApi)); _copyBuffer = (BufferApi)Marshal.GetDelegateForFunctionPointer(instanceDll.GetProcAddress("CopyBuffer"), typeof(BufferApi)); _setBuffer = (BufferApi)Marshal.GetDelegateForFunctionPointer(instanceDll.GetProcAddress("SetBuffer"), typeof(BufferApi)); comm = (CommStruct *)dllinit().ToPointer(); }
private void SetupApis() { Error = new ErrorApi { Client = this }; Account = new AccountApi { Client = this }; Application = new ApplicationApi { Client = this }; AvailableNumber = new AvailableNumberApi { Client = this }; Bridge = new BridgeApi { Client = this }; Domain = new DomainApi { Client = this }; Call = new CallApi { Client = this }; Conference = new ConferenceApi { Client = this }; Message = new MessageApi { Client = this }; NumberInfo = new NumberInfoApi { Client = this }; PhoneNumber = new PhoneNumberApi { Client = this }; Recording = new RecordingApi { Client = this }; Transcription = new TranscriptionApi { Client = this }; Media = new MediaApi { Client = this }; Endpoint = new EndpointApi { Client = this }; V2 = new ApiV2 { Message = new Bandwidth.Net.ApiV2.MessageApi { Client = this } }; }
public void TestMessageApiDeleteErrorWhenMessageNotExists() { string requestString = "DELETE /messages/1 HTTP/1.1\r\nUser-Agent: curl/7.55.1\r\nAccept: */*"; RequestContext request = new RequestContext(requestString); Regex messageRegex = new Regex(@"^/messages/?\d*$"); MessageApi api = new MessageApi(request, messageRegex, _fileService.Object, "messages"); _fileService.Setup(s => s.FileExists("messages\\1.txt")).Returns(false); string response = api.Interaction(); Assert.AreEqual("DELETE ERR", response); }
public void TestMessageApiPutUpdatesMessage() { string requestString = "PUT /messages/1 HTTP/1.1\r\nUser-Agent: curl/7.55.1\r\nAccept: */*\r\nContent-Length: 19\r\n\r\nOverwritten Message"; RequestContext request = new RequestContext(requestString); Regex messageRegex = new Regex(@"^/messages/?\d*$"); MessageApi api = new MessageApi(request, messageRegex, _fileService.Object, "messages"); _fileService.Setup(s => s.FileExists("messages\\1.txt")).Returns(true); string response = api.Interaction(); Assert.AreEqual("PUT OK", response); }
public void TestMessageApiGetOneMessage() { string requestString = "GET /messages/100 HTTP/1.1\r\nUser-Agent: curl/7.55.1\r\nAccept: */*"; RequestContext request = new RequestContext(requestString); Regex messageRegex = new Regex(@"^/messages/?\d*$"); MessageApi api = new MessageApi(request, messageRegex, _fileService.Object, "messages"); _fileService.Setup(s => s.FileExists("messages\\100.txt")).Returns(true); _fileService.Setup(s => s.ReadFromFile("messages\\100.txt")).Returns("message"); string response = api.Interaction(); Assert.AreEqual("message", response); }
private static void Exist_Tag(string str, string UserId) { MessageApi mm = new MessageApi(); string id = ""; string[] ss = str.Split('/'); List <Tag> ll = get_TagList(); for (int i = 0; i < ss.Length; i++) { id = get_TagId(ss[i], ll); createUser_tag(id, UserId); } }
protected override void OnExecute(BackgroundWorker backgroundWorker) { body = "This is a log archive submitted by the FieldLog submit tool."; MessageApi mapi = new MessageApi(); mapi.AddRecipientTo(RecipientAddress); mapi.AddAttachment(SharedData.Instance.ArchiveFileName); bool result; if (SharedData.Instance.InteractiveEMail) { result = mapi.SendMailInteractive(Subject, body); } else { result = mapi.SendMailDirect(Subject, body); } if (backgroundWorker.CancellationPending) { return; } if (!result) { string x64Note = ""; if (IntPtr.Size == 8) { x64Note = " " + Tx.T("msg.error.mapi x64"); } string mapiError = "MAPI: " + mapi.LastError + "." + x64Note; if (mapi.LastError == MessageApi.MessageApiError.GeneralFailure && IsOutlookAvailable()) { try { SendWithOutlookDynamic(); } catch (Exception ex) { throw new Exception(mapiError + " " + Tx.T("msg.error.outlook fallback failed") + " " + ex.Message); } } else { throw new Exception(mapiError); } } }
public string GetXml() { //Exist("13183489320"); DataSet dt = ExcelToDS("D:\\Sample.xlsx"); MessageApi mm = new MessageApi(); string erro = ""; // Exist_Tag("羽毛球爱好者/管理/测试", "19909096219"); //Dictionary<string, string> dict = new Dictionary<string, string>(); //dynamic de = MyUtility.GetObjFromJson<dynamic>(Json_d); //List<List<string>> sx = new List<List<string>>(); //List<string> m = new List<string>(); for (int i = 6; i < dt.Tables[0].Rows.Count; i++) { mm = Exist_Par(dt.Tables[0].Rows[i][0].ToString()); if (mm.code == "404") { erro += "用户id为" + dt.Tables[0].Rows[i][3].ToString() + "录入失败:" + mm.txt + ";"; continue; } else { mm = createUser(mm.txt, dt.Tables[0].Rows[i][4].ToString(), dt.Tables[0].Rows[i][3].ToString(), dt.Tables[0].Rows[i][2].ToString()); if (mm.code == "404") { erro += "用户id为" + dt.Tables[0].Rows[i][3].ToString() + "录入失败:" + mm.txt + ";"; continue; } else { Exist_Tag(dt.Tables[0].Rows[i][1].ToString(), dt.Tables[0].Rows[i][3].ToString()); } } } //string data = ""; //Tag t = new Tag(); //t.tagid = "28"; //t.userlist = m; //data = MyUtility.GetJsonFromObj(t); //string accss = MyUtility.GetGroupAccess(); //RequestContainer req = new RequestContainer("https://qyapi.weixin.qq.com/cgi-bin/tag/addtagusers?access_token=" + accss); //req.RequestObj.Method = "POST"; //req.RequestObj.ContentType = "application/Json"; //req.SetRequestContent(data); //HttpWebResponse rep = req.GetResponse(); //string x = req.GetResponseContent(rep); return(erro); }
public void onRequestReceived(MessageApi.Message msg) { Console.WriteLine( " :: " + "Requete recu de type : " + msg.sujetMsg.ToString() + " id : " + msg.id); if (msg.sujetMsg == Message.MessageSujet.RequeteRejoindrePartie) { handleRejoindrePartie((RequeteRejoindrePartie)msg); } else if (msg.sujetMsg == Message.MessageSujet.RequeteValeurDe) { ReponseDe rep = (ReponseDe)(msg.creerReponse(Message.MessageSujet.ReponseDe)); rep.valeurDe = connManager.valeurDe; msg.repondre(); } else if (msg.sujetMsg == Message.MessageSujet.RequeteTerminerTour) { msg.creerReponse(Message.MessageSujet.ReponseOk); msg.repondre(); connManager.tourSuivant(); } else if (msg.sujetMsg == Message.MessageSujet.RequeteConstructionColonie) { msg.creerReponse(Message.MessageSujet.ReponseOk); msg.repondre(); connManager.onColonieConstruite(((RequetePosition)msg).position, joueur); } else if (msg.sujetMsg == Message.MessageSujet.RequeteConstructionRoute) { msg.creerReponse(Message.MessageSujet.ReponseOk); msg.repondre(); connManager.onRouteConstruite(((RequetePosition)msg).position, joueur); } else if (msg.sujetMsg == Message.MessageSujet.RequeteConstructionVille) { msg.creerReponse(Message.MessageSujet.ReponseOk); msg.repondre(); connManager.onVilleConstruite(((RequetePosition)msg).position, joueur); } else if( msg.sujetMsg == Message.MessageSujet.RequeteResGenere ) { ReponseRes rep = (ReponseRes)msg.creerReponse(Message.MessageSujet.ReponseRes); rep.res = connManager.getResPourJoueur(joueur); msg.repondre(); } }
/// <summary> /// 留言提醒,模板编号:1069 /// </summary> /// <param name="toUser">接收者(用户)的 openid</param> /// <param name="templateId">消息模板Id</param> /// <param name="text">留言内容,20个以内字符</param> /// <param name="date">留言时间,4小时制时间格式(支持+年月日) 例如:15:01,或:2019年10月1日 15:01</param> /// <param name="page">点击模板卡片后的跳转页面,仅限本小程序内的页面。支持带参数,(示例index?foo=bar)。该字段不填则模板无跳转。</param> public static WxJsonResult SendCommentNotice(string toUser, string templateId, string text, string date, string page) { var data = new TemplateMessageData(); data["thing1"] = new TemplateMessageDataValue(text); data["time2"] = new TemplateMessageDataValue(date); var submitData = new { touser = toUser, template_id = templateId, page = page, data = data }; return(MessageApi.SendSubscribe(weixinAppId, toUser, templateId, data, page)); }
/// <summary> /// 资讯早报通知,模板编号:269 /// </summary> /// <param name="toUser">接收者(用户)的 openid</param> /// <param name="templateId">消息模板Id</param> /// <param name="title">更新内容,20个以内字符</param> /// <param name="remark">备注,20个以内字符</param> /// <param name="page">点击模板卡片后的跳转页面,仅限本小程序内的页面。支持带参数,(示例index?foo=bar)。该字段不填则模板无跳转。</param> public static WxJsonResult SendNewsMorningNotice(string toUser, string templateId, string title, string remark, string page) { var data = new TemplateMessageData(); data["thing1"] = new TemplateMessageDataValue(title); data["thing2"] = new TemplateMessageDataValue(remark); var submitData = new { touser = toUser, template_id = templateId, page = page, data = data }; return(MessageApi.SendSubscribe(weixinAppId, toUser, templateId, data, page)); }
public static object sendMessage(string channelId, string content, string nonce, string parentMessageId) { return(new ThunkAction <AppState>((dispatcher, getState) => { return MessageApi.SendMessage(channelId, content, nonce, parentMessageId) .Then(sendMessageResponse => { dispatcher.dispatch(new SendMessageSuccessAction { channelId = channelId, content = content, nonce = nonce }); }) .Catch(error => { dispatcher.dispatch(new SendMessageFailureAction()); Debuger.LogError(message: error); }); })); }
public void TestMessageApiGetAllMessages() { string requestString = "GET /messages/ HTTP/1.1\r\nUser-Agent: curl/7.55.1\r\nAccept: */*"; RequestContext request = new RequestContext(requestString); Regex messageRegex = new Regex(@"^/messages/?\d*$"); MessageApi api = new MessageApi(request, messageRegex, _fileService.Object, "messages"); // FileService gets mocked _fileService.Setup(s => s.GetFilesInDir("messages")) .Returns(new string[] { "messages\\0.txt", "messages\\1.txt" }); _fileService.Setup(s => s.ReadFromFile("messages\\0.txt")).Returns("Message0"); _fileService.Setup(s => s.ReadFromFile("messages\\1.txt")).Returns("Message1"); _fileService.Setup(s => s.ReadAllFilesInDir("messages")).Returns("0.txt: Message0\n1.txt: Message1"); string response = api.Interaction(); Assert.AreEqual("0.txt: Message0\n1.txt: Message1", response); }
public void onConnectionInterrupted(MessageApi.Connection c) { Console.WriteLine("onConnectionInterrupted!!"); }
public void onNotifReceived(MessageApi.Message msg) { Console.WriteLine(nom + " :: " + "Notif recu de type : " + msg.sujetMsg.ToString() + " id : " + msg.id); }