client

package module
v0.0.0-...-c9fd1d9 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package client provides an HTTP client for using the Playbooks API.

Index

Constants

View Source
const (
	// Action types
	ActionTypeWelcomeMessage    = "send_welcome_message"
	ActionTypePromptRunPlaybook = "prompt_run_playbook"
	ActionTypeCategorizeChannel = "categorize_channel"

	// Trigger types
	TriggerTypeNewMemberJoins = "new_member_joins"
	TriggerTypeKeywordsPosted = "keywords"
)
View Source
const (
	MetricTypeDuration = "metric_duration"
	MetricTypeCurrency = "metric_currency"
	MetricTypeInteger  = "metric_integer"
)
View Source
const Me = "me"

Me is a constant that refers to the current user, and can be used in various APIs in place of explicitly specifying the current user's id.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionsService

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

ActionsService handles communication with the actions related methods of the Playbook API.

func (*ActionsService) Create

func (s *ActionsService) Create(ctx context.Context, channelID string, opts ChannelActionCreateOptions) (string, error)

Create an action. Returns the id of the newly created action.

func (*ActionsService) List

List the actions in a channel.

func (*ActionsService) Update

func (s *ActionsService) Update(ctx context.Context, action GenericChannelAction) error

Update an existing action.

type CategorizeChannelPayload

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

type ChannelActionCreateOptions

type ChannelActionCreateOptions struct {
	ChannelID   string      `json:"channel_id"`
	Enabled     bool        `json:"enabled"`
	ActionType  string      `json:"action_type"`
	TriggerType string      `json:"trigger_type"`
	Payload     interface{} `json:"payload"`
}

ChannelActionCreateOptions specifies the parameters for ActionsService.Create method.

type ChannelActionListOptions

type ChannelActionListOptions struct {
	TriggerType string `url:"trigger_type,omitempty"`
	ActionType  string `url:"action_type,omitempty"`
}

ChannelActionListOptions specifies the optional parameters to the ActionsService.List method.

type ChannelPlaybookMode

type ChannelPlaybookMode int
const (
	PlaybookRunCreateNewChannel ChannelPlaybookMode = iota
	PlaybookRunLinkExistingChannel
)

func (ChannelPlaybookMode) MarshalText

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

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

func (ChannelPlaybookMode) String

func (cpm ChannelPlaybookMode) String() string

String creates the string version of the TelemetryTrack

func (*ChannelPlaybookMode) UnmarshalText

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

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

type Checklist

type Checklist struct {
	ID    string          `json:"id"`
	Title string          `json:"title"`
	Items []ChecklistItem `json:"items"`
}

Checklist represents a checklist in a playbook

type ChecklistItem

type ChecklistItem struct {
	ID               string       `json:"id"`
	Title            string       `json:"title"`
	State            string       `json:"state"`
	StateModified    int64        `json:"state_modified"`
	AssigneeID       string       `json:"assignee_id"`
	AssigneeModified int64        `json:"assignee_modified"`
	Command          string       `json:"command"`
	CommandLastRun   int64        `json:"command_last_run"`
	Description      string       `json:"description"`
	LastSkipped      int64        `json:"delete_at"`
	DueDate          int64        `json:"due_date"`
	TaskActions      []TaskAction `json:"task_actions"`
}

ChecklistItem represents an item in a checklist

type Client

type Client struct {

	// BaseURL is the base HTTP endpoint for the Playbooks plugin.
	BaseURL *url.URL
	// User agent used when communicating with the Playbooks API.
	UserAgent string

	// PlaybookRuns is a collection of methods used to interact with playbook runs.
	PlaybookRuns *PlaybookRunService
	// Playbooks is a collection of methods used to interact with playbooks.
	Playbooks *PlaybooksService
	// Settings is a collection of methods used to interact with settings.
	Settings *SettingsService
	// Actions is a collection of methods used to interact with actions.
	Actions *ActionsService
	// Stats is a collection of methods used to interact with stats.
	Stats *StatsService
	// Reminders is a collection of methods used to interact with reminders.
	Reminders *RemindersService
	// Telemetry is a collection of methods used to interact with telemetry.
	Telemetry *TelemetryService
	// contains filtered or unexported fields
}

Client manages communication with the Playbooks API.

func New

func New(url, token string) (*Client, error)

New creates a new instance of Client using the configuration from the given Mattermost Client.

func (*Client) DoGraphql

func (c *Client) DoGraphql(ctx context.Context, input *GraphQLInput, v interface{}) error

type ErrorResponse

type ErrorResponse struct {
	// Method is the HTTP verb used in the API request.
	Method string
	// URL is the HTTP endpoint used in the API request.
	URL string
	// StatusCode is the HTTP status code returned by the API.
	StatusCode int

	// Err is the error parsed from the API response.
	Err error `json:"error"`
}

ErrorResponse is an error from an API request.

func (*ErrorResponse) Error

func (e *ErrorResponse) Error() string

Error describes the error from the API request.

func (*ErrorResponse) UnmarshalJSON

func (e *ErrorResponse) UnmarshalJSON(data []byte) error

func (*ErrorResponse) Unwrap

func (e *ErrorResponse) Unwrap() error

Unwrap exposes the underlying error of an ErrorResponse.

type GenericChannelAction

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

type GenericChannelActionWithoutPayload

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

type GetPlaybookRunsResults

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

type GetPlaybooksResults

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

type GlobalSettings

type GlobalSettings struct {
}

type GraphQLInput

type GraphQLInput struct {
	Query         string                 `json:"query"`
	OperationName string                 `json:"operationName"`
	Variables     map[string]interface{} `json:"variables"`
}

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 Playbook

type Playbook struct {
	ID                                      string                 `json:"id"`
	Title                                   string                 `json:"title"`
	Description                             string                 `json:"description"`
	Public                                  bool                   `json:"public"`
	TeamID                                  string                 `json:"team_id"`
	CreatePublicPlaybookRun                 bool                   `json:"create_public_playbook_run"`
	CreateAt                                int64                  `json:"create_at"`
	DeleteAt                                int64                  `json:"delete_at"`
	NumStages                               int64                  `json:"num_stages"`
	NumSteps                                int64                  `json:"num_steps"`
	Checklists                              []Checklist            `json:"checklists"`
	Members                                 []PlaybookMember       `json:"members"`
	ReminderMessageTemplate                 string                 `json:"reminder_message_template"`
	ReminderTimerDefaultSeconds             int64                  `json:"reminder_timer_default_seconds"`
	InvitedUserIDs                          []string               `json:"invited_user_ids"`
	InvitedGroupIDs                         []string               `json:"invited_group_ids"`
	InviteUsersEnabled                      bool                   `json:"invite_users_enabled"`
	DefaultOwnerID                          string                 `json:"default_owner_id"`
	DefaultOwnerEnabled                     bool                   `json:"default_owner_enabled"`
	BroadcastChannelIDs                     []string               `json:"broadcast_channel_ids"`
	BroadcastEnabled                        bool                   `json:"broadcast_enabled"`
	WebhookOnCreationURLs                   []string               `json:"webhook_on_creation_urls"`
	WebhookOnCreationEnabled                bool                   `json:"webhook_on_creation_enabled"`
	Metrics                                 []PlaybookMetricConfig `json:"metrics"`
	CreateChannelMemberOnNewParticipant     bool                   `json:"create_channel_member_on_new_participant"`
	RemoveChannelMemberOnRemovedParticipant bool                   `json:"remove_channel_member_on_removed_participant"`
	ChannelID                               string                 `json:"channel_id" export:"channel_id"`
	ChannelMode                             ChannelPlaybookMode    `json:"channel_mode" export:"channel_mode"`
}

Playbook represents the planning before a playbook run is initiated.

type PlaybookCreateOptions

type PlaybookCreateOptions struct {
	Title                                   string                 `json:"title"`
	Description                             string                 `json:"description"`
	TeamID                                  string                 `json:"team_id"`
	Public                                  bool                   `json:"public"`
	CreatePublicPlaybookRun                 bool                   `json:"create_public_playbook_run"`
	Checklists                              []Checklist            `json:"checklists"`
	Members                                 []PlaybookMember       `json:"members"`
	BroadcastChannelID                      string                 `json:"broadcast_channel_id"`
	ReminderMessageTemplate                 string                 `json:"reminder_message_template"`
	ReminderTimerDefaultSeconds             int64                  `json:"reminder_timer_default_seconds"`
	InvitedUserIDs                          []string               `json:"invited_user_ids"`
	InvitedGroupIDs                         []string               `json:"invited_group_ids"`
	InviteUsersEnabled                      bool                   `json:"invite_users_enabled"`
	DefaultOwnerID                          string                 `json:"default_owner_id"`
	DefaultOwnerEnabled                     bool                   `json:"default_owner_enabled"`
	BroadcastChannelIDs                     []string               `json:"broadcast_channel_ids"`
	BroadcastEnabled                        bool                   `json:"broadcast_enabled"`
	Metrics                                 []PlaybookMetricConfig `json:"metrics"`
	CreateChannelMemberOnNewParticipant     bool                   `json:"create_channel_member_on_new_participant"`
	RemoveChannelMemberOnRemovedParticipant bool                   `json:"remove_channel_member_on_removed_participant"`
	ChannelID                               string                 `json:"channel_id" export:"channel_id"`
	ChannelMode                             ChannelPlaybookMode    `json:"channel_mode" export:"channel_mode"`
}

PlaybookCreateOptions specifies the parameters for PlaybooksService.Create method.

type PlaybookListOptions

type PlaybookListOptions struct {
	Sort         Sort          `url:"sort,omitempty"`
	Direction    SortDirection `url:"direction,omitempty"`
	SearchTeam   string        `url:"search_term,omitempty"`
	WithArchived bool          `url:"with_archived,omitempty"`
}

PlaybookListOptions specifies the optional parameters to the PlaybooksService.List method.

type PlaybookMember

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

type PlaybookMetricConfig

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

type PlaybookRun

type PlaybookRun struct {
	ID                                      string          `json:"id"`
	Name                                    string          `json:"name"`
	Summary                                 string          `json:"summary"`
	SummaryModifiedAt                       int64           `json:"summary_modified_at"`
	OwnerUserID                             string          `json:"owner_user_id"`
	ReporterUserID                          string          `json:"reporter_user_id"`
	TeamID                                  string          `json:"team_id"`
	ChannelID                               string          `json:"channel_id"`
	CreateAt                                int64           `json:"create_at"`
	EndAt                                   int64           `json:"end_at"`
	DeleteAt                                int64           `json:"delete_at"`
	ActiveStage                             int             `json:"active_stage"`
	ActiveStageTitle                        string          `json:"active_stage_title"`
	PostID                                  string          `json:"post_id"`
	PlaybookID                              string          `json:"playbook_id"`
	Checklists                              []Checklist     `json:"checklists"`
	StatusPosts                             []StatusPost    `json:"status_posts"`
	CurrentStatus                           string          `json:"current_status"`
	LastStatusUpdateAt                      int64           `json:"last_status_update_at"`
	ReminderPostID                          string          `json:"reminder_post_id"`
	PreviousReminder                        time.Duration   `json:"previous_reminder"`
	ReminderTimerDefaultSeconds             int64           `json:"reminder_timer_default_seconds"`
	StatusUpdateEnabled                     bool            `json:"status_update_enabled"`
	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"`
	ReminderMessageTemplate                 string          `json:"reminder_message_template"`
	InvitedUserIDs                          []string        `json:"invited_user_ids"`
	InvitedGroupIDs                         []string        `json:"invited_group_ids"`
	TimelineEvents                          []TimelineEvent `json:"timeline_events"`
	DefaultOwnerID                          string          `json:"default_owner_id"`
	WebhookOnCreationURLs                   []string        `json:"webhook_on_creation_urls"`
	Retrospective                           string          `json:"retrospective"`
	RetrospectivePublishedAt                int64           `json:"retrospective_published_at"`
	RetrospectiveWasCanceled                bool            `json:"retrospective_was_canceled"`
	RetrospectiveReminderIntervalSeconds    int64           `json:"retrospective_reminder_interval_seconds"`
	RetrospectiveEnabled                    bool            `json:"retrospective_enabled"`
	MessageOnJoin                           string          `json:"message_on_join"`
	ParticipantIDs                          []string        `json:"participant_ids"`
	CategoryName                            string          `json:"category_name"`
	MetricsData                             []RunMetricData `json:"metrics_data"`
	CreateChannelMemberOnNewParticipant     bool            `json:"create_channel_member_on_new_participant"`
	RemoveChannelMemberOnRemovedParticipant bool            `json:"remove_channel_member_on_removed_participant"`
}

PlaybookRun represents a playbook run.

type PlaybookRunCreateOptions

type PlaybookRunCreateOptions struct {
	Name            string `json:"name"`
	OwnerUserID     string `json:"owner_user_id"`
	TeamID          string `json:"team_id"`
	ChannelID       string `json:"channel_id"`
	Description     string `json:"description"`
	PostID          string `json:"post_id"`
	PlaybookID      string `json:"playbook_id"`
	CreatePublicRun *bool  `json:"create_public_run"`
	Type            string `json:"type"`
}

PlaybookRunCreateOptions specifies the parameters for PlaybookRunService.Create method.

type PlaybookRunList

type PlaybookRunList struct {
	TotalCount int  `json:"total_count"`
	PageCount  int  `json:"page_count"`
	HasMore    bool `json:"has_more"`
	Items      []*PlaybookRun
}

PlaybookRunList contains the paginated result.

type PlaybookRunListOptions

type PlaybookRunListOptions struct {
	// TeamID filters playbook runs to those in the given team.
	TeamID string `url:"team_id,omitempty"`

	Sort      Sort          `url:"sort,omitempty"`
	Direction SortDirection `url:"direction,omitempty"`

	// Statuses filters by InProgress or Ended; defaults to All when no status specified.
	Statuses []Status `url:"statuses,omitempty"`

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

	// ParticipantID filters playbook runs that have this user as a participant. Defaults to blank (no filter). Specify "me" for current user.
	ParticipantID string `url:"participant_id,omitempty"`

	// ParticipantOrFollowerID filters playbook runs that have this user as member or as follower. Defaults to blank (no filter). Specify "me" for current user.
	ParticipantOrFollowerID string `url:"participant_or_follower,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"`
}

PlaybookRunListOptions specifies the optional parameters to the PlaybookRunService.List method.

type PlaybookRunService

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

PlaybookRunService handles communication with the playbook run related methods of the Playbooks API.

func (*PlaybookRunService) AddChecklistItem

func (s *PlaybookRunService) AddChecklistItem(ctx context.Context, playbookRunID string, checklistNumber int, checklistItem ChecklistItem) error

func (*PlaybookRunService) Create

Create a playbook run.

func (*PlaybookRunService) CreateChecklist

func (s *PlaybookRunService) CreateChecklist(ctx context.Context, playbookRunID string, checklist Checklist) error

func (*PlaybookRunService) Finish

func (s *PlaybookRunService) Finish(ctx context.Context, playbookRunID string) error

func (*PlaybookRunService) Get

func (s *PlaybookRunService) Get(ctx context.Context, playbookRunID string) (*PlaybookRun, error)

Get a playbook run.

func (*PlaybookRunService) GetByChannelID

func (s *PlaybookRunService) GetByChannelID(ctx context.Context, channelID string) (*PlaybookRun, error)

GetByChannelID gets a playbook run by ChannelID.

func (*PlaybookRunService) GetMetadata

func (s *PlaybookRunService) GetMetadata(ctx context.Context, playbookRunID string) (*Metadata, error)

Get a playbook run's metadata.

func (*PlaybookRunService) GetOwners

func (s *PlaybookRunService) GetOwners(ctx context.Context) ([]OwnerInfo, error)

Get a playbook run.

func (*PlaybookRunService) GetStatusUpdates

func (s *PlaybookRunService) GetStatusUpdates(ctx context.Context, playbookRunID string) ([]StatusPostComplete, error)

Get all playbook status updates.

func (*PlaybookRunService) List

List the playbook runs.

func (*PlaybookRunService) MoveChecklist

func (s *PlaybookRunService) MoveChecklist(ctx context.Context, playbookRunID string, sourceChecklistIdx, destChecklistIdx int) error

func (*PlaybookRunService) MoveChecklistItem

func (s *PlaybookRunService) MoveChecklistItem(ctx context.Context, playbookRunID string, sourceChecklistIdx, sourceItemIdx, destChecklistIdx, destItemIdx int) error

func (*PlaybookRunService) PublishRetrospective

func (s *PlaybookRunService) PublishRetrospective(ctx context.Context, playbookRunID, userID string, retroUpdate RetrospectiveUpdate) error

PublishRetrospective publishes the run's retrospective

func (*PlaybookRunService) RemoveChecklist

func (s *PlaybookRunService) RemoveChecklist(ctx context.Context, playbookRunID string, checklistNumber int) error

func (*PlaybookRunService) RenameChecklist

func (s *PlaybookRunService) RenameChecklist(ctx context.Context, playbookRunID string, checklistNumber int, newTitle string) error

func (*PlaybookRunService) RequestUpdate

func (s *PlaybookRunService) RequestUpdate(ctx context.Context, playbookRunID, userID string) error

func (*PlaybookRunService) RunItemCommand

func (s *PlaybookRunService) RunItemCommand(ctx context.Context, playbookRunID string, checklistIdx int, itemIdx int) error

func (*PlaybookRunService) SetItemAssignee

func (s *PlaybookRunService) SetItemAssignee(ctx context.Context, playbookRunID string, checklistIdx int, itemIdx int, assigneeID string) error

func (*PlaybookRunService) SetItemCommand

func (s *PlaybookRunService) SetItemCommand(ctx context.Context, playbookRunID string, checklistIdx int, itemIdx int, newCommand string) error

func (*PlaybookRunService) SetItemDueDate

func (s *PlaybookRunService) SetItemDueDate(ctx context.Context, playbookRunID string, checklistIdx int, itemIdx int, duedate int64) error

func (*PlaybookRunService) UpdateRetrospective

func (s *PlaybookRunService) UpdateRetrospective(ctx context.Context, playbookRunID, userID string, retroUpdate RetrospectiveUpdate) error

UpdateRetrospective updates the run's retrospective info

func (*PlaybookRunService) UpdateStatus

func (s *PlaybookRunService) UpdateStatus(ctx context.Context, playbookRunID string, message string, reminderInSeconds int64) error

type PlaybookSiteStats

type PlaybookSiteStats struct {
	TotalPlaybooks    int `json:"total_playbooks"`
	TotalPlaybookRuns int `json:"total_playbook_runs"`
}

PlaybookSiteStats holds the data that we want to expose in system console

type PlaybookStats

type PlaybookStats struct {
	RunsInProgress                int        `json:"runs_in_progress"`
	ParticipantsActive            int        `json:"participants_active"`
	RunsFinishedPrev30Days        int        `json:"runs_finished_prev_30_days"`
	RunsFinishedPercentageChange  int        `json:"runs_finished_percentage_change"`
	RunsStartedPerWeek            []int      `json:"runs_started_per_week"`
	RunsStartedPerWeekTimes       [][]int64  `json:"runs_started_per_week_times"`
	ActiveRunsPerDay              []int      `json:"active_runs_per_day"`
	ActiveRunsPerDayTimes         [][]int64  `json:"active_runs_per_day_times"`
	ActiveParticipantsPerDay      []int      `json:"active_participants_per_day"`
	ActiveParticipantsPerDayTimes [][]int64  `json:"active_participants_per_day_times"`
	MetricOverallAverage          []null.Int `json:"metric_overall_average"`
	MetricRollingAverage          []null.Int `json:"metric_rolling_average"`
	MetricRollingAverageChange    []null.Int `json:"metric_rolling_average_change"`
	MetricValueRange              [][]int64  `json:"metric_value_range"`
	MetricRollingValues           [][]int64  `json:"metric_rolling_values"`
	LastXRunNames                 []string   `json:"last_x_run_names"`
}

type PlaybooksService

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

PlaybooksService handles communication with the playbook related methods of the Playbook API.

func (*PlaybooksService) Archive

func (s *PlaybooksService) Archive(ctx context.Context, playbookID string) error

func (*PlaybooksService) AutoFollow

func (s *PlaybooksService) AutoFollow(ctx context.Context, playbookID string, userID string) error

func (*PlaybooksService) AutoUnfollow

func (s *PlaybooksService) AutoUnfollow(ctx context.Context, playbookID string, userID string) error

func (*PlaybooksService) Create

Create a playbook. Returns the id of the newly created playbook

func (*PlaybooksService) Duplicate

func (s *PlaybooksService) Duplicate(ctx context.Context, playbookID string) (string, error)

Duplicate a playbook. Returns the id of the newly created playbook

func (*PlaybooksService) Export

func (s *PlaybooksService) Export(ctx context.Context, playbookID string) ([]byte, error)

func (*PlaybooksService) Get

func (s *PlaybooksService) Get(ctx context.Context, playbookID string) (*Playbook, error)

Get a playbook.

func (*PlaybooksService) GetAutoFollows

func (s *PlaybooksService) GetAutoFollows(ctx context.Context, playbookID string) ([]string, error)

func (*PlaybooksService) Import

func (s *PlaybooksService) Import(ctx context.Context, toImport []byte, team string) (string, error)

Imports a playbook. Returns the id of the newly created playbook

func (*PlaybooksService) List

func (s *PlaybooksService) List(ctx context.Context, teamId string, page, perPage int, opts PlaybookListOptions) (*GetPlaybooksResults, error)

List the playbooks.

func (*PlaybooksService) Stats

func (s *PlaybooksService) Stats(ctx context.Context, playbookID string) (*PlaybookStats, error)

func (*PlaybooksService) Update

func (s *PlaybooksService) Update(ctx context.Context, playbook Playbook) error

type PromptRunPlaybookFromKeywordsPayload

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

type ReminderResetPayload

type ReminderResetPayload struct {
	NewReminderSeconds int `json:"new_reminder_seconds"`
}

type RemindersService

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

func (*RemindersService) Reset

func (s *RemindersService) Reset(ctx context.Context, playbookRunID string, payload ReminderResetPayload) error

type RetrospectiveUpdate

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

RetrospectiveUpdate represents the run retrospective info

type RunAction

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"`
}

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

type RunMetricData

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

type SettingsService

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

SettingsService handles communication with the settings related methods.

func (*SettingsService) Get

Get the configured settings.

func (*SettingsService) Update

func (s *SettingsService) Update(ctx context.Context, settings GlobalSettings) error

Update the configured settings.

type Sort

type Sort string

Sort enumerates the available fields we can sort on.

const (
	// SortByCreateAt sorts by the "create_at" field. It is the default.
	SortByCreateAt Sort = "create_at"

	// SortByID sorts by the "id" field.
	SortByID Sort = "id"

	// SortByName sorts by the "name" field.
	SortByName Sort = "name"

	// SortByOwnerUserID sorts by the "owner_user_id" field.
	SortByOwnerUserID Sort = "owner_user_id"

	// SortByTeamID sorts by the "team_id" field.
	SortByTeamID Sort = "team_id"

	// SortByEndAt sorts by the "end_at" field.
	SortByEndAt Sort = "end_at"

	// SortBySteps sorts playbooks by the number of steps in the playbook.
	SortBySteps Sort = "steps"

	// SortByStages sorts playbooks by the number of stages in the playbook.
	SortByStages Sort = "stages"

	// SortByTitle sorts by the "title" field.
	SortByTitle Sort = "title"

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

type SortDirection

type SortDirection string

SortDirection determines whether results are sorted ascending or descending.

const (
	// Desc sorts the results in descending order.
	SortDesc SortDirection = "desc"

	// Asc sorts the results in ascending order.
	SortAsc SortDirection = "asc"
)

type StatsService

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

StatsService handles communication with the stats related methods.

func (*StatsService) GetSiteStats

func (s *StatsService) GetSiteStats(ctx context.Context) (*PlaybookSiteStats, error)

Get the stats that should be displayed in system console.

type Status

type Status string

Status is the type used to specify the activity status of the playbook run.

const (
	StatusInProgress Status = "InProgress"
	StatusFinished   Status = "Finished"
)

type StatusPost

type StatusPost struct {
	ID       string `json:"id"`
	CreateAt int64  `json:"create_at"`
	DeleteAt int64  `json:"delete_at"`
}

StatusPost is information added to the playbook run when selecting from the db and sent to the client; it is not saved to the db.

type StatusPostComplete

type StatusPostComplete struct {
	Id             string `json:"id"`
	CreateAt       int64  `json:"create_at"`
	UpdateAt       int64  `json:"update_at"`
	DeleteAt       int64  `json:"delete_at"`
	Message        string `json:"message"`
	AuthorUserName string `json:"author_user_name"`
}

StatusPostComplete is the complete status update (post) it's similar to StatusPost but with extended info.

type StatusUpdateOptions

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

StatusUpdateOptions are the fields required to update a playbook run's status

type TaskAction

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

TaskAction represents a task action in an item

type TelemetryService

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

func (*TelemetryService) CreateEvent

func (s *TelemetryService) CreateEvent(ctx context.Context, name string, eventType string, properties map[string]interface{}) error

type TimelineEvent

type TimelineEvent struct {
	ID            string            `json:"id"`
	PlaybookRunID string            `json:"playbook_run"`
	CreateAt      int64             `json:"create_at"`
	DeleteAt      int64             `json:"delete_at"`
	EventAt       int64             `json:"event_at"`
	EventType     TimelineEventType `json:"event_type"`
	Summary       string            `json:"summary"`
	Details       string            `json:"details"`
	PostID        string            `json:"post_id"`
	SubjectUserID string            `json:"subject_user_id"`
	CreatorUserID string            `json:"creator_user_id"`
}

TimelineEvent represents an event recorded to a playbook run's timeline.

type TimelineEventType

type TimelineEventType string

TimelineEventType describes a type of timeline event.

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"
	PublishedRetrospective TimelineEventType = "published_retrospective"
	CanceledRetrospective  TimelineEventType = "canceled_retrospective"
	RunFinished            TimelineEventType = "run_finished"
	RunRestored            TimelineEventType = "run_restored"
	StatusUpdatesEnabled   TimelineEventType = "status_updates_enabled"
	StatusUpdatesDisabled  TimelineEventType = "status_updates_disabled"
)

type TriggerAction

type TriggerAction struct {
	Type    string `json:"type"`
	Payload string `json:"payload"`
}

TriggerAction represents a trigger or action in a Task Action

type WelcomeMessageAction

type WelcomeMessageAction struct {
	GenericChannelActionWithoutPayload
	Payload WelcomeMessagePayload `json:"payload"`
}

type WelcomeMessagePayload

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

Jump to

Keyboard shortcuts

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