Esempio n. 1
0
        public async Task <List <Room> > GetRoomsForCurrentUser()
        {
            List <Room> rooms = new List <Room>();

            HttpResponseMessage response = await RequestsBL.GETRequest("/room", Constants.BaseRequestStub);

            if (response != null)
            {
                if (response.IsSuccessStatusCode)
                {
                    rooms = RequestsBL.DeserializeObjects <Room>(XDocument.Parse(await response.Content.ReadAsStringAsync()), elementPointer);
                }
            }

            return(rooms);
        }
Esempio n. 2
0
        public async Task <List <Chat> > GetChatsInRoom(Room Room)
        {
            List <Chat> chats = new List <Chat>();

            HttpResponseMessage response = await RequestsBL.GETRequest(string.Format
                                                                           ("/chat/{0}?lastKnownMessageId=0&limit=100&lookIntoFuture=1", Room.token), Constants.BaseRequestStub);

            if (response != null)
            {
                if (response.IsSuccessStatusCode)
                {
                    chats = RequestsBL.DeserializeObjects <Chat>(XDocument.Parse(await response.Content.ReadAsStringAsync()), elementPointer);
                }
            }

            return(chats);
        }
Esempio n. 3
0
        public async Task <UserInfo> GetUserInfo(string userId)
        {
            HttpResponseMessage response = await RequestsBL.GETRequest(string.Format("/{0}", userId), Constants.UsersRequestStub);

            UserInfo ui = new UserInfo();

            if (response != null)
            {
                if (response.IsSuccessStatusCode)
                {
                    ui = RequestsBL.DeserializeObjects <UserInfo>(XDocument.Parse(await response.Content.ReadAsStringAsync()), dataPointer)[0];
                }
            }

            return(ui);
        }