Documentation
¶
Index ¶
- type Option
- type Result
- type ResultType
- 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) UsersBulk(ctx context.Context, proc processor.Users, ids ...string) 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 OptFailOnChanNotFound ¶ added in v3.1.10
OptFailOnChanNotFound enables or disables detection and special treatment of channel_not_found Slack errors. If disabled, non-existing channels are skipped.
func OptFastSearch ¶
func OptFastSearch() Option
func OptInclusive ¶ added in v3.0.4
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 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
ListChannels calls processor for each batch of channels received from the API.
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 processes all users in the workspace, calling proc for each batch of users returned by the API.
func (*Stream) UsersBulk ¶ added in v3.1.0
UsersBulk processes all users in the workspace, calling proc for each batch of users returned by the API.
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.)