api-builder alternatives and similar packages
Based on the "Network" category.
Alternatively, view api-builder alternatives based on common mentions on social networks and blogs.
-
pusher-http-haskell
Haskell client library for the Pusher HTTP API
Get performance insights in less than 4 minutes
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest. Visit our partner's website for more details.
Do you think we are missing an alternative of api-builder or a related project?
Popular Comparisons
README
api-builder 
Simple library for building API wrappers in Haskell – define a Builder
, add some types with Receivable
instances, an error type, and some routes, and you can easily use any API from Haskell code. Based on a EitherT StateT StateT
monad transformer stack.
Stack Overflow example
Define a type for a stack overflow question:
data Question = Question { title :: Text
, isAnswered :: Bool
, score :: Int
, tags :: [Text] }
deriving (Show, Eq)
And a wrapper since SO wraps its JSON responses:
newtype Questions = Questions [Question]
deriving (Show, Eq)
Add FromJSON
instances for both the types:
instance FromJSON Question where
parseJSON (Object o) =
Question <$> o .: "title"
<*> o .: "is_answered"
<*> o .: "score"
<*> o .: "tags"
parseJSON _ = mempty
instance FromJSON Questions where
parseJSON (Object o) = Questions <$> o .: "items"
parseJSON _ = mempty
and a Receivable
instance for Questions
that just uses the FromJSON
instance:
instance Receivable Questions where
receive = useFromJSON
Define a Builder
for the API endpoint:
stackOverflow :: Builder
stackOverflow = basicBuilder "StackOverflow API" "http://api.stackexchange.com"
And the Route
to use to get the data:
answersRoute :: Route
answersRoute = Route { urlPieces = [ "2.2", "questions" ]
, urlParams = [ "order" =. Just "desc"
, "sort" =. Just "activity"
, "site" =. Just "stackoverflow" ]
, httpMethod = GET }
And a function to actually run the API:
getAnswers :: IO (Either (APIError ()) Questions)
getAnswers = execAPI stackOverflow () $ runRoute answersRoute
> getAnswers
Right (Questions [Question {title = "Using parse API with codeigniter", isAnswered = True, score = 2, tags = ["php","codeigniter","parse.com","codeigniter-2","php-5.6"]},Question {title = "Object...