Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data GithubRequest k a where
- GithubGet :: FromJSON a => Paths -> QueryString -> GithubRequest k a
- GithubPagedGet :: FromJSON (Vector a) => Paths -> QueryString -> Maybe Count -> GithubRequest k (Vector a)
- GithubPost :: FromJSON a => PostMethod -> Paths -> ByteString -> GithubRequest True a
- GithubDelete :: Paths -> GithubRequest True ()
- GithubStatus :: GithubRequest k () -> GithubRequest k Status
- data PostMethod
- toMethod :: PostMethod -> Method
- type Paths = [String]
- type QueryString = [(ByteString, Maybe ByteString)]
- executeRequest :: Show a => GithubAuth -> GithubRequest k a -> IO (Either Error a)
- executeRequestWithMgr :: Show a => Manager -> GithubAuth -> GithubRequest k a -> IO (Either Error a)
- executeRequest' :: Show a => GithubRequest False a -> IO (Either Error a)
- executeRequestWithMgr' :: Show a => Manager -> GithubRequest False a -> IO (Either Error a)
- executeRequestMaybe :: Show a => Maybe GithubAuth -> GithubRequest False a -> IO (Either Error a)
- unsafeDropAuthRequirements :: GithubRequest True a -> GithubRequest k a
- makeHttpRequest :: MonadThrow m => Maybe GithubAuth -> GithubRequest k a -> m Request
- parseResponse :: (FromJSON a, MonadError Error m) => Response ByteString -> m a
- getNextUrl :: Response a -> Maybe URI
Types
data GithubRequest k a where Source
Github request data type.
k
describes whether authentication is required. It's required for non-GET
requests.a
is the result type
Note: GithubRequest
is not Functor
on purpose.
TODO: Add constructor for collection fetches.
GithubGet :: FromJSON a => Paths -> QueryString -> GithubRequest k a | |
GithubPagedGet :: FromJSON (Vector a) => Paths -> QueryString -> Maybe Count -> GithubRequest k (Vector a) | |
GithubPost :: FromJSON a => PostMethod -> Paths -> ByteString -> GithubRequest True a | |
GithubDelete :: Paths -> GithubRequest True () | |
GithubStatus :: GithubRequest k () -> GithubRequest k Status |
Eq (GithubRequest k a) Source | |
Show (GithubRequest k a) Source |
data PostMethod Source
Http method of requests with body.
toMethod :: PostMethod -> Method Source
type QueryString = [(ByteString, Maybe ByteString)] Source
Request execution in IO
executeRequest :: Show a => GithubAuth -> GithubRequest k a -> IO (Either Error a) Source
Execute GithubRequest
in IO
executeRequestWithMgr :: Show a => Manager -> GithubAuth -> GithubRequest k a -> IO (Either Error a) Source
Like executeRequest
but with provided Manager
.
executeRequest' :: Show a => GithubRequest False a -> IO (Either Error a) Source
Like executeRequest
but without authentication.
executeRequestWithMgr' :: Show a => Manager -> GithubRequest False a -> IO (Either Error a) Source
Like executeRequestWithMgr
but without authentication.
executeRequestMaybe :: Show a => Maybe GithubAuth -> GithubRequest False a -> IO (Either Error a) Source
Helper for picking between executeRequest
and executeRequest'
.
The use is discouraged.
unsafeDropAuthRequirements :: GithubRequest True a -> GithubRequest k a Source
Partial function to drop authentication need.
Tools
makeHttpRequest :: MonadThrow m => Maybe GithubAuth -> GithubRequest k a -> m Request Source
parseResponse :: (FromJSON a, MonadError Error m) => Response ByteString -> m a Source
getNextUrl :: Response a -> Maybe URI Source
Get Link rel=next from request headers.