pokitdok-4.1.0.2: PokitDok Platform API Client for Haskell

Safe HaskellNone
LanguageHaskell98

PokitDok.Requests

Description

This module bridges the minimal calls in the Client module, adds specific headers required by the API, and passes them to the more generic calls of the OAuth2 module.

It also includes auxiliary funtions for handling its main return type: ResponseData.

Synopsis

Documentation

pokitdokGetRequest Source

Arguments

:: OAuth2

An OAuth2 credential.

-> String

The request url path.

-> Parameters

The query parameters.

-> IO ResponseData

The response from the server.

Sends a GET request to the server with the given query parameters.

pokitdokDeleteRequest Source

Arguments

:: OAuth2

A credential.

-> String

The request url path.

-> IO ResponseData

Response from the server.

Sends a DELETE request to the server with the given query parameters.

pokitdokPostRequest Source

Arguments

:: OAuth2

Credentials.

-> String

The request url path.

-> String

JSON object String.

-> IO ResponseData

Response from the server.

Sends a POST request to the server and posts the json string.

pokitdokPutRequest Source

Arguments

:: OAuth2

Credentials.

-> String

The request url path.

-> String

A JSON object String.

-> IO ResponseData

Response from the server.

Sends a PUT request with JSON data.

pokitdokMultipartRequest Source

Arguments

:: OAuth2

Credentials.

-> String

The request url path.

-> Parameters

Post data.

-> String

File system path of file to be posted.

-> IO ResponseData

Response from the server.

A multipart request that uploads a file.

activateKeyWithAuthCode :: OAuth2 -> String -> IO OAuth2 Source

Takes an OAuth2 & an authorization code, and returns an OAuth2 with a refreshed AccessToken.

refreshExpired :: OAuth2 -> Bool -> IO OAuth2 Source

Refreshes an OAuth2's token given whether or not it is expired.

isExpired' :: AccessToken -> IO Bool Source

Checks if the given AccessToken is expired.

assertValid :: OAuth2 -> IO () Source

Asserts that the given OAuth2 is valid to make a call.

getJSONIO :: ResponseData -> IO String Source

Pulls the JSON response String from a ResponseDatum, and lifts the result to an IO monad.