slack

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package slack provides business logic for interacting with Slack, such as sending and receiving messages, and retrieving channel lists.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API interface {
	AddPinContext(ctx context.Context, channel string, item slack.ItemRef) error
	GetConversationsContext(ctx context.Context, params *slack.GetConversationsParameters) (channels []slack.Channel, nextCursor string, err error)
	GetPermalinkContext(ctx context.Context, params *slack.PermalinkParameters) (string, error)
	GetTeamInfoContext(ctx context.Context) (*slack.TeamInfo, error)
	GetUserInfoContext(ctx context.Context, user string) (*slack.User, error)
	GetUsersContext(ctx context.Context, options ...slack.GetUsersOption) ([]slack.User, error)
	GetUsersInConversationContext(ctx context.Context, params *slack.GetUsersInConversationParameters) ([]string, string, error)
	OpenViewContext(ctx context.Context, triggerID string, view slack.ModalViewRequest) (*slack.ViewResponse, error)
	PostEphemeralContext(ctx context.Context, channelID, userID string, options ...slack.MsgOption) (timestamp string, err error)
	PostMessageContext(ctx context.Context, channel string, options ...slack.MsgOption) (string, string, error)
	PushViewContext(ctx context.Context, triggerID string, view slack.ModalViewRequest) (*slack.ViewResponse, error)
	RemovePinContext(ctx context.Context, channel string, item slack.ItemRef) error
	UpdateMessageContext(ctx context.Context, channelID string, timestamp string, options ...slack.MsgOption) (string, string, string, error)
	UpdateViewContext(ctx context.Context, view slack.ModalViewRequest, externalID string, hash string, viewID string) (*slack.ViewResponse, error)
}

type Client

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

func Init

func Init() (*Client, error)

Init initializes and returns a new Slack client using token

func (*Client) AddPinContext

func (c *Client) AddPinContext(ctx context.Context, channel string, item slack.ItemRef) error

func (*Client) GetConversationsContext

func (c *Client) GetConversationsContext(ctx context.Context, params *slack.GetConversationsParameters) (channels []slack.Channel, nextCursor string, err error)

func (*Client) GetPermalinkContext

func (c *Client) GetPermalinkContext(ctx context.Context, params *slack.PermalinkParameters) (string, error)

func (*Client) GetTeamInfoContext

func (c *Client) GetTeamInfoContext(ctx context.Context) (*slack.TeamInfo, error)

func (*Client) GetUserInfoContext

func (c *Client) GetUserInfoContext(ctx context.Context, user string) (*slack.User, error)

func (*Client) GetUsersContext

func (c *Client) GetUsersContext(ctx context.Context, options ...slack.GetUsersOption) ([]slack.User, error)

func (*Client) GetUsersInConversationContext

func (c *Client) GetUsersInConversationContext(ctx context.Context, params *slack.GetUsersInConversationParameters) ([]string, string, error)

func (*Client) OpenViewContext

func (c *Client) OpenViewContext(ctx context.Context, triggerID string, view slack.ModalViewRequest) (*slack.ViewResponse, error)

func (*Client) PostEphemeralContext

func (c *Client) PostEphemeralContext(ctx context.Context, channelID, userID string, options ...slack.MsgOption) (timestamp string, err error)

func (*Client) PostMessageContext

func (c *Client) PostMessageContext(ctx context.Context, channel string, options ...slack.MsgOption) (string, string, error)

func (*Client) PushViewContext

func (c *Client) PushViewContext(ctx context.Context, triggerID string, view slack.ModalViewRequest) (*slack.ViewResponse, error)

func (*Client) RemovePinContext

func (c *Client) RemovePinContext(ctx context.Context, channel string, item slack.ItemRef) error

func (*Client) UpdateMessageContext

func (c *Client) UpdateMessageContext(ctx context.Context, channelID, timestamp string, options ...slack.MsgOption) (string, string, string, error)

func (*Client) UpdateViewContext

func (c *Client) UpdateViewContext(ctx context.Context, view slack.ModalViewRequest, externalID, hash, viewID string) (*slack.ViewResponse, error)

type PostgresRepository

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

func NewRepository

func NewRepository(q sqlc.Querier) *PostgresRepository

func (*PostgresRepository) CreateUser

func (r *PostgresRepository) CreateUser(ctx context.Context, user *models.User) (*models.User, error)

CreateUser creates a new Slack user in the database. This operation executes a single INSERT statement and does not require an explicit transaction.

func (*PostgresRepository) DeleteUser

func (r *PostgresRepository) DeleteUser(ctx context.Context, user *models.User) (*models.User, error)

func (*PostgresRepository) ExistsUserByID

func (r *PostgresRepository) ExistsUserByID(ctx context.Context, id string) (bool, error)

func (*PostgresRepository) GetUserByID

func (r *PostgresRepository) GetUserByID(ctx context.Context, id string) (*models.User, error)

func (*PostgresRepository) GetUserByName

func (r *PostgresRepository) GetUserByName(ctx context.Context, name string) (*models.User, error)

func (*PostgresRepository) GetUserBySlackUserID

func (r *PostgresRepository) GetUserBySlackUserID(ctx context.Context, id int32) (*models.User, error)

type Repository

type Repository interface {
	CreateUser(ctx context.Context, user *models.User) (*models.User, error)
	DeleteUser(ctx context.Context, user *models.User) (*models.User, error)
	ExistsUserByID(ctx context.Context, id string) (bool, error)
	GetUserByID(ctx context.Context, id string) (*models.User, error)
	GetUserBySlackUserID(ctx context.Context, id int32) (*models.User, error)
}

type Service

type Service interface {
	AddPinContext(ctx context.Context, channel, timestamp string) error
	CreateUser(ctx context.Context, user *models.User) (*models.User, error)
	DeleteUser(ctx context.Context, user *models.User) (*models.User, error)
	ExistsUserByID(ctx context.Context, id string) (bool, error)
	ExistsUserInChannelByID(ctx context.Context, id string, channelID string) (bool, error)
	FetchAllChannelsContext(ctx context.Context) ([]slack.Channel, error)
	FetchReviewersChannelByRole(ctx context.Context, role string) ([]types.ReviewersChannel, error)
	FetchTeamInfoContext(ctx context.Context) (*types.TeamInfo, error)
	FetchUserInfoContext(ctx context.Context, user string) (*models.User, error)
	FetchUsersContext(ctx context.Context) ([]models.User, error)
	FetchUsersInConversationContext(ctx context.Context, channelID string) ([]string, error)
	GetPermalinkContext(ctx context.Context, channel, timestamp string) (string, error)
	GetUserByID(ctx context.Context, id string) (*models.User, error)
	GetUserBySlackUserID(ctx context.Context, id int32) (*models.User, error)
	OpenModalContext(ctx context.Context, triggerID string, builder modal.Builder) error
	PostEphemeralContext(ctx context.Context, channelID, userID string, builder message.Builder) (timestamp string, err error)
	PostMessageContext(ctx context.Context, channelID string, builder message.Builder) (string, string, error)
	PushModalContext(ctx context.Context, triggerID string, builder modal.Builder) error
	RemovePinContext(ctx context.Context, channel string, timestamp string) error
	UpdateMessageContext(ctx context.Context, channel, timestamp string, builder message.Builder) (string, string, string, error)
	UpdateModalContext(ctx context.Context, builder modal.Builder, externalID, hash, viewID string) error
}

func NewService

func NewService(api API, repo Repository) Service

Jump to

Keyboard shortcuts

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