Skip to content

Commit

Permalink
export Slacker interface, remove Type form Provider
Browse files Browse the repository at this point in the history
  • Loading branch information
rusq committed Jan 12, 2024
1 parent 71a5d75 commit a427a60
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 61 deletions.
2 changes: 0 additions & 2 deletions auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ type Provider interface {
SlackToken() string
// Cookies should return a set of Slack Session cookies.
Cookies() []*http.Cookie
// Type returns the auth type.
Type() Type
// Validate should return error, in case the token or cookies cannot be
// retrieved.
Validate() error
Expand Down
76 changes: 38 additions & 38 deletions clienter_mock_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cmd/slackdump/internal/auth/new.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func runWspNew(ctx context.Context, cmd *base.Command, args []string) error {
return fmt.Errorf("failed to select the default workpace: %s", err)
}
fmt.Printf("Success: added workspace %q\n", realname(wsp))
lg.Debugf("workspace %q type: %q", realname(wsp), prov.Type())
lg.Debugf("workspace %q, type %T", realname(wsp), prov)
return nil
}

Expand Down
15 changes: 0 additions & 15 deletions internal/mocks/mock_auth/mock_auth.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions slackdump.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ type Session struct {
// WorkspaceInfo is an type alias for [slack.AuthTestResponse].
type WorkspaceInfo = slack.AuthTestResponse

// slacker is the interface with some functions of slack.Client.
type slacker interface {
// Slacker is the interface with some functions of slack.Client.
type Slacker interface {
AuthTestContext(context.Context) (response *slack.AuthTestResponse, err error)
GetConversationInfoContext(ctx context.Context, input *slack.GetConversationInfoInput) (*slack.Channel, error)
GetConversationHistoryContext(ctx context.Context, params *slack.GetConversationHistoryParameters) (*slack.GetConversationHistoryResponse, error)
Expand All @@ -53,7 +53,7 @@ type slacker interface {
// clienter is the interface with some functions of slack.Client with the sole
// purpose of mocking in tests (see client_mock.go)
type clienter interface {
slacker
Slacker
GetFile(downloadURL string, writer io.Writer) error
GetUsersContext(ctx context.Context, options ...slack.GetUsersOption) ([]slack.User, error)
GetEmojiContext(ctx context.Context) (map[string]string, error)
Expand Down
4 changes: 2 additions & 2 deletions stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const (
// use.
type Stream struct {
oldest, latest time.Time
client slacker
client Slacker
limits rateLimits
chanCache *chanCache
resultFn []func(sr StreamResult) error
Expand Down Expand Up @@ -139,7 +139,7 @@ func OptState(s *state.State) StreamOption {

// NewStream creates a new Stream instance that allows to stream different
// slack entities.
func NewStream(cl slacker, l *Limits, opts ...StreamOption) *Stream {
func NewStream(cl Slacker, l *Limits, opts ...StreamOption) *Stream {
cs := &Stream{
client: cl,
limits: limits(l),
Expand Down

0 comments on commit a427a60

Please sign in to comment.