Esempio n. 1
0
        public void ReallyMessageCustomSendNewsTest()
        {
            var request = new MessageCustomSendNewsRequest
            {
                AccessToken = GetCurrentToken(),
                ToUser      = "******",
                News        = new NewsMessage
                {
                    Articles = new List <NewsArticleMessage>
                    {
                        new NewsArticleMessage {
                            Title       = "博客园",
                            Description = "博客园,技术改变人生",
                            Url         = "http://inday.cnblogs.com",
                            PicUrl      = "http://static.cnblogs.com/images/logo_small.gif"
                        },
                        new NewsArticleMessage {
                            Title       = "博客园",
                            Description = "博客园,技术改变人生",
                            Url         = "http://inday.cnblogs.com",
                            PicUrl      = "http://static.cnblogs.com/images/logo_small.gif"
                        }
                    }
                }
            };

            var response = m_client.Execute(request);

            if (response.IsError)
            {
                Console.WriteLine(response);
            }
            else
            {
                Console.WriteLine("send is ok");
            }
        }
Esempio n. 2
0
        public void SendRequestTest()
        {
            var textRequest = new MessageCustomSendTextRequest
            {
                AccessToken = "123",
                ToUser      = "******",
                Text        = new TextMessage
                {
                    Content = "test content"
                }
            };

            var imageRequest = new MessageCustomSendImageRequest
            {
                ToUser = "******",
                Image  = new ImageMessage
                {
                    MediaId = "image_media_id"
                }
            };

            var voiceRequest = new MessageCustomSendVoiceRequest
            {
                ToUser = "******",
                Voice  = new VoiceMessage
                {
                    MediaId = "voice_media_id"
                }
            };

            var videoRequest = new MessageCustomSendVideoRequest
            {
                ToUser = "******",
                Video  = new VideoMessage
                {
                    MediaId = "video_media_id",
                    Title   = "video test title"
                }
            };

            var musicRequest = new MessageCustomSendMusicRequest
            {
                ToUser = "******",
                Music  = new MusicMessage
                {
                    Title        = "test music title",
                    HQMusicUrl   = "hqmusicurl",
                    MusicUrl     = "musicurl",
                    ThumbMediaId = "media_id"
                }
            };

            var newsRequest = new MessageCustomSendNewsRequest
            {
                ToUser = "******",
                News   = new NewsMessage
                {
                    Articles = new List <NewsArticleMessage>
                    {
                        new NewsArticleMessage {
                            Title       = "Happy Day",
                            Description = "Is Really A Happy Day",
                            Url         = "url1",
                            PicUrl      = "picurl1"
                        },
                        new NewsArticleMessage {
                            Title       = "Happy Day",
                            Description = "Is Really A Happy Day",
                            Url         = "url2",
                            PicUrl      = "picurl2"
                        }
                    }
                }
            };

            Console.WriteLine(textRequest.GetPostContent());
            Console.WriteLine(imageRequest.GetPostContent());
            Console.WriteLine(voiceRequest.GetPostContent());
            Console.WriteLine(videoRequest.GetPostContent());
            Console.WriteLine(musicRequest.GetPostContent());
            Console.WriteLine(newsRequest.GetPostContent());
        }