コード例 #1
0
        public static async Task <object> DeleteRoom(string roomID, ERoomType type)
        {
            string request = "";

            switch (type)
            {
            case ERoomType.Channel:
                request = "api/v1/channels.delete";
                break;

            case ERoomType.Group:
                request = "/api/v1/groups.delete";
                break;

            case ERoomType.Dialog:
                request = "/api/v1/im.close";
                break;
            }

            var data = new { roomId = roomID };

            var res = await ApiHelper.RequestInternalJson <object>(request, data, AppPersistent.Token);

            return(res);
        }
コード例 #2
0
        public static async Task LoginAs(AnonymProfileData data)
        {
            AuthData authData = new AuthData()
            {
                user     = data.login,
                password = "******" + data.id.ToString()
            };
            var response = await ApiHelper.RequestInternalJson <AuthResponse>("api/v1/login", authData, null);

            if (response.status == "success")
            {
                AppPersistent.Token = new AuthTokens()
                {
                    UserId = response.data.userId,
                    Token  = response.data.authToken
                };
            }
            PageNavigationManager.SwitchToPage(new RoomsPage());
        }
コード例 #3
0
        public static async Task <List <RoomData> > GetRooms()
        {
            var result = await ApiHelper.RequestInternalJson <GetRoomResponse>("api/v1/rooms.get", null, AppPersistent.Token, ApiHelper.ERequestType.GET);

            return(result.update);
        }