events

package
v2.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package events implements MCP tools for GitLab event operations.

The package wraps the GitLab Events API:

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatContributionListMarkdown

func FormatContributionListMarkdown(out ListContributionEventsOutput) *mcp.CallToolResult

FormatContributionListMarkdown formats contribution events as a Markdown CallToolResult.

func FormatContributionListMarkdownString

func FormatContributionListMarkdownString(out ListContributionEventsOutput) string

FormatContributionListMarkdownString renders contribution events as a Markdown string.

func FormatListMarkdown

func FormatListMarkdown(out ListProjectEventsOutput) *mcp.CallToolResult

FormatListMarkdown formats project events as a Markdown CallToolResult.

func FormatListMarkdownString

func FormatListMarkdownString(out ListProjectEventsOutput) string

FormatListMarkdownString renders project events as a Markdown string.

func UserActionSpecs

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

UserActionSpecs returns canonical specs for event actions exposed through gitlab_user.

Types

type CommitOutput added in v2.3.0

type CommitOutput struct {
	ID               string              `json:"id"`
	ShortID          string              `json:"short_id,omitempty"`
	Title            string              `json:"title,omitempty"`
	AuthorName       string              `json:"author_name,omitempty"`
	AuthorEmail      string              `json:"author_email,omitempty"`
	AuthoredDate     string              `json:"authored_date,omitempty"`
	CommitterName    string              `json:"committer_name,omitempty"`
	CommitterEmail   string              `json:"committer_email,omitempty"`
	CommittedDate    string              `json:"committed_date,omitempty"`
	CreatedAt        string              `json:"created_at,omitempty"`
	Message          string              `json:"message,omitempty"`
	ParentIDs        []string            `json:"parent_ids,omitempty"`
	Stats            *CommitStatsOutput  `json:"stats,omitempty"`
	Status           string              `json:"status,omitempty"`
	LastPipeline     *PipelineInfoOutput `json:"last_pipeline,omitempty"`
	ProjectID        int64               `json:"project_id,omitempty"`
	Trailers         map[string]string   `json:"trailers,omitempty"`
	ExtendedTrailers map[string]string   `json:"extended_trailers,omitempty"`
	WebURL           string              `json:"web_url,omitempty"`
}

CommitOutput mirrors gitlab.Commit as embedded in project event push data.

type CommitStatsOutput added in v2.3.0

type CommitStatsOutput struct {
	Additions int64 `json:"additions"`
	Deletions int64 `json:"deletions"`
	Total     int64 `json:"total"`
}

CommitStatsOutput mirrors gitlab.CommitStats.

type ContributionEventOutput

type ContributionEventOutput struct {
	ID             int64                            `json:"id"`
	Title          string                           `json:"title,omitempty"`
	ProjectID      int64                            `json:"project_id"`
	ActionName     string                           `json:"action_name"`
	TargetID       int64                            `json:"target_id,omitempty"`
	TargetIID      int64                            `json:"target_iid,omitempty"`
	TargetType     string                           `json:"target_type,omitempty"`
	TargetURL      string                           `json:"target_url,omitempty"`
	AuthorID       int64                            `json:"author_id"`
	TargetTitle    string                           `json:"target_title,omitempty"`
	CreatedAt      string                           `json:"created_at,omitempty"`
	PushData       *ContributionEventPushDataOutput `json:"push_data,omitempty"`
	Note           *NoteOutput                      `json:"note,omitempty"`
	Author         *UserOutput                      `json:"author,omitempty"`
	AuthorUsername string                           `json:"author_username,omitempty"`
}

ContributionEventOutput mirrors gitlab.ContributionEvent.

type ContributionEventPushDataOutput added in v2.3.0

type ContributionEventPushDataOutput struct {
	CommitCount int64  `json:"commit_count"`
	Action      string `json:"action,omitempty"`
	RefType     string `json:"ref_type,omitempty"`
	CommitFrom  string `json:"commit_from,omitempty"`
	CommitTo    string `json:"commit_to,omitempty"`
	Ref         string `json:"ref,omitempty"`
	CommitTitle string `json:"commit_title,omitempty"`
}

ContributionEventPushDataOutput mirrors gitlab.ContributionEventPushData.

type LinePositionOutput added in v2.3.0

type LinePositionOutput struct {
	LineCode string `json:"line_code,omitempty"`
	Type     string `json:"type,omitempty"`
	OldLine  int64  `json:"old_line,omitempty"`
	NewLine  int64  `json:"new_line,omitempty"`
}

LinePositionOutput mirrors gitlab.LinePosition.

type LineRangeOutput added in v2.3.0

type LineRangeOutput struct {
	StartRange *LinePositionOutput `json:"start,omitempty"`
	EndRange   *LinePositionOutput `json:"end,omitempty"`
}

LineRangeOutput mirrors gitlab.LineRange.

type ListContributionEventsInput

type ListContributionEventsInput struct {
	Action     string `` /* 156-byte string literal not displayed */
	TargetType string `` /* 127-byte string literal not displayed */
	Before     string `json:"before,omitempty" jsonschema:"Return events before this date (YYYY-MM-DD)"`
	After      string `json:"after,omitempty" jsonschema:"Return events after this date (YYYY-MM-DD)"`
	Sort       string `json:"sort,omitempty" jsonschema:"Sort order (asc or desc)"`
	Scope      string `json:"scope,omitempty" jsonschema:"Include events from all projects (all) or only user's projects"`
	OrderBy    string `json:"order_by,omitempty" jsonschema:"Column by which to order keyset-paginated results (id)"`
	toolutil.PaginationInput
	toolutil.KeysetPaginationInput
}

ListContributionEventsInput contains parameters for listing current user contribution events.

type ListContributionEventsOutput

type ListContributionEventsOutput struct {
	toolutil.HintableOutput
	Events     []ContributionEventOutput `json:"events"`
	Pagination toolutil.PaginationOutput `json:"pagination"`
}

ListContributionEventsOutput holds a paginated list of contribution events.

func ListCurrentUserContributionEvents

func ListCurrentUserContributionEvents(ctx context.Context, client *gitlabclient.Client, input ListContributionEventsInput) (ListContributionEventsOutput, error)

ListCurrentUserContributionEvents returns contribution events for the authenticated user.

type ListProjectEventsInput

type ListProjectEventsInput struct {
	ProjectID  toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	Action     string               `` /* 156-byte string literal not displayed */
	TargetType string               `` /* 127-byte string literal not displayed */
	Before     string               `json:"before,omitempty" jsonschema:"Return events before this date (YYYY-MM-DD)"`
	After      string               `json:"after,omitempty" jsonschema:"Return events after this date (YYYY-MM-DD)"`
	Sort       string               `json:"sort,omitempty" jsonschema:"Sort order (asc or desc, default desc)"`
	OrderBy    string               `json:"order_by,omitempty" jsonschema:"Column by which to order keyset-paginated results (id)"`
	toolutil.PaginationInput
	toolutil.KeysetPaginationInput
}

ListProjectEventsInput contains parameters for listing project visible events.

type ListProjectEventsOutput

type ListProjectEventsOutput struct {
	toolutil.HintableOutput
	Events     []ProjectEventOutput      `json:"events"`
	Pagination toolutil.PaginationOutput `json:"pagination"`
}

ListProjectEventsOutput holds a paginated list of project events.

func ListProjectEvents

func ListProjectEvents(ctx context.Context, client *gitlabclient.Client, input ListProjectEventsInput) (ListProjectEventsOutput, error)

ListProjectEvents returns a paginated list of visible events for a project.

type NoteAuthorOutput added in v2.3.0

type NoteAuthorOutput struct {
	ID        int64  `json:"id"`
	Username  string `json:"username,omitempty"`
	Email     string `json:"email,omitempty"`
	Name      string `json:"name,omitempty"`
	State     string `json:"state,omitempty"`
	AvatarURL string `json:"avatar_url,omitempty"`
	WebURL    string `json:"web_url,omitempty"`
}

NoteAuthorOutput mirrors gitlab.NoteAuthor / gitlab.NoteResolvedBy.

type NoteOutput added in v2.3.0

type NoteOutput struct {
	ID           int64               `json:"id"`
	Type         string              `json:"type,omitempty"`
	Body         string              `json:"body,omitempty"`
	Attachment   string              `json:"attachment,omitempty"`
	Title        string              `json:"title,omitempty"`
	FileName     string              `json:"file_name,omitempty"`
	Author       *NoteAuthorOutput   `json:"author,omitempty"`
	System       bool                `json:"system"`
	CreatedAt    string              `json:"created_at,omitempty"`
	UpdatedAt    string              `json:"updated_at,omitempty"`
	ExpiresAt    string              `json:"expires_at,omitempty"`
	CommitID     string              `json:"commit_id,omitempty"`
	Position     *NotePositionOutput `json:"position,omitempty"`
	NoteableID   int64               `json:"noteable_id,omitempty"`
	NoteableType string              `json:"noteable_type,omitempty"`
	ProjectID    int64               `json:"project_id,omitempty"`
	NoteableIID  int64               `json:"noteable_iid,omitempty"`
	Resolvable   bool                `json:"resolvable"`
	Resolved     bool                `json:"resolved"`
	ResolvedAt   string              `json:"resolved_at,omitempty"`
	ResolvedBy   *NoteAuthorOutput   `json:"resolved_by,omitempty"`
	Internal     bool                `json:"internal"`
	Confidential bool                `json:"confidential"`
}

NoteOutput mirrors gitlab.Note as embedded on a ContributionEvent.

type NotePositionOutput added in v2.3.0

type NotePositionOutput struct {
	BaseSHA      string           `json:"base_sha,omitempty"`
	StartSHA     string           `json:"start_sha,omitempty"`
	HeadSHA      string           `json:"head_sha,omitempty"`
	PositionType string           `json:"position_type,omitempty"`
	NewPath      string           `json:"new_path,omitempty"`
	NewLine      int64            `json:"new_line,omitempty"`
	OldPath      string           `json:"old_path,omitempty"`
	OldLine      int64            `json:"old_line,omitempty"`
	LineRange    *LineRangeOutput `json:"line_range,omitempty"`
}

NotePositionOutput mirrors gitlab.NotePosition.

type PipelineInfoOutput added in v2.3.0

type PipelineInfoOutput struct {
	ID        int64  `json:"id"`
	IID       int64  `json:"iid"`
	ProjectID int64  `json:"project_id"`
	Status    string `json:"status,omitempty"`
	Source    string `json:"source,omitempty"`
	Ref       string `json:"ref,omitempty"`
	SHA       string `json:"sha,omitempty"`
	Name      string `json:"name,omitempty"`
	WebURL    string `json:"web_url,omitempty"`
	UpdatedAt string `json:"updated_at,omitempty"`
	CreatedAt string `json:"created_at,omitempty"`
}

PipelineInfoOutput mirrors gitlab.PipelineInfo.

type ProjectEventDataOutput added in v2.3.0

type ProjectEventDataOutput struct {
	Before            string            `json:"before,omitempty"`
	After             string            `json:"after,omitempty"`
	Ref               string            `json:"ref,omitempty"`
	UserID            int64             `json:"user_id,omitempty"`
	UserName          string            `json:"user_name,omitempty"`
	Repository        *RepositoryOutput `json:"repository,omitempty"`
	Commits           []CommitOutput    `json:"commits,omitempty"`
	TotalCommitsCount int64             `json:"total_commits_count"`
}

ProjectEventDataOutput mirrors gitlab.ProjectEventData.

type ProjectEventNoteOutput added in v2.3.0

type ProjectEventNoteOutput struct {
	ID           int64             `json:"id"`
	Body         string            `json:"body,omitempty"`
	Attachment   string            `json:"attachment,omitempty"`
	Author       *NoteAuthorOutput `json:"author,omitempty"`
	CreatedAt    string            `json:"created_at,omitempty"`
	System       bool              `json:"system"`
	NoteableID   int64             `json:"noteable_id,omitempty"`
	NoteableType string            `json:"noteable_type,omitempty"`
	NoteableIID  int64             `json:"noteable_iid,omitempty"`
}

ProjectEventNoteOutput mirrors gitlab.ProjectEventNote.

type ProjectEventOutput

type ProjectEventOutput struct {
	ID             int64                       `json:"id"`
	Title          string                      `json:"title,omitempty"`
	ProjectID      int64                       `json:"project_id"`
	ActionName     string                      `json:"action_name"`
	TargetID       int64                       `json:"target_id,omitempty"`
	TargetIID      int64                       `json:"target_iid,omitempty"`
	TargetType     string                      `json:"target_type,omitempty"`
	TargetURL      string                      `json:"target_url,omitempty"`
	AuthorID       int64                       `json:"author_id"`
	TargetTitle    string                      `json:"target_title,omitempty"`
	CreatedAt      string                      `json:"created_at,omitempty"`
	Author         *UserOutput                 `json:"author,omitempty"`
	AuthorUsername string                      `json:"author_username,omitempty"`
	Data           *ProjectEventDataOutput     `json:"data,omitempty"`
	Note           *ProjectEventNoteOutput     `json:"note,omitempty"`
	PushData       *ProjectEventPushDataOutput `json:"push_data,omitempty"`
}

ProjectEventOutput mirrors gitlab.ProjectEvent.

type ProjectEventPushDataOutput added in v2.3.0

type ProjectEventPushDataOutput struct {
	CommitCount int64  `json:"commit_count"`
	Action      string `json:"action,omitempty"`
	RefType     string `json:"ref_type,omitempty"`
	CommitFrom  string `json:"commit_from,omitempty"`
	CommitTo    string `json:"commit_to,omitempty"`
	Ref         string `json:"ref,omitempty"`
	CommitTitle string `json:"commit_title,omitempty"`
}

ProjectEventPushDataOutput mirrors gitlab.ProjectEventPushData.

type RepositoryOutput added in v2.3.0

type RepositoryOutput struct {
	Name              string `json:"name,omitempty"`
	Description       string `json:"description,omitempty"`
	WebURL            string `json:"web_url,omitempty"`
	AvatarURL         string `json:"avatar_url,omitempty"`
	GitSSHURL         string `json:"git_ssh_url,omitempty"`
	GitHTTPURL        string `json:"git_http_url,omitempty"`
	Namespace         string `json:"namespace,omitempty"`
	Visibility        string `json:"visibility,omitempty"`
	PathWithNamespace string `json:"path_with_namespace,omitempty"`
	DefaultBranch     string `json:"default_branch,omitempty"`
	Homepage          string `json:"homepage,omitempty"`
	URL               string `json:"url,omitempty"`
	SSHURL            string `json:"ssh_url,omitempty"`
	HTTPURL           string `json:"http_url,omitempty"`
}

RepositoryOutput mirrors gitlab.Repository.

type UserOutput added in v2.3.0

type UserOutput struct {
	ID        int64  `json:"id"`
	Username  string `json:"username,omitempty"`
	Name      string `json:"name,omitempty"`
	State     string `json:"state,omitempty"`
	CreatedAt string `json:"created_at,omitempty"`
	AvatarURL string `json:"avatar_url,omitempty"`
	WebURL    string `json:"web_url,omitempty"`
}

UserOutput mirrors gitlab.BasicUser embedded as an event author.

Jump to

Keyboard shortcuts

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