Safe Haskell | None |
---|
Helper functions for accessing Google APIs.
- type AccessToken = ByteString
- toAccessToken :: String -> AccessToken
- type ProjectId = String
- appendBody :: ByteString -> Request m -> Request m
- appendHeaders :: [(String, String)] -> Request m -> Request m
- appendQuery :: [(String, String)] -> Request m -> Request m
- doManagedRequest :: DoRequest a => Manager -> Request (ResourceT IO) -> IO a
- doRequest :: DoRequest a => Request (ResourceT IO) -> IO a
- makeHeaderName :: String -> CI ByteString
- makeProjectRequest :: ProjectId -> AccessToken -> (String, String) -> String -> (String, String) -> Request m
- makeRequest :: AccessToken -> (String, String) -> String -> (String, String) -> Request m
- makeRequestValue :: String -> ByteString
Types
type AccessToken = ByteStringSource
OAuth 2.0 access token.
:: String | The string. |
-> AccessToken | The OAuth 2.0 access token. |
Convert a string to an access token.
Google API project ID, see https://code.google.com/apis/console.
Functions
:: ByteString | The data for the body. |
-> Request m | The request. |
-> Request m | The request with the body appended. |
Append a body to a request.
:: [(String, String)] | The (name/key, value) pairs for the headers. |
-> Request m | The request. |
-> Request m | The request with the additional headers. |
Append headers to a request.
:: [(String, String)] | The query keys and values. |
-> Request m | The request. |
-> Request m | The request with the query appended. |
Append a query to a request.
:: DoRequest a | |
=> Request (ResourceT IO) | The request. |
-> IO a | The action returning the result of performing the request. |
Perform a request.
:: String | The name. |
-> CI ByteString | The prepared name. TODO: In principle, we should UTF-8 encode the bytestrings packed below. |
Prepare a name/key for a header.
:: ProjectId | The project ID. |
-> AccessToken | The OAuth 2.0 access token. |
-> (String, String) | The Google API name and version. |
-> String | The HTTP method. |
-> (String, String) | The host and path for the request. |
-> Request m | The HTTP request. |
Construct a project-related Google API request.
:: AccessToken | The OAuth 2.0 access token. |
-> (String, String) | The Google API name and version. |
-> String | The HTTP method. |
-> (String, String) | The host and path for the request. |
-> Request m | The HTTP request. |
Construct a Google API request.
:: String | The string. |
-> ByteString | The prepared string. TODO: In principle, we should UTF-8 encode the bytestrings packed below. |
Prepare a string for inclusion in a request.