public void GetUserIDFromUserNameTest()
        {
            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);

            UserClient userClient = botClient.getUsersClient();
            UserInfo   user       = userClient.getUserFromUsername("mikepreview");

            StreamClient    streamClient    = botClient.getStreamsClient();
            RoomSearchQuery roomSearchQuery = new RoomSearchQuery();

            roomSearchQuery.query     = "APITestRoom";
            roomSearchQuery.active    = true;
            roomSearchQuery.isPrivate = true;
            NumericId id = new NumericId();

            id.id = user.id;
            roomSearchQuery.member = id;
            RoomSearchResult result = streamClient.searchRooms(roomSearchQuery, 0, 0);

            Assert.IsTrue(user != null);
        }
        public void SearchRoom()
        {
            var streamClient    = botClient.getStreamsClient();
            var roomSearchQuery = new RoomSearchQuery
            {
                query     = config.GetSection("test_room_name").Value,
                active    = true,
                isPrivate = true
            };
            var result = streamClient.searchRooms(roomSearchQuery, 0, 0);

            Assert.IsNotNull(result);
            Assert.IsTrue(result.count >= 1);
        }
示例#3
0
        //TODO: CHECK WHY 500
        public RoomSearchResult searchRooms(RoomSearchQuery query, int skip, int limit)
        {
            RoomSearchResult result    = null;
            SymConfig        symConfig = botClient.getConfig();

            RestRequestHandler restRequestHandler = new RestRequestHandler();
            string             url = CommonConstants.HTTPSPREFIX + symConfig.podHost + ":" + symConfig.podPort + PodConstants.SEARCHROOMS;


            if (skip > 0)
            {
                if (url.Contains("?"))
                {
                    url = url + "&skip=" + skip;
                }
                else
                {
                    url = url + "?skip=" + skip;
                }
            }
            if (limit > 0)
            {
                if (url.Contains("?"))
                {
                    url = url + "&limit=" + limit;
                }
                else
                {
                    url = url + "?limit=" + limit;
                }
            }
            if (query.labels == null)
            {
                query.labels = new List <String>();
            }
            HttpWebResponse resp = restRequestHandler.executeRequest(query, url, false, WebRequestMethods.Http.Post, symConfig, true);
            string          body = restRequestHandler.ReadResponse(resp);

            result = JsonConvert.DeserializeObject <RoomSearchResult>(body);

            return(result);
        }
        public void SearchRoom()
        {
            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);

            StreamClient    streamClient    = botClient.getStreamsClient();
            RoomSearchQuery roomSearchQuery = new RoomSearchQuery();

            roomSearchQuery.query     = "APITestRoom";
            roomSearchQuery.active    = true;
            roomSearchQuery.isPrivate = true;
            RoomSearchResult result = streamClient.searchRooms(roomSearchQuery, 0, 0);

            Assert.IsTrue(result != null);
        }