slack-web-1.5.0.0: Bindings for the Slack web API
Safe HaskellSafe-Inferred
LanguageHaskell2010

Web.Slack.Classy

Description

 
Synopsis

Documentation

data SlackConfig Source #

Instances

Instances details
HasManager SlackConfig Source # 
Instance details

Defined in Web.Slack.Classy

HasToken SlackConfig Source # 
Instance details

Defined in Web.Slack.Classy

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.

authTest :: (MonadReader env m, HasManager env, HasToken env, MonadIO m) => m (Response TestRsp) Source #

Check authentication and identity.

https://api.slack.com/methods/auth.test

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.

https://api.slack.com/methods/conversations.history

conversationsHistoryAll Source #

Arguments

:: (MonadReader env m, HasManager env, HasToken env, MonadIO m) 
=> HistoryReq

The first request to send. _NOTE_: historyReqCursor is silently ignored.

-> 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.

https://api.slack.com/methods/conversations.replies

repliesFetchAll Source #

Arguments

:: (MonadReader env m, HasManager env, HasToken env, MonadIO m) 
=> RepliesReq

The first request to send. _NOTE_: repliesReqCursor is silently ignored.

-> 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.

getUserDesc Source #

Arguments

:: (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 usersList.

-> UserId -> Text

A function from UserId to username.

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) => m (Response ListRsp) Source #

This method returns a list of all users in the team. This includes deleted/deactivated users.

https://api.slack.com/methods/users.list

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.

https://api.slack.com/methods/users.lookupByEmail

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

Methods

getManager :: a -> Manager Source #

Instances

Instances details
HasManager SlackConfig Source # 
Instance details

Defined in Web.Slack.Classy

class HasToken a where Source #

Implemented by SlackConfig

Methods

getToken :: a -> Text Source #

Instances

Instances details
HasToken SlackConfig Source # 
Instance details

Defined in Web.Slack.Classy