public void OBOLogoutTest()
        {
            SymConfig       symConfig       = new SymConfig();
            SymConfigLoader symConfigLoader = new SymConfigLoader();

            symConfig = symConfigLoader.loadFromFile("C:/Users/Michael/Documents/Visual Studio 2017/Projects/apiClientDotNet/apiClientDotNetTest/Resources/testConfig3.json");
            SymOBOAuth oboAuth = new SymOBOAuth(symConfig);

            oboAuth.sessionAppAuthenticate();
            SymOBOUserAuth auth   = oboAuth.getUserAuth("*****@*****.**");
            SymOBOClient   client = SymOBOClient.initOBOClient(symConfig, auth);

            OutboundMessage message = new OutboundMessage();

            message.message = "<messageML>Hello Alexa</messageML>";

            apiClientDotNet.Models.Stream stream = new apiClientDotNet.Models.Stream();
            stream.streamId = "IzgD3nNbpoaNJ6_To7Ds0n___pmCBYMrdA";

            MessageClient  messageClient = new MessageClient(client);
            InboundMessage resp          = messageClient.sendMessage(stream.streamId, message, false);

            auth.logout();


            //Assert.IsTrue(resp.message != null);
        }
示例#2
0
        private void SendMessageAsync()
        {
            var task = new Task(() =>
            {
                var symConfigLoader = new SymConfigLoader();
                var configPathTwo   = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Resources", "testConfigPsdevTwo.json");
                var symConfigTwo    = symConfigLoader.loadFromFile(configPathTwo);
                var botAuthTwo      = new SymBotRSAAuth(symConfigTwo);
                botAuthTwo.authenticate();
                var botClientTwo = SymBotClient.initBot(symConfigTwo, botAuthTwo);

                // Find one BOT stream id
                var streamClient = botClientTwo.getStreamsClient();
                var streamTypes  = new List <string>
                {
                    "ROOM"
                };
                var result = streamClient.getUserStreams(streamTypes, false);
                // Send to that stream a messages
                var message = new OutboundMessage
                {
                    message = "<messageML>Hello world! From .NET SDK Integration Test.</messageML>"
                };
                var stream = new apiClientDotNet.Models.Stream
                {
                    streamId = result[0].id
                };
                var messageClient = new MessageClient(botClientTwo);
                messageClient.sendMessage(stream.streamId, message, false);
            }, TaskCreationOptions.AttachedToParent);

            task.Start();
        }
        public void OBOAuth()
        {
            SymConfig       symConfig       = new SymConfig();
            SymConfigLoader symConfigLoader = new SymConfigLoader();

            symConfig = symConfigLoader.loadFromFile("C:/Users/Michael/Documents/Visual Studio 2017/Projects/apiClientDotNet/apiClientDotNetTest/Resources/testConfig3.json");
            SymOBOAuth oboAuth = new SymOBOAuth(symConfig);

            oboAuth.sessionAppAuthenticate();
            SymOBOUserAuth auth = oboAuth.getUserAuth("*****@*****.**");

            // auth.setSessionToken("eyJhbGciOiJSUzUxMiJ9.eyJzdWIiOiJzdGlzaGxlciIsImlzcyI6InN5bXBob255IiwiYXBwUGVybWlzc2lvbnMiOlsiQUNUX0FTX1VTRVIiLCJHRVRfQkFTSUNfQ09OVEFDVF9JTkZPIiwiR0VUX1BSRVNFTkNFIiwiTElTVF9VU0VSX1NUUkVBTVMiLCJNQU5BR0VfUk9PTVMiLCJTRU5EX01FU1NBR0VTIl0sImFwcEdyb3VwSWQiOiJhZG55LXcxNDYiLCJzZXNzaW9uSWQiOiJiNGI3N2NjMWUyYzg4ODAxMWNmNWI3MWI5YmQwYTZhNjJlNDI0MTMzMzJlMGRkNDk1NWQzYzk3ZjViNjE4MWMyNWE2MTVmYThkMjNmNjM2YmNmNDJiNTMxOGI4ZDlkNDgwMDAwMDE2NjhjZTIyOGNjMDAwMDUyYjAwMDAwMDAxOSIsInVzZXJJZCI6IjkwOTE1ODY3NzIxNzUzIn0.hSsZOBEH-OlUzOjDl_NhoxVTrlbJSEaxnmV0s5VQO92VgYaTBc0eUbcHaCYzmRtafil8dy_4_pOSMSR9VupDayklL9igT2cRHZGKvryR4_2hNDym3Xs-uYCxC83O1l9CTm2ISrSVgVabzVOznN23sZLQ6IoIj2EORS6B8eemGlGTWjZge1iav464kFosQ5glSDSecY4mTcbh4sYE3mwINlCEML5VqpEbc0Pdu1ZOesLMBHsa3KzlGuIUEjtigP4NZeYPc31G-rzxSKHWeMo3Mqwwk_0dSL6voQgw-29fly0uIGTF7wCSngk3g9n4Lv_0m4Yh5xDcyQ0h4RRxny-Sgg");
            // symConfig.agentHost = "alphadyne.symphony.com";
            SymOBOClient client = SymOBOClient.initOBOClient(symConfig, auth);

            OutboundMessage message = new OutboundMessage();

            message.message = "<messageML>Hello it is mike fron NET 2</messageML>";

            apiClientDotNet.Models.Stream stream = new apiClientDotNet.Models.Stream();
            stream.streamId = "IzgD3nNbpoaNJ6_To7Ds0n___pmCBYMrdA";
            //stream.streamId = "AQpEsS9DJM1ZRrGF7Kb7i3___pui0wKcdA";

            MessageClient  messageClient = new MessageClient(client);
            InboundMessage resp          = messageClient.sendMessage(stream.streamId, message, false);


            Assert.IsTrue(resp.message != null);
        }
        public void MessageRoomTest()
        {
            SymConfig       symConfig       = new SymConfig();
            SymConfigLoader symConfigLoader = new SymConfigLoader();

            symConfig = symConfigLoader.loadFromFile("C:/Users/Michael/Documents/Visual Studio 2017/Projects/apiClientDotNet/apiClientDotNetTest/Resources/testConfig.json");
            SymBotAuth botAuth = new SymBotAuth(symConfig);

            botAuth.authenticate();
            SymBotClient    botClient = SymBotClient.initBot(symConfig, botAuth);
            OutboundMessage message   = new OutboundMessage();

            message.message = "<messageML>Hello world!</messageML>";


            FileStream        fileStream  = File.OpenRead("C:/Users/Michael/Documents/Visual Studio 2017/Projects/apiClientDotNet/apiClientDotNetTest/Resources/AttachmentTest.txt");
            List <FileStream> attachments = new List <FileStream>();

            attachments.Add(fileStream);
            message.attachments = attachments;
            apiClientDotNet.Models.Stream stream = new apiClientDotNet.Models.Stream();
            stream.streamId = "fu1cJFoklnYlR9vu1AOZ5X___pzXDKPXdA";

            MessageClient  messageClient = new MessageClient(botClient);
            InboundMessage resp          = messageClient.sendMessage(stream.streamId, message, false);

            Assert.IsTrue(resp.messageId != null);
        }
示例#5
0
文件: BotLogic.cs 项目: mmtrand/mybot
        private void SendMessageTo(string name, Stream stream, Message message)
        {
            string        filePath      = Path.GetFullPath("config.json");
            SymBotClient  symBotClient  = new SymBotClient();
            SymConfig     symConfig     = symBotClient.initBot(filePath);
            MessageClient messageClient = new apiClientDotNet.MessageClient();

            messageClient.sendMessage(symConfig, message, stream);
        }
示例#6
0
        private static void SendMessageAsync(string streamId, string text)
        {
            var task = new Task(() =>
            {
                // Send to that stream a messages
                var message = new OutboundMessage
                {
                    message = "<messageML>" + text + "</messageML>"
                };
                var stream = new apiClientDotNet.Models.Stream
                {
                    streamId = streamId
                };
                var messageClient = new MessageClient(symBotClient);
                messageClient.sendMessage(stream.streamId, message, false);
            }, TaskCreationOptions.AttachedToParent);

            task.Start();
        }
        public void MessageRoomTest(string streamId)
        {
            var fileStream  = File.OpenRead(attachmentTestPath);
            var attachments = new List <FileStream>
            {
                fileStream
            };
            var message = new OutboundMessage
            {
                message = "<messageML>Hello world! From .NET SDK Integration Test.</messageML>"
            };

            message.attachments = attachments;
            var stream = new apiClientDotNet.Models.Stream
            {
                streamId = streamId
            };

            var messageClient = new MessageClient(botClient);
            var resp          = messageClient.sendMessage(stream.streamId, message, false);

            Assert.IsNotNull(resp.messageId);
        }
示例#8
0
        public void OBOLogoutTest()
        {
            SymOBOAuth oboAuth = new SymOBOAuth(symConfig);

            oboAuth.sessionAppAuthenticate();
            SymOBOUserAuth auth   = oboAuth.getUserAuth("*****@*****.**");
            SymOBOClient   client = SymOBOClient.initOBOClient(symConfig, auth);

            OutboundMessage message = new OutboundMessage();

            message.message = "<messageML>Hello Alexa</messageML>";

            apiClientDotNet.Models.Stream stream = new apiClientDotNet.Models.Stream();
            stream.streamId = "IzgD3nNbpoaNJ6_To7Ds0n___pmCBYMrdA";

            MessageClient  messageClient = new MessageClient(client);
            InboundMessage resp          = messageClient.sendMessage(stream.streamId, message, false);

            auth.logout();


            //Assert.IsTrue(resp.message != null);
        }
示例#9
0
 public void onRoomReactivated(apiClientDotNet.Models.Stream stream)
 {
 }
示例#10
0
 public void onIMCreated(apiClientDotNet.Models.Stream stream)
 {
 }