packages feed

pokitdok-4.1.0.0: PokitDok.hs

-----------------------------------------------------------------------------
-- |
-- Module      :  PokitDok
-- Version     :  PokitDok Platform API v4
-- Copyright   :  (c) PokitDok Inc., 2011-2015
-- License     :  see LICENSE.txt
-- 
-- Maintainer  :  gage.swenson@pokitdok.com
-- Stability   :  internal
-- Portability :  non-portable
--
-- Exports every call in the
-- PokitDok.Client module.
--
-----------------------------------------------------------------------------

--   The PokitDok module enables a Haskell programmer to make PokitDok API
--   calls from within the Haskell platform. The usage principles are concise
--   and easy to implement.
--
--   1. A client creates an @'OAuth2'@ by calling @'keyWithIdSecret'@,
--      given their API secret key and credentials. This datum stores an id,
--      secret, callback url, and access token, along with the lesser meddled
--      with authorize endpoint and access token endpoint.
--
--   2. A client refreshes their OAuth's access token by calling @'refresh'@
--      With an id and secret, one can fetch access token data from the API.
--      To call the API, a fresh (not expired) access token is required.
--      @'keyModCallback'@, @'authorizationUrl'@, and @'authenticateCode'@
--      are helpful for developers working with PokitDok accounts in context.
--
--   3. Make API calls with the refreshed OAuth2. Most tokens last for 3600
--      seconds. It is safe to call refresh before every API call because a
--      token will only refresh if it is expired. If you authenticated with
--      a code and have a refresh token, it is more safe to store the result
--      of every @'refresh'@ so that you use the latest issued token.
--      
--   
--   Sample usage:
-- >
-- > -- Each call returns an IO String.
-- > -- Each string contains a json object
-- >
-- > import PokitDok
-- > 
-- > main :: IO ()
-- > main = do
-- >     -- id and secret credentials to access the API
-- >     putStrLn "Enter your PokitDok API ID:"
-- >     id     <- getLine
-- >     putStrLn "Enter your secret key:"
-- >     secret <- getLine
-- >     pd <- refresh $ keyWithIdSecet id secret
-- >
-- >     -- retrieve provider information by NPI
-- >     providersWithNpi pd "1467560003" >>= putStrLn
-- >     
-- >     -- retrieve cash price information by zip and CPT code
-- >     cashPriceJson <- pricesCash pd [("zip_code","85255"),("cpt_code","87799")]
-- >     putStrLn cashPriceJson
-- >
-- >     -- a sample usage of readFile with an API call
-- >     readFile "postdata.json" >>= claims pd
-- >
-- >     -- an example of a non persistent refresh with an API call
-- >     refresh pd >>= (flip activitiesWithId) "5362b5a064da150ef6f2526c"
-- >
-- >     -- an example of a persistent refresh
-- >     pd1 <- refresh pd
-- >     return ()
--

module PokitDok
    ( module PokitDok.Client
    ) where
import PokitDok.Client