--------------------------------------------------------------------
-- |
-- Module      : FriendFeed.Room
-- Description : Fetch room-specific FriendFeed info.
-- Copyright   : (c) Sigbjorn Finne, 2008
-- License     : BSD3
--
-- Maintainer: Sigbjorn Finne <sof@forkIO.com>
-- Stability : provisional
-- Portability: portable
--
-- Actions for fetching info on and entries from a room.
-- 
--------------------------------------------------------------------
module FriendFeed.Room where

import FriendFeed.Types
import FriendFeed.Types.Import
import FriendFeed.Monad

-- | Returns a list of all of the room's members 
-- and the url associated with the room 
-- (Authentication required for private rooms).
getRoomProfile :: RoomName -> FFm Room
getRoomProfile r = authCall $
  ffeedTranslate $
   ffeedCall ["room", r, "profile"] []

-- | Returns the entries the authenticated user 
-- would see on their Rooms page - entries from all 
-- of the rooms they are members of.
getRoomsFeeds :: FFm [Entry]
getRoomsFeeds = authCall $
  ffeedTranslateLs "entries" $
   ffeedCall ["feed","rooms"] []

-- | Returns the most recent entries in the room with the given nickname.
-- If the room is private, authentication is required.
getRoomEntries :: RoomName -> FFm [Entry]
getRoomEntries r = 
  ffeedTranslateLs "entries" $
   ffeedCall ["feed","room",r] []