haskheap-0.1.2: Haskell bindings to refheap.

Safe HaskellNone

Network.Haskheap

Description

A library for interfacing with the refheap (https:www.refheap.com) API.

Synopsis

Documentation

data Success Source

Result of as successful request (either empty or a paste).

Constructors

Paste 

Fields

getLines :: Integer

Lines in the paste.

getDate :: Maybe UTCTime

Time the paste was created.

getID :: PasteID

ID of the paste (may be numeric or hash or sorts).

getLanguage :: Language

The language of the paste.

getPrivate :: Bool

Whether or not the paste is Private. True is yes.

getURL :: Maybe URI

URL of the paste.

getUser :: Maybe String

User who created the paste. Nothing indicates anonymous.

getBody :: Contents

Body of the paste.

Line String

A string was returned by the API that can't be represented as a paste.

Empty

Operation was successful, but response is empty.

data Error Source

A simple error box so I can parse refheap error messages into something useful.

Constructors

Error String 

Instances

getPaste :: PasteID -> IO (Either Error Success)Source

Get a paste from refheap. Will return IO Nothing if the paste doesn't exist.

createPaste :: Contents -> Bool -> Language -> Maybe Auth -> IO (Either Error Success)Source

Create a new paste.

deletePaste :: PasteID -> Auth -> IO (Either Error Success)Source

Delete a paste. If it fails for some reason, will return the error message from refheap's API wrapped in Maybe, otherwise Nothing.

forkPaste :: PasteID -> Auth -> IO (Either Error Success)Source

Fork a paste.

editPaste :: PasteID -> Contents -> Bool -> Language -> Auth -> IO (Either Error Success)Source

Edit a paste.

getHighlightedPaste :: PasteID -> IO (Either Error Success)Source

Get the highlighted body of a paste. This does not include theme css, just raw HTML.