Documentation
¶
Index ¶
- Variables
- type Client
- func (c *Client) AuthTestContext(ctx context.Context) (*slack.AuthTestResponse, error)
- func (c *Client) Edge() *edge.Client
- func (c *Client) GetConversationInfoContext(ctx context.Context, input *slack.GetConversationInfoInput) (*slack.Channel, error)
- func (c *Client) GetConversationsContext(ctx context.Context, params *slack.GetConversationsParameters) ([]slack.Channel, string, error)
- func (c *Client) GetConversationsContextEx(ctx context.Context, params *slack.GetConversationsParameters, onlyMy bool) ([]slack.Channel, string, error)
- func (c *Client) GetUsersInConversationContext(ctx context.Context, params *slack.GetUsersInConversationParameters) ([]string, string, error)
- type Option
- type Pool
- func (p *Pool) AuthTestContext(ctx context.Context) (response *slack.AuthTestResponse, err error)
- func (p *Pool) GetConversationHistoryContext(ctx context.Context, params *slack.GetConversationHistoryParameters) (*slack.GetConversationHistoryResponse, error)
- func (p *Pool) GetConversationInfoContext(ctx context.Context, input *slack.GetConversationInfoInput) (*slack.Channel, error)
- func (p *Pool) GetConversationRepliesContext(ctx context.Context, params *slack.GetConversationRepliesParameters) (msgs []slack.Message, hasMore bool, nextCursor string, err error)
- func (p *Pool) GetConversationsContext(ctx context.Context, params *slack.GetConversationsParameters) (channels []slack.Channel, nextCursor string, err error)
- func (p *Pool) GetEmojiContext(ctx context.Context) (map[string]string, error)
- func (p *Pool) GetFileContext(ctx context.Context, downloadURL string, writer io.Writer) error
- func (p *Pool) GetFileInfoContext(ctx context.Context, fileID string, count int, page int) (*slack.File, []slack.Comment, *slack.Paging, error)
- func (p *Pool) GetStarredContext(ctx context.Context, params slack.StarsParameters) ([]slack.StarredItem, *slack.Paging, error)
- func (p *Pool) GetUserInfoContext(ctx context.Context, user string) (*slack.User, error)
- func (w *Pool) GetUserProfileContext(ctx context.Context, params *slack.GetUserProfileParameters) (*slack.UserProfile, error)
- func (p *Pool) GetUsersContext(ctx context.Context, options ...slack.GetUsersOption) ([]slack.User, error)
- func (p *Pool) GetUsersInConversationContext(ctx context.Context, params *slack.GetUsersInConversationParameters) ([]string, string, error)
- func (p *Pool) GetUsersPaginated(options ...slack.GetUsersOption) slack.UserPagination
- func (p *Pool) ListBookmarks(channelID string) ([]slack.Bookmark, error)
- func (p *Pool) SearchFilesContext(ctx context.Context, query string, params slack.SearchParameters) (*slack.SearchFiles, error)
- func (p *Pool) SearchMessagesContext(ctx context.Context, query string, params slack.SearchParameters) (*slack.SearchMessages, error)
- type Slack
Constants ¶
This section is empty.
Variables ¶
var ErrOpNotSupported = errors.New("client doesn't support this operation")
ErrOpNotSupported is returned by edge-only methods when the Client was not initialised with an edge (enterprise) connection.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
*slack.Client // always set; promotes all Slack API methods
// contains filtered or unexported fields
}
Client wraps *slack.Client and, optionally, *edge.Client. The edge client is only present for enterprise workspaces. All Slack interface methods are promoted from the embedded *slack.Client; edge-aware methods override them when c.edge is set.
func New ¶
New creates a new Client instance. It checks if workspace provider is valid, and checks if it's an enterprise workspace. If it is, it creates an edge client.
func NewEdge ¶
NewEdge returns a new *Client that is guaranteed to have an edge (enterprise) connection. Use c.Edge() to obtain the underlying *edge.Client.
func Wrap ¶
Wrap wraps a *slack.Client and returns a *Client that implements the Slack interface. Intended for testing.
func (*Client) AuthTestContext ¶
AuthTestContext returns the cached workspace information that was captured on initialisation. If the cache is empty it calls the API.
func (*Client) Edge ¶ added in v4.0.2
Edge returns the underlying *edge.Client, or nil when the workspace is not an enterprise workspace.
func (*Client) GetConversationInfoContext ¶ added in v4.1.1
func (c *Client) GetConversationInfoContext(ctx context.Context, input *slack.GetConversationInfoInput) (*slack.Channel, error)
GetConversationInfoContext overrides the standard method with the edge client for enterprise workspaces.
func (*Client) GetConversationsContext ¶ added in v4.1.1
func (c *Client) GetConversationsContext(ctx context.Context, params *slack.GetConversationsParameters) ([]slack.Channel, string, error)
GetConversationsContext overrides the standard method with the edge client for enterprise workspaces.
func (*Client) GetConversationsContextEx ¶ added in v4.1.1
func (c *Client) GetConversationsContextEx(ctx context.Context, params *slack.GetConversationsParameters, onlyMy bool) ([]slack.Channel, string, error)
GetConversationsContextEx is the extended variant that supports the onlyMy parameter available in enterprise workspaces. Returns ErrOpNotSupported when there is no edge client.
func (*Client) GetUsersInConversationContext ¶ added in v4.1.1
func (c *Client) GetUsersInConversationContext(ctx context.Context, params *slack.GetUsersInConversationParameters) ([]string, string, error)
GetUsersInConversationContext overrides the standard method with the edge client for enterprise workspaces.
type Option ¶
type Option func(*options)
func WithEnterprise ¶
WithEnterprise sets the enterprise flag. Setting the flag to true forces the use of the edge client, even if the workspace is not an enterprise workspace.
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
Pool is a pool of Slack clients that can be used to make API calls. Zero value is not usable, must be initialised with NewPool.
IMPORTANT: Every method on the Slack interface must be delegated here. When new methods are added to Slack, add the corresponding delegation below. A compile-time assertion below catches interface drift.
func NewPool ¶
NewPool wraps the slack.Client with the edge client, so that the edge client can be used as a fallback.
func (*Pool) AuthTestContext ¶
func (*Pool) GetConversationHistoryContext ¶
func (p *Pool) GetConversationHistoryContext(ctx context.Context, params *slack.GetConversationHistoryParameters) (*slack.GetConversationHistoryResponse, error)
func (*Pool) GetConversationInfoContext ¶
func (*Pool) GetConversationRepliesContext ¶
func (*Pool) GetConversationsContext ¶
func (*Pool) GetEmojiContext ¶
func (*Pool) GetFileContext ¶
func (*Pool) GetFileInfoContext ¶
func (*Pool) GetStarredContext ¶
func (p *Pool) GetStarredContext(ctx context.Context, params slack.StarsParameters) ([]slack.StarredItem, *slack.Paging, error)
func (*Pool) GetUserInfoContext ¶
func (*Pool) GetUserProfileContext ¶
func (w *Pool) GetUserProfileContext(ctx context.Context, params *slack.GetUserProfileParameters) (*slack.UserProfile, error)
func (*Pool) GetUsersContext ¶
func (*Pool) GetUsersInConversationContext ¶
func (*Pool) GetUsersPaginated ¶
func (p *Pool) GetUsersPaginated(options ...slack.GetUsersOption) slack.UserPagination
func (*Pool) ListBookmarks ¶
func (*Pool) SearchFilesContext ¶
func (p *Pool) SearchFilesContext(ctx context.Context, query string, params slack.SearchParameters) (*slack.SearchFiles, error)
func (*Pool) SearchMessagesContext ¶
func (p *Pool) SearchMessagesContext(ctx context.Context, query string, params slack.SearchParameters) (*slack.SearchMessages, error)
type Slack ¶
type Slack interface {
AuthTestContext(ctx context.Context) (response *slack.AuthTestResponse, err error)
GetConversationHistoryContext(ctx context.Context, params *slack.GetConversationHistoryParameters) (*slack.GetConversationHistoryResponse, error)
GetConversationInfoContext(ctx context.Context, input *slack.GetConversationInfoInput) (*slack.Channel, error)
GetConversationRepliesContext(ctx context.Context, params *slack.GetConversationRepliesParameters) (msgs []slack.Message, hasMore bool, nextCursor string, err error)
GetConversationsContext(ctx context.Context, params *slack.GetConversationsParameters) (channels []slack.Channel, nextCursor string, err error)
GetEmojiContext(ctx context.Context) (map[string]string, error)
GetFileContext(ctx context.Context, downloadURL string, writer io.Writer) error
GetFileInfoContext(ctx context.Context, fileID string, count int, page int) (*slack.File, []slack.Comment, *slack.Paging, error)
GetStarredContext(ctx context.Context, params slack.StarsParameters) ([]slack.StarredItem, *slack.Paging, error)
GetUserInfoContext(ctx context.Context, user string) (*slack.User, error)
GetUsersContext(ctx context.Context, options ...slack.GetUsersOption) ([]slack.User, error)
GetUsersInConversationContext(ctx context.Context, params *slack.GetUsersInConversationParameters) ([]string, string, error)
GetUsersPaginated(options ...slack.GetUsersOption) slack.UserPagination
ListBookmarks(channelID string) ([]slack.Bookmark, error)
SearchFilesContext(ctx context.Context, query string, params slack.SearchParameters) (*slack.SearchFiles, error)
SearchMessagesContext(ctx context.Context, query string, params slack.SearchParameters) (*slack.SearchMessages, error)
GetUserProfileContext(ctx context.Context, params *slack.GetUserProfileParameters) (*slack.UserProfile, error)
}
Slack is an interface that defines the methods that a Slack client should provide.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package mock_client is a generated GoMock package.
|
Package mock_client is a generated GoMock package. |