telegraph-1.2.0: Binding to the telegraph API
Safe HaskellNone
LanguageHaskell2010

Web.Telegraph.API

Description

The telegraph API. Note that the Error HttpException effect should be interpreted using either errorToIOAsExc or errorToErrorIOAsExc or otherwise it won't get caught.

Synopsis

Types

data AccountInfo Source #

Constructors

AccountInfo 

Instances

Instances details
Eq AccountInfo Source # 
Instance details

Defined in Web.Telegraph.API

Show AccountInfo Source # 
Instance details

Defined in Web.Telegraph.API

ToJSON AccountInfo Source # 
Instance details

Defined in Web.Telegraph.API

FromJSON AccountInfo Source # 
Instance details

Defined in Web.Telegraph.API

(k ~ A_Lens, a ~ Text, b ~ Text) => LabelOptic "authorName" k AccountInfo AccountInfo a b Source # 
Instance details

Defined in Web.Telegraph.API

(k ~ A_Lens, a ~ Text, b ~ Text) => LabelOptic "authorUrl" k AccountInfo AccountInfo a b Source # 
Instance details

Defined in Web.Telegraph.API

(k ~ A_Lens, a ~ Text, b ~ Text) => LabelOptic "shortName" k AccountInfo AccountInfo a b Source # 
Instance details

Defined in Web.Telegraph.API

data TS Source #

Telegraph state

Constructors

TS 

Instances

Instances details
Eq TS Source # 
Instance details

Defined in Control.Effect.Telegraph

Methods

(==) :: TS -> TS -> Bool #

(/=) :: TS -> TS -> Bool #

Show TS Source # 
Instance details

Defined in Control.Effect.Telegraph

Methods

showsPrec :: Int -> TS -> ShowS #

show :: TS -> String #

showList :: [TS] -> ShowS #

(k ~ A_Lens, a ~ Text, b ~ Text) => LabelOptic "accessToken" k TS TS a b Source # 
Instance details

Defined in Control.Effect.Telegraph

Methods

labelOptic :: Optic k NoIx TS TS a b #

(k ~ A_Lens, a ~ Text, b ~ Text) => LabelOptic "authorName" k TS TS a b Source # 
Instance details

Defined in Control.Effect.Telegraph

Methods

labelOptic :: Optic k NoIx TS TS a b #

(k ~ A_Lens, a ~ Text, b ~ Text) => LabelOptic "authorUrl" k TS TS a b Source # 
Instance details

Defined in Control.Effect.Telegraph

Methods

labelOptic :: Optic k NoIx TS TS a b #

(k ~ A_Lens, a ~ Text, b ~ Text) => LabelOptic "shortName" k TS TS a b Source # 
Instance details

Defined in Control.Effect.Telegraph

Methods

labelOptic :: Optic k NoIx TS TS a b #

Effects

data Telegraph :: Effect where Source #

Constructors

TakeTS :: Telegraph m TS 
ReadTS :: Telegraph m TS 
PutTS :: TS -> Telegraph m () 

Instances

Instances details
Effs '[Embed IO, Reader (MVar TS)] m => Handler TelegraphH Telegraph m Source # 
Instance details

Defined in Control.Effect.Telegraph

data Http :: Effect where Source #

Instances

Instances details
Effs '[Embed IO, Reader Manager] m => Handler HttpH Http m Source # 
Instance details

Defined in Control.Effect.Telegraph

Interpreters

runTelegraph :: (Effs '[Embed IO, Reader Manager, Error HttpException, Throw TelegraphError] m, Threaders '[ReaderThreads] m p) => Text -> TelegraphToIOC m a -> m a Source #

Interpret a Http effect together with a Telegraph effect with a supplied access token

runTelegraph' :: (Effs '[Embed IO, Reader Manager, Error HttpException, Throw TelegraphError] m, Threaders '[ReaderThreads] m p) => AccountInfo -> TelegraphToIOC m a -> m a Source #

Interpret a Http effect together with a Telegraph effect with account info that will be used to create a new account

Account related APIs

editAccountInfo :: Effs '[Telegraph', Bracket, Throw TelegraphError] m => AccountInfo -> m () Source #

Use this method to update information about this Telegraph account

getAccountInfo :: Effs '[Telegraph', Throw TelegraphError] m => m Account Source #

Use this method to get information about this Telegraph account

revokeAccessToken :: Effs '[Telegraph', Bracket, Error TelegraphError] m => m Account Source #

Use this method to revoke access_token and generate a new one

createPage Source #

Arguments

:: Effs '[Telegraph', Error TelegraphError] m 
=> Text

title

-> [Node]

content

-> m Page 

Use this method to create a new Telegraph page

editPage Source #

Arguments

:: Effs '[Telegraph', Throw TelegraphError] m 
=> Text

path

-> Text

title

-> [Node]

content

-> m Page 

Use this method to edit an existing Telegraph page

getPageList Source #

Arguments

:: Effs '[Telegraph', Throw TelegraphError] m 
=> Int

offset

-> Int

limit (0 - 200)

-> m PageList 

Use this method to get a list of pages belonging to this Telegraph account

Account independent APIs

createAccount :: Eff Http' m => AccountInfo -> m (Result Account) Source #

Use this method to create a new Telegraph account

getPage :: Eff Http' m => Text -> m (Result Page) Source #

Use this method to get a Telegraph page

getTotalViews :: Eff Http' m => Text -> m (Result PageViews) Source #

Use this method to get the total number of views for a Telegraph article

Image uploading API

uploadImageFromFile :: Effs '[Telegraph', Bracket, Embed IO] m => FilePath -> m UploadResult Source #

Upload a image from a filepath to Telegraph

uploadImageFromFiles :: Effs '[Telegraph', Bracket, Embed IO] m => [FilePath] -> m UploadResult Source #

Upload a list of images to Telegraph. The resulting list of images will be in the same order

data ImgStream Source #

Constructors

ImgStream 

Fields

Instances

Instances details
(k ~ A_Lens, a ~ Text, b ~ Text) => LabelOptic "name" k ImgStream ImgStream a b Source # 
Instance details

Defined in Web.Telegraph.API

uploadImageStreaming :: Eff Telegraph' m => ImgStream -> m UploadResult Source #

Upload a image stream to Telegraph

uploadImagesStreaming :: Eff Telegraph' m => [ImgStream] -> m UploadResult Source #

Upload a list of image streams to Telegraph. The resulting list of images

Interpreter primitives

data TelegraphH Source #

Instances

Instances details
Effs '[Embed IO, Reader (MVar TS)] m => Handler TelegraphH Telegraph m Source # 
Instance details

Defined in Control.Effect.Telegraph

data HttpH Source #

Instances

Instances details
Effs '[Embed IO, Reader Manager] m => Handler HttpH Http m Source # 
Instance details

Defined in Control.Effect.Telegraph

telegraph :: Effs '[Embed IO, Reader (MVar TS)] m => TelegraphC m a -> m a Source #

http :: Effs '[Embed IO, Reader Manager] m => HttpC m a -> m a Source #

Interpret an Http effect