-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A library for Google/SixApart pubsub hub interaction -- -- A package for setting up, sending and receiving PubSub requests to -- pubsub hubs, -- http://pubsubhubbub.googlecode.com/svn/trunk/pubsubhubbub-core-0.1.html -- -- Git repository available at git://coming.soon/ @package pubsub @version 0.10 -- | Taking care of the details of creating & tearing down network -- connections, both client and server connections. module Network.Connection data ClientOptions ClientOptions :: String -> Maybe PortNumber -> Maybe ProtocolNumber -> Maybe PortNumber -> ConnectionOptions -> ClientOptions host :: ClientOptions -> String port :: ClientOptions -> Maybe PortNumber cliProto :: ClientOptions -> Maybe ProtocolNumber localEnd :: ClientOptions -> Maybe PortNumber cliOpts :: ClientOptions -> ConnectionOptions clientOpts :: ClientOptions data Connection Connection :: Handle -> Socket -> Maybe Server -> Connection coHandle :: Connection -> Handle coSocket :: Connection -> Socket coServer :: Connection -> Maybe Server data ConnectionOptions ConnectionOptions :: Bool -> IOMode -> BufferMode -> ConnectionOptions connMode :: ConnectionOptions -> Bool ioMode :: ConnectionOptions -> IOMode bufMode :: ConnectionOptions -> BufferMode defaultConnectionOptions :: ConnectionOptions -- | clientConnection opts tries to open up a connection as -- requested by the ClientOptions opts. If successful, -- returns a Handle and its underlying Socket. The -- latter is only meant to be used when doing orderly & draining -- shutdowns. All I/O is expected to happen over the Handle. clientConnection :: ClientOptions -> IO Connection data Server data ServerOptions ServerOptions :: Maybe String -> Maybe PortNumber -> Maybe ProtocolNumber -> ConnectionOptions -> ServerOptions servInterface :: ServerOptions -> Maybe String servPort :: ServerOptions -> Maybe PortNumber servProto :: ServerOptions -> Maybe ProtocolNumber servOpts :: ServerOptions -> ConnectionOptions serverOpts :: ServerOptions newServer :: ServerOptions -> IO Server acceptConnection :: Server -> IO (Connection, SockAddr) closeConnection :: Connection -> IO () closeSession :: Connection -> Server -> IO () instance Show ConnectionOptions instance Show ClientOptions -- | Working with MIME content; missing bits. module Web.Utils.MIME uploadFileType :: String -> Type mixedType :: IO (MIMEValue, String) uploadFile :: String -> FilePath -> IO MIMEValue showMIMEValue :: String -> MIMEValue -> ([(String, String)], String) showMIMEContent :: String -> MIMEContent -> String crnl :: String showDisposition :: Disposition -> String showDispType :: DispType -> String showDispParam :: DispParam -> String -- | License : See the file LICENSE -- -- Status : Coded -- -- Codec for de/encoding URI strings via percent encodings (cf. RFC -- 3986.) module Web.Codec.Percent getEncodedString :: String -> String getDecodedString :: String -> String getEncodedChar :: Char -> Maybe String getDecodedChar :: String -> Maybe (Char, String) -- | License : See the file LICENSE -- -- Status : Coded -- -- Codec for de/encoding form data shipped in URL query strings or in -- POST request bodies. (application/x-www-form-urlencoded) (cf. RFC -- 3986.) module Web.Codec.URLEncoder encodeString :: String -> String decodeString :: String -> String -- | isUTF8Encoded str tries to recognize input string as being in -- UTF-8 form. Will soon migrate to utf8-string. isUTF8Encoded :: String -> Bool utf8Encode :: String -> String -- | Working with POSTed form payloads. module Web.Utils.Post data PostReq PostReq :: String -> [PostParam] -> PostReq prName :: PostReq -> String prVals :: PostReq -> [PostParam] data PostKind PostQuery :: PostKind PostWWWForm :: PostKind PostFormData :: PostKind newPostRequest :: String -> PostReq testRequest :: PostReq -> Maybe PostKind -> IO () toRequest :: PostReq -> Maybe PostKind -> IO (String, [(String, String)], String) toAmpString :: [PostParam] -> String mustBeBody :: PostParam -> Bool mustBeQuery :: PostParam -> Bool -- | addNameValue nm val req augments the request req -- with a binding for (nm,val). Neither nm nor -- val are assumed encoded. It leaves it until the serialization -- phase to fix on how to communicate the binding for the POST request -- (i.e., via the query portion or in the request's body.) addNameValue :: String -> String -> PostReq -> PostReq -- | addQueryNameValue nm val req performs same function as -- addNameValue, but adds the constraint that the binding must -- be transmitted as part of the query portion of the URL it ends up -- going out via. addQueryNameValue :: String -> String -> PostReq -> PostReq -- | addQueryNameValue nm val req performs same function as -- addNameValue, but adds the constraint that the binding must -- be transmitted as part of the body of the POST request, forcing the -- payload to be of MIME type application/x-www-form-urlencoded addBodyNameValue :: String -> String -> PostReq -> PostReq -- | addNameFile nm fb mbMimeType req augments the request -- req with a binding of name nm to the local file -- fb. It will be slurped in and included in the POST request, -- as part of a multi-part payload. addNameFile :: String -> FilePath -> Maybe String -> PostReq -> PostReq data PostParam PostNameValue :: String -> String -> (Maybe Bool) -> PostParam PostFile :: String -> FilePath -> (Maybe String) -> PostParam isPostFile :: PostParam -> Bool toMIMEValue :: [PostParam] -> IO MIMEValue fromPostParam :: String -> PostParam -> IO MIMEValue toMIMEType :: String -> IO Type getMIMEType :: String -> IO Type -- | for publish-subscribing to URL change notifications over HTTP. Nice -- and simple (the protocol, that is :-) ) module Web.Types type URLString = String -- | Basic types and defs behind the PubSubHub protocol. module Web.PubSub.Types data HubLink HubLink :: URLString -> HubLink linkURL :: HubLink -> URLString -- | Subscribe represents both subscribe and subscribe requests. data Subscribe Subscribe :: Bool -> URLString -> URLString -> [VerifyMode] -> Maybe VerifyToken -> Maybe Integer -> Subscribe subMode :: Subscribe -> Bool subCallback :: Subscribe -> URLString subTopic :: Subscribe -> URLString subVerify :: Subscribe -> [VerifyMode] subVerifyToken :: Subscribe -> Maybe VerifyToken subLeaseSecs :: Subscribe -> Maybe Integer data VerifyMode VerifySync :: Bool -> VerifyMode type VerifyToken = String instance Show HubLink -- | Simple GET/de-ref of URLs; abstracting out networking backend/package. module Web.Utils.Fetch readContentsURL :: URLString -> IO String readUserContentsURL :: Maybe AuthUser -> Bool -> Bool -> URLString -> [(String, String)] -> IO ([(String, String)], String) postContentsURL :: Maybe AuthUser -> URLString -> [(String, String)] -> [Cookie] -> String -> IO ([Cookie], [(String, String)], String) data AuthUser AuthUser :: String -> String -> AuthUser authUserName :: AuthUser -> String authUserPass :: AuthUser -> String nullAuthUser :: AuthUser -- | Cookie is the Haskell representation of HTTP cookie values. -- See its relevant specs for authoritative details. data Cookie :: * addDefaultHeaders :: Int -> [(String, String)] -> [(String, String)] -- | Ad-hoc, one-off, but convenient untyped representation of HTTP -- requests and responses. Includes instances for serializing both via -- JSON. module Web.Utils.HTTP data Request Request :: String -> URLString -> [(String, String)] -> [(String, String)] -> String -> Request reqMethod :: Request -> String reqURL :: Request -> URLString reqHeaders :: Request -> [(String, String)] reqVars :: Request -> [(String, String)] reqBody :: Request -> String data Response Response :: Integer -> [(String, String)] -> String -> Response respStatus :: Response -> Integer respHeaders :: Response -> [(String, String)] respBody :: Response -> String jsonRequest :: String -> Maybe Request jsonResponse :: Response -> String readRequest :: JSValue -> Result Request showRequest :: Request -> JSValue readResponse :: JSValue -> Result Response showResponse :: Response -> JSValue toStatusString :: Integer -> String statusMap :: [(Integer, String)] instance Show Response instance Read Response instance JSON Response instance JSON Request -- | for publish-subscribing to URL change notifications over HTTP. Nice -- and simple (the protocol, that is :-) ) module Web.PubSub getHubLink :: Feed -> Maybe HubLink discover :: URLString -> IO (Maybe Feed) subscribe :: Maybe AuthUser -> URLString -> Subscribe -> IO () getContent :: URLString -> Maybe Integer -> IO (Maybe Feed) notifyPublish :: Maybe AuthUser -> URLString -> URLString -> IO () -- | Handle incoming POST notification of updated topic content. Checks to -- see that the MIME type is indeed atom. Returns the feed along -- with status code (and headers) to respond with. A result of -- Nothing should be interpreted as an error and responded to -- accordingly. notifyContent :: Request -> IO (Response, Maybe Feed) -- | In response to a (un)subscription POST request, a hub will do a -- POSTback to verify the request. The Subscribe argument is the -- same as the one used to issue the original (un)subscription request. handleVerify :: Subscribe -> Request -> Response