datasource

package
v0.0.0-...-ab17b8d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 22, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConcreteSlackClient

type ConcreteSlackClient struct {
	// contains filtered or unexported fields
}

ConcreteSlackClient is a concrete implementation of the Slack client interface

func NewConcreteSlackClient

func NewConcreteSlackClient(token string) *ConcreteSlackClient

NewConcreteSlackClient creates a new Slack client with the given token

func (*ConcreteSlackClient) GetConversationHistory

GetConversationHistory is a wrapper around slack.GetConversationHistory

func (*ConcreteSlackClient) GetConversationRepliesContext

func (c *ConcreteSlackClient) GetConversationRepliesContext(ctx context.Context, params *slack.GetConversationRepliesParameters) ([]slack.Message, bool, string, error)

GetConversationRepliesContext is a wrapper around slack.GetConversationRepliesContext

type DatasourceMock

type DatasourceMock struct {
	mock.Mock
}

func (*DatasourceMock) GetData

func (_m *DatasourceMock) GetData(currentState types.State) ([]types.Document, types.State, error)

func (*DatasourceMock) GetID

func (_m *DatasourceMock) GetID() string

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func NewDatasourceManager

func NewDatasourceManager(storage storage.Storage, logger *logrus.Logger, aclManager auth.ACLManager) *Manager

func (*Manager) RegisterRoutes

func (dm *Manager) RegisterRoutes(r chi.Router)

type SlackClient

type SlackClient interface {
	GetConversationHistory(params *slack.GetConversationHistoryParameters) (*slack.GetConversationHistoryResponse, error)
	GetConversationRepliesContext(ctx context.Context, params *slack.GetConversationRepliesParameters) (msgs []slack.Message, hasMore bool, nextCursor string, err error)
}

SlackClient is an interface for a Slack client

type SlackClientMock

type SlackClientMock struct {
	mock.Mock
}

func NewSlackClient

func NewSlackClient(t interface {
	mock.TestingT
	Cleanup(func())
}) *SlackClientMock

func (*SlackClientMock) GetConversationHistory

func (*SlackClientMock) GetConversationRepliesContext

func (_m *SlackClientMock) GetConversationRepliesContext(ctx context.Context, params *slack.GetConversationRepliesParameters) ([]slack.Message, bool, string, error)

type SlackDatasource

type SlackDatasource struct {
	// contains filtered or unexported fields
}

SlackDatasource is a datasource for fetching messages from a Slack channel

func NewSlackDatasource

func NewSlackDatasource(config types.DatasourceConfig, client SlackClient, logger *logrus.Logger) (*SlackDatasource, error)

NewSlackDatasource creates a new Slack datasource with the given configuration, client, and logger

func (*SlackDatasource) GetData

GetData fetches new messages from the Slack channel and returns them as documents

func (*SlackDatasource) GetID

func (s *SlackDatasource) GetID() uuid.UUID

GetID returns the UUID of the Slack datasource

func (*SlackDatasource) Validate

func (s *SlackDatasource) Validate() error

Validate validates the Slack datasource configuration

type SlackDatasourceError

type SlackDatasourceError struct {
	Op  string
	Err error
}

SlackDatasourceError is an error type for Slack datasource operations

func (*SlackDatasourceError) Error

func (e *SlackDatasourceError) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL