Help us shape the future of Go! Take the 2026 Go Developer Survey

notifications

package
v3.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package notifications implements MCP tools for GitLab notification setting operations.

The package wraps the GitLab Notification settings API:

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ActionSpecs

func ActionSpecs(client *gitlabclient.Client) []toolutil.ActionSpec

ActionSpecs returns canonical specs for notification settings actions exposed as MCP tools. The global, project, and group read/update routes are projected into the dynamic, meta, individual, and audit surfaces by the action catalog (ADR-0004).

func FormatMarkdown

func FormatMarkdown(out Output) *mcp.CallToolResult

FormatMarkdown formats notification settings as a Markdown CallToolResult.

func FormatMarkdownString

func FormatMarkdownString(out Output) string

FormatMarkdownString renders notification settings as the card of one object: the level and the email, then the per-event flags as a section when the level is custom and GitLab sends them.

The event flags used to be written as "- ✅ Close Issue", which reads as a list of enabled events rather than as fields of the settings object. Each is a field, so each is a row whose value is the flag.

Types

type EventOutput

type EventOutput struct {
	CloseIssue                bool `json:"close_issue"`
	CloseMergeRequest         bool `json:"close_merge_request"`
	FailedPipeline            bool `json:"failed_pipeline"`
	FixedPipeline             bool `json:"fixed_pipeline"`
	IssueDue                  bool `json:"issue_due"`
	MergeWhenPipelineSucceeds bool `json:"merge_when_pipeline_succeeds"`
	MergeMergeRequest         bool `json:"merge_merge_request"`
	MovedProject              bool `json:"moved_project"`
	NewIssue                  bool `json:"new_issue"`
	NewMergeRequest           bool `json:"new_merge_request"`
	NewEpic                   bool `json:"new_epic"`
	NewNote                   bool `json:"new_note"`
	PushToMergeRequest        bool `json:"push_to_merge_request"`
	ReassignIssue             bool `json:"reassign_issue"`
	ReassignMergeRequest      bool `json:"reassign_merge_request"`
	ReopenIssue               bool `json:"reopen_issue"`
	ReopenMergeRequest        bool `json:"reopen_merge_request"`
	SuccessPipeline           bool `json:"success_pipeline"`
}

EventOutput represents which events trigger notifications.

type GetGlobalInput

type GetGlobalInput struct{}

GetGlobalInput is the input for getting global notification settings.

type GetGroupInput

type GetGroupInput struct {
	GroupID toolutil.StringOrInt `json:"group_id" jsonschema:"Group ID or URL-encoded path,required"`
}

GetGroupInput is the input for getting group notification settings.

type GetProjectInput

type GetProjectInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
}

GetProjectInput is the input for getting project notification settings.

type Output

type Output struct {
	toolutil.HintableOutput
	Level             string       `json:"level"`
	NotificationEmail string       `json:"notification_email,omitempty"`
	Events            *EventOutput `json:"events,omitempty"`
}

Output represents notification settings.

func GetGlobalSettings

func GetGlobalSettings(ctx context.Context, client *gitlabclient.Client, _ GetGlobalInput) (Output, error)

GetGlobalSettings retrieves the authenticated user's global notification settings via the GitLab Notification settings API (GET /notification_settings).

func GetSettingsForGroup

func GetSettingsForGroup(ctx context.Context, client *gitlabclient.Client, input GetGroupInput) (Output, error)

GetSettingsForGroup retrieves the authenticated user's notification settings for a group via the GitLab Notification settings API (GET /groups/:id/notification_settings).

func GetSettingsForProject

func GetSettingsForProject(ctx context.Context, client *gitlabclient.Client, input GetProjectInput) (Output, error)

GetSettingsForProject retrieves the authenticated user's notification settings for a project via the GitLab Notification settings API (GET /projects/:id/notification_settings).

func UpdateGlobalSettings

func UpdateGlobalSettings(ctx context.Context, client *gitlabclient.Client, input UpdateGlobalInput) (Output, error)

UpdateGlobalSettings updates the authenticated user's global notification settings via the GitLab Notification settings API (PUT /notification_settings). Only non-nil fields are applied.

func UpdateSettingsForGroup

func UpdateSettingsForGroup(ctx context.Context, client *gitlabclient.Client, input UpdateGroupInput) (Output, error)

UpdateSettingsForGroup updates the authenticated user's notification settings for a group via the GitLab Notification settings API (PUT /groups/:id/notification_settings).

func UpdateSettingsForProject

func UpdateSettingsForProject(ctx context.Context, client *gitlabclient.Client, input UpdateProjectInput) (Output, error)

UpdateSettingsForProject updates the authenticated user's notification settings for a project via the GitLab Notification settings API (PUT /projects/:id/notification_settings).

type UpdateGlobalInput

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

UpdateGlobalInput is the input for updating global notification settings.

type UpdateGroupInput

type UpdateGroupInput struct {
	GroupID toolutil.StringOrInt `json:"group_id" jsonschema:"Group ID or URL-encoded path,required"`
	// contains filtered or unexported fields
}

UpdateGroupInput is the input for updating group notification settings.

type UpdateProjectInput

type UpdateProjectInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	// contains filtered or unexported fields
}

UpdateProjectInput is the input for updating project notification settings.

Jump to

Keyboard shortcuts

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