Documentation ¶
Index ¶
- type Option
- type Result
- type ResultType
- type Slacker
- type Stream
- func (cs *Stream) Conversations(ctx context.Context, proc processor.Conversations, ...) error
- func (cs *Stream) ConversationsCB(ctx context.Context, proc processor.Conversations, ...) error
- func (cs *Stream) ListChannels(ctx context.Context, proc processor.Channels, ...) error
- func (s *Stream) Search(ctx context.Context, proc processor.Searcher, query string) error
- func (cs *Stream) SearchFiles(ctx context.Context, proc processor.FileSearcher, query string) error
- func (cs *Stream) SearchMessages(ctx context.Context, proc processor.MessageSearcher, query string) error
- func (cs *Stream) SyncConversations(ctx context.Context, proc processor.Conversations, ...) error
- func (cs *Stream) Users(ctx context.Context, proc processor.Users, opt ...slack.GetUsersOption) error
- func (cs *Stream) WorkspaceInfo(ctx context.Context, proc processor.WorkspaceInfo) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*Stream)
Option functions are used to configure the stream.
func OptFastSearch ¶
func OptFastSearch() Option
func OptResultFn ¶
OptResultFn sets the callback function that is called for each result.
type Result ¶
type Result struct { Type ResultType ChannelID string ThreadTS string ThreadCount int IsLast bool // true if this is the last message for the channel or thread // Count contains the count of entities in the result. Right now it's // populated only for search results. Count int // Err contains the error if the result is an error. Err error }
Result is sent to the callback function for each channel or thread.
type ResultType ¶
type ResultType int8
ResultType helps to identify the type of the result, so that the callback function can handle it appropriately.
const ( RTMain ResultType = iota // Main function result RTChannel // Result containing channel information RTThread // Result containing thread information RTChannelInfo RTChannelUsers RTSearch )
func (ResultType) String ¶
func (i ResultType) String() string
type Slacker ¶
type Slacker interface { AuthTestContext(context.Context) (response *slack.AuthTestResponse, err error) GetConversationHistoryContext(ctx context.Context, params *slack.GetConversationHistoryParameters) (*slack.GetConversationHistoryResponse, error) GetConversationRepliesContext(ctx context.Context, params *slack.GetConversationRepliesParameters) (msgs []slack.Message, hasMore bool, nextCursor string, err error) GetUsersPaginated(options ...slack.GetUsersOption) slack.UserPagination GetStarredContext(ctx context.Context, params slack.StarsParameters) ([]slack.StarredItem, *slack.Paging, error) ListBookmarks(channelID string) ([]slack.Bookmark, error) GetConversationsContext(ctx context.Context, params *slack.GetConversationsParameters) (channels []slack.Channel, nextCursor string, err error) GetConversationInfoContext(ctx context.Context, input *slack.GetConversationInfoInput) (*slack.Channel, error) GetUsersInConversationContext(ctx context.Context, params *slack.GetUsersInConversationParameters) ([]string, string, error) SearchMessagesContext(ctx context.Context, query string, params slack.SearchParameters) (*slack.SearchMessages, error) SearchFilesContext(ctx context.Context, query string, params slack.SearchParameters) (*slack.SearchFiles, error) }
Slacker is the interface with some functions of slack.Client.
type Stream ¶
type Stream struct {
// contains filtered or unexported fields
}
Stream is used to fetch conversations from Slack. It is safe for concurrent use.
func (*Stream) Conversations ¶
func (cs *Stream) Conversations(ctx context.Context, proc processor.Conversations, items <-chan structures.EntityItem) error
Conversations fetches the conversations from the links channel. The link sent on that channel can be a channelID, channel URL, thread URL or a link in Slackdump format. fn is called for each result (channel messages, or thread messages). The fact that fn was called for channel messages, does not mean that all threads for that channel were already processed. Each last thread result is marked with StreamResult.IsLast. The caller must track the number of threads processed for each channel, and when the thread result with IsLast is received, the caller can assume that all threads and messages for that channel have been processed. For example, see cmd/slackdump/internal/export/expproc.
func (*Stream) ConversationsCB ¶
func (cs *Stream) ConversationsCB(ctx context.Context, proc processor.Conversations, items []structures.EntityItem, cb func(Result) error) error
func (*Stream) ListChannels ¶
func (cs *Stream) ListChannels(ctx context.Context, proc processor.Channels, p *slack.GetConversationsParameters) error
TODO: test this.
func (*Stream) SearchFiles ¶
SearchFiles executes the search query and calls the processor for each returned slice of files. Channels do not have the file information.
func (*Stream) SearchMessages ¶
func (cs *Stream) SearchMessages(ctx context.Context, proc processor.MessageSearcher, query string) error
SearchMessages executes the search query and calls the processor for each message results, it will also collect information about the channels. Message search results do not have files attached, so do not expect Files method to be called.
func (*Stream) SyncConversations ¶
func (cs *Stream) SyncConversations(ctx context.Context, proc processor.Conversations, items ...structures.EntityItem) error
SyncConversations fetches the conversations from the link which can be a channelID, channel URL, thread URL or a link in Slackdump format.
func (*Stream) Users ¶
func (cs *Stream) Users(ctx context.Context, proc processor.Users, opt ...slack.GetUsersOption) error
Users returns all users in the workspace.
func (*Stream) WorkspaceInfo ¶
WorkspaceInfo fetches the workspace info and passes it to the processor. Getting it might be needed when the transformer need the current User ID or Team ID. (Different teams within one workspace are not yet supported.)