app

package
v1.40.0 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Action types: add new types to the ValidTriggerTypes array below
	ActionTypeWelcomeMessage    ActionType = "send_welcome_message"
	ActionTypePromptRunPlaybook ActionType = "prompt_run_playbook"
	ActionTypeCategorizeChannel ActionType = "categorize_channel"

	// Trigger types: add new types to the ValidTriggerTypes array below
	TriggerTypeNewMemberJoins TriggerType = "new_member_joins"
	TriggerTypeKeywordsPosted TriggerType = "keywords"
)
View Source
const (
	PlaybookRoleMember = "playbook_member"
	PlaybookRoleAdmin  = "playbook_admin"
)
View Source
const (
	MetricTypeDuration = "metric_duration"
	MetricTypeCurrency = "metric_currency"
	MetricTypeInteger  = "metric_integer"
)
View Source
const (
	ChecklistItemStateOpen       = ""
	ChecklistItemStateInProgress = "in_progress"
	ChecklistItemStateClosed     = "closed"
	ChecklistItemStateSkipped    = "skipped"
)
View Source
const (
	StatusInProgress = "InProgress"
	StatusFinished   = "Finished"
)
View Source
const (
	RunRoleMember = "run_member"
	RunRoleAdmin  = "run_admin"
)
View Source
const (
	RunSourcePost   = "post"
	RunSourceDialog = "dialog"
)
View Source
const (
	RunTypePlaybook         = "playbook"
	RunTypeChannelChecklist = "channelChecklist"
)
View Source
const (
	PlaybookRunCreated     timelineEventType = "incident_created"
	TaskStateModified      timelineEventType = "task_state_modified"
	StatusUpdated          timelineEventType = "status_updated"
	StatusUpdateRequested  timelineEventType = "status_update_requested"
	OwnerChanged           timelineEventType = "owner_changed"
	AssigneeChanged        timelineEventType = "assignee_changed"
	RanSlashCommand        timelineEventType = "ran_slash_command"
	EventFromPost          timelineEventType = "event_from_post"
	UserJoinedLeft         timelineEventType = "user_joined_left"
	ParticipantsChanged    timelineEventType = "participants_changed"
	PublishedRetrospective timelineEventType = "published_retrospective"
	CanceledRetrospective  timelineEventType = "canceled_retrospective"
	RunFinished            timelineEventType = "run_finished"
	RunRestored            timelineEventType = "run_restored"
	StatusUpdateSnoozed    timelineEventType = "status_update_snoozed"
	StatusUpdatesEnabled   timelineEventType = "status_updates_enabled"
	StatusUpdatesDisabled  timelineEventType = "status_updates_disabled"
)
View Source
const (
	ActionTypeBroadcastChannels = "broadcast_to_channels"
	ActionTypeBroadcastWebhooks = "broadcast_to_webhooks"

	TriggerTypeStatusUpdatePosted = "status_update_posted"
)
View Source
const (
	KeywordsByUsersTriggerType TaskTriggerType = "keywords_by_users"

	MarkItemAsDoneActionType TaskActionType = "mark_item_as_done"
)

Known Types

View Source
const (
	PlaybooksPath = "/playbooks/playbooks"
	RunsPath      = "/playbooks/runs"
)
View Source
const CurrentPlaybookExportVersion = 1
View Source
const DialogFieldDescriptionKey = "description"

DialogFieldDescriptionKey is the key for the description textarea field used in UpdatePlaybookRunDialog

View Source
const DialogFieldFinishRun = "finish_run"

DialogFieldFinishRun is the key for the "Finish run" bool field used in UpdatePlaybookRunDialog

View Source
const DialogFieldItemCommandKey = "command"

DialogFieldCommandKey is the key for the command in AddChecklistItemDialog

View Source
const DialogFieldItemDescriptionKey = "description"

DialogFieldDescriptionKey is the key for the description in AddChecklistItemDialog

View Source
const DialogFieldItemNameKey = "name"

DialogFieldItemName is the key for the playbook run name in AddChecklistItemDialog

View Source
const DialogFieldMessageKey = "message"

DialogFieldMessageKey is the key for the message textarea field used in UpdatePlaybookRunDialog

View Source
const DialogFieldNameKey = "playbookRunName"

DialogFieldNameKey is the key for the playbook run name field used in OpenCreatePlaybookRunDialog.

View Source
const DialogFieldPlaybookIDKey = "playbookID"

DialogFieldPlaybookIDKey is the key for the playbook ID field used in OpenCreatePlaybookRunDialog.

View Source
const DialogFieldPlaybookRunKey = "playbook_run"

DialogFieldPlaybookRunKey is the key for the playbook run chosen in AddToTimelineDialog

View Source
const DialogFieldReminderInSecondsKey = "reminder"

DialogFieldReminderInSecondsKey is the key for the reminder select field used in UpdatePlaybookRunDialog

View Source
const DialogFieldSummary = "summary"

DialogFieldSummary is the key for the summary in AddToTimelineDialog

View Source
const MaxMetricsPerPlaybook = 4
View Source
const PerPageDefault = 1000
View Source
const (
	// PlaybookRunCreatedWSEvent is for playbook run creation.
	PlaybookRunCreatedWSEvent = "playbook_run_created"
)
View Source
const RetrospectivePrefix = "retro_"

Variables

View Source
var (
	ErrChannelNotFound          = errors.Errorf("channel not found")
	ErrChannelDeleted           = errors.Errorf("channel deleted")
	ErrChannelNotInExpectedTeam = errors.Errorf("channel in different team")
)
View Source
var ErrChannelDisplayNameInvalid = errors.New("channel name is invalid or too long")

ErrChannelDisplayNameInvalid is used when a channel name is too long.

View Source
var ErrDuplicateEntry = errors.New("duplicate entry")

ErrDuplicateEntry occurs when failing to insert because the entry already existed.

View Source
var ErrLicensedFeature = errors.New("not covered by current server license")

ErrLicensedFeature if the error is caused by the server not having the needed license for the feature

View Source
var ErrMalformedPlaybookRun = errors.New("malformed")

ErrMalformedPlaybookRun occurs when a playbook run is not valid.

View Source
var ErrNoPermissions = errors.New("does not have permissions")

ErrNoPermissions if the error is caused by the user not having permissions

View Source
var ErrNotFound = errors.New("not found")

ErrNotFound used when an entity is not found.

View Source
var ErrPlaybookRunActive = errors.New("already active")

ErrPlaybookRunActive occurs when trying to run a command on a playbook run that is active.

View Source
var ErrPlaybookRunNotActive = errors.New("already ended")

ErrPlaybookRunNotActive occurs when trying to run a command on a playbook run that has ended.

View Source
var (
	ValidTaskActionTypes = []TaskActionType{
		MarkItemAsDoneActionType,
	}
)

Functions

func CanManageChannelProperties added in v1.26.0

func CanManageChannelProperties(userID, channelID string, pluginAPI *pluginapi.Client) bool

CanManageChannelProperties returns true if the userID is allowed to manage the properties of channelID

func CanPostToChannel

func CanPostToChannel(userID, channelID string, pluginAPI *pluginapi.Client) bool

func CleanUpChecklists added in v1.35.0

func CleanUpChecklists[T ChecklistCommon](checklists []T)

CleanUpChecklists sets empty values for checklist fields that are not editable

func GeneratePlaybookExport

func GeneratePlaybookExport(playbook Playbook) ([]byte, error)

GeneratePlaybookExport returns a playbook in export format. Fields marked with the stuct tag "export" are included using the given string.

func GetDistinctAssignees added in v1.35.0

func GetDistinctAssignees[T ChecklistCommon](checklists []T) []string

GetDistinctAssignees returns a list of distinct user ids that are assignees in the given checklists

func GetPlaybookDetailsRelativeURL added in v1.26.0

func GetPlaybookDetailsRelativeURL(playbookID string) string

func GetRunDetailsRelativeURL added in v1.26.0

func GetRunDetailsRelativeURL(playbookRunID string) string

relative urls

func IsChannelActiveInTeam

func IsChannelActiveInTeam(channelID string, expectedTeamID string, pluginAPI *pluginapi.Client) error

func IsGuest

func IsGuest(userID string, pluginAPI *pluginapi.Client) (bool, error)

IsGuest returns true if the userID is a system guest

func IsMemberOfTeam

func IsMemberOfTeam(userID, teamID string, pluginAPI *pluginapi.Client) bool

func IsSystemAdmin

func IsSystemAdmin(userID string, pluginAPI *pluginapi.Client) bool

IsSystemAdmin returns true if the userID is a system admin

func IsValidChecklistItemIndex

func IsValidChecklistItemIndex(checklists []Checklist, checklistNum, itemNum int) bool

func IsValidChecklistItemState

func IsValidChecklistItemState(state string) bool

func IsValidDirection

func IsValidDirection(direction SortDirection) bool

func ProcessSignalAnyKeywords added in v1.28.0

func ProcessSignalAnyKeywords(keywords []string) []string

func ShouldSendDailyDigestMessage added in v1.34.0

func ShouldSendDailyDigestMessage(userInfo UserInfo, timezone *time.Location, currentTime time.Time) bool

func ShouldSendWeeklyDigestMessage added in v1.34.0

func ShouldSendWeeklyDigestMessage(userInfo UserInfo, timezone *time.Location, currentTime time.Time) bool

func ValidateAction added in v1.34.0

func ValidateAction(a Action) error

func ValidateCategoryName added in v1.28.0

func ValidateCategoryName(categoryName string) error

func ValidatePreAssignment added in v1.35.0

func ValidatePreAssignment(assignees []string, invitedUsers []string, inviteUsersEnabled bool) error

ValidatePreAssignment checks if invitations are enabled and if all assignees are also invited

func ValidateTrigger added in v1.34.0

func ValidateTrigger(t Trigger) error

Validators

func ValidateWebhookURLs added in v1.28.0

func ValidateWebhookURLs(urls []string) error

Types

type Action added in v1.34.0

type Action struct {
	Type TaskActionType `json:"type"`
	// Payload is the json payload that stores action specific settings or config.
	// This should be unmarshalled into a concrete type during usage
	Payload string `json:"payload"`
}

type ActionType added in v1.26.0

type ActionType string

type AssignedRun

type AssignedRun struct {
	RunLink
	Tasks []AssignedTask
}

AssignedRun represents all the info needed to display a Run & ChecklistItem to a user

type AssignedTask

type AssignedTask struct {
	// ID is the identifier of the containing checklist.
	ChecklistID string

	// Title is the name of the containing checklist.
	ChecklistTitle string

	ChecklistItem
}

AssignedTask represents a ChecklistItem + extra info needed to display to a user

type CategorizeChannelPayload added in v1.26.0

type CategorizeChannelPayload struct {
	CategoryName string `json:"category_name" mapstructure:"category_name"`
}

type Category added in v1.31.0

type Category struct {
	ID        string         `json:"id"`
	Name      string         `json:"name"`
	TeamID    string         `json:"team_id"`
	UserID    string         `json:"user_id"`
	Collapsed bool           `json:"collapsed"`
	CreateAt  int64          `json:"create_at"`
	UpdateAt  int64          `json:"update_at"`
	DeleteAt  int64          `json:"delete_at"`
	Items     []CategoryItem `json:"items"`
}

Category represents sidebar category with items

func (*Category) ContainsItem added in v1.31.0

func (c *Category) ContainsItem(item CategoryItem) bool

func (*Category) IsValid added in v1.31.0

func (c *Category) IsValid() error

type CategoryItem added in v1.31.0

type CategoryItem struct {
	ItemID string           `json:"item_id"`
	Type   CategoryItemType `json:"type"`
	Name   string           `json:"name"`
	Public bool             `json:"public"`
}

type CategoryItemType added in v1.31.0

type CategoryItemType string
const (
	PlaybookItemType CategoryItemType = "p"
	RunItemType      CategoryItemType = "r"
)

func StringToItemType added in v1.31.0

func StringToItemType(item string) (CategoryItemType, error)

type CategoryService added in v1.31.0

type CategoryService interface {
	// Create creates a new Category
	Create(category Category) (string, error)

	// Get retrieves category with categoryID for user for team
	Get(categoryID string) (Category, error)

	// GetCategories retrieves all categories for user for team
	GetCategories(teamID, userID string) ([]Category, error)

	// Update updates a category
	Update(category Category) error

	// Delete deletes a category
	Delete(categoryID string) error

	// AddFavorite favorites an item, which may be either run or playbook
	AddFavorite(item CategoryItem, teamID, userID string) error

	// DeleteFavorite unfavorites an item, which may be either run or playbook
	DeleteFavorite(item CategoryItem, teamID, userID string) error

	// IsItemFavorite returns whether item was favorited or not
	IsItemFavorite(item CategoryItem, teamID, userID string) (bool, error)

	AreItemsFavorites(items []CategoryItem, teamID, userID string) ([]bool, error)
}

CategoryService is the category service for managing categories

func NewCategoryService added in v1.31.0

func NewCategoryService(store CategoryStore, api *pluginapi.Client, categoryTelemetry CategoryTelemetry) CategoryService

NewPlaybookService returns a new playbook service

type CategoryStore added in v1.31.0

type CategoryStore interface {
	// Get retrieves a Category. Returns ErrNotFound if not found.
	Get(id string) (Category, error)

	// Create creates a new Category
	Create(category Category) error

	// GetCategories retrieves all categories for user for team
	GetCategories(teamID, userID string) ([]Category, error)

	// Update updates a category
	Update(category Category) error

	// Delete deletes a category
	Delete(categoryID string) error

	// GetFavoriteCategory returns favorite category
	GetFavoriteCategory(teamID, userID string) (Category, error)

	// AddItemToFavoriteCategory adds an item to favorite category,
	// if favorite category does not exist it creates one
	AddItemToFavoriteCategory(item CategoryItem, teamID, userID string) error

	// AddItemToCategory adds an item to category
	AddItemToCategory(item CategoryItem, categoryID string) error

	// DeleteItemFromCategory adds an item to category
	DeleteItemFromCategory(item CategoryItem, categoryID string) error
}

type CategoryTelemetry added in v1.31.0

type CategoryTelemetry interface {
	// FavoriteItem tracks run favoriting of an item. Item can be run or a playbook
	FavoriteItem(item CategoryItem, userID string)

	// UnfavoriteItem tracks run unfavoriting of an item. Item can be run or a playbook
	UnfavoriteItem(item CategoryItem, userID string)
}

type ChannelActionService added in v1.26.0

type ChannelActionService interface {
	// Create creates a new action
	Create(action GenericChannelAction) (string, error)

	// Get returns the action identified by id
	Get(id string) (GenericChannelAction, error)

	// GetChannelActions returns all actions in channelID,
	// filtered with the options if different from its zero value
	GetChannelActions(channelID string, options GetChannelActionOptions) ([]GenericChannelAction, error)

	// Update updates an existing action identified by action.ID
	Update(action GenericChannelAction, userID string) error

	// UserHasJoinedChannel is called when userID has joined channelID. If actorID is not blank, userID
	// was invited by actorID.
	UserHasJoinedChannel(userID, channelID, actorID string)

	// CheckAndSendMessageOnJoin checks if userID has viewed channelID and sends
	// the registered welcome message action. Returns true if the message was sent.
	CheckAndSendMessageOnJoin(userID, channelID string) bool

	// MessageHasBeenPosted suggests playbooks to the user if triggered
	MessageHasBeenPosted(post *model.Post)
}

func NewChannelActionsService added in v1.26.0

func NewChannelActionsService(api *pluginapi.Client, poster bot.Poster, configService config.Service, store ChannelActionStore, playbookGetter PlaybookGetter, keywordsThreadIgnorer KeywordsThreadIgnorer, telemetry ChannelActionTelemetry) ChannelActionService

type ChannelActionStore added in v1.26.0

type ChannelActionStore interface {
	// Create creates a new action
	Create(action GenericChannelAction) (string, error)

	// Get returns the action identified by id
	Get(id string) (GenericChannelAction, error)

	// GetChannelActions returns all actions in channelID,
	// filtered with the options if different from its zero value
	GetChannelActions(channelID string, options GetChannelActionOptions) ([]GenericChannelAction, error)

	// Update updates an existing action identified by action.ID
	Update(action GenericChannelAction) error

	// HasViewedChannel returns true if userID has viewed channelID
	HasViewedChannel(userID, channelID string) bool

	// SetViewedChannel records that userID has viewed channelID. NOTE: does not check if there is already a
	// record of that userID/channelID (i.e., will create duplicate rows)
	SetViewedChannel(userID, channelID string) error

	// SetViewedChannel records that all users in userIDs have viewed channelID.
	SetMultipleViewedChannel(userIDs []string, channelID string) error
}

type ChannelActionTelemetry added in v1.26.0

type ChannelActionTelemetry interface {
	// RunChannelAction tracks the execution of a channel action, performed by the specified user.
	RunChannelAction(action GenericChannelAction, userID string)

	// UpdateChannelAction tracks the update of a channel action, performed by the specified user.
	UpdateChannelAction(action GenericChannelAction, userID string)
}

ChannelActionTelemetry defines the methods that the ChannelAction service needs from RudderTelemetry. userID is the user initiating the event.

type ChannelPlaybookMode added in v1.34.0

type ChannelPlaybookMode int

ChannelPlaybookMode is a type alias to hold all possible modes for playbook > run > channel relation

const (
	PlaybookRunCreateNewChannel ChannelPlaybookMode = iota
	PlaybookRunLinkExistingChannel
)

func (ChannelPlaybookMode) MarshalText added in v1.34.0

func (cpm ChannelPlaybookMode) MarshalText() ([]byte, error)

MarshalText converts a ChannelPlaybookMode to a string for serializers (including JSON)

func (*ChannelPlaybookMode) Scan added in v1.34.0

func (cpm *ChannelPlaybookMode) Scan(src interface{}) error

Scan parses a ChannelPlaybookMode back from the DB

func (ChannelPlaybookMode) String added in v1.34.0

func (cpm ChannelPlaybookMode) String() string

String creates the string version of the TelemetryTrack

func (*ChannelPlaybookMode) UnmarshalText added in v1.34.0

func (cpm *ChannelPlaybookMode) UnmarshalText(text []byte) error

UnmarshalText parses a ChannelPlaybookMode from text. For deserializers (including JSON)

func (ChannelPlaybookMode) Value added in v1.34.0

func (cpm ChannelPlaybookMode) Value() (driver.Value, error)

Value represents a ChannelPlaybookMode as a type writable into the DB

type Checklist

type Checklist struct {
	// ID is the identifier of the checklist.
	ID string `json:"id" export:"-"`

	// Title is the name of the checklist.
	Title string `json:"title" export:"title"`

	// Items is an array of all the items in the checklist.
	Items []ChecklistItem `json:"items" export:"-"`
}

Checklist represents a checklist in a playbook.

func (Checklist) Clone

func (c Checklist) Clone() Checklist

func (Checklist) GetItems added in v1.35.0

func (c Checklist) GetItems() []ChecklistItemCommon

type ChecklistCommon added in v1.35.0

type ChecklistCommon interface {
	GetItems() []ChecklistItemCommon
}

ChecklistCommon allows access on common fields of Checklist and api.UpdateChecklist

type ChecklistItem

type ChecklistItem struct {
	// ID is the identifier of the checklist item.
	ID string `json:"id" export:"-"`

	// Title is the content of the checklist item.
	Title string `json:"title" export:"title"`

	// State is the state of the checklist item: "closed" if it's checked, "skipped" if it has
	// been skipped, the empty string otherwise.
	State string `json:"state" export:"-"`

	// StateModified is the timestamp, in milliseconds since epoch, of the last time the item's
	// state was modified. 0 if it was never modified.
	StateModified int64 `json:"state_modified" export:"-"`

	// AssigneeID is the identifier of the user to whom this item is assigned.
	AssigneeID string `json:"assignee_id" export:"-"`

	// AssigneeModified is the timestamp, in milliseconds since epoch, of the last time the item's
	// assignee was modified. 0 if it was never modified.
	AssigneeModified int64 `json:"assignee_modified" export:"-"`

	// Command, if not empty, is the slash command that can be run as part of this item.
	Command string `json:"command" export:"command"`

	// CommandLastRun is the timestamp, in milliseconds since epoch, of the last time the item's
	// slash command was run. 0 if it was never run.
	CommandLastRun int64 `json:"command_last_run" export:"-"`

	// Description is a string with the markdown content of the long description of the item.
	Description string `json:"description" export:"description"`

	// LastSkipped is the timestamp, in milliseconds since epoch, of the last time the item
	// was skipped. 0 if it was never skipped.
	LastSkipped int64 `json:"delete_at" export:"-"`

	// DueDate is the timestamp, in milliseconds since epoch. indicates relative or absolute due date
	// of the checklist item. 0 if not set.
	// Playbook can have only relative timstamp, run can have only absolute timestamp.
	DueDate int64 `json:"due_date" export:"due_date"`

	// TaskActions is an array of all the task actions associated with this task.
	TaskActions []TaskAction `json:"task_actions" export:"-"`
}

ChecklistItem represents an item in a checklist.

func (*ChecklistItem) GetAssigneeID added in v1.35.0

func (ci *ChecklistItem) GetAssigneeID() string

func (*ChecklistItem) SetAssigneeModified added in v1.35.0

func (ci *ChecklistItem) SetAssigneeModified(modified int64)

func (*ChecklistItem) SetCommandLastRun added in v1.35.0

func (ci *ChecklistItem) SetCommandLastRun(lastRun int64)

func (*ChecklistItem) SetState added in v1.35.0

func (ci *ChecklistItem) SetState(state string)

func (*ChecklistItem) SetStateModified added in v1.35.0

func (ci *ChecklistItem) SetStateModified(modified int64)

type ChecklistItemCommon added in v1.35.0

type ChecklistItemCommon interface {
	GetAssigneeID() string

	SetAssigneeModified(modified int64)
	SetState(state string)
	SetStateModified(modified int64)
	SetCommandLastRun(lastRun int64)
}

ChecklistItemCommon allows access on common fields of ChecklistItem and api.UpdateChecklistItem

type DialogState

type DialogState struct {
	PostID       string `json:"post_id"`
	ClientID     string `json:"client_id"`
	PromptPostID string `json:"prompt_post_id"`
}

DialogState holds the start playbook run interactive dialog's state as it appears in the client and is submitted back to the server.

type DialogStateAddToTimeline

type DialogStateAddToTimeline struct {
	PostID string `json:"post_id"`
}

type DigestNotificationSettings

type DigestNotificationSettings struct {
	DisableDailyDigest  bool `json:"disable_daily_digest"`
	DisableWeeklyDigest bool `json:"disable_weekly_digest"`
}

DigestNotificationSettings is a separate type to make it easy to marshal/unmarshal it into JSON in the sqlstore. It is set by the user with the `/playbook settings digest [on/off]` slash command.

type GenericChannelAction added in v1.26.0

type GenericChannelAction struct {
	GenericChannelActionWithoutPayload
	Payload interface{} `json:"payload"`
}

type GenericChannelActionWithoutPayload added in v1.26.0

type GenericChannelActionWithoutPayload struct {
	ID          string      `json:"id"`
	ChannelID   string      `json:"channel_id"`
	Enabled     bool        `json:"enabled"`
	DeleteAt    int64       `json:"delete_at"`
	ActionType  ActionType  `json:"action_type"`
	TriggerType TriggerType `json:"trigger_type"`
}

type GenericTelemetry added in v1.34.0

type GenericTelemetry interface {
	Page(name TelemetryPage, properties map[string]interface{})
	Track(name TelemetryTrack, properties map[string]interface{})
}

GenericTelemetry is the generic interface for telemetry.

type GetChannelActionOptions added in v1.26.0

type GetChannelActionOptions struct {
	ActionType  ActionType
	TriggerType TriggerType
}

type GetPlaybookRunsResults

type GetPlaybookRunsResults struct {
	TotalCount int           `json:"total_count"`
	PageCount  int           `json:"page_count"`
	PerPage    int           `json:"per_page"`
	HasMore    bool          `json:"has_more"`
	Items      []PlaybookRun `json:"items"`
}

GetPlaybookRunsResults collects the results of the GetPlaybookRuns call: the list of PlaybookRuns matching the HeaderFilterOptions, and the TotalCount of the matching playbook runs before paging was applied.

func (GetPlaybookRunsResults) Clone

func (GetPlaybookRunsResults) MarshalJSON

func (r GetPlaybookRunsResults) MarshalJSON() ([]byte, error)

type GetPlaybooksResults

type GetPlaybooksResults struct {
	TotalCount int        `json:"total_count"`
	PageCount  int        `json:"page_count"`
	HasMore    bool       `json:"has_more"`
	Items      []Playbook `json:"items"`
}

func (GetPlaybooksResults) MarshalJSON

func (r GetPlaybooksResults) MarshalJSON() ([]byte, error)

MarshalJSON customizes the JSON marshalling for GetPlaybooksResults by rendering a nil Items as an empty slice instead.

type JobOnceScheduler

type JobOnceScheduler interface {
	Start() error
	SetCallback(callback func(string)) error
	ListScheduledJobs() ([]cluster.JobOnceMetadata, error)
	ScheduleOnce(key string, runAt time.Time) (*cluster.JobOnce, error)
	Cancel(key string)
}

type KeywordsByUsersTrigger added in v1.34.0

type KeywordsByUsersTrigger struct {
	Payload KeywordsByUsersTriggerPayload
	// contains filtered or unexported fields
}

Triggers

func NewKeywordsByUsersTrigger added in v1.34.0

func NewKeywordsByUsersTrigger(trigger Trigger) (*KeywordsByUsersTrigger, error)

func (*KeywordsByUsersTrigger) IsTriggered added in v1.34.0

func (t *KeywordsByUsersTrigger) IsTriggered(post *model.Post) bool

func (*KeywordsByUsersTrigger) IsValid added in v1.34.0

func (t *KeywordsByUsersTrigger) IsValid() error

type KeywordsByUsersTriggerPayload added in v1.34.0

type KeywordsByUsersTriggerPayload struct {
	Keywords []string `json:"keywords" mapstructure:"keywords"`
	UserIDs  []string `json:"user_ids" mapstructure:"user_ids"`
}

type KeywordsThreadIgnorer

type KeywordsThreadIgnorer interface {
	Ignore(postID, userID string)
	IsIgnored(postID, userID string) bool
}

func NewKeywordsThreadIgnorer

func NewKeywordsThreadIgnorer() KeywordsThreadIgnorer

type LicenseChecker

type LicenseChecker interface {
	PlaybookAllowed(isPlaybookPublic bool) bool
	RetrospectiveAllowed() bool
	TimelineAllowed() bool
	StatsAllowed() bool
	ChecklistItemDueDateAllowed() bool
}

type MarkItemAsDoneAction added in v1.34.0

type MarkItemAsDoneAction struct {
	Payload MarkItemAsDoneActionPayload
	// contains filtered or unexported fields
}

Actions

func NewMarkItemAsDoneAction added in v1.34.0

func NewMarkItemAsDoneAction(action Action) (*MarkItemAsDoneAction, error)

func (*MarkItemAsDoneAction) IsValid added in v1.34.0

func (a *MarkItemAsDoneAction) IsValid() error

type MarkItemAsDoneActionPayload added in v1.34.0

type MarkItemAsDoneActionPayload struct {
	Enabled bool `json:"enabled"`
}

type Metadata

type Metadata struct {
	ChannelName        string   `json:"channel_name"`
	ChannelDisplayName string   `json:"channel_display_name"`
	TeamName           string   `json:"team_name"`
	NumParticipants    int64    `json:"num_participants"`
	TotalPosts         int64    `json:"total_posts"`
	Followers          []string `json:"followers"`
}

Metadata tracks ancillary metadata about a playbook run.

type OwnerInfo

type OwnerInfo struct {
	UserID    string `json:"user_id"`
	Username  string `json:"username"`
	FirstName string `json:"first_name"`
	LastName  string `json:"last_name"`
	Nickname  string `json:"nickname"`
}

OwnerInfo holds the summary information of a owner.

type PermissionsService

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

func NewPermissionsService

func NewPermissionsService(
	playbookService PlaybookService,
	runService PlaybookRunService,
	pluginAPI *pluginapi.Client,
	configService config.Service,
	licenseChecker LicenseChecker,
) *PermissionsService

func (*PermissionsService) ChannelActionCreate added in v1.26.0

func (p *PermissionsService) ChannelActionCreate(userID, channelID string) error

func (*PermissionsService) ChannelActionUpdate added in v1.26.0

func (p *PermissionsService) ChannelActionUpdate(userID, channelID string) error

func (*PermissionsService) ChannelActionView added in v1.26.0

func (p *PermissionsService) ChannelActionView(userID, channelID string) error

func (*PermissionsService) DeletePlaybook

func (p *PermissionsService) DeletePlaybook(userID string, playbook Playbook) error

func (*PermissionsService) FilterInvitedGroupIDs added in v1.28.0

func (p *PermissionsService) FilterInvitedGroupIDs(invitedGroupIDs []string) []string

func (*PermissionsService) FilterInvitedUserIDs added in v1.28.0

func (p *PermissionsService) FilterInvitedUserIDs(invitedUserIDs []string, teamID string) []string

func (*PermissionsService) HasPermissionsToRun added in v1.34.0

func (p *PermissionsService) HasPermissionsToRun(userID string, run *PlaybookRun, permission *model.Permission) bool

func (*PermissionsService) NoAddedBroadcastChannelsWithoutPermission added in v1.28.0

func (p *PermissionsService) NoAddedBroadcastChannelsWithoutPermission(userID string, broadcastChannelIDs, oldBroadcastChannelIDs []string) error

func (*PermissionsService) PlaybookCreate

func (p *PermissionsService) PlaybookCreate(userID string, playbook Playbook) error

func (*PermissionsService) PlaybookIsPublic

func (p *PermissionsService) PlaybookIsPublic(playbook Playbook) bool

func (*PermissionsService) PlaybookList

func (p *PermissionsService) PlaybookList(userID, teamID string) error

func (*PermissionsService) PlaybookMakePrivate

func (p *PermissionsService) PlaybookMakePrivate(userID string, playbook Playbook) error

func (*PermissionsService) PlaybookMakePublic

func (p *PermissionsService) PlaybookMakePublic(userID string, playbook Playbook) error

func (*PermissionsService) PlaybookManageMembers

func (p *PermissionsService) PlaybookManageMembers(userID string, playbook Playbook) error

func (*PermissionsService) PlaybookManageProperties

func (p *PermissionsService) PlaybookManageProperties(userID string, playbook Playbook) error

func (*PermissionsService) PlaybookManageRoles added in v1.26.0

func (p *PermissionsService) PlaybookManageRoles(userID string, playbook Playbook) error

func (*PermissionsService) PlaybookModifyWithFixes

func (p *PermissionsService) PlaybookModifyWithFixes(userID string, playbook *Playbook, oldPlaybook Playbook) error

PlaybookodifyWithFixes checks both ManageProperties and ManageMembers permissions performs permissions checks that can be resolved though modification of the input. This function modifies the playbook argument.

func (*PermissionsService) PlaybookView

func (p *PermissionsService) PlaybookView(userID string, playbookID string) error

func (*PermissionsService) PlaybookViewWithPlaybook

func (p *PermissionsService) PlaybookViewWithPlaybook(userID string, playbook Playbook) error

func (*PermissionsService) RunCreate

func (p *PermissionsService) RunCreate(userID string, playbook Playbook) error

func (*PermissionsService) RunManageProperties

func (p *PermissionsService) RunManageProperties(userID, runID string) error

func (*PermissionsService) RunView

func (p *PermissionsService) RunView(userID, runID string) error

type Playbook

type Playbook struct {
	ID                                      string                 `json:"id" export:"-"`
	Title                                   string                 `json:"title" export:"title"`
	Description                             string                 `json:"description" export:"description"`
	Public                                  bool                   `json:"public" export:"-"`
	TeamID                                  string                 `json:"team_id" export:"-"`
	CreatePublicPlaybookRun                 bool                   `json:"create_public_playbook_run" export:"-"`
	CreateAt                                int64                  `json:"create_at" export:"-"`
	UpdateAt                                int64                  `json:"update_at" export:"-"`
	DeleteAt                                int64                  `json:"delete_at" export:"-"`
	NumStages                               int64                  `json:"num_stages" export:"-"`
	NumSteps                                int64                  `json:"num_steps" export:"-"`
	NumRuns                                 int64                  `json:"num_runs" export:"-"`
	NumActions                              int64                  `json:"num_actions" export:"-"`
	LastRunAt                               int64                  `json:"last_run_at" export:"-"`
	Checklists                              []Checklist            `json:"checklists" export:"-"`
	Members                                 []PlaybookMember       `json:"members" export:"-"`
	ReminderMessageTemplate                 string                 `json:"reminder_message_template" export:"reminder_message_template"`
	ReminderTimerDefaultSeconds             int64                  `json:"reminder_timer_default_seconds" export:"reminder_timer_default_seconds"`
	StatusUpdateEnabled                     bool                   `json:"status_update_enabled" export:"status_update_enabled"`
	InvitedUserIDs                          []string               `json:"invited_user_ids" export:"-"`
	InvitedGroupIDs                         []string               `json:"invited_group_ids" export:"-"`
	InviteUsersEnabled                      bool                   `json:"invite_users_enabled" export:"-"`
	DefaultOwnerID                          string                 `json:"default_owner_id" export:"-"`
	DefaultOwnerEnabled                     bool                   `json:"default_owner_enabled" export:"-"`
	BroadcastChannelIDs                     []string               `json:"broadcast_channel_ids" export:"-"`
	WebhookOnCreationURLs                   []string               `json:"webhook_on_creation_urls" export:"-"`
	WebhookOnCreationEnabled                bool                   `json:"webhook_on_creation_enabled" export:"-"`
	MessageOnJoin                           string                 `json:"message_on_join" export:"message_on_join"`
	MessageOnJoinEnabled                    bool                   `json:"message_on_join_enabled" export:"message_on_join_enabled"`
	RetrospectiveReminderIntervalSeconds    int64                  `json:"retrospective_reminder_interval_seconds" export:"retrospective_reminder_interval_seconds"`
	RetrospectiveTemplate                   string                 `json:"retrospective_template" export:"retrospective_template"`
	RetrospectiveEnabled                    bool                   `json:"retrospective_enabled" export:"retrospective_enabled"`
	WebhookOnStatusUpdateURLs               []string               `json:"webhook_on_status_update_urls" export:"-"`
	SignalAnyKeywords                       []string               `json:"signal_any_keywords" export:"signal_any_keywords"`
	SignalAnyKeywordsEnabled                bool                   `json:"signal_any_keywords_enabled" export:"signal_any_keywords_enabled"`
	CategorizeChannelEnabled                bool                   `json:"categorize_channel_enabled" export:"categorize_channel_enabled"`
	CategoryName                            string                 `json:"category_name" export:"category_name"`
	RunSummaryTemplateEnabled               bool                   `json:"run_summary_template_enabled" export:"run_summary_template_enabled"`
	RunSummaryTemplate                      string                 `json:"run_summary_template" export:"run_summary_template"`
	ChannelNameTemplate                     string                 `json:"channel_name_template" export:"channel_name_template"`
	DefaultPlaybookAdminRole                string                 `json:"default_playbook_admin_role" export:"-"`
	DefaultPlaybookMemberRole               string                 `json:"default_playbook_member_role" export:"-"`
	DefaultRunAdminRole                     string                 `json:"default_run_admin_role" export:"-"`
	DefaultRunMemberRole                    string                 `json:"default_run_member_role" export:"-"`
	Metrics                                 []PlaybookMetricConfig `json:"metrics" export:"metrics"`
	ActiveRuns                              int64                  `json:"active_runs" export:"-"`
	CreateChannelMemberOnNewParticipant     bool                   `json:"create_channel_member_on_new_participant" export:"create_channel_member_on_new_participant"`
	RemoveChannelMemberOnRemovedParticipant bool                   `json:"remove_channel_member_on_removed_participant" export:"create_channel_member_on_removed_participant"`

	// ChannelID is the identifier of the channel that would be -potentially- linked
	// to any new run of this playbook
	ChannelID string `json:"channel_id" export:"channel_id"`

	// ChannelMode is the playbook>run>channel flow used
	ChannelMode ChannelPlaybookMode `json:"channel_mode" export:"channel_mode"`

	// Deprecated: preserved for backwards compatibility with v1.27
	BroadcastEnabled             bool `json:"broadcast_enabled" export:"-"`
	WebhookOnStatusUpdateEnabled bool `json:"webhook_on_status_update_enabled" export:"-"`
}

Playbook represents a desired business outcome, from which playbook runs are started to solve a specific instance. The tag export supports the export/import feature. If the field makes sense for export, the value should be the JSON name of the item in the export format. If the field should not be exported the value should be "-". Fields should be exported if they are not server specific like InvitedUserIDs or are tracking metadata like CreateAt.

func (Playbook) Clone

func (p Playbook) Clone() Playbook

func (Playbook) GetRunChannelID added in v1.34.0

func (p Playbook) GetRunChannelID() string

func (Playbook) MarshalJSON

func (p Playbook) MarshalJSON() ([]byte, error)

type PlaybookFilterOptions

type PlaybookFilterOptions struct {
	Sort               SortField
	Direction          SortDirection
	SearchTerm         string
	WithArchived       bool
	WithMembershipOnly bool //if true will return only playbooks you are a member of
	PlaybookIDs        []string

	// Pagination options.
	Page    int
	PerPage int
}

PlaybookFilterOptions specifies the parameters when getting playbooks.

func (*PlaybookFilterOptions) Clone

Clone duplicates the given options.

func (PlaybookFilterOptions) Validate

Validate returns a new, validated filter options or returns an error if invalid.

type PlaybookGetter added in v1.26.0

type PlaybookGetter interface {
	Get(id string) (Playbook, error)
}

type PlaybookInsight added in v1.32.0

type PlaybookInsight struct {
	// ID of the playbook
	// required: true
	PlaybookID string `json:"playbook_id"`

	// Run count of playbook
	// required: true
	NumRuns int `json:"num_runs"`

	// Title of playbook
	// required: true
	Title string `json:"title"`

	// Time the playbook was last run.
	// required: false
	LastRunAt int64 `json:"last_run_at"`
}

type PlaybookMember

type PlaybookMember struct {
	UserID      string   `json:"user_id"`
	Roles       []string `json:"roles"`
	SchemeRoles []string `json:"scheme_roles"`
}

func (PlaybookMember) Clone

func (pm PlaybookMember) Clone() PlaybookMember

type PlaybookMetricConfig

type PlaybookMetricConfig struct {
	ID          string   `json:"id" export:"-"`
	PlaybookID  string   `json:"playbook_id" export:"-"`
	Title       string   `json:"title" export:"title"`
	Description string   `json:"description" export:"description"`
	Type        string   `json:"type" export:"type"`
	Target      null.Int `json:"target" export:"target"`
}

type PlaybookRun

type PlaybookRun struct {
	// ID is the unique identifier of the playbook run.
	ID string `json:"id"`

	// Name is the name of the playbook run's channel.
	Name string `json:"name"`

	// Summary is a short string, in Markdown, describing what the run is.
	Summary string `json:"summary"`

	// SummaryModifiedAt is date when the summary was modified
	SummaryModifiedAt int64 `json:"summary_modified_at"`

	// OwnerUserID is the user identifier of the playbook run's owner.
	OwnerUserID string `json:"owner_user_id"`

	// ReporterUserID is the user identifier of the playbook run's reporter; i.e., the user that created the run.
	ReporterUserID string `json:"reporter_user_id"`

	// TeamID is the identifier of the team the playbook run lives in.
	TeamID string `json:"team_id"`

	// ChannelID is the identifier of the playbook run's channel.
	ChannelID string `json:"channel_id"`

	// CreateAt is the timestamp, in milliseconds since epoch, of when the playbook run was created.
	CreateAt int64 `json:"create_at"`

	// EndAt is the timestamp, in milliseconds since epoch, of when the playbook run was ended.
	// If 0, the run is still ongoing.
	EndAt int64 `json:"end_at"`

	// Deprecated: preserved for backwards compatibility with v1.2.
	DeleteAt int64 `json:"delete_at"`

	// Deprecated: preserved for backwards compatibility with v1.2.
	ActiveStage int `json:"active_stage"`

	// Deprecated: preserved for backwards compatibility with v1.2.
	ActiveStageTitle string `json:"active_stage_title"`

	// PostID, if not empty, is the identifier of the post from which this playbook run was originally created.
	PostID string `json:"post_id"`

	// PlaybookID is the identifier of the playbook from which this run was created.
	PlaybookID string `json:"playbook_id"`

	// Checklists is an array of the checklists in the run.
	Checklists []Checklist `json:"checklists"`

	// StatusPosts is an array of all the status updates posted in the run.
	StatusPosts []StatusPost `json:"status_posts"`

	// CurrentStatus is the current status of the playbook run.
	// It can be StatusInProgress ("InProgress") or StatusFinished ("Finished")
	CurrentStatus string `json:"current_status"`

	// LastStatusUpdateAt is the timestamp, in milliseconds since epoch, of the time the last
	// status update was posted.
	LastStatusUpdateAt int64 `json:"last_status_update_at"`

	// ReminderPostID, if not empty, is the identifier of the reminder posted to the channel to
	// update the status.
	ReminderPostID string `json:"reminder_post_id"`

	// PreviousReminder, if not empty, is the time.Duration (nanoseconds) at which the next
	// scheduled status update will be posted.
	PreviousReminder time.Duration `json:"previous_reminder"`

	// ReminderMessageTemplate, if not empty, is the template shown when updating the status of the
	// playbook run for the first time.
	ReminderMessageTemplate string `json:"reminder_message_template"`

	// ReminderTimerDefaultSeconds is the expected default interval, in seconds,
	// between every status update
	ReminderTimerDefaultSeconds int64 `json:"reminder_timer_default_seconds"`

	//Defines if status update functionality is enabled
	StatusUpdateEnabled bool `json:"status_update_enabled"`

	// InvitedUserIDs, if not empty, is an array containing the identifiers of the users that were
	// automatically invited to the playbook run when it was created.
	InvitedUserIDs []string `json:"invited_user_ids"`

	// InvitedGroupIDs, if not empty, is an array containing the identifiers of the user groups that
	// were automatically invited to the playbook run when it was created.
	InvitedGroupIDs []string `json:"invited_group_ids"`

	// TimelineEvents is an array of the events saved to the timeline of the playbook run.
	TimelineEvents []TimelineEvent `json:"timeline_events"`

	// DefaultOwnerID, if not empty, is the identifier of the user that was automatically assigned
	// as owner of the playbook run when it was created.
	DefaultOwnerID string `json:"default_owner_id"`

	// BroadcastChannelIDs is an array of the identifiers of the channels where the playbook run
	// creation and status updates are announced.
	BroadcastChannelIDs []string `json:"broadcast_channel_ids"`

	// WebhookOnCreationURLs, if not empty, is the URL to which a POST request is made with the whole
	// playbook run as payload when the run is created.
	WebhookOnCreationURLs []string `json:"webhook_on_creation_urls"`

	// WebhookOnStatusUpdateURLs, if not empty, is the URL to which a POST request is made with the
	// whole playbook run as payload every time the status of the playbook run is updated.
	WebhookOnStatusUpdateURLs []string `json:"webhook_on_status_update_urls"`

	// StatusUpdateBroadcastChannelsEnabled is true if the channels broadcast action is enabled for
	// the run status update event, false otherwise.
	StatusUpdateBroadcastChannelsEnabled bool `json:"status_update_broadcast_channels_enabled"`

	// StatusUpdateBroadcastWebhooksEnabled is true if the webhooks broadcast action is enabled for
	// the run status update event, false otherwise.
	StatusUpdateBroadcastWebhooksEnabled bool `json:"status_update_broadcast_webhooks_enabled"`

	// Retrospective is a string containing the currently saved retrospective.
	// If RetrospectivePublishedAt is different than 0, this is the final published retrospective.
	Retrospective string `json:"retrospective"`

	// RetrospectivePublishedAt is the timestamp, in milliseconds since epoch, of the last time a
	// retrospective was published. If 0, the retrospective has not been published yet.
	RetrospectivePublishedAt int64 `json:"retrospective_published_at"`

	// RetrospectiveWasCanceled is true if the retrospective was cancelled, false otherwise.
	RetrospectiveWasCanceled bool `json:"retrospective_was_canceled"`

	// RetrospectiveReminderIntervalSeconds is the interval, in seconds, between subsequent reminders
	// to fill the retrospective.
	RetrospectiveReminderIntervalSeconds int64 `json:"retrospective_reminder_interval_seconds"`

	// Defines if retrospective functionality is enabled
	RetrospectiveEnabled bool `json:"retrospective_enabled"`

	// MessageOnJoin, if not empty, is the message shown to every user that joins the channel of
	// the playbook run.
	MessageOnJoin string `json:"message_on_join"`

	// ParticipantIDs is an array of the identifiers of all the participants in the playbook run.
	// A participant is any member of the playbook run channel that isn't a bot.
	ParticipantIDs []string `json:"participant_ids"`

	// CategoryName, if not empty, is the name of the category where the run channel will live.
	CategoryName string `json:"category_name"`

	// Playbook run metric values
	MetricsData []RunMetricData `json:"metrics_data"`

	// CreateChannelMemberOnNewParticipant is the Run action flag that defines if a new channel member will be added
	// to the run's channel when a new participant is added to the run (by themselve or by other members).
	CreateChannelMemberOnNewParticipant bool `json:"create_channel_member_on_new_participant" export:"create_channel_member_on_new_participant"`

	// RemoveChannelMemberOnRemovedParticipant is the Run action flag that defines if an existent channel member will be removed
	// from the run's channel when a new participant is added to the run (by themselve or by other members).
	RemoveChannelMemberOnRemovedParticipant bool `json:"remove_channel_member_on_removed_participant" export:"create_channel_member_on_removed_participant"`

	// Type determines a type of a run.
	// It can be RunTypePlaybook ("playbook") or RunTypeChannelChecklist ("channel")
	Type string `json:"type"`
}

PlaybookRun holds the detailed information of a playbook run.

NOTE: When adding a column to the db, search for "When adding a PlaybookRun column" to see where that column needs to be added in the sqlstore code.

func (*PlaybookRun) Clone

func (r *PlaybookRun) Clone() *PlaybookRun

func (PlaybookRun) MarshalJSON

func (r PlaybookRun) MarshalJSON() ([]byte, error)

func (*PlaybookRun) SetChecklistFromPlaybook added in v1.31.0

func (r *PlaybookRun) SetChecklistFromPlaybook(playbook Playbook)

SetChecklistFromPlaybook overwrites this run's checklists with the ones in the provided playbook.

func (*PlaybookRun) SetConfigurationFromPlaybook added in v1.31.0

func (r *PlaybookRun) SetConfigurationFromPlaybook(playbook Playbook, source string)

SetConfigurationFromPlaybook overwrites this run's configuration with the data from the provided playbook, effectively snapshoting the playbook's configuration in this moment of time.

type PlaybookRunFilterOptions

type PlaybookRunFilterOptions struct {
	// Gets all the headers with this TeamID.
	TeamID string `url:"team_id,omitempty"`

	// Pagination options.
	Page    int `url:"page,omitempty"`
	PerPage int `url:"per_page,omitempty"`

	// Sort sorts by this header field in json format (eg, "create_at", "end_at", "name", etc.);
	// defaults to "create_at".
	Sort SortField `url:"sort,omitempty"`

	// Direction orders by ascending or descending, defaulting to ascending.
	Direction SortDirection `url:"direction,omitempty"`

	// Statuses filters by all statuses in the list (inclusive)
	Statuses []string

	// OwnerID filters by owner's Mattermost user ID. Defaults to blank (no filter).
	OwnerID string `url:"owner_user_id,omitempty"`

	// ParticipantID filters playbook runs that have this member. Defaults to blank (no filter).
	ParticipantID string `url:"participant_id,omitempty"`

	// ParticipantOrFollowerID filters playbook runs that have this user as member or as follower. Defaults to blank (no filter).
	ParticipantOrFollowerID string `url:"participant_or_follower,omitempty"`

	// IncludeFavorites filters playbook runs that ParticipantOrFollowerID has marked as favorite.
	// There's no impact if ParticipantOrFollowerID is empty.
	IncludeFavorites bool `url:"include_favorites,omitempty"`

	// SearchTerm returns results of the search term and respecting the other header filter options.
	// The search term acts as a filter and respects the Sort and Direction fields (i.e., results are
	// not returned in relevance order).
	SearchTerm string `url:"search_term,omitempty"`

	// PlaybookID filters playbook runs that are derived from this playbook id.
	// Defaults to blank (no filter).
	PlaybookID string `url:"playbook_id,omitempty"`

	// ActiveGTE filters playbook runs that were active after (or equal) to the unix time given (in millis).
	// A value of 0 means the filter is ignored (which is the default).
	ActiveGTE int64 `url:"active_gte,omitempty"`

	// ActiveLT filters playbook runs that were active before the unix time given (in millis).
	// A value of 0 means the filter is ignored (which is the default).
	ActiveLT int64 `url:"active_lt,omitempty"`

	// StartedGTE filters playbook runs that were started after (or equal) to the unix time given (in millis).
	// A value of 0 means the filter is ignored (which is the default).
	StartedGTE int64 `url:"started_gte,omitempty"`

	// StartedLT filters playbook runs that were started before the unix time given (in millis).
	// A value of 0 means the filter is ignored (which is the default).
	StartedLT int64 `url:"started_lt,omitempty"`

	// ChannelID filters to playbook runs that are associated with the given channel ID
	ChannelID string `url:"channel_id,omitempty"`

	// Types filters by all run types in the list (inclusive)
	Types []string

	// Skip getting extra information (like timeline events and status posts). Used by GraphQL to limit the amount of data retrieved.
	SkipExtras bool
}

PlaybookRunFilterOptions specifies the optional parameters when getting playbook runs.

func (*PlaybookRunFilterOptions) Clone

Clone duplicates the given options.

func (PlaybookRunFilterOptions) Validate

Validate returns a new, validated filter options or returns an error if invalid.

type PlaybookRunService

type PlaybookRunService interface {
	// GetPlaybookRuns returns filtered playbook runs and the total count before paging.
	GetPlaybookRuns(requesterInfo RequesterInfo, options PlaybookRunFilterOptions) (*GetPlaybookRunsResults, error)

	// CreatePlaybookRun creates a new playbook run. userID is the user who initiated the CreatePlaybookRun.
	CreatePlaybookRun(playbookRun *PlaybookRun, playbook *Playbook, userID string, public bool) (*PlaybookRun, error)

	// OpenCreatePlaybookRunDialog opens an interactive dialog to start a new playbook run.
	OpenCreatePlaybookRunDialog(teamID, ownerID, triggerID, postID, clientID string, playbooks []Playbook) error

	// OpenUpdateStatusDialog opens an interactive dialog so the user can update the playbook run's status.
	OpenUpdateStatusDialog(playbookRunID, userID, triggerID string) error

	// OpenAddToTimelineDialog opens an interactive dialog so the user can add a post to the playbook run timeline.
	OpenAddToTimelineDialog(requesterInfo RequesterInfo, postID, teamID, triggerID string) error

	// OpenAddChecklistItemDialog opens an interactive dialog so the user can add a post to the playbook run timeline.
	OpenAddChecklistItemDialog(triggerID, userID, playbookRunID string, checklist int) error

	// AddPostToTimeline adds an event based on a post to a playbook run's timeline.
	AddPostToTimeline(playbookRunID, userID string, post *model.Post, summary string) error

	// RemoveTimelineEvent removes the timeline event (sets the DeleteAt to the current time).
	RemoveTimelineEvent(playbookRunID, userID, eventID string) error

	// UpdateStatus updates a playbook run's status.
	UpdateStatus(playbookRunID, userID string, options StatusUpdateOptions) error

	// OpenFinishPlaybookRunDialog opens the dialog to confirm the run should be finished.
	OpenFinishPlaybookRunDialog(playbookRunID, userID, triggerID string) error

	// FinishPlaybookRun changes a run's state to Finished. If run is already in Finished state, the call is a noop.
	FinishPlaybookRun(playbookRunID, userID string) error

	// ToggleStatusUpdates  enables or disables status update for the run
	ToggleStatusUpdates(playbookRunID, userID string, enable bool) error

	// GetPlaybookRun gets a playbook run by ID. Returns error if it could not be found.
	GetPlaybookRun(playbookRunID string) (*PlaybookRun, error)

	// GetPlaybookRunMetadata gets ancillary metadata about a playbook run.
	GetPlaybookRunMetadata(playbookRunID string) (*Metadata, error)

	// GetPlaybookRunsForChannelByUser get the playbookRuns associated with this channel and user.
	GetPlaybookRunsForChannelByUser(channelID string, userID string) ([]PlaybookRun, error)

	// GetOwners returns all the owners of playbook runs selected
	GetOwners(requesterInfo RequesterInfo, options PlaybookRunFilterOptions) ([]OwnerInfo, error)

	// IsOwner returns true if the userID is the owner for playbookRunID.
	IsOwner(playbookRunID string, userID string) bool

	// ChangeOwner processes a request from userID to change the owner for playbookRunID
	// to ownerID. Changing to the same ownerID is a no-op.
	ChangeOwner(playbookRunID string, userID string, ownerID string) error

	// ModifyCheckedState modifies the state of the specified checklist item
	// Idempotent, will not perform any actions if the checklist item is already in the specified state
	ModifyCheckedState(playbookRunID, userID, newState string, checklistNumber int, itemNumber int) error

	// ToggleCheckedState checks or unchecks the specified checklist item
	ToggleCheckedState(playbookRunID, userID string, checklistNumber, itemNumber int) error

	// SetAssignee sets the assignee for the specified checklist item
	// Idempotent, will not perform any actions if the checklist item is already assigned to assigneeID
	SetAssignee(playbookRunID, userID, assigneeID string, checklistNumber, itemNumber int) error

	// SetCommandToChecklistItem sets command to checklist item
	SetCommandToChecklistItem(playbookRunID, userID string, checklistNumber, itemNumber int, newCommand string) error

	// SetDueDate sets absolute due date timestamp for the specified checklist item
	SetDueDate(playbookRunID, userID string, duedate int64, checklistNumber, itemNumber int) error

	// SetTaskActionsToChecklistItem sets Task Actions to checklist item
	SetTaskActionsToChecklistItem(playbookRunID, userID string, checklistNumber, itemNumber int, taskActions []TaskAction) error

	// RunChecklistItemSlashCommand executes the slash command associated with the specified checklist item.
	RunChecklistItemSlashCommand(playbookRunID, userID string, checklistNumber, itemNumber int) (string, error)

	// DuplicateChecklistItem duplicates the checklist item.
	DuplicateChecklistItem(playbookRunID, userID string, checklistNumber, itemNumber int) error

	// AddChecklistItem adds an item to the specified checklist
	AddChecklistItem(playbookRunID, userID string, checklistNumber int, checklistItem ChecklistItem) error

	// RemoveChecklistItem removes an item from the specified checklist
	RemoveChecklistItem(playbookRunID, userID string, checklistNumber int, itemNumber int) error

	// DuplicateChecklist duplicates a checklist
	DuplicateChecklist(playbookRunID, userID string, checklistNumber int) error

	// SkipChecklist skips a checklist
	SkipChecklist(playbookRunID, userID string, checklistNumber int) error

	// RestoreChecklist restores a skipped checklist
	RestoreChecklist(playbookRunID, userID string, checklistNumber int) error

	// SkipChecklistItem removes an item from the specified checklist
	SkipChecklistItem(playbookRunID, userID string, checklistNumber int, itemNumber int) error

	// RestoreChecklistItem restores a skipped item from the specified checklist
	RestoreChecklistItem(playbookRunID, userID string, checklistNumber int, itemNumber int) error

	// EditChecklistItem changes the title, command and description of a specified checklist item.
	EditChecklistItem(playbookRunID, userID string, checklistNumber int, itemNumber int, newTitle, newCommand, newDescription string) error

	// MoveChecklistItem moves a checklist item from one position to another.
	MoveChecklist(playbookRunID, userID string, sourceChecklistIdx, destChecklistIdx int) error

	// MoveChecklistItem moves a checklist item from one position to another.
	MoveChecklistItem(playbookRunID, userID string, sourceChecklistIdx, sourceItemIdx, destChecklistIdx, destItemIdx int) error

	// GetChecklistItemAutocomplete returns the list of checklist items for playbookRuns to be used in autocomplete
	GetChecklistItemAutocomplete(playbookRuns []PlaybookRun) ([]model.AutocompleteListItem, error)

	// GetChecklistAutocomplete returns the list of checklists for playbookRuns to be used in autocomplete
	GetChecklistAutocomplete(playbookRuns []PlaybookRun) ([]model.AutocompleteListItem, error)

	// GetRunsAutocomplete returns the list of runs to be used in autocomplete
	GetRunsAutocomplete(playbookRuns []PlaybookRun) ([]model.AutocompleteListItem, error)

	// AddChecklist prepends a new checklist to the specified run
	AddChecklist(playbookRunID, userID string, checklist Checklist) error

	// RemoveChecklist removes the specified checklist.
	RemoveChecklist(playbookRunID, userID string, checklistNumber int) error

	// RenameChecklist renames the specified checklist
	RenameChecklist(playbookRunID, userID string, checklistNumber int, newTitle string) error

	// NukeDB removes all playbook run related data.
	NukeDB() error

	// SetReminder sets a reminder. After time.Now().Add(fromNow) in the future,
	// the owner will be reminded to update the playbook run's status.
	SetReminder(playbookRunID string, fromNow time.Duration) error

	// RemoveReminder removes the pending reminder for playbookRunID (if any).
	RemoveReminder(playbookRunID string)

	// HandleReminder is the handler for all reminder events.
	HandleReminder(key string)

	// SetNewReminder sets a new reminder for playbookRunID, removes any pending reminder, removes the
	// reminder post in the playbookRun's channel, and resets the PreviousReminder and
	// LastStatusUpdateAt (so the countdown timer to "update due" shows the correct time)
	SetNewReminder(playbookRunID string, newReminder time.Duration) error

	// ResetReminder records an event for snoozing a reminder, then calls SetNewReminder to create
	// the next reminder
	ResetReminder(playbookRunID string, newReminder time.Duration) error

	// ChangeCreationDate changes the creation date of the specified playbook run.
	ChangeCreationDate(playbookRunID string, creationTimestamp time.Time) error

	// UpdateRetrospective updates the retrospective for the given playbook run.
	UpdateRetrospective(playbookRunID, userID string, retrospective RetrospectiveUpdate) error

	// PublishRetrospective publishes the retrospective.
	PublishRetrospective(playbookRunID, userID string, retrospective RetrospectiveUpdate) error

	// CancelRetrospective cancels the retrospective.
	CancelRetrospective(playbookRunID, userID string) error

	// EphemeralPostTodoDigestToUser gathers the list of assigned tasks, participating runs, and overdue updates,
	// and sends an ephemeral post to userID on channelID. Use force = true to post even if there are no items.
	EphemeralPostTodoDigestToUser(userID string, channelID string, force bool, includeRunsInProgress bool) error

	// DMTodoDigestToUser gathers the list of assigned tasks, participating runs, and overdue updates,
	// and DMs the message to userID. Use force = true to DM even if there are no items.
	DMTodoDigestToUser(userID string, force bool, includeRunsInProgress bool) error

	// GetRunsWithAssignedTasks returns the list of runs that have tasks assigned to userID
	GetRunsWithAssignedTasks(userID string) ([]AssignedRun, error)

	// GetParticipatingRuns returns the list of active runs with userID as participant
	GetParticipatingRuns(userID string) ([]RunLink, error)

	// GetOverdueUpdateRuns returns the list of userID's runs that have overdue updates
	GetOverdueUpdateRuns(userID string) ([]RunLink, error)

	// Follow method lets user follow a specific playbook run
	Follow(playbookRunID, userID string) error

	// UnFollow method lets user unfollow a specific playbook run
	Unfollow(playbookRunID, userID string) error

	// GetFollowers returns list of followers for a specific playbook run
	GetFollowers(playbookRunID string) ([]string, error)

	// RestorePlaybookRun reverts a run from the Finished state. If run was not in Finished state, the call is a noop.
	RestorePlaybookRun(playbookRunID, userID string) error

	// RequestUpdate posts a status update request message in the run's channel
	RequestUpdate(playbookRunID, requesterID string) error

	// RequestJoinChannel posts a channel-join request message in the run's channel
	RequestJoinChannel(playbookRunID, requesterID string) error

	// RemoveParticipants removes users from the run's participants
	RemoveParticipants(playbookRunID string, userIDs []string, requesterUserID string) error

	// AddParticipants adds users to the participants list
	AddParticipants(playbookRunID string, userIDs []string, requesterUserID string, forceAddToChannel bool) error

	// GetPlaybookRunIDsForUser returns run ids where user is a participant or is following
	GetPlaybookRunIDsForUser(userID string) ([]string, error)

	// GetRunMetadataByIDs returns playbook runs metadata by passed run IDs.
	// Notice that order of passed ids and returned runs might not coincide
	GetRunMetadataByIDs(runIDs []string) ([]RunMetadata, error)

	// GetTaskMetadataByIDs gets PlaybookRunIDs and TeamIDs from runs by taskIDs
	GetTaskMetadataByIDs(taskIDs []string) ([]TopicMetadata, error)

	// GetStatusMetadataByIDs gets PlaybookRunIDs and TeamIDs from runs by statusIDs
	GetStatusMetadataByIDs(statusIDs []string) ([]TopicMetadata, error)

	// GraphqlUpdate taking a setmap for graphql
	GraphqlUpdate(id string, setmap map[string]interface{}) error

	// MessageHasBeenPosted checks posted messages for triggers that may trigger task actions
	MessageHasBeenPosted(post *model.Post)
}

PlaybookRunService is the playbook run service interface.

type PlaybookRunServiceImpl

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

PlaybookRunServiceImpl holds the information needed by the PlaybookRunService's methods to complete their functions.

func NewPlaybookRunService

func NewPlaybookRunService(
	pluginAPI *pluginapi.Client,
	store PlaybookRunStore,
	poster bot.Poster,
	configService config.Service,
	scheduler JobOnceScheduler,
	telemetry PlaybookRunTelemetry,
	genericTelemetry GenericTelemetry,
	api plugin.API,
	playbookService PlaybookService,
	channelActionService ChannelActionService,
	licenseChecker LicenseChecker,
	metricsService *metrics.Metrics,
) *PlaybookRunServiceImpl

NewPlaybookRunService creates a new PlaybookRunServiceImpl.

func (*PlaybookRunServiceImpl) AddChecklist

func (s *PlaybookRunServiceImpl) AddChecklist(playbookRunID, userID string, checklist Checklist) error

AddChecklist adds a checklist to the specified run

func (*PlaybookRunServiceImpl) AddChecklistItem

func (s *PlaybookRunServiceImpl) AddChecklistItem(playbookRunID, userID string, checklistNumber int, checklistItem ChecklistItem) error

AddChecklistItem adds an item to the specified checklist

func (*PlaybookRunServiceImpl) AddParticipants added in v1.34.0

func (s *PlaybookRunServiceImpl) AddParticipants(playbookRunID string, userIDs []string, requesterUserID string, forceAddToChannel bool) error

func (*PlaybookRunServiceImpl) AddPostToTimeline

func (s *PlaybookRunServiceImpl) AddPostToTimeline(playbookRunID, userID string, post *model.Post, summary string) error

func (*PlaybookRunServiceImpl) CancelRetrospective

func (s *PlaybookRunServiceImpl) CancelRetrospective(playbookRunID, cancelerID string) error

func (*PlaybookRunServiceImpl) ChangeCreationDate

func (s *PlaybookRunServiceImpl) ChangeCreationDate(playbookRunID string, creationTimestamp time.Time) error

ChangeCreationDate changes the creation date of the playbook run.

func (*PlaybookRunServiceImpl) ChangeOwner

func (s *PlaybookRunServiceImpl) ChangeOwner(playbookRunID, userID, ownerID string) error

ChangeOwner processes a request from userID to change the owner for playbookRunID to ownerID. Changing to the same ownerID is a no-op.

func (*PlaybookRunServiceImpl) CreatePlaybookRun

func (s *PlaybookRunServiceImpl) CreatePlaybookRun(playbookRun *PlaybookRun, pb *Playbook, userID string, public bool) (*PlaybookRun, error)

CreatePlaybookRun creates a new playbook run. userID is the user who initiated the CreatePlaybookRun.

func (*PlaybookRunServiceImpl) DMTodoDigestToUser

func (s *PlaybookRunServiceImpl) DMTodoDigestToUser(userID string, force bool, shouldSendFullData bool) error

DMTodoDigestToUser DMs the message to userID. Use force = true to DM even if there are no items.

func (*PlaybookRunServiceImpl) DuplicateChecklist added in v1.28.0

func (s *PlaybookRunServiceImpl) DuplicateChecklist(playbookRunID, userID string, checklistNumber int) error

DuplicateChecklist duplicates a checklist

func (*PlaybookRunServiceImpl) DuplicateChecklistItem added in v1.27.0

func (s *PlaybookRunServiceImpl) DuplicateChecklistItem(playbookRunID, userID string, checklistNumber, itemNumber int) error

func (*PlaybookRunServiceImpl) EditChecklistItem

func (s *PlaybookRunServiceImpl) EditChecklistItem(playbookRunID, userID string, checklistNumber, itemNumber int, newTitle, newCommand, newDescription string) error

EditChecklistItem changes the title of a specified checklist item

func (*PlaybookRunServiceImpl) EphemeralPostTodoDigestToUser added in v1.26.0

func (s *PlaybookRunServiceImpl) EphemeralPostTodoDigestToUser(userID string, channelID string, force bool, shouldSendFullData bool) error

EphemeralPostTodoDigestToUser builds todo digest message and sends an ephemeral post to userID, channelID. Use force = true to send post even if there are no items.

func (*PlaybookRunServiceImpl) FinishPlaybookRun

func (s *PlaybookRunServiceImpl) FinishPlaybookRun(playbookRunID, userID string) error

FinishPlaybookRun changes a run's state to Finished. If run is already in Finished state, the call is a noop.

func (*PlaybookRunServiceImpl) Follow

func (s *PlaybookRunServiceImpl) Follow(playbookRunID, userID string) error

Follow method lets user follow a specific playbook run

func (*PlaybookRunServiceImpl) GetChecklistAutocomplete

func (s *PlaybookRunServiceImpl) GetChecklistAutocomplete(playbookRuns []PlaybookRun) ([]model.AutocompleteListItem, error)

GetChecklistAutocomplete returns the list of checklist items for playbookRuns to be used in autocomplete

func (*PlaybookRunServiceImpl) GetChecklistItemAutocomplete

func (s *PlaybookRunServiceImpl) GetChecklistItemAutocomplete(playbookRuns []PlaybookRun) ([]model.AutocompleteListItem, error)

GetChecklistItemAutocomplete returns the list of checklist items for playbookRuns to be used in autocomplete

func (*PlaybookRunServiceImpl) GetFollowers

func (s *PlaybookRunServiceImpl) GetFollowers(playbookRunID string) ([]string, error)

GetFollowers returns list of followers for a specific playbook run

func (*PlaybookRunServiceImpl) GetOverdueUpdateRuns

func (s *PlaybookRunServiceImpl) GetOverdueUpdateRuns(userID string) ([]RunLink, error)

GetOverdueUpdateRuns returns the list of userID's runs that have overdue updates

func (*PlaybookRunServiceImpl) GetOwners

func (s *PlaybookRunServiceImpl) GetOwners(requesterInfo RequesterInfo, options PlaybookRunFilterOptions) ([]OwnerInfo, error)

GetOwners returns all the owners of the playbook runs selected by options

func (*PlaybookRunServiceImpl) GetParticipatingRuns

func (s *PlaybookRunServiceImpl) GetParticipatingRuns(userID string) ([]RunLink, error)

GetParticipatingRuns returns the list of active runs with userID as a participant

func (*PlaybookRunServiceImpl) GetPlaybookRun

func (s *PlaybookRunServiceImpl) GetPlaybookRun(playbookRunID string) (*PlaybookRun, error)

GetPlaybookRun gets a playbook run by ID. Returns error if it could not be found.

func (*PlaybookRunServiceImpl) GetPlaybookRunIDsForUser added in v1.34.0

func (s *PlaybookRunServiceImpl) GetPlaybookRunIDsForUser(userID string) ([]string, error)

GetPlaybookRunIDsForUser returns run ids where user is a participant or is following

func (*PlaybookRunServiceImpl) GetPlaybookRunMetadata

func (s *PlaybookRunServiceImpl) GetPlaybookRunMetadata(playbookRunID string) (*Metadata, error)

GetPlaybookRunMetadata gets ancillary metadata about a playbook run.

func (*PlaybookRunServiceImpl) GetPlaybookRuns

func (s *PlaybookRunServiceImpl) GetPlaybookRuns(requesterInfo RequesterInfo, options PlaybookRunFilterOptions) (*GetPlaybookRunsResults, error)

GetPlaybookRuns returns filtered playbook runs and the total count before paging.

func (*PlaybookRunServiceImpl) GetPlaybookRunsForChannelByUser added in v1.34.0

func (s *PlaybookRunServiceImpl) GetPlaybookRunsForChannelByUser(channelID string, userID string) ([]PlaybookRun, error)

GetPlaybookRunsForChannelByUser get the playbookRuns list associated with this channel and user.

func (*PlaybookRunServiceImpl) GetRunMetadataByIDs added in v1.34.0

func (s *PlaybookRunServiceImpl) GetRunMetadataByIDs(runIDs []string) ([]RunMetadata, error)

GetRunMetadataByIDs returns playbook runs metadata by passed run IDs.

func (*PlaybookRunServiceImpl) GetRunsAutocomplete added in v1.34.0

func (s *PlaybookRunServiceImpl) GetRunsAutocomplete(playbookRuns []PlaybookRun) ([]model.AutocompleteListItem, error)

GetRunsAutocomplete returns the list of runs to be used in autocomplete

func (*PlaybookRunServiceImpl) GetRunsWithAssignedTasks

func (s *PlaybookRunServiceImpl) GetRunsWithAssignedTasks(userID string) ([]AssignedRun, error)

GetRunsWithAssignedTasks returns the list of runs that have tasks assigned to userID

func (*PlaybookRunServiceImpl) GetSchemeRolesForChannel added in v1.32.0

func (s *PlaybookRunServiceImpl) GetSchemeRolesForChannel(channel *model.Channel) (string, string, string)

func (*PlaybookRunServiceImpl) GetStatusMetadataByIDs added in v1.34.0

func (s *PlaybookRunServiceImpl) GetStatusMetadataByIDs(statusIDs []string) ([]TopicMetadata, error)

GetStatusMetadataByIDs gets PlaybookRunIDs and TeamIDs from runs by statusIDs

func (*PlaybookRunServiceImpl) GetTaskMetadataByIDs added in v1.34.0

func (s *PlaybookRunServiceImpl) GetTaskMetadataByIDs(taskIDs []string) ([]TopicMetadata, error)

GetTaskMetadataByIDs gets PlaybookRunIDs and TeamIDs from runs by taskIDs

func (*PlaybookRunServiceImpl) GraphqlUpdate added in v1.34.0

func (s *PlaybookRunServiceImpl) GraphqlUpdate(id string, setmap map[string]interface{}) error

GraphqlUpdate updates fields based on a setmap

func (*PlaybookRunServiceImpl) HandleReminder

func (s *PlaybookRunServiceImpl) HandleReminder(key string)

HandleReminder is the handler for all reminder events.

func (*PlaybookRunServiceImpl) IsOwner

func (s *PlaybookRunServiceImpl) IsOwner(playbookRunID, userID string) bool

IsOwner returns true if the userID is the owner for playbookRunID.

func (*PlaybookRunServiceImpl) MessageHasBeenPosted added in v1.34.0

func (s *PlaybookRunServiceImpl) MessageHasBeenPosted(post *model.Post)

func (*PlaybookRunServiceImpl) ModifyCheckedState

func (s *PlaybookRunServiceImpl) ModifyCheckedState(playbookRunID, userID, newState string, checklistNumber, itemNumber int) error

ModifyCheckedState checks or unchecks the specified checklist item. Idempotent, will not perform any action if the checklist item is already in the given checked state

func (*PlaybookRunServiceImpl) MoveChecklist

func (s *PlaybookRunServiceImpl) MoveChecklist(playbookRunID, userID string, sourceChecklistIdx, destChecklistIdx int) error

MoveChecklist moves a checklist to a new location

func (*PlaybookRunServiceImpl) MoveChecklistItem

func (s *PlaybookRunServiceImpl) MoveChecklistItem(playbookRunID, userID string, sourceChecklistIdx, sourceItemIdx, destChecklistIdx, destItemIdx int) error

MoveChecklistItem moves a checklist item to a new location

func (*PlaybookRunServiceImpl) NukeDB

func (s *PlaybookRunServiceImpl) NukeDB() error

NukeDB removes all playbook run related data.

func (*PlaybookRunServiceImpl) OpenAddChecklistItemDialog

func (s *PlaybookRunServiceImpl) OpenAddChecklistItemDialog(triggerID, userID, playbookRunID string, checklist int) error

func (*PlaybookRunServiceImpl) OpenAddToTimelineDialog

func (s *PlaybookRunServiceImpl) OpenAddToTimelineDialog(requesterInfo RequesterInfo, postID, teamID, triggerID string) error

func (*PlaybookRunServiceImpl) OpenCreatePlaybookRunDialog

func (s *PlaybookRunServiceImpl) OpenCreatePlaybookRunDialog(teamID, requesterID, triggerID, postID, clientID string, playbooks []Playbook) error

OpenCreatePlaybookRunDialog opens a interactive dialog to start a new playbook run.

func (*PlaybookRunServiceImpl) OpenFinishPlaybookRunDialog

func (s *PlaybookRunServiceImpl) OpenFinishPlaybookRunDialog(playbookRunID, userID, triggerID string) error

func (*PlaybookRunServiceImpl) OpenUpdateStatusDialog

func (s *PlaybookRunServiceImpl) OpenUpdateStatusDialog(playbookRunID, userID, triggerID string) error

func (*PlaybookRunServiceImpl) PublishRetrospective

func (s *PlaybookRunServiceImpl) PublishRetrospective(playbookRunID, publisherID string, retrospective RetrospectiveUpdate) error

func (*PlaybookRunServiceImpl) RemoveChecklist

func (s *PlaybookRunServiceImpl) RemoveChecklist(playbookRunID, userID string, checklistNumber int) error

RemoveChecklist removes the specified checklist

func (*PlaybookRunServiceImpl) RemoveChecklistItem

func (s *PlaybookRunServiceImpl) RemoveChecklistItem(playbookRunID, userID string, checklistNumber, itemNumber int) error

RemoveChecklistItem removes the item at the given index from the given checklist

func (*PlaybookRunServiceImpl) RemoveParticipants added in v1.34.0

func (s *PlaybookRunServiceImpl) RemoveParticipants(playbookRunID string, userIDs []string, requesterUserID string) error

Leave removes user from the run's participants

func (*PlaybookRunServiceImpl) RemoveReminder

func (s *PlaybookRunServiceImpl) RemoveReminder(playbookRunID string)

RemoveReminder removes the pending reminder for the given playbook run, if any.

func (*PlaybookRunServiceImpl) RemoveTimelineEvent

func (s *PlaybookRunServiceImpl) RemoveTimelineEvent(playbookRunID, userID, eventID string) error

RemoveTimelineEvent removes the timeline event (sets the DeleteAt to the current time).

func (*PlaybookRunServiceImpl) RenameChecklist

func (s *PlaybookRunServiceImpl) RenameChecklist(playbookRunID, userID string, checklistNumber int, newTitle string) error

RenameChecklist adds a checklist to the specified run

func (*PlaybookRunServiceImpl) RequestJoinChannel added in v1.34.0

func (s *PlaybookRunServiceImpl) RequestJoinChannel(playbookRunID, requesterID string) error

RequestJoinChannel posts a channel-join request message in the run's channel

func (*PlaybookRunServiceImpl) RequestUpdate added in v1.31.0

func (s *PlaybookRunServiceImpl) RequestUpdate(playbookRunID, requesterID string) error

RequestUpdate posts a status update request message in the run's channel

func (*PlaybookRunServiceImpl) ResetReminder added in v1.31.0

func (s *PlaybookRunServiceImpl) ResetReminder(playbookRunID string, newReminder time.Duration) error

ResetReminder creates a timeline event for a reminder being reset and then creates a new reminder

func (*PlaybookRunServiceImpl) RestoreChecklist added in v1.27.0

func (s *PlaybookRunServiceImpl) RestoreChecklist(playbookRunID, userID string, checklistNumber int) error

RestoreChecklist restores the skipped checklist

func (*PlaybookRunServiceImpl) RestoreChecklistItem

func (s *PlaybookRunServiceImpl) RestoreChecklistItem(playbookRunID, userID string, checklistNumber, itemNumber int) error

RestoreChecklistItem restores the item at the given index from the given checklist

func (*PlaybookRunServiceImpl) RestorePlaybookRun

func (s *PlaybookRunServiceImpl) RestorePlaybookRun(playbookRunID, userID string) error

RestorePlaybookRun reverts a run from the Finished state. If run was not in Finished state, the call is a noop.

func (*PlaybookRunServiceImpl) RunChecklistItemSlashCommand

func (s *PlaybookRunServiceImpl) RunChecklistItemSlashCommand(playbookRunID, userID string, checklistNumber, itemNumber int) (string, error)

RunChecklistItemSlashCommand executes the slash command associated with the specified checklist item.

func (*PlaybookRunServiceImpl) SetAssignee

func (s *PlaybookRunServiceImpl) SetAssignee(playbookRunID, userID, assigneeID string, checklistNumber, itemNumber int) error

SetAssignee sets the assignee for the specified checklist item Idempotent, will not perform any actions if the checklist item is already assigned to assigneeID

func (*PlaybookRunServiceImpl) SetCommandToChecklistItem added in v1.27.0

func (s *PlaybookRunServiceImpl) SetCommandToChecklistItem(playbookRunID, userID string, checklistNumber, itemNumber int, newCommand string) error

SetCommandToChecklistItem sets command to checklist item

func (*PlaybookRunServiceImpl) SetDueDate added in v1.27.0

func (s *PlaybookRunServiceImpl) SetDueDate(playbookRunID, userID string, duedate int64, checklistNumber, itemNumber int) error

SetDueDate sets absolute due date timestamp for the specified checklist item

func (*PlaybookRunServiceImpl) SetNewReminder

func (s *PlaybookRunServiceImpl) SetNewReminder(playbookRunID string, newReminder time.Duration) error

SetNewReminder sets a new reminder for playbookRunID, removes any pending reminder, removes the reminder post in the playbookRun's channel, and resets the PreviousReminder and LastStatusUpdateAt (so the countdown timer to "update due" shows the correct time)

func (*PlaybookRunServiceImpl) SetReminder

func (s *PlaybookRunServiceImpl) SetReminder(playbookRunID string, fromNow time.Duration) error

SetReminder sets a reminder. After timeInMinutes in the future, the owner will be reminded to update the playbook run's status.

func (*PlaybookRunServiceImpl) SetTaskActionsToChecklistItem added in v1.34.0

func (s *PlaybookRunServiceImpl) SetTaskActionsToChecklistItem(playbookRunID, userID string, checklistNumber, itemNumber int, taskActions []TaskAction) error

func (*PlaybookRunServiceImpl) SkipChecklist added in v1.27.0

func (s *PlaybookRunServiceImpl) SkipChecklist(playbookRunID, userID string, checklistNumber int) error

SkipChecklist skips the checklist

func (*PlaybookRunServiceImpl) SkipChecklistItem

func (s *PlaybookRunServiceImpl) SkipChecklistItem(playbookRunID, userID string, checklistNumber, itemNumber int) error

SkipChecklistItem skips the item at the given index from the given checklist

func (*PlaybookRunServiceImpl) ToggleCheckedState

func (s *PlaybookRunServiceImpl) ToggleCheckedState(playbookRunID, userID string, checklistNumber, itemNumber int) error

ToggleCheckedState checks or unchecks the specified checklist item

func (*PlaybookRunServiceImpl) ToggleStatusUpdates added in v1.34.0

func (s *PlaybookRunServiceImpl) ToggleStatusUpdates(playbookRunID, userID string, enable bool) error

func (*PlaybookRunServiceImpl) Unfollow

func (s *PlaybookRunServiceImpl) Unfollow(playbookRunID, userID string) error

UnFollow method lets user unfollow a specific playbook run

func (*PlaybookRunServiceImpl) UpdateRetrospective

func (s *PlaybookRunServiceImpl) UpdateRetrospective(playbookRunID, updaterID string, newRetrospective RetrospectiveUpdate) error

func (*PlaybookRunServiceImpl) UpdateStatus

func (s *PlaybookRunServiceImpl) UpdateStatus(playbookRunID, userID string, options StatusUpdateOptions) error

UpdateStatus updates a playbook run's status.

type PlaybookRunStore

type PlaybookRunStore interface {
	// GetPlaybookRuns returns filtered playbook runs and the total count before paging.
	GetPlaybookRuns(requesterInfo RequesterInfo, options PlaybookRunFilterOptions) (*GetPlaybookRunsResults, error)

	// CreatePlaybookRun creates a new playbook run. If playbook run has an ID, that ID will be used.
	CreatePlaybookRun(playbookRun *PlaybookRun) (*PlaybookRun, error)

	// UpdatePlaybookRun updates a playbook run.
	UpdatePlaybookRun(playbookRun *PlaybookRun) (*PlaybookRun, error)

	// GraphqlUpdate taking a setmap for graphql
	GraphqlUpdate(id string, setmap map[string]interface{}) error

	// UpdateStatus updates the status of a playbook run.
	UpdateStatus(statusPost *SQLStatusPost) error

	// FinishPlaybookRun finishes a run at endAt (in millis)
	FinishPlaybookRun(playbookRunID string, endAt int64) error

	// RestorePlaybookRun restores a run at restoreAt (in millis)
	RestorePlaybookRun(playbookRunID string, restoreAt int64) error

	// GetTimelineEvent returns the timeline event for playbookRunID by the timeline event ID.
	GetTimelineEvent(playbookRunID, eventID string) (*TimelineEvent, error)

	// CreateTimelineEvent inserts the timeline event into the DB and returns the new event ID
	CreateTimelineEvent(event *TimelineEvent) (*TimelineEvent, error)

	// UpdateTimelineEvent updates an existing timeline event
	UpdateTimelineEvent(event *TimelineEvent) error

	// GetPlaybookRun gets a playbook run by ID.
	GetPlaybookRun(playbookRunID string) (*PlaybookRun, error)

	// GetPlaybookRunIDsForChannel gets a playbook runs list associated with the given channel id.
	GetPlaybookRunIDsForChannel(channelID string) ([]string, error)

	// GetHistoricalPlaybookRunParticipantsCount returns the count of all participants of the
	// playbook run associated with the given channel id since the beginning of the
	// playbook run, excluding bots.
	GetHistoricalPlaybookRunParticipantsCount(channelID string) (int64, error)

	// GetOwners returns the owners of the playbook runs selected by options
	GetOwners(requesterInfo RequesterInfo, options PlaybookRunFilterOptions) ([]OwnerInfo, error)

	// NukeDB removes all playbook run related data.
	NukeDB() error

	// ChangeCreationDate changes the creation date of the specified playbook run.
	ChangeCreationDate(playbookRunID string, creationTimestamp time.Time) error

	// GetBroadcastChannelIDsToRootIDs takes a playbookRunID and returns the mapping of
	// broadcastChannelID->rootID (to keep track of the status updates thread in each of the
	// playbook's broadcast channels).
	GetBroadcastChannelIDsToRootIDs(playbookRunID string) (map[string]string, error)

	// SetBroadcastChannelIDsToRootID sets the broadcastChannelID->rootID mappings for playbookRunID
	SetBroadcastChannelIDsToRootID(playbookRunID string, channelIDsToRootIDs map[string]string) error

	// GetRunsWithAssignedTasks returns the list of runs that have tasks assigned to userID
	GetRunsWithAssignedTasks(userID string) ([]AssignedRun, error)

	// GetParticipatingRuns returns the list of active runs with userID as a participant
	GetParticipatingRuns(userID string) ([]RunLink, error)

	// GetOverdueUpdateRuns returns the list of runs that userID is participating in that have overdue updates
	GetOverdueUpdateRuns(userID string) ([]RunLink, error)

	// Follow method lets user follow a specific playbook run
	Follow(playbookRunID, userID string) error

	// UnFollow method lets user unfollow a specific playbook run
	Unfollow(playbookRunID, userID string) error

	// GetFollowers returns list of followers for a specific playbook run
	GetFollowers(playbookRunID string) ([]string, error)

	// GetRunsActiveTotal returns number of active runs
	GetRunsActiveTotal() (int64, error)

	// GetOverdueUpdateRunsTotal returns number of runs that have overdue status updates
	GetOverdueUpdateRunsTotal() (int64, error)

	// GetOverdueRetroRunsTotal returns the number of completed runs without retro and with reminder
	GetOverdueRetroRunsTotal() (int64, error)

	// GetFollowersActiveTotal returns total number of active followers, including duplicates
	// if a user is following more than one run, it will be counted multiple times
	GetFollowersActiveTotal() (int64, error)

	// GetParticipantsActiveTotal returns number of active participants
	// (i.e. members of the playbook run channel when the run is active)
	// if a user is member of more than one channel, it will be counted multiple times
	GetParticipantsActiveTotal() (int64, error)

	// AddParticipants adds particpants to the run
	AddParticipants(playbookRunID string, userIDs []string) error

	// RemoveParticipants removes participants from the run
	RemoveParticipants(playbookRunID string, userIDs []string) error

	// GetSchemeRolesForChannel scheme role ids for the channel
	GetSchemeRolesForChannel(channelID string) (string, string, string, error)

	// GetSchemeRolesForTeam scheme role ids for the team
	GetSchemeRolesForTeam(teamID string) (string, string, string, error)

	// GetPlaybookRunIDsForUser returns run ids where user is a participant or is following
	GetPlaybookRunIDsForUser(userID string) ([]string, error)

	// GetRunMetadataByIDs returns playbook runs metadata by passed run IDs.
	// Notice that order of passed ids and returned runs might not coincide
	GetRunMetadataByIDs(runIDs []string) ([]RunMetadata, error)

	// GetTaskAsTopicMetadataByIDs gets PlaybookRunIDs and TeamIDs from runs by taskIDs
	GetTaskAsTopicMetadataByIDs(taskIDs []string) ([]TopicMetadata, error)

	// GetStatusAsTopicMetadataByIDs gets PlaybookRunIDs and TeamIDs from runs by statusIDs
	GetStatusAsTopicMetadataByIDs(statusIDs []string) ([]TopicMetadata, error)

	// GetStatsPostsByIDs gets the status posts for playbook runs
	GetStatusPostsByIDs(playbookRunID []string) (map[string][]StatusPost, error)

	// GetTimelineEventsByIDs gets the timeline events for playbook runs.
	GetTimelineEventsByIDs(playbookRunID []string) ([]TimelineEvent, error)

	// GetMetricsByIDs gets the metrics for playbook runs.
	GetMetricsByIDs(playbookRunID []string) (map[string][]RunMetricData, error)
}

PlaybookRunStore defines the methods the PlaybookRunServiceImpl needs from the interfaceStore.

type PlaybookRunTelemetry

type PlaybookRunTelemetry interface {
	// CreatePlaybookRun tracks the creation of a new playbook run.
	CreatePlaybookRun(playbookRun *PlaybookRun, userID string, public bool)

	// FinishPlaybookRun tracks the end of a playbook run.
	FinishPlaybookRun(playbookRun *PlaybookRun, userID string)

	// RestorePlaybookRun tracks the restoration of a playbook run.
	RestorePlaybookRun(playbookRun *PlaybookRun, userID string)

	// RestartPlaybookRun tracks the restart of a playbook run.
	RestartPlaybookRun(playbookRun *PlaybookRun, userID string)

	// ChangeOwner tracks changes in owner.
	ChangeOwner(playbookRun *PlaybookRun, userID string)

	// UpdateStatus tracks when a playbook run's status has been updated
	UpdateStatus(playbookRun *PlaybookRun, userID string)

	// FrontendTelemetryForPlaybookRun tracks an event originating from the frontend
	FrontendTelemetryForPlaybookRun(playbookRun *PlaybookRun, userID, action string)

	// AddPostToTimeline tracks userID creating a timeline event from a post.
	AddPostToTimeline(playbookRun *PlaybookRun, userID string)

	// RemoveTimelineEvent tracks userID removing a timeline event.
	RemoveTimelineEvent(playbookRun *PlaybookRun, userID string)

	// ModifyCheckedState tracks the checking and unchecking of items.
	ModifyCheckedState(playbookRunID, userID string, task ChecklistItem, wasOwner bool)

	// SetAssignee tracks the changing of an assignee on an item.
	SetAssignee(playbookRunID, userID string, task ChecklistItem)

	// AddTask tracks the creation of a new checklist item.
	AddTask(playbookRunID, userID string, task ChecklistItem)

	// RemoveTask tracks the removal of a checklist item.
	RemoveTask(playbookRunID, userID string, task ChecklistItem)

	// SkipChecklist tracks the skipping of a checklist.
	SkipChecklist(playbookRunID, userID string, checklist Checklist)

	// RestoreChecklist tracks the restoring of a checklist.
	RestoreChecklist(playbookRunID, userID string, checklist Checklist)

	// SkipTask tracks the skipping of a checklist item.
	SkipTask(playbookRunID, userID string, task ChecklistItem)

	// RestoreTask tracks the restoring of a checklist item.
	RestoreTask(playbookRunID, userID string, task ChecklistItem)

	// RenameTask tracks the update of a checklist item.
	RenameTask(playbookRunID, userID string, task ChecklistItem)

	// MoveChecklist tracks the movement of a checklist
	MoveChecklist(playbookRunID, userID string, task Checklist)

	// MoveTask tracks the movement of a checklist item
	MoveTask(playbookRunID, userID string, task ChecklistItem)

	// RunTaskSlashCommand tracks the execution of a slash command attached to
	// a checklist item.
	RunTaskSlashCommand(playbookRunID, userID string, task ChecklistItem)

	// AddChecklsit tracks the creation of a new checklist.
	AddChecklist(playbookRunID, userID string, checklist Checklist)

	// RemoveChecklist tracks the removal of a checklist.
	RemoveChecklist(playbookRunID, userID string, checklist Checklist)

	// RenameChecklsit tracks the creation of a new checklist.
	RenameChecklist(playbookRunID, userID string, checklist Checklist)

	// UpdateRetrospective event
	UpdateRetrospective(playbookRun *PlaybookRun, userID string)

	// PublishRetrospective event
	PublishRetrospective(playbookRun *PlaybookRun, userID string)

	// Follow tracks userID following a playbook run.
	Follow(playbookRun *PlaybookRun, userID string)

	// Unfollow tracks userID following a playbook run.
	Unfollow(playbookRun *PlaybookRun, userID string)

	// RunAction tracks the run actions, i.e., status broadcast action
	RunAction(playbookRun *PlaybookRun, userID, triggerType, actionType string, numBroadcasts int)
}

PlaybookRunTelemetry defines the methods that the PlaybookRunServiceImpl needs from the RudderTelemetry. Unless otherwise noted, userID is the user initiating the event.

type PlaybookRunWebhookEvent added in v1.31.0

type PlaybookRunWebhookEvent struct {
	// Type is the type of event emitted.
	Type timelineEventType `json:"type"`

	// At is the time when the event occurred.
	At int64 `json:"at"`

	// UserId is the user who triggered the event.
	UserID string `json:"user_id"`

	// Payload is optional, event-specific metadata.
	Payload interface{} `json:"payload"`
}

type PlaybookRunWebhookPayload

type PlaybookRunWebhookPayload struct {
	PlaybookRun

	// ChannelURL is the absolute URL of the playbook run channel.
	ChannelURL string `json:"channel_url"`

	// DetailsURL is the absolute URL of the playbook run overview page.
	DetailsURL string `json:"details_url"`

	// Event is metadata concerning the event that triggered this webhook.
	Event PlaybookRunWebhookEvent `json:"event"`
}

PlaybookRunWebhookPayload is the body of the payload sent via playbook run webhooks.

type PlaybookService

type PlaybookService interface {
	// Get retrieves a playbook. Returns ErrNotFound if not found.
	Get(id string) (Playbook, error)

	// Create creates a new playbook
	Create(playbook Playbook, userID string) (string, error)

	// Import imports a new playbook
	Import(playbook Playbook, userID string) (string, error)

	// GetPlaybooks retrieves all playbooks
	GetPlaybooks() ([]Playbook, error)

	// GetPlaybooksForTeam retrieves all playbooks on the specified team given the provided options
	GetPlaybooksForTeam(requesterInfo RequesterInfo, teamID string, opts PlaybookFilterOptions) (GetPlaybooksResults, error)

	// Update updates a playbook
	Update(playbook Playbook, userID string) error

	// Archive archives a playbook
	Archive(playbook Playbook, userID string) error

	// Restores an archived playbook
	Restore(playbook Playbook, userID string) error

	// AutoFollow method lets user auto-follow all runs of a specific playbook
	AutoFollow(playbookID, userID string) error

	// AutoUnfollow method lets user to not auto-follow the newly created playbook runs
	AutoUnfollow(playbookID, userID string) error

	// GetAutoFollows returns list of users who auto-follows a playbook
	GetAutoFollows(playbookID string) ([]string, error)

	// Duplicate duplicates a playbook
	Duplicate(playbook Playbook, userID string) (string, error)

	// Get top playbooks for teams
	GetTopPlaybooksForTeam(teamID, userID string, opts *model.InsightsOpts) (*PlaybooksInsightsList, error)

	// Get top playbooks for users
	GetTopPlaybooksForUser(teamID, userID string, opts *model.InsightsOpts) (*PlaybooksInsightsList, error)
}

PlaybookService is the playbook service for managing playbooks userID is the user initiating the event.

func NewPlaybookService

func NewPlaybookService(store PlaybookStore, poster bot.Poster, telemetry PlaybookTelemetry, api *pluginapi.Client, metricsService *metrics.Metrics) PlaybookService

NewPlaybookService returns a new playbook service

type PlaybookStore

type PlaybookStore interface {
	// Get retrieves a playbook
	Get(id string) (Playbook, error)

	// Create creates a new playbook
	Create(playbook Playbook) (string, error)

	// GetPlaybooks retrieves all playbooks
	GetPlaybooks() ([]Playbook, error)

	// GetPlaybooksForTeam retrieves all playbooks on the specified team
	GetPlaybooksForTeam(requesterInfo RequesterInfo, teamID string, opts PlaybookFilterOptions) (GetPlaybooksResults, error)

	// GetPlaybooksWithKeywords retrieves all playbooks with keywords enabled
	GetPlaybooksWithKeywords(opts PlaybookFilterOptions) ([]Playbook, error)

	// GetTimeLastUpdated retrieves time last playbook was updated at.
	// Passed argument determines whether to include playbooks with
	// SignalAnyKeywordsEnabled flag or not.
	GetTimeLastUpdated(onlyPlaybooksWithKeywordsEnabled bool) (int64, error)

	// GetPlaybookIDsForUser retrieves playbooks user can access
	GetPlaybookIDsForUser(userID, teamID string) ([]string, error)

	// Update updates a playbook
	Update(playbook Playbook) error

	// GraphqlUpdate taking a setmap for graphql
	GraphqlUpdate(id string, setmap map[string]interface{}) error

	// Archive archives a playbook
	Archive(id string) error

	// Restore restores a deleted playbook
	Restore(id string) error

	// AutoFollow method lets user auto-follow all runs of a specific playbook
	AutoFollow(playbookID, userID string) error

	// AutoUnfollow method lets user to not auto-follow the newly created playbook runs
	AutoUnfollow(playbookID, userID string) error

	// GetAutoFollows returns list of users who auto-follows a playbook
	GetAutoFollows(playbookID string) ([]string, error)

	// GetPlaybooksActiveTotal returns number of active playbooks
	GetPlaybooksActiveTotal() (int64, error)

	// GetMetric retrieves a metric by ID
	GetMetric(id string) (*PlaybookMetricConfig, error)

	// AddMetric adds a metric
	AddMetric(playbookID string, config PlaybookMetricConfig) error

	// UpdateMetric updates a metric
	UpdateMetric(id string, setmap map[string]interface{}) error

	// DeleteMetric deletes a metric
	DeleteMetric(id string) error

	// Get top playbooks for teams
	GetTopPlaybooksForTeam(teamID, userID string, opts *model.InsightsOpts) (*PlaybooksInsightsList, error)

	// Get top playbooks for users
	GetTopPlaybooksForUser(teamID, userID string, opts *model.InsightsOpts) (*PlaybooksInsightsList, error)

	// AddPlaybookMember adds a user as a member to a playbook
	AddPlaybookMember(id string, memberID string) error

	// RemovePlaybookMember removes a user from a playbook
	RemovePlaybookMember(id string, memberID string) error
}

PlaybookStore is an interface for storing playbooks

type PlaybookTelemetry

type PlaybookTelemetry interface {
	// CreatePlaybook tracks the creation of a playbook.
	CreatePlaybook(playbook Playbook, userID string)

	// ImportPlaybook tracks the import of a playbook.
	ImportPlaybook(playbook Playbook, userID string)

	// UpdatePlaybook tracks the update of a playbook.
	UpdatePlaybook(playbook Playbook, userID string)

	// DeletePlaybook tracks the deletion of a playbook.
	DeletePlaybook(playbook Playbook, userID string)

	// RestorePlaybook tracks the restoration of a playbook.
	RestorePlaybook(playbook Playbook, userID string)

	// FrontendTelemetryForPlaybook tracks an event originating from the frontend
	FrontendTelemetryForPlaybook(playbook Playbook, userID, action string)

	// FrontendTelemetryForPlaybookTemplate tracks an event originating from the frontend
	FrontendTelemetryForPlaybookTemplate(templateName string, userID, action string)

	// AutoFollowPlaybook tracks the auto-follow of a playbook.
	AutoFollowPlaybook(playbook Playbook, userID string)

	// AutoUnfollowPlaybook tracks the auto-unfollow of a playbook.
	AutoUnfollowPlaybook(playbook Playbook, userID string)
}

PlaybookTelemetry defines the methods that the Playbook service needs from the RudderTelemetry. userID is the user initiating the event.

type PlaybooksInsightsList added in v1.32.0

type PlaybooksInsightsList struct {
	HasNext bool               `json:"has_next"`
	Items   []*PlaybookInsight `json:"items"`
}

PlaybooksInsightsList is a response type with pagination support.

type PromptRunPlaybookFromKeywordsPayload added in v1.26.0

type PromptRunPlaybookFromKeywordsPayload struct {
	Keywords   []string `json:"keywords" mapstructure:"keywords"`
	PlaybookID string   `json:"playbook_id" mapstructure:"playbook_id"`
}

type RequesterInfo

type RequesterInfo struct {
	UserID  string
	TeamID  string
	IsAdmin bool
	IsGuest bool
}

RequesterInfo holds the userID and teamID that this request is regarding, and permissions for the user making the request

func GetRequesterInfo

func GetRequesterInfo(userID string, pluginAPI *pluginapi.Client) (RequesterInfo, error)

type RetrospectiveUpdate

type RetrospectiveUpdate struct {
	Text    string          `json:"retrospective"`
	Metrics []RunMetricData `json:"metrics"`
}

type RunAction added in v1.28.0

type RunAction struct {
	BroadcastChannelIDs       []string `json:"broadcast_channel_ids"`
	WebhookOnStatusUpdateURLs []string `json:"webhook_on_status_update_urls"`

	StatusUpdateBroadcastChannelsEnabled bool `json:"status_update_broadcast_channels_enabled"`
	StatusUpdateBroadcastWebhooksEnabled bool `json:"status_update_broadcast_webhooks_enabled"`

	CreateChannelMemberOnNewParticipant     bool `json:"create_channel_member_on_new_participant"`
	RemoveChannelMemberOnRemovedParticipant bool `json:"remove_channel_member_on_removed_participant"`
}

RunAction represents the run action settings. Frontend passes this struct to update settings.

type RunLink struct {
	PlaybookRunID string
	Name          string
}

RunLink represents the info needed to display and link to a run

type RunMetadata added in v1.34.0

type RunMetadata struct {
	ID     string
	Name   string
	TeamID string
}

type RunMetricData

type RunMetricData struct {
	MetricConfigID string   `json:"metric_config_id"`
	Value          null.Int `json:"value"`
}

type RunWSOption added in v1.34.0

type RunWSOption func(options *RunWSOptions)

type RunWSOptions added in v1.34.0

type RunWSOptions struct {
	AdditionalUserIDs []string
	PlaybookRun       *PlaybookRun
}

structure to handle optional parameters for sendPlaybookRunUpdatedWS

type SQLStatusPost

type SQLStatusPost struct {
	PlaybookRunID string
	PostID        string
	EndAt         int64
}

type SortDirection

type SortDirection string

SortDirection is the type used to specify the ascending or descending order of returned results.

const (
	// DirectionDesc is descending order.
	DirectionDesc SortDirection = "DESC"

	// DirectionAsc is ascending order.
	DirectionAsc SortDirection = "ASC"
)

type SortField

type SortField string

SortField enumerates the available fields we can sort on.

const (
	// SortByTitle sorts by the title field of a playbook.
	SortByTitle SortField = "title"

	// SortByStages sorts by the number of checklists in a playbook.
	SortByStages SortField = "stages"

	// SortBySteps sorts by the number of steps in a playbook.
	SortBySteps SortField = "steps"

	// SortByRuns sorts by the number of times a playbook has been run.
	SortByRuns SortField = "runs"

	// SortByCreateAt sorts by the created time of a playbook or playbook run.
	SortByCreateAt SortField = "create_at"

	// SortByID sorts by the primary key of a playbook or playbook run.
	SortByID SortField = "id"

	// SortByName sorts by the name of a playbook run.
	SortByName SortField = "name"

	// SortByOwnerUserID sorts by the user id of the owner of a playbook run.
	SortByOwnerUserID SortField = "owner_user_id"

	// SortByTeamID sorts by the team id of a playbook or playbook run.
	SortByTeamID SortField = "team_id"

	// SortByEndAt sorts by the end time of a playbook run.
	SortByEndAt SortField = "end_at"

	// SortByStatus sorts by the status of a playbook run.
	SortByStatus SortField = "status"

	// SortByLastStatusUpdateAt sorts by when the playbook run was last updated.
	SortByLastStatusUpdateAt SortField = "last_status_update_at"

	// SortByLastStatusUpdateAt sorts by when the playbook was last run.
	SortByLastRunAt SortField = "last_run_at"

	// SortByActiveRuns sorts by number of active runs in the playbook.
	SortByActiveRuns SortField = "active_runs"

	// SortByMetric0 ..3 sorts by the playbook's metric index
	SortByMetric0 SortField = "metric0"
	SortByMetric1 SortField = "metric1"
	SortByMetric2 SortField = "metric2"
	SortByMetric3 SortField = "metric3"
)

type StatusPost

type StatusPost struct {
	// ID is the identifier of the post containing the status update.
	ID string `json:"id"`

	// CreateAt is the timestamp, in milliseconds since epoch, of the time this status update was
	// posted.
	CreateAt int64 `json:"create_at"`

	// DeleteAt is the timestamp, in milliseconds since epoch, of the time the post containing this
	// status update was deleted. 0 if it was never deleted.
	DeleteAt int64 `json:"delete_at"`
}

type StatusPostComplete added in v1.31.0

type StatusPostComplete struct {
	// ID is the identifier of the post containing the status update.
	ID string `json:"id"`

	// CreateAt is the timestamp, in milliseconds since epoch, of the time this status update was
	// posted.
	CreateAt int64 `json:"create_at"`

	// DeleteAt is the timestamp, in milliseconds since epoch, of the time the post containing this
	// status update was deleted. 0 if it was never deleted.
	DeleteAt int64 `json:"delete_at"`

	// Message is the content of the status update. It supports markdown.
	Message string `json:"message"`

	// AuthorUserName is the username of the user who sent the status update.
	AuthorUserName string `json:"author_user_name"`
}

StatusPostComplete is the "complete" representation of a status update

This type is part of an effort to decopuple channels and playbooks, where status updates will stop being -only- Posts in a channel.

func NewStatusPostComplete added in v1.31.0

func NewStatusPostComplete(post *model.Post) *StatusPostComplete

NewStatusPostComplete creates a StatusUpdate from a channel Post

type StatusUpdateOptions

type StatusUpdateOptions struct {
	Message   string        `json:"message"`
	Reminder  time.Duration `json:"reminder"`
	FinishRun bool          `json:"finish_run"`
}

StatusUpdateOptions encapsulates the fields that can be set when updating a playbook run's status NOTE: changes made to this should be reflected in the client package.

type TaskAction added in v1.34.0

type TaskAction struct {
	Trigger Trigger  `json:"trigger"`
	Actions []Action `json:"actions"`
}

type TaskActionType added in v1.34.0

type TaskActionType string

type TaskTriggerType added in v1.34.0

type TaskTriggerType string

type TelemetryPage added in v1.34.0

type TelemetryPage int

TelemetryPage is a type alias to hold all possible page tracking names in an enum-like

Contained names should match the ones that are at webapp/src/types/telemetry.ts when they use generic tracking

func NewTelemetryPage added in v1.34.0

func NewTelemetryPage(name string) (*TelemetryPage, error)

NewTelemetryPage creates an instance of TelemetryPage from a string. It's useful to validate that the arbitrary string has a equivalent constant for what pages we want to track (and avoid typos).

func (TelemetryPage) String added in v1.34.0

func (tp TelemetryPage) String() string

String creates the string version of the Telemetrypage

type TelemetryTrack added in v1.34.0

type TelemetryTrack int

TelemetryTrack is a type alias to hold all possible event tracking names in an enum-like

Contained names should match the ones that are at webapp/src/types/telemetry.ts when they use generic tracking

func NewTelemetryTrack added in v1.34.0

func NewTelemetryTrack(name string) (*TelemetryTrack, error)

NewTelemetryTrack creates an instance of TelemetryTrack from a string. It's useful to validate that the arbitrary string has a equivalent constant for what events we want to track (and avoid typos).

func (TelemetryTrack) String added in v1.34.0

func (tt TelemetryTrack) String() string

String creates the string version of the TelemetryTrack

type TelemetryType added in v1.34.0

type TelemetryType string

TelemetryType is the type for the different kinds of tracking we have

const (
	// TelemetryTypeTrack is for tracking events (click, submit, etc..)
	TelemetryTypeTrack TelemetryType = "track"
	// TelemetryTypePage is for tracking page views
	TelemetryTypePage TelemetryType = "page"
)

type TimelineEvent

type TimelineEvent struct {
	// ID is the identifier of this event.
	ID string `json:"id"`

	// PlaybookRunID is the identifier of the playbook run this event lives in.
	PlaybookRunID string `json:"playbook_run_id"`

	// CreateAt is the timestamp, in milliseconds since epoch, of the time this event was created.
	CreateAt int64 `json:"create_at"`

	// DeleteAt is the timestamp, in milliseconds since epoch, of the time this event was deleted.
	// 0 if it was never deleted.
	DeleteAt int64 `json:"delete_at"`

	// EventAt is the timestamp, in milliseconds since epoch, of the actual situation this event is
	// describing.
	EventAt int64 `json:"event_at"`

	// EventType is the type of this event. It can be "incident_created", "task_state_modified",
	// "status_updated", "owner_changed", "assignee_changed", "ran_slash_command",
	// "event_from_post", "user_joined_left", "published_retrospective", "canceled_retrospective" or "status_update_snoozed".
	EventType timelineEventType `json:"event_type"`

	// Summary is a short description of the event.
	Summary string `json:"summary"`

	// Details is the longer description of the event.
	Details string `json:"details"`

	// PostID, if not empty, is the identifier of the post announcing in the channel this event
	// happened. If the event is of type "event_from_post", this is the identifier of that post.
	PostID string `json:"post_id"`

	// SubjectUserID is the identifier of the user involved in the event. For example, if the event
	// is of type "owner_changed", this is the identifier of the new owner.
	SubjectUserID string `json:"subject_user_id"`

	// CreatorUserID is the identifier of the user that created the event.
	CreatorUserID string `json:"creator_user_id"`
}

type TodoDigestMessageItems added in v1.34.0

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

type TopicMetadata added in v1.34.0

type TopicMetadata struct {
	ID     string
	RunID  string
	TeamID string
}

type Trigger added in v1.34.0

type Trigger struct {
	Type TaskTriggerType `json:"type"`
	// Payload is the json payload that stores trigger specific settings or config.
	// This should be unmarshalled into a concrete type during usage
	Payload string `json:"payload"`
}

type TriggerType added in v1.26.0

type TriggerType string

type UpdateOptions

type UpdateOptions struct {
}

type UserInfo

type UserInfo struct {
	ID                string
	LastDailyTodoDMAt int64
	DigestNotificationSettings
}

type UserInfoStore

type UserInfoStore interface {
	// Get retrieves a UserInfo struct by the user's userID.
	Get(userID string) (UserInfo, error)

	// Upsert inserts (creates) or updates the UserInfo in info.
	Upsert(info UserInfo) error
}

type UserInfoTelemetry

type UserInfoTelemetry interface {
	// ChangeDigestSettings tracks when a user changes one of the digest settings
	ChangeDigestSettings(userID string, old DigestNotificationSettings, new DigestNotificationSettings)
}

UserInfoTelemetry defines the methods that the UserInfo store needs from the RudderTelemetry. userID is the user initiating the event.

type WelcomeMessagePayload added in v1.26.0

type WelcomeMessagePayload struct {
	Message string `json:"message" mapstructure:"message"`
}

Directories

Path Synopsis
Package mock_app is a generated GoMock package.
Package mock_app is a generated GoMock package.

Jump to

Keyboard shortcuts

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