Copyright | Copyright (c) 2015, Michael Alan Dorman |
---|---|
License | MIT |
Maintainer | mdorman@jaunder.io |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
This module is intended to be import qualified
. No attempt has been made to keep names of types or functions from clashing with obvious or otherwise commonly-used names, or even other modules within this package.
The functions here are derived from (and presented in the same order as) the Server Configuration API documentation. For each function, we attempt to link back to the original documentation, as well as make a notation as to how complete and correct we feel our implementation is.
Each function takes a Context
as its final parameter, and returns a Result
.
- server :: (FromJSON a, MonadIO m) => Context -> m (Result a)
- section :: (FromJSON a, MonadIO m) => DocId -> Context -> m (Result a)
- getValue :: (FromJSON a, MonadIO m) => DocId -> DocId -> Context -> m (Result a)
- setValue :: (ToJSON a, FromJSON b, MonadIO m) => DocId -> DocId -> a -> Context -> m (Result b)
- delValue :: (FromJSON a, MonadIO m) => DocId -> DocId -> Context -> m (Result a)
- configPath :: RequestBuilder ()
- sectionPath :: DocId -> RequestBuilder ()
- itemPath :: DocId -> DocId -> RequestBuilder ()
Documentation
server :: (FromJSON a, MonadIO m) => Context -> m (Result a) Source
Get the overall server configuration
The return value is an object whose fields often vary, so it is most easily decoded as a Value
:
>>>
value :: Result Value <- Configuration.server ctx
Status: Complete
Get the configuration for one section
The return value is an object whose fields often vary, so it is most easily decoded as a Value
:
>>>
value :: Result Value <- Configuration.section "auth" ctx
Status: Complete
Get the configuration for one item
The return value is a JSON Value whose fields often vary, so it is most easily decoded as a Value
:
>>>
value :: Result Value <- Configuration.getValue "auth" "ssl" ctx
Status: Complete
:: (ToJSON a, FromJSON b, MonadIO m) | |
=> DocId | Section name |
-> DocId | Key name |
-> a | Value |
-> Context | |
-> m (Result b) |
Set the configuration value for one item
The value to set must be something that can be translated to JSON.
The return value is a JSON Value whose fields often vary, so it is most easily decoded as a Value
:
>>>
value :: Result Value <- Configuration.setValue "auth" "ssl" Bool ctx
Status: Complete
Remove the configuration value for one item
Returns the previous JSON Value.
The return value is a JSON Value whose fields often vary, so it is most easily decoded as a Value
:
>>>
value :: Result Value <- Configuration.delValue "auth" "ssl" ctx
Status: Complete
Internal combinators
configPath :: RequestBuilder () Source
Base path for all config requests
:: DocId | Section name |
-> DocId | Key name |
-> RequestBuilder () |
Base path for all item requests