Documentation
¶
Index ¶
- Constants
- Variables
- type Client
- func (c *Client) Connect(ctx context.Context) error
- func (c *Client) Delete(ctx context.Context, issue *models.Issue, reason string, ...) error
- func (c *Client) DeletePost(ctx context.Context, channelID, ts string) error
- func (c *Client) GetChannelName(ctx context.Context, channelID string) string
- func (c *Client) GetUserInfo(ctx context.Context, userID string) (*slack.User, error)
- func (c *Client) IsAlertChannel(ctx context.Context, channelID string) (bool, string, error)
- func (c *Client) NotifyWebhookOutcome(ctx context.Context, outcome *models.WebhookOutcome)
- func (c *Client) OpenModal(ctx context.Context, triggerID string, request slack.ModalViewRequest) error
- func (c *Client) PostEphemeral(ctx context.Context, channelID, userID string, options ...slack.MsgOption) (string, error)
- func (c *Client) RunSocketMode(ctx context.Context) error
- func (c *Client) SendResponse(ctx context.Context, channelID, responseURL, responseType, text string) error
- func (c *Client) SetInsightsRecorder(recorder *insights.Recorder)
- func (c *Client) SetIssueFinder(issueFinder IssueFinder)
- func (c *Client) SetIssueSaver(issueSaver IssueSaver)
- func (c *Client) SocketModeQuiet() bool
- func (c *Client) Update(ctx context.Context, channelID string, allChannelIssues []*models.Issue) error
- func (c *Client) UpdateModal(ctx context.Context, viewID string, request slack.ModalViewRequest) error
- func (c *Client) UpdateSingleIssue(ctx context.Context, issue *models.Issue, reason string) error
- func (c *Client) UpdateSingleIssueWithThrottling(ctx context.Context, issue *models.Issue, reason string, issuesInChannel int) error
- func (c *Client) UserIsInGroup(ctx context.Context, groupID, userID string) bool
- type FifoQueueProducer
- type IssueFinder
- type IssueSaver
Constants ¶
const (
// PostIDInvalidChannel represents the post ID for issues with invalid channel ID
PostIDInvalidChannel = "INVALID_CHANNEL_ID"
)
Variables ¶
var ErrPendingPostUnresolved = errors.New("pending Slack post is not resolved yet")
ErrPendingPostUnresolved is returned by Client.Delete when the issue has a pending Slack post that was not found in the channel history yet, and the grace period has not elapsed. The post may still exist, so it can neither be deleted nor assumed to not exist. The issue is left unchanged, and the delete should be retried later.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func New ¶
func New(commandHandler FifoQueueProducer, cacheStore store.StoreInterface, logger types.Logger, metrics types.Metrics, cfg *config.ManagerConfig, managerSettings *models.ManagerSettingsWrapper, slackAPIClientOpts ...func(*internal.SlackAPIClient)) *Client
func (*Client) Delete ¶
func (c *Client) Delete(ctx context.Context, issue *models.Issue, reason string, updateIfMessageHasReplies bool) error
Delete deletes the Slack post of the issue, if any, and registers the post as deleted on the issue. If updateIfMessageHasReplies is true and the post has replies, the post is updated to look deleted instead. Errors where the channel or the message is no longer available are ignored.
A pending post (see models.Issue.SlackPostPendingSince) is looked up first. If the lookup fails, and the pending post has not expired, the error is returned (wrapping [errPendingPostLookup]). If the post is not found, and the grace period has not elapsed, ErrPendingPostUnresolved is returned, and the delete must be retried later.
func (*Client) DeletePost ¶
func (*Client) GetChannelName ¶
func (*Client) GetUserInfo ¶
func (*Client) IsAlertChannel ¶
func (*Client) NotifyWebhookOutcome ¶ added in v0.18.0
func (c *Client) NotifyWebhookOutcome(ctx context.Context, outcome *models.WebhookOutcome)
NotifyWebhookOutcome informs the user who clicked a webhook button about the webhook outcome.
If the webhook was confirmed in a modal (see models.WebhookOutcome.ViewID), the modal is updated with the outcome. If there is no modal, or it can't be updated (typically because the user has closed it), the outcome is reported in an ephemeral message if models.WebhookOutcome.NotifyWithoutModal is true, i.e. for failures, rejections and deliveries with a message from the receiving system. Plain deliveries are not reported.
Errors are logged, not returned.
func (*Client) PostEphemeral ¶
func (*Client) SendResponse ¶
func (*Client) SetInsightsRecorder ¶ added in v0.16.0
SetInsightsRecorder sets the recorder for Slack post insights events. A nil recorder disables recording. It must be called before the client is used.
func (*Client) SetIssueFinder ¶
func (c *Client) SetIssueFinder(issueFinder IssueFinder)
func (*Client) SetIssueSaver ¶ added in v0.17.0
func (c *Client) SetIssueSaver(issueSaver IssueSaver)
SetIssueSaver sets the saver used to save an issue as pending before its Slack post is created (write-ahead). If the process crashes after the post is created, but before the issue is saved with the post ID, the post is then found in the channel history and adopted, rather than posted again. It is required, and must be called before Client.Connect.
func (*Client) SocketModeQuiet ¶ added in v0.4.0
SocketModeQuiet returns true when no Socket Mode event handlers are currently in flight. Used by the rate-limit gate's ready check.
func (*Client) Update ¶
func (c *Client) Update(ctx context.Context, channelID string, allChannelIssues []*models.Issue) error
Update runs a channel update cycle for the non-archived issues in the channel: posts are deleted where requested (or for re-ordering), pending posts are looked up, and posts are created or updated where needed. A failed issue does not block the other issues, unless the error affects all Slack calls (see [abortsChannelUpdate]). All errors from the cycle are returned joined.
func (*Client) UpdateModal ¶ added in v0.18.0
func (c *Client) UpdateModal(ctx context.Context, viewID string, request slack.ModalViewRequest) error
UpdateModal replaces the content of an open modal view. It fails if the user has closed the modal.
func (*Client) UpdateSingleIssue ¶
UpdateSingleIssue creates or updates the Slack post for the issue, if the issue requires it (see models.Issue.GetSlackAction). A pending post is looked up first (see [Client.resolvePendingPost]), and an error is returned if the lookup fails. Before a new post is created, the issue is saved to the database (see Client.SetIssueSaver).
func (*Client) UpdateSingleIssueWithThrottling ¶
func (c *Client) UpdateSingleIssueWithThrottling(ctx context.Context, issue *models.Issue, reason string, issuesInChannel int) error
UpdateSingleIssueWithThrottling is Client.UpdateSingleIssue, except that the post is not created or updated if the issue is throttled, based on its activity and the number of open issues in the channel.
type FifoQueueProducer ¶
type IssueFinder ¶
type IssueSaver ¶ added in v0.17.0
IssueSaver saves an issue to the database. See Client.SetIssueSaver.