Documentation
¶
Index ¶
- Variables
- type GetChannelsParameters
- type Option
- type ProcessFunc
- type ProcessResult
- type ProcessResults
- type Session
- func (s *Session) Client() (*slack.Client, error)
- 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 (sd *Session) GetChannelMembers(ctx context.Context, channelID string) ([]string, error)
- func (s *Session) GetChannels(ctx context.Context, chanTypes ...string) (types.Channels, error)
- func (s *Session) GetChannelsEx(ctx context.Context, p GetChannelsParameters) (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) errordeprecated
- func (s *Session) StreamChannelsEx(ctx context.Context, p GetChannelsParameters) iter.Seq2[[]slack.Channel, error]
- type WorkspaceInfo
Examples ¶
Constants ¶
This section is empty.
Variables ¶
AllChanTypes enumerates all API-supported channel types as of 12/2025.
var ErrNoUserCache = errors.New("user cache unavailable")
ErrNoUserCache is returned when the user cache is not initialised.
var ErrNotAClient = errors.New("programming error: underlying client is not a slack.Client")
ErrNotAClient is returned by Client() when the underlying client is not a slack.Client.
var ErrStop = errors.New("stop")
ErrStop instructs early stop to streaming function, when returned from a callback function.
Functions ¶
This section is empty.
Types ¶
type GetChannelsParameters ¶ added in v4.0.2
type GetChannelsParameters struct {
// ChannelTypes allows to specify the channel types to fetch. If the slice
// is empty, all channel types will be fetched.
ChannelTypes []string
// OnlyMyChannels restricts the channels only to the channels that the user
// is a member of.
OnlyMyChannels bool
}
GetChannelsParameters holds the parameters for [GetChannelsEx] and [StreamChannelsEx] functions.
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 client.SlackClienter) 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.NewPlaywrightAuth(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
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
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
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) Client ¶
Client returns the underlying slack.Client. If the underlying client is not a slack.Client, ErrNotAClient is returned.
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) GetChannelMembers ¶
GetChannelMembers returns a list of all members in a channel.
func (*Session) GetChannels ¶
GetChannels list all conversations for a user. `chanTypes` specifies the type of channels to fetch. See github.com/rusq/slack docs for possible values. If large number of channels is to be returned, consider using [StreamChannelsEx]. It is a wrapper for [GetChannelsEx].
Deprecated; Use [GetChannelsEx]. This function Will be removed in v5.
func (*Session) GetChannelsEx ¶ added in v4.0.2
func (s *Session) GetChannelsEx(ctx context.Context, p GetChannelsParameters) (types.Channels, error)
GetChannelsEx list all conversations for a user. GetChannelParameters should contain the fetch criteria. If large number of channels is to be returned, consider using [StreamChannelsEx].
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.
func (*Session) StreamChannels
deprecated
func (s *Session) StreamChannels(ctx context.Context, chanTypes []string, cb func(ch slack.Channel) error) error
StreamChannels requests the channels from the API and calls the callback function cb for each. It is a wrapper for [StreamChannelsEx].
Deprecated: Use [StreamChannelsEx]. This function Will be removed in v5.
type WorkspaceInfo ¶
type WorkspaceInfo = slack.AuthTestResponse
WorkspaceInfo is an type alias for slack.AuthTestResponse.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
browser
Package browser provides the playwright browser authentication provider.
|
Package browser provides the playwright browser authentication provider. |
|
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
command
|
|
|
slackdump/internal/cfg
Package cfg contains common configuration variables.
|
Package cfg contains common configuration variables. |
|
slackdump/internal/diag
Package diag should be named tools, and contains different useful tools and utilities.
|
Package diag should be named tools, and contains different useful tools and utilities. |
|
slackdump/internal/diag/info
Package info contains the Info command.
|
Package info contains the Info command. |
|
slackdump/internal/diag/sdv1
Package sdv1 contains Slackdump v1.0.x related code.
|
Package sdv1 contains Slackdump v1.0.x related code. |
|
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/export
Package export implements export subcommand.
|
Package export implements export subcommand. |
|
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. |
|
slackdump/internal/workspace/workspaceui
Package workspaceui is a generated GoMock package.
|
Package workspaceui is a generated GoMock package. |
|
slackdump/internal/workspace/wspcfg
Package wspcfg contains workspace configuration variables.
|
Package wspcfg contains workspace configuration variables. |
|
contrib
|
|
|
_gen
command
|
|
|
internal
|
|
|
chunk/backend/dbase/repository/mock_repository
Package mock_repository is a generated GoMock package.
|
Package mock_repository is a generated GoMock package. |
|
chunk/backend/directory
Package directory is a processor that writes the data into gzipped files in a directory.
|
Package directory is a processor that writes the data into gzipped files in a directory. |
|
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/control/mock_control
Package mock_control is a generated GoMock package.
|
Package mock_control is a generated GoMock package. |
|
chunk/mock_chunk
Package mock_chunk is a generated GoMock package.
|
Package mock_chunk is a generated GoMock package. |
|
chunk/obfuscate
Package obfuscate obfuscates a slackdump chunk recording.
|
Package obfuscate obfuscates a slackdump chunk recording. |
|
client/mock_client
Package mock_client is a generated GoMock package.
|
Package mock_client is a generated GoMock package. |
|
convert/mock_convert
Package mock_convert is a generated GoMock package.
|
Package mock_convert is a generated GoMock package. |
|
convert/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. |
|
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 functions for different output format types.
|
Package format provides formatting functions for different output format types. |
|
mocks/mock_auth
Package mock_auth is a generated GoMock package.
|
Package mock_auth is a generated GoMock package. |
|
mocks/mock_cache
Package mock_cache is a generated GoMock package.
|
Package mock_cache 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. |
|
primitive
Package primitive contains some primitives and helper functions.
|
Package primitive contains some primitives and helper 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
Package renderer provides rendering functions.
|
Package renderer provides rendering functions. |
|
viewer/renderer/functions
Package functions provides shared template functions.
|
Package functions provides shared template functions. |
|
mocks
|
|
|
mock_downloader
Package mock_downloader is a generated GoMock package.
|
Package mock_downloader is a generated GoMock package. |
|
mock_processor
Package mock_processor is a generated GoMock package.
|
Package mock_processor is a generated GoMock package. |
|
Package source provides archive readers for different output formats.
|
Package source provides archive readers for different output formats. |
|
mock_source
Package mock_source is a generated GoMock package.
|
Package mock_source is a generated GoMock package. |
|
Package stream provides entity streaming functions.
|
Package stream provides entity streaming functions. |
|
Package types contains types and utility functions specific to Slackdump.
|
Package types contains types and utility functions specific to Slackdump. |
