Documentation ¶
Index ¶
- Variables
- type Option
- type ProcessFunc
- type ProcessResult
- type ProcessResults
- type Session
- func (s *Session) Client() *slack.Client
- func (s *Session) CurrentUserID() string
- func (s *Session) Dump(ctx context.Context, link string, oldest, latest time.Time, ...) (*types.Conversation, error)
- func (s *Session) DumpAll(ctx context.Context, link string) (*types.Conversation, error)
- func (s *Session) DumpEmojis(ctx context.Context) (map[string]string, error)
- func (s *Session) DumpRaw(ctx context.Context, link string, oldest, latest time.Time, ...) (*types.Conversation, error)
- func (s *Session) GetChannels(ctx context.Context, chanTypes ...string) (types.Channels, error)
- func (s *Session) GetUsers(ctx context.Context) (types.Users, error)
- func (s *Session) Info() *WorkspaceInfo
- func (s *Session) Stream(opts ...stream.Option) *stream.Stream
- func (s *Session) StreamChannels(ctx context.Context, chanTypes []string, cb func(ch slack.Channel) error) error
- type Slacker
- type WorkspaceInfo
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var AllChanTypes = []string{"mpim", "im", "public_channel", "private_channel"}
AllChanTypes enumerates all API-supported channel types as of 03/2023.
var ErrNoUserCache = errors.New("user cache unavailable")
ErrNoUserCache is returned when the user cache is not initialised.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*Session)
Option is the signature of the option-setting function.
func WithFilesystem ¶
WithFilesystem sets the filesystem adapter to use for the session. If this option is not given, the default filesystem adapter is initialised with the base location specified in the Config.
func WithForceEnterprise ¶
func WithLimits ¶
WithLimits sets the API limits to use for the session. If this option is not given, the default limits are initialised with the values specified in DefLimits.
func WithLogger ¶
WithLogger sets the logger to use for the session. If this option is not given, the default logger is initialised with the filename specified in Config.Logfile. If the Config.Logfile is empty, the default logger writes to STDERR.
func WithSlackClient ¶
func WithSlackClient(cl clienter) Option
WithSlackClient sets the Slack client to use for the session. If this
func WithUserCacheRetention ¶
WithUserCacheRetention sets the retention period for the user cache. If this option is not given, the default value is 60 minutes.
type ProcessFunc ¶
type ProcessFunc func(msg []types.Message, channelID string) (ProcessResult, error)
ProcessFunc is the signature of the processor function that Dump* family functions accept and call for each API call result. It can be used to modify in-place the slice of messages, returned from API, before they are appended to the slice that will be returned by Dump*. Messages passed to this function are unsorted.
type ProcessResult ¶
type ProcessResult struct { // Entity is the type of entity that this result is related to. Entity string // Count is the number of items processed during processing. Count int }
ProcessResult contains the result of processing.
func (ProcessResult) String ¶
func (pr ProcessResult) String() string
type ProcessResults ¶
type ProcessResults []ProcessResult
ProcessResults is the slice of ProcessResult
func (ProcessResults) String ¶
func (prs ProcessResults) String() string
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session stores basic session parameters. Zero value is not usable, must be initialised with New.
func New ¶
New creates new Slackdump session with provided options, and populates the internal cache of users and channels for lookups. If it fails to authenticate, AuthError is returned.
Example (BrowserAuth) ¶
provider, err := auth.NewBrowserAuth(context.Background()) if err != nil { log.Print(err) return } fsa := openTempFS() defer fsa.Close() sd, err := New(context.Background(), provider) if err != nil { log.Print(err) return } _ = sd
Output:
Example (CookieFile) ¶
provider, err := auth.NewCookieFileAuth("xoxc-...", "cookies.txt") if err != nil { log.Print(err) return } fsa := openTempFS() defer fsa.Close() sd, err := New(context.Background(), provider) if err != nil { log.Print(err) return } _ = sd
Output:
Example (TokenAndCookie) ¶
provider, err := auth.NewValueAuth("xoxc-...", "xoxd-...") if err != nil { log.Print(err) return } fsa := openTempFS() defer fsa.Close() sd, err := New(context.Background(), provider) if err != nil { log.Print(err) return } _ = sd
Output:
func NewNoValidate ¶
NewNoValidate creates new Slackdump session with provided options, and populates the internal cache of users and channels for lookups. This function does not validate the auth.Provider.
func (*Session) CurrentUserID ¶
CurrentUserID returns the user ID of the authenticated user.
func (*Session) Dump ¶
func (s *Session) Dump(ctx context.Context, link string, oldest, latest time.Time, processFn ...ProcessFunc) (*types.Conversation, error)
Dump dumps messages or threads specified by link. link can be one of the following:
- Channel URL - i.e. https://ora600.slack.com/archives/CHM82GF99
- Thread URL - i.e. https://ora600.slack.com/archives/CHM82GF99/p1577694990000400
- ChannelID - i.e. CHM82GF99
- ChannelID:ThreadTS - i.e. CHM82GF99:1577694990.000400
oldest and latest timestamps set a timeframe within which the messages should be retrieved, also one can provide process functions.
func (*Session) DumpAll ¶
DumpAll dumps all messages. See description of Dump for what can be provided in link.
func (*Session) DumpEmojis ¶
func (*Session) DumpRaw ¶
func (s *Session) DumpRaw(ctx context.Context, link string, oldest, latest time.Time, processFn ...ProcessFunc) (*types.Conversation, error)
DumpRaw dumps all messages, but does not account for any options defined, such as DumpFiles, instead, the caller must hassle about any processFns they want to apply.
func (*Session) GetChannels ¶
GetChannels list all conversations for a user. `chanTypes` specifies the type of messages to fetch. See github.com/rusq/slack docs for possible values. If large number of channels is to be returned, consider using StreamChannels.
func (*Session) GetUsers ¶
GetUsers retrieves all users either from cache or from the API. If Session.usercache is not empty, it will return the cached users. Otherwise, it will try fetching them from the API and cache them.
func (*Session) Info ¶
func (s *Session) Info() *WorkspaceInfo
Info returns a workspace information. Slackdump retrieves workspace information during the initialisation when performing authentication test, so no API call is involved at this point.
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 WorkspaceInfo ¶
type WorkspaceInfo = slack.AuthTestResponse
WorkspaceInfo is an type alias for slack.AuthTestResponse.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
browser/pwcompat
Package pwcompat provides a compatibility layer, so when the playwright-go team decides to break compatibility again, there's a place to write a workaround.
|
Package pwcompat provides a compatibility layer, so when the playwright-go team decides to break compatibility again, there's a place to write a workaround. |
cmd
|
|
slackdump/internal/bootstrap
Package bootstrap contains some initialisation functions that are shared between main some other top level commands, i.e.
|
Package bootstrap contains some initialisation functions that are shared between main some other top level commands, i.e. |
slackdump/internal/cfg
Package cfg contains common configuration variables.
|
Package cfg contains common configuration variables. |
slackdump/internal/diag/info
Package info contains the Info command.
|
Package info contains the Info command. |
slackdump/internal/emoji/emojidl
Package emojidl provides functions to dump the all slack emojis for a workspace.
|
Package emojidl provides functions to dump the all slack emojis for a workspace. |
slackdump/internal/format
Package format formats Slackdump conversations, channels and users as human-readable text or CSV.
|
Package format formats Slackdump conversations, channels and users as human-readable text or CSV. |
slackdump/internal/golang/base
Package base defines shared basic pieces of the slackdump command.
|
Package base defines shared basic pieces of the slackdump command. |
slackdump/internal/golang/help
Package help implements "slackdump help" command.
|
Package help implements "slackdump help" command. |
slackdump/internal/ui
Package ui contains some common UI elements.
|
Package ui contains some common UI elements. |
slackdump/internal/ui/ask
Package ask provides common functions for asking questions for getting user input on dump and export parameters.
|
Package ask provides common functions for asking questions for getting user input on dump and export parameters. |
slackdump/internal/ui/bubbles/datepicker
Package datepicker provides a bubble tea component for viewing and selecting a date from a monthly view.
|
Package datepicker provides a bubble tea component for viewing and selecting a date from a monthly view. |
slackdump/internal/ui/dumpui
Package dumpui provides a universal wizard for running dump-family commands.
|
Package dumpui provides a universal wizard for running dump-family commands. |
slackdump/internal/ui/updaters
Package updaters contains the models that wrap the variable and provide the UI for changing their values.
|
Package updaters contains the models that wrap the variable and provide the UI for changing their values. |
contrib
|
|
Package downloader provides the sync and async file download functionality.
|
Package downloader provides the sync and async file download functionality. |
internal
|
|
chunk/chunktest
Package chunktest provides a test server for testing the chunk package.
|
Package chunktest provides a test server for testing the chunk package. |
chunk/control
Package control holds the implementation of the Slack Stream controller.
|
Package control holds the implementation of the Slack Stream controller. |
chunk/dirproc
Package dirproc is a processor that writes the data into gzipped files in a directory.
|
Package dirproc is a processor that writes the data into gzipped files in a directory. |
chunk/obfuscate
Package obfuscate obfuscates a slackdump chunk recording.
|
Package obfuscate obfuscates a slackdump chunk recording. |
chunk/transform/fileproc
Package fileproc is the file processor that can be used in conjunction with the transformer.
|
Package fileproc is the file processor that can be used in conjunction with the transformer. |
convert
Package convert implements conversions between different Slackdump formats.
|
Package convert implements conversions between different Slackdump formats. |
edge
Package edge provides a limited implementation of undocumented Slack Edge API necessary to get the data from a slack workspace.
|
Package edge provides a limited implementation of undocumented Slack Edge API necessary to get the data from a slack workspace. |
fixtures/fixchunks
Package fixchunks contains chunk fixtures.
|
Package fixchunks contains chunk fixtures. |
fixtures/fixgen
Package fixgen generates test fixtures for slackdump.
|
Package fixgen generates test fixtures for slackdump. |
format
Package format provides formatting fuctions for different output format types.
|
Package format provides formatting fuctions for different output format types. |
mocks/mock_appauth
Package mock_appauth is a generated GoMock package.
|
Package mock_appauth is a generated GoMock package. |
mocks/mock_auth
Package mock_auth is a generated GoMock package.
|
Package mock_auth is a generated GoMock package. |
mocks/mock_dl
Package mock_dl is a generated GoMock package.
|
Package mock_dl is a generated GoMock package. |
mocks/mock_downloader
Package mock_downloader is a generated GoMock package.
|
Package mock_downloader is a generated GoMock package. |
mocks/mock_fsadapter
Package mock_fsadapter is a generated GoMock package.
|
Package mock_fsadapter is a generated GoMock package. |
mocks/mock_io
Package mock_io is a generated GoMock package.
|
Package mock_io is a generated GoMock package. |
mocks/mock_os
Package mock_os is a generated GoMock package.
|
Package mock_os is a generated GoMock package. |
nametmpl
Package nametmpl contains the name template logic.
|
Package nametmpl contains the name template logic. |
osext
Package osext provides some helpful os functions.
|
Package osext provides some helpful os functions. |
structures
Package structures provides functions to parse Slack data types.
|
Package structures provides functions to parse Slack data types. |
structures/files
Package files contains some additional file logic.
|
Package files contains some additional file logic. |
viewer
Package viewer implements the logic to view the slackdump files.
|
Package viewer implements the logic to view the slackdump files. |
viewer/renderer/functions
Package functions provides shared template functions.
|
Package functions provides shared template functions. |
mocks
|
|
mock_appauth
Package mock_cache is a generated GoMock package.
|
Package mock_cache is a generated GoMock package. |
mock_processor
Package mock_processor is a generated GoMock package.
|
Package mock_processor is a generated GoMock package. |