/// <summary> /// Push Message to Tag /// </summary> /// <param name="request">Push request parameter</param> /// <returns></returns> public MessagePushResponse PushMessageTag(MessagePushTagRequest request) { var postStr = request.GeneratePostData(Apikey, SecretKey); var response = PostData(request.ServiceUrl, postStr); if (response == null) return null; MessagePushResponse result = null; try { result = JsonConvert.DeserializeObject<MessagePushResponse>(response); } catch (Exception ex) { Debug.WriteLine("PushMessageTag Error Response Deserialize Fail, May not valid json:" + ex.Message + " " + response); } return result; }
public void PushMesssageTagSingleTest() { var messageList = new List<string> { Guid.NewGuid().ToString() }; var messageKeyList = new List<string> { Guid.NewGuid().ToString() }; var request = new MessagePushTagRequest( DeviceTypes.Android, "TAG_TEST", MessageTypes.Message, messageList, messageKeyList ); Console.WriteLine("Push Message:" + request.Messages); var pushService = new Client(_apiKey, _secretKey); var response = pushService.PushMessageTag(request); Assert.NotNull(response); Assert.Greater(response.RequestId, 0); }