Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data SlackConfig = SlackConfig {}
- mkSlackConfig :: Text -> IO SlackConfig
- apiTest :: (MonadReader env m, HasManager env, MonadIO m) => TestReq -> m (Response TestRsp)
- authTest :: (MonadReader env m, HasManager env, HasToken env, MonadIO m) => m (Response TestRsp)
- chatPostMessage :: (MonadReader env m, HasManager env, HasToken env, MonadIO m) => PostMsgReq -> m (Response PostMsgRsp)
- conversationsList :: (MonadReader env m, HasManager env, HasToken env, MonadIO m) => ListReq -> m (Response ListRsp)
- conversationsHistory :: (MonadReader env m, HasManager env, HasToken env, MonadIO m) => HistoryReq -> m (Response HistoryRsp)
- conversationsHistoryAll :: (MonadReader env m, HasManager env, HasToken env, MonadIO m) => HistoryReq -> m (LoadPage m Message)
- conversationsReplies :: (MonadReader env m, HasManager env, HasToken env, MonadIO m) => RepliesReq -> m (Response HistoryRsp)
- repliesFetchAll :: (MonadReader env m, HasManager env, HasToken env, MonadIO m) => RepliesReq -> m (LoadPage m Message)
- getUserDesc :: (UserId -> Text) -> ListRsp -> UserId -> Text
- usersList :: (MonadReader env m, HasManager env, HasToken env, MonadIO m) => ListReq -> m (Response ListRsp)
- userLookupByEmail :: (MonadReader env m, HasManager env, HasToken env, MonadIO m) => Email -> m (Response UserRsp)
- authenticateReq :: Text -> Request -> Request
- type Response a = Either SlackClientError a
- type LoadPage m a = m (Response [a])
- class HasManager a where
- getManager :: a -> Manager
- class HasToken a where
Documentation
data SlackConfig Source #
Instances
HasManager SlackConfig Source # | |
Defined in Web.Slack.Classy getManager :: SlackConfig -> Manager Source # | |
HasToken SlackConfig Source # | |
Defined in Web.Slack.Classy getToken :: SlackConfig -> Text Source # |
mkSlackConfig :: Text -> IO SlackConfig Source #
Prepare a SlackConfig from a slack token. You can then call the other functions providing this in a reader context.
apiTest :: (MonadReader env m, HasManager env, MonadIO m) => TestReq -> m (Response TestRsp) Source #
Check API calling code.
authTest :: (MonadReader env m, HasManager env, HasToken env, MonadIO m) => m (Response TestRsp) Source #
Check authentication and identity.
chatPostMessage :: (MonadReader env m, HasManager env, HasToken env, MonadIO m) => PostMsgReq -> m (Response PostMsgRsp) Source #
Send a message to a channel.
conversationsList :: (MonadReader env m, HasManager env, HasToken env, MonadIO m) => ListReq -> m (Response ListRsp) Source #
Retrieve conversations list.
conversationsHistory :: (MonadReader env m, HasManager env, HasToken env, MonadIO m) => HistoryReq -> m (Response HistoryRsp) Source #
Retrieve ceonversation history.
Consider using historyFetchAll
in combination with this function.
conversationsHistoryAll Source #
:: (MonadReader env m, HasManager env, HasToken env, MonadIO m) | |
=> HistoryReq | The first request to send. _NOTE_: |
-> m (LoadPage m Message) | An action which returns a new page of messages every time called. If there are no pages anymore, it returns an empty list. |
Returns an action to send a request to get the history of a conversation.
To fetch all messages in the conversation, run the returned LoadPage
action
repeatedly until it returns an empty list.
conversationsReplies :: (MonadReader env m, HasManager env, HasToken env, MonadIO m) => RepliesReq -> m (Response HistoryRsp) Source #
Retrieve replies of a conversation.
Consider using repliesFetchAll
if you want to get entire replies
of a conversation.
:: (MonadReader env m, HasManager env, HasToken env, MonadIO m) | |
=> RepliesReq | The first request to send. _NOTE_: |
-> m (LoadPage m Message) | An action which returns a new page of messages every time called. If there are no pages anymore, it returns an empty list. |
Returns an action to send a request to get the replies of a conversation.
To fetch all replies in the conversation, run the returned LoadPage
action
repeatedly until it returns an empty list.
- NOTE*: The conversations.replies endpoint always returns the first message
of the thread. So every page returned by the
LoadPage
action includes the first message of the thread. You should drop it if you want to collect messages in a thread without duplicates.
:: (UserId -> Text) | A function to give a default username in case the username is unknown |
-> ListRsp | List of users as known by the slack server. See |
-> UserId -> Text | A function from |
Returns a function to get a username from a UserId
.
Comes in handy to use messageToHtml
usersList :: (MonadReader env m, HasManager env, HasToken env, MonadIO m) => ListReq -> m (Response ListRsp) Source #
This method returns a list of all users in the team. This includes deleted/deactivated users.
userLookupByEmail :: (MonadReader env m, HasManager env, HasToken env, MonadIO m) => Email -> m (Response UserRsp) Source #
This method returns a list of all users in the team. This includes deleted/deactivated users.
type Response a = Either SlackClientError a Source #
type LoadPage m a = m (Response [a]) Source #
Represents an action which returns a paginated response from Slack. Every time calling the action, it performs a request with a new cursor to get the next page. If there is no more response, the action returns an empty list.
class HasManager a where Source #
Implemented by SlackConfig
getManager :: a -> Manager Source #
Instances
HasManager SlackConfig Source # | |
Defined in Web.Slack.Classy getManager :: SlackConfig -> Manager Source # |
class HasToken a where Source #
Implemented by SlackConfig
Instances
HasToken SlackConfig Source # | |
Defined in Web.Slack.Classy getToken :: SlackConfig -> Text Source # |