예제 #1
0
        /// <summary>
        /// 创建单播的消息(消息类型=消息)推送请求
        /// </summary>
        /// <param name="pBaiduUserID"></param>
        /// <param name="pBaiduChannelID"></param>
        /// <param name="pDeviceType"></param>
        /// <param name="pMessage"></param>
        /// <param name="pMessageKey"></param>
        /// <returns></returns>
        public static PushMsgRequest CreateUnicastMessageRequest(string pBaiduUserID
                                                                 , string pBaiduChannelID
                                                                 , DeviceTypes?pDeviceType
                                                                 , string pMessage
                                                                 , string pMessageKey
                                                                 , PushTypes pushType = PushTypes.Unicast)
        {
            PushMsgRequest req = new PushMsgRequest();

            req.PushType = pushType;
            if (!string.IsNullOrEmpty(pBaiduUserID))
            {
                req.BaiduUserID = pBaiduUserID;
            }
            req.BaiduChannelID = pBaiduChannelID;
            req.DeviceType     = pDeviceType;
            req.MessageType    = MessageTypes.Message;
            req.Message        = pMessage;
            if (!string.IsNullOrWhiteSpace(pMessageKey))
            {
                req.BaiduMessageKey = pMessageKey;
            }
            //
            return(req);
        }
예제 #2
0
 /// <summary>
 /// 推送消息
 /// </summary>
 /// <param name="pChannel"></param>
 /// <param name="pMessage"></param>
 /// <returns>推送的响应</returns>
 public static BaiduPushMessageResponse PushMessage(BaiduChannel pChannel, PushMsgRequest pRequest)
 {
     return(BaiduCloudPush.Call(pChannel, HttpMethods.POST, pRequest));
 }