approveapi: ApproveAPI Haskell Client

[ api, client, library, mit ] [ Propose Tags ] [ Report a vulnerability ]

Haskell client for the ApproveAPI HTTP API ApproveAPI is a simple API to request a user's real-time approval on anything via email, sms + mobile push. category: Web


[Skip to Readme]

Modules

  • ApproveApi
    • ApproveApi.API
      • ApproveApi.API.Approve
    • ApproveApi.Client
    • ApproveApi.Core
    • ApproveApi.Logging
    • ApproveApi.MimeTypes
    • ApproveApi.Model
    • ApproveApi.ModelLens

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.1.0.0, 0.1.3.0
Dependencies aeson (>=1.0 && <2.0), base (>=4.7 && <5.0), base64-bytestring (>1.0 && <2.0), bytestring (>=0.10.0 && <0.11), case-insensitive (>=1.2.0 && <1.3), containers (>=0.5.0.0 && <0.6), deepseq (>=1.4 && <1.6), exceptions (>=0.10.0 && <0.11), http-api-data (>=0.3.4 && <0.4), http-client (>=0.5 && <0.6), http-client-tls (>=0.3.5 && <0.4), http-media (>=0.4 && <0.8), http-types (>=0.8 && <0.13), iso8601-time (>=0.1.3 && <0.2.0), katip (>=0.4 && <0.9), microlens (>=0.4.3 && <0.5), mtl (>=2.2.2 && <2.3), network (>=2.6.2 && <2.8), random (>=1.1 && <1.2), safe-exceptions (<0.2), text (>=0.11 && <1.3), time (>=1.5 && <1.10), transformers (>=0.4.0.0 && <0.6), unordered-containers (>=0.2.9 && <0.3), vector (>=0.10.9 && <0.13) [details]
License MIT
Copyright 2019 - ApproveAPI
Author Kevin King
Maintainer dev@approveapi.com
Category API, Client
Home page https://approveapi.com
Uploaded by kcking at 2019-04-01T23:25:52Z
Distributions
Downloads 1089 total (11 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
All reported builds failed as of 2019-04-02 [all 3 reports]

Readme for approveapi-0.1.3.0

[back to package description]

approveapi-haskell

Haskell API bindings for the ApproveAPI HTTP API.

ApproveAPI is a simple API to request a user's real-time approval on anything via email, sms + mobile push.

Getting Started

To get started, we create a config:

import qualified ApproveApi as A
...
config <- (`A.addAuthMethod` A.AuthBasicApiKey "sk_test_yourapikeyhere" "")
          <$> A.newConfig 

Now we can make API calls. For example, let's send an approval prompt to confirm a financial transaction.

import qualified Network.HTTP.Client.TLS as NH
...
let body = "Your AcmeBank credit card was just charged $3249.99 at APPLE STORE,\
\ San Francisco. Authorize this transaction?"
let prompt = (A.mkCreatePromptRequest "alice@approveapi.com" body) {
                A.createPromptRequestLongPoll = Just True,
		            A.createPromptRequestApproveText = Just "Authorize",
		            A.createPromptRequestRejectText = Just "Reject"
              }
let createPromptRequest = A.createPrompt prompt

mgr <- NH.newTlsManager
createPromptResponse <- A.dispatchMime mgr config createPromptRequest

flip mapM_ createPromptResponse (\r ->
  case A.promptAnswer r of 
    Nothing -> putStrLn $ "No response yet"
    Just answer -> case A.promptAnswerResult answer of
      True -> putStrLn $ "Request approved"
      False -> putStrLn $ "Request rejected"
  )

Documentation

Full documentation is available here: approveapi.com/docs.