pokitdok-4.1.0.2: PokitDok Platform API Client for Haskell

Safe HaskellNone
LanguageHaskell98

PokitDok.OAuth2

Description

This module provides the core functionality that connects to the specified API and performs generic GET, POST, PUT, and DELETE requests.

Powered by the Network.HTTP.Conduit (http-conduit) package.

Synopsis

Documentation

data AccessToken Source

OAuth access token.

Constructors

AccessToken 

Fields

accessToken :: String
 
refreshToken :: Maybe String
 
expires :: Maybe Int

measured in POSIX seconds.

expiresIn :: Maybe Int
 
token_type :: Maybe String
 

data ResponseData Source

Stores http response headers, body and status code.

Constructors

ResponseData 

Fields

headers :: Headers
 
body :: String
 
status :: Int
 

Instances

keyModAccessToken :: OAuth2 -> Maybe AccessToken -> OAuth2 Source

Modifies the given key's AccessToken with the given Maybe AccessToken's value.

authenticateClientCredentials :: Headers -> OAuth2 -> IO AccessToken Source

Returns a valid AccessCode given some headers and an OAuth2.

authenticateAuthorizationCode :: Headers -> OAuth2 -> String -> IO AccessToken Source

Returns an AccessToken given some headers, an OAuth2, and an authorization code.

authenticateRefreshToken :: Headers -> OAuth2 -> IO AccessToken Source

Takes OAuth2 data and returns a refreshed AccessToken.

getRequest :: Headers -> String -> Parameters -> IO ResponseData Source

Perform a GET request given request headers, a url, and query parameters.

deleteRequest :: Headers -> String -> IO ResponseData Source

Perform a DELETE request, given some headers, for the given resource.

postRequest :: Headers -> String -> String -> IO ResponseData Source

Perform a POST request given request headers, a url, and request body.

multipartRequest Source

Arguments

:: Headers

Some headers, must include authorization.

-> String

Request URL.

-> Parameters

Multipart parameters.

-> String

Post file path.

-> String

The boundary for each of the headers.

-> IO ResponseData 

Performs a multipart request file upload with the given parameters.

putRequest :: Headers -> String -> String -> IO ResponseData Source

Perform a PUT request given request headers, a url, and a request body.

makeUserAgentHeader :: String -> (String, String) Source

Returns a user agent tuple with the specified user agent.

makeContentHeader :: String -> (String, String) Source

Returns a content type tuple with the specified content type.

makeAuthHeader :: String -> (String, String) Source

Returns an authorization tuple with the specified authorization string.

appendParams :: String -> Parameters -> String Source

Takes a url and appends the parameters to form a query url.