libstackexchange-0.3.1: StackExchange API interface

Safe HaskellNone
LanguageHaskell98

Network.StackExchange.Request

Contents

Description

StackExchange API request manipulation routines

Synopsis

Type

type Request a n r = Dual (Endo (R a n r)) Source #

data R (a :: Auth) (n :: Symbol) r Source #

StackExchange API Request data type.

a is a phantom type showing whether authentication is enabled

n is a phantom type dissallowing combination of different API calls in one request

r is a type of parsed API call result

Constructors

R 

Fields

Instances

Default (R a n r) Source #

Default StackExchange API request, defines only host link

Methods

def :: R a n r #

data Auth Source #

Authentication

Constructors

RequireToken

Request requires auth_token

Ready

Request may be sent without auth_token

newtype SE (a :: Object) Source #

SE response value wrapper

Constructors

SE 

Fields

Instances

Show (SE a) Source # 

Methods

showsPrec :: Int -> SE a -> ShowS #

show :: SE a -> String #

showList :: [SE a] -> ShowS #

FromJSON (SE a) Source # 

Methods

parseJSON :: Value -> Parser (SE a) #

parseJSONList :: Value -> Parser [SE a] #

data Object Source #

SE response type

Constructors

AccessToken

https://api.stackexchange.com/docs/types/access-token

AccountMerge

https://api.stackexchange.com/docs/types/account-merge

Answer

https://api.stackexchange.com/docs/types/answer

Badge

https://api.stackexchange.com/docs/types/badge

Comment

https://api.stackexchange.com/docs/types/comment

Error

https://api.stackexchange.com/docs/types/error

Event

https://api.stackexchange.com/docs/types/event

Filter

https://api.stackexchange.com/docs/types/filter

InboxItem

https://api.stackexchange.com/docs/types/inbox-item

Info

https://api.stackexchange.com/docs/types/info

NetworkUser

https://api.stackexchange.com/docs/types/network-user

Notification

https://api.stackexchange.com/docs/types/notification

Post

https://api.stackexchange.com/docs/types/post

Privilege

https://api.stackexchange.com/docs/types/privilege

Question

https://api.stackexchange.com/docs/types/question

QuestionTimeline

https://api.stackexchange.com/docs/types/question-timeline

Reputation

https://api.stackexchange.com/docs/types/reputation

ReputationHistory

https://api.stackexchange.com/docs/types/reputation-history

Revision

https://api.stackexchange.com/docs/types/revision

Site

https://api.stackexchange.com/docs/types/site

SuggestedEdit

https://api.stackexchange.com/docs/types/suggested-edit

Tag

https://api.stackexchange.com/docs/types/tag

TagScore

https://api.stackexchange.com/docs/types/tag-score

TagSynonym

https://api.stackexchange.com/docs/types/tag-synonym

TagWiki

https://api.stackexchange.com/docs/types/tag-wiki

TopTag

https://api.stackexchange.com/docs/types/top-tag

User

https://api.stackexchange.com/docs/types/user

UserTimeline

https://api.stackexchange.com/docs/types/user-timeline

WritePermission

https://api.stackexchange.com/docs/types/write-permission

Constructing requests

host :: Text -> Request a n r Source #

Request defining only API call host

Primarily used in Auth, not intended for usage by library user

path :: Text -> Request a n r Source #

Request defining only API call path

Primarily used in API call wrappers, not intended for usage by library user

method :: Text -> Request a n r Source #

Request defining only call method

Primarily used in API call wrappers, not intended for usage by library user

parse :: (ByteString -> r) -> Request a n r Source #

Request defining only API call result parsing function

Primarily used in API call wrappers, not intended for usage by library user

query :: [(Text, Text)] -> Request a n r Source #

Request defining only API call query parameters

Rather low level interface. For more specific usage site, filter, etc calls may be more convenient

Takes a list of (key, value) parameters such as [("order", "asc"), ("sort", "rank")]

token :: Text -> Request RequireToken n r -> Request Ready n r Source #

Convert token requiring Request into ready one

key :: Text -> Request a n r Source #

Request defining only App key

site :: Text -> Request a n r Source #

Request defining only API call site query parameter

filter :: Text -> Request a n r Source #

Request defining only API call filter query parameter

state :: Text -> Request a n r Source #

Request defining only API call state query parameter

data Scope Source #

Scope defines permission granted for application by user

scope :: [Scope] -> Request a n r Source #

Request defining only API call scope query parameter

client :: Int -> Request a n r Source #

Request defining only Authentication API call application id

Primarily used in Authentication API call wrappers, not intended for usage by library user

redirectURI :: Text -> Request a n r Source #

Request defining only Authentication API call redirect url

Primarily used in Authentication API call wrappers, not intended for usage by library user

secret :: Text -> Request a n r Source #

Request defining only Authentication API call application secret

Primarily used in Authentication API call wrappers, not intended for usage by library user

code :: Text -> Request a n r Source #

Request defining only Authentication API call code

Primarily used in Authentication API call wrappers, not intended for usage by library user

Internal wrapping/unwrapping

wrap :: (R a n r -> R a n r) -> Request a n r Source #

Wrapping to interesting Monoid (R -> R) instance

unwrap :: Request a n r -> R a n r -> R a n r Source #

Unwrapping from interesting Monoid (R -> R) instance

Rendering

render :: Request a n r -> String Source #

Render R as URI string for networking