{-# LANGUAGE DeriveDataTypeable, FlexibleContexts, OverloadedStrings #-}moduleFacebook.Object.User(User(..),Gender(..),getUser,searchUsers,getUserCheckins,Friend(..),getUserFriends)whereimportControl.ApplicativeimportControl.Monad(mzero)importControl.Monad.Trans.Control(MonadBaseControl)importData.Aeson((.:),(.:?))importData.Text(Text)importData.Typeable(Typeable)-- import qualified Control.Exception.Lifted as EimportqualifiedData.AesonasAimportqualifiedData.ConduitasCimportFacebook.TypesimportFacebook.MonadimportFacebook.GraphimportFacebook.Object.Checkin-- | A Facebook user profile (see-- <https://developers.facebook.com/docs/reference/api/user/>).---- /NOTE:/ We still don't support all fields supported by-- Facebook. Please fill an issue if you need access to any other-- fields.dataUser=User{userId::UserId,userName::MaybeText,userFirstName::MaybeText,userMiddleName::MaybeText,userLastName::MaybeText,userGender::MaybeGender,userLocale::MaybeText,userUsername::MaybeText,userVerified::MaybeBool,userEmail::MaybeText,userLocation::MaybePlace}deriving(Eq,Ord,Show,Read,Typeable)instanceA.FromJSONUserwhereparseJSON(A.Objectv)=User<$>v.:"id"<*>v.:?"name"<*>v.:?"first_name"<*>v.:?"middle_name"<*>v.:?"last_name"<*>v.:?"gender"<*>v.:?"locale"<*>v.:?"username"<*>v.:?"verified"<*>v.:?"email"<*>v.:?"location"parseJSON_=mzero-- | An user's gender.dataGender=Male|Femalederiving(Eq,Ord,Show,Read,Enum,Typeable)instanceA.FromJSONGenderwhereparseJSON(A.String"male")=returnMaleparseJSON(A.String"female")=returnFemaleparseJSON_=mzeroinstanceA.ToJSONGenderwheretoJSON=A.toJSON.toTextwheretoText::Gender->TexttoTextMale="male"toTextFemale="female"-- | Get an user using his user ID. The user access token is-- optional, but when provided more information can be returned-- back by Facebook. The user ID may be @\"me\"@, in which-- case you must provide an user access token and information-- about the token's owner is given.getUser::(C.MonadResourcem,MonadBaseControlIOm)=>UserId-- ^ User ID or @\"me\"@.->[Argument]-- ^ Arguments to be passed to Facebook.->MaybeUserAccessToken-- ^ Optional user access token.->FacebookTanyAuthmUsergetUserid_querymtoken=getObject("/"<>idCodeid_)querymtoken-- | Search users by keyword.searchUsers::(C.MonadResourcem,MonadBaseControlIOm)=>Text->[Argument]->MaybeUserAccessToken->FacebookTanyAuthm(PagerUser)searchUsers=searchObjects"user"-- | Get a list of check-ins made by a given user.getUserCheckins::(C.MonadResourcem,MonadBaseControlIOm)=>UserId-- ^ User ID or @\"me\"@.->[Argument]-- ^ Arguments to be passed to Facebook.->UserAccessToken-- ^ User access token.->FacebookTanyAuthm(PagerCheckin)getUserCheckinsid_querytoken=getObject("/"<>idCodeid_<>"/checkins")query(Justtoken)-- | A friend connection of a 'User'.dataFriend=Friend{friendId::UserId,friendName::Text}deriving(Eq,Ord,Show,Read,Typeable)instanceA.FromJSONFriendwhereparseJSON(A.Objectv)=Friend<$>v.:"id"<*>v.:"name"parseJSON_=mzero-- | Get the list of friends of the given user.getUserFriends::(C.MonadResourcem,MonadBaseControlIOm)=>UserId-- ^ User ID or @\"me\"@.->[Argument]-- ^ Arguments to be passed to Facebook.->UserAccessToken-- ^ User access token.->FacebookTanyAuthm(PagerFriend)getUserFriendsid_querytoken=getObject("/"<>idCodeid_<>"/friends")query(Justtoken)