-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Bindings to Facebook's API. -- -- This package exports bindings to Facebook's APIs (see -- http://developers.facebook.com/). Does not have any external -- dependencies and tries to use as little resources (such as memory, -- sockets and CPU) as possible by using packages such as aeson, -- attoparsec, bytestring, conduit, -- http-conduit, text and others. -- -- While we would like to have a complete binding to Facebook's API, this -- package is being developed on demand. If you need something that has -- not been implemented yet, please send a pull request or file an issue -- on GitHub (https://github.com/meteficha/fb/issues). @package fb @version 0.4 module Facebook -- | FacebookT auth m a is this library's monad transformer. -- Contains information needed to issue commands and queries to Facebook. -- The phantom type auth may be either Auth (you have -- supplied your Credentials) or NoAuth (you have not -- supplied any Credentials). data FacebookT auth m a -- | Run a computation in the FacebookT monad transformer with your -- credentials. runFacebookT :: Credentials -> Manager -> FacebookT Auth m a -> m a -- | Run a computation in the FacebookT monad without credentials. runNoAuthFacebookT :: Manager -> FacebookT NoAuth m a -> m a -- | Phantom type stating that you have provided your Credentials -- and thus have access to the whole API. data Auth -- | Phantom type stating that you have not provided your -- Credentials. This means that you'll be limited about which APIs -- you'll be able use. data NoAuth -- | Credentials that you get for your app when you register on Facebook. data Credentials Credentials :: Ascii -> Ascii -> Ascii -> Credentials -- | Your application name (e.g. for OpenGraph calls). appName :: Credentials -> Ascii -- | Your application ID. appId :: Credentials -> Ascii -- | Your application secret key. appSecret :: Credentials -> Ascii -- | An access token. While you can make some API calls without an access -- token, many require an access token and some will give you more -- information with an appropriate access token. -- -- There are two kinds of access tokens: -- --
-- {-# LANGUAGE OverloadedStrings #-}
--
-- perms :: [Permission]
-- perms = ["user_about_me", "email", "offline_access"]
--
data Permission
-- | The first step to get an user access token. Returns the Facebook URL
-- you should redirect you user to. Facebook will authenticate the user,
-- authorize your app and then redirect the user back into the provider
-- RedirectUrl.
getUserAccessTokenStep1 :: Credentials -> RedirectUrl -> [Permission] -> Text
-- | The second step to get an user access token. If the user is
-- successfully authenticate and they authorize your application, then
-- they'll be redirected back to the RedirectUrl you've passed to
-- getUserAccessTokenStep1. You should take the request query
-- parameters passed to your RedirectUrl and give to this function
-- that will complete the user authentication flow and give you an
-- AccessToken User.
getUserAccessTokenStep2 :: ResourceIO m => RedirectUrl -> [Argument] -> FacebookT Auth m (AccessToken User)
-- | Extend the expiration time of an user access token (see
-- https://developers.facebook.com/docs/offline-access-deprecation/).
-- Returns Left exc if there is an error while extending, or
-- Right token with the new user access token (which could have
-- the same data and expiration time as before, but you can't assume
-- this). Note that expired access tokens can't be extended, only valid
-- tokens.
extendUserAccessToken :: ResourceIO m => AccessToken User -> FacebookT Auth m (Either FacebookException (AccessToken User))
-- | Creates an Open Graph action on the user's timeline. Returns the
-- Id of the newly created action. For example:
--
-- -- now <- liftIO getCurrentTime -- createAction "cook" -- [ "recipe" #= "http://example.com/cookie.html" -- , "when" #= now ] -- token --createAction :: ResourceIO m => Action -> [Argument] -> AccessToken User -> FacebookT Auth m Id -- | An action of your app. Please refer to Facebook's documentation at -- https://developers.facebook.com/docs/opengraph/keyconcepts/#actions-objects -- to see how you can create actions. -- -- This is a newtype of Ascii that supports only -- IsString. This means that to create an Action you should -- use the OverloadedStrings language extension. For example, -- --
-- {-# LANGUAGE OverloadedStrings #-}
--
-- foo token = do
-- ...
-- createAction "cook" [...] token
--
data Action
-- | Create an Argument with a SimpleType. See the docs on
-- createAction for an example.
(#=) :: SimpleType a => Ascii -> a -> Argument
-- | Class for data types that may be represented as a Facebook simple
-- type. (see
-- https://developers.facebook.com/docs/opengraph/simpletypes/).
class SimpleType a
encodeFbParam :: SimpleType a => a -> Text
-- | Make a raw GET request to Facebook's Graph API. Returns a raw
-- JSON Value.
getObject :: (ResourceIO m, FromJSON a) => Ascii -> [Argument] -> Maybe (AccessToken kind) -> FacebookT anyAuth m a
-- | Make a raw POST request to Facebook's Graph API. Returns a
-- raw JSON Value.
postObject :: (ResourceIO m, FromJSON a) => Ascii -> [Argument] -> AccessToken kind -> FacebookT Auth m a
-- | The identification code of an object.
newtype Id
Id :: Ascii -> Id
idCode :: Id -> Ascii
-- | An exception that may be thrown by functions on this package. Includes
-- any information provided by Facebook.
data FacebookException
-- | An exception coming from Facebook.
FacebookException :: Text -> Text -> FacebookException
fbeType :: FacebookException -> Text
fbeMessage :: FacebookException -> Text
-- | An exception coming from the fb package's code.
FbLibraryException :: Text -> FacebookException
fbeMessage :: FacebookException -> Text