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

resourceevents

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 resourceevents implements MCP tools for GitLab resource state event operations.

The package wraps the GitLab Resource state events API:

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EpicActionSpecs

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

EpicActionSpecs returns canonical specs for group epic resource event actions. Epic label events are a GitLab Premium/Ultimate (Edition: editionPremium) feature.

func FormatIterationEventMarkdown

func FormatIterationEventMarkdown(out IterationEventOutput) string

FormatIterationEventMarkdown formats a single iteration event as a card. The iteration's own ID is written only when GitLab sent one, on the same terms as the milestone's.

func FormatIterationEventsMarkdown

func FormatIterationEventsMarkdown(out ListIterationEventsOutput) string

FormatIterationEventsMarkdown formats a list of iteration events.

func FormatLabelEventMarkdown

func FormatLabelEventMarkdown(out LabelEventOutput) string

FormatLabelEventMarkdown formats a single label event as a card.

func FormatLabelEventsMarkdown

func FormatLabelEventsMarkdown(out ListLabelEventsOutput) string

FormatLabelEventsMarkdown formats a list of label events.

func FormatMilestoneEventMarkdown

func FormatMilestoneEventMarkdown(out MilestoneEventOutput) string

FormatMilestoneEventMarkdown formats a single milestone event as a card. The milestone's own ID is a row of its own and is written only when GitLab sent one: an event whose milestone has been deleted used to read "(ID: 0)".

func FormatMilestoneEventsMarkdown

func FormatMilestoneEventsMarkdown(out ListMilestoneEventsOutput) string

FormatMilestoneEventsMarkdown formats a list of milestone events.

func FormatStateEventMarkdown

func FormatStateEventMarkdown(out StateEventOutput) string

FormatStateEventMarkdown formats a single state event as a card.

func FormatStateEventsMarkdown

func FormatStateEventsMarkdown(out ListStateEventsOutput) string

FormatStateEventsMarkdown formats a list of state events.

func FormatWeightEventsMarkdown

func FormatWeightEventsMarkdown(out ListWeightEventsOutput) string

FormatWeightEventsMarkdown formats a list of weight events.

func IssueActionSpecs

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

IssueActionSpecs returns canonical specs for issue resource event actions.

func MergeRequestActionSpecs

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

MergeRequestActionSpecs returns canonical specs for merge request resource event actions.

Types

type EventUserOutput

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

EventUserOutput mirrors gl.BasicUser, the user object embedded on every resource event (the actor that performed the change).

type GetGroupEpicLabelEventInput

type GetGroupEpicLabelEventInput struct {
	GroupID      toolutil.StringOrInt `json:"group_id" jsonschema:"Group ID or URL-encoded path,required"`
	EpicIID      int64                `json:"epic_iid" jsonschema:"Epic internal ID (IID) within the group,required"`
	LabelEventID int64                `json:"label_event_id" jsonschema:"Label event ID,required"`
}

GetGroupEpicLabelEventInput defines parameters for getting a single group epic label event.

type GetIssueIterationEventInput

type GetIssueIterationEventInput struct {
	ProjectID        toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	IssueIID         int64                `json:"issue_iid" jsonschema:"Issue internal ID,required"`
	IterationEventID int64                `json:"iteration_event_id" jsonschema:"Iteration event ID,required"`
}

GetIssueIterationEventInput defines parameters for getting a single issue iteration event.

type GetIssueLabelEventInput

type GetIssueLabelEventInput struct {
	ProjectID    toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	IssueIID     int64                `json:"issue_iid" jsonschema:"Issue internal ID,required"`
	LabelEventID int64                `json:"label_event_id" jsonschema:"Label event ID,required"`
}

GetIssueLabelEventInput defines parameters for getting a single issue label event.

type GetIssueMilestoneEventInput

type GetIssueMilestoneEventInput struct {
	ProjectID        toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	IssueIID         int64                `json:"issue_iid" jsonschema:"Issue internal ID,required"`
	MilestoneEventID int64                `json:"milestone_event_id" jsonschema:"Milestone event ID,required"`
}

GetIssueMilestoneEventInput defines parameters for getting a single issue milestone event.

type GetIssueStateEventInput

type GetIssueStateEventInput struct {
	ProjectID    toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	IssueIID     int64                `json:"issue_iid" jsonschema:"Issue internal ID,required"`
	StateEventID int64                `json:"state_event_id" jsonschema:"State event ID,required"`
}

GetIssueStateEventInput defines parameters for getting a single issue state event.

type GetMRLabelEventInput

type GetMRLabelEventInput struct {
	ProjectID    toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	MRIID        int64                `json:"merge_request_iid" jsonschema:"Merge request internal ID,required"`
	LabelEventID int64                `json:"label_event_id" jsonschema:"Label event ID,required"`
}

GetMRLabelEventInput defines parameters for getting a single MR label event.

type GetMRMilestoneEventInput

type GetMRMilestoneEventInput struct {
	ProjectID        toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	MRIID            int64                `json:"merge_request_iid" jsonschema:"Merge request internal ID,required"`
	MilestoneEventID int64                `json:"milestone_event_id" jsonschema:"Milestone event ID,required"`
}

GetMRMilestoneEventInput defines parameters for getting a single MR milestone event.

type GetMRStateEventInput

type GetMRStateEventInput struct {
	ProjectID    toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	MRIID        int64                `json:"merge_request_iid" jsonschema:"Merge request internal ID,required"`
	StateEventID int64                `json:"state_event_id" jsonschema:"State event ID,required"`
}

GetMRStateEventInput defines parameters for getting a single MR state event.

type IterationEventOutput

type IterationEventOutput struct {
	toolutil.HintableOutput
	ID           int64            `json:"id"`
	Action       string           `json:"action"`
	CreatedAt    string           `json:"created_at"`
	ResourceType string           `json:"resource_type"`
	ResourceID   int64            `json:"resource_id"`
	User         *EventUserOutput `json:"user,omitempty"`
	Iteration    *IterationOutput `json:"iteration,omitempty"`
}

IterationEventOutput represents a resource iteration event.

func GetIssueIterationEvent

func GetIssueIterationEvent(ctx context.Context, client *gitlabclient.Client, input GetIssueIterationEventInput) (IterationEventOutput, error)

GetIssueIterationEvent gets a single iteration event for an issue.

type IterationOutput

type IterationOutput = toolutil.IterationOutput

IterationOutput mirrors gl.Iteration (the iteration object on a resource iteration event). Canonical shape shared via toolutil.

type LabelEventLabelOutput

type LabelEventLabelOutput struct {
	ID          int64  `json:"id"`
	Name        string `json:"name"`
	Color       string `json:"color"`
	TextColor   string `json:"text_color"`
	Description string `json:"description"`
}

LabelEventLabelOutput mirrors gl.LabelEventLabel (the compact label object on a resource label event).

type LabelEventOutput

type LabelEventOutput struct {
	toolutil.HintableOutput
	ID           int64                  `json:"id"`
	Action       string                 `json:"action"`
	CreatedAt    string                 `json:"created_at"`
	ResourceType string                 `json:"resource_type"`
	ResourceID   int64                  `json:"resource_id"`
	User         *EventUserOutput       `json:"user,omitempty"`
	Label        *LabelEventLabelOutput `json:"label,omitempty"`
}

LabelEventOutput represents a resource label event.

func GetGroupEpicLabelEvent

func GetGroupEpicLabelEvent(ctx context.Context, client *gitlabclient.Client, input GetGroupEpicLabelEventInput) (LabelEventOutput, error)

GetGroupEpicLabelEvent gets a single label event for a group epic (Premium/Ultimate).

func GetIssueLabelEvent

func GetIssueLabelEvent(ctx context.Context, client *gitlabclient.Client, input GetIssueLabelEventInput) (LabelEventOutput, error)

GetIssueLabelEvent gets a single label event for an issue.

func GetMRLabelEvent

func GetMRLabelEvent(ctx context.Context, client *gitlabclient.Client, input GetMRLabelEventInput) (LabelEventOutput, error)

GetMRLabelEvent gets a single label event for a merge request.

type ListGroupEpicLabelEventsInput

type ListGroupEpicLabelEventsInput struct {
	GroupID toolutil.StringOrInt `json:"group_id" jsonschema:"Group ID or URL-encoded path,required"`
	EpicIID int64                `json:"epic_iid" jsonschema:"Epic internal ID (IID) within the group,required"`
	OrderBy string               `json:"order_by,omitempty" jsonschema:"Column to order keyset-paginated results by (e.g. id)"`
	Sort    string               `json:"sort,omitempty" jsonschema:"Sort direction for keyset pagination: asc or desc"`
	toolutil.PaginationInput
	toolutil.KeysetPaginationInput
}

ListGroupEpicLabelEventsInput defines parameters for listing group epic label events.

type ListIssueIterationEventsInput

type ListIssueIterationEventsInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	IssueIID  int64                `json:"issue_iid" jsonschema:"Issue internal ID,required"`
	OrderBy   string               `json:"order_by,omitempty" jsonschema:"Column to order keyset-paginated results by (e.g. id)"`
	Sort      string               `json:"sort,omitempty" jsonschema:"Sort direction for keyset pagination: asc or desc"`
	toolutil.PaginationInput
	toolutil.KeysetPaginationInput
}

ListIssueIterationEventsInput defines parameters for listing issue iteration events.

type ListIssueLabelEventsInput

type ListIssueLabelEventsInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	IssueIID  int64                `json:"issue_iid" jsonschema:"Issue internal ID,required"`
	OrderBy   string               `json:"order_by,omitempty" jsonschema:"Column to order keyset-paginated results by (e.g. id)"`
	Sort      string               `json:"sort,omitempty" jsonschema:"Sort direction for keyset pagination: asc or desc"`
	toolutil.PaginationInput
	toolutil.KeysetPaginationInput
}

ListIssueLabelEventsInput defines parameters for listing issue label events.

type ListIssueMilestoneEventsInput

type ListIssueMilestoneEventsInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	IssueIID  int64                `json:"issue_iid" jsonschema:"Issue internal ID,required"`
	OrderBy   string               `json:"order_by,omitempty" jsonschema:"Column to order keyset-paginated results by (e.g. id)"`
	Sort      string               `json:"sort,omitempty" jsonschema:"Sort direction for keyset pagination: asc or desc"`
	toolutil.PaginationInput
	toolutil.KeysetPaginationInput
}

ListIssueMilestoneEventsInput defines parameters for listing issue milestone events.

type ListIssueStateEventsInput

type ListIssueStateEventsInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	IssueIID  int64                `json:"issue_iid" jsonschema:"Issue internal ID,required"`
	OrderBy   string               `json:"order_by,omitempty" jsonschema:"Column to order keyset-paginated results by (e.g. id)"`
	Sort      string               `json:"sort,omitempty" jsonschema:"Sort direction for keyset pagination: asc or desc"`
	toolutil.PaginationInput
	toolutil.KeysetPaginationInput
}

ListIssueStateEventsInput defines parameters for listing issue state events.

type ListIssueWeightEventsInput

type ListIssueWeightEventsInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	IssueIID  int64                `json:"issue_iid" jsonschema:"Issue internal ID,required"`
	OrderBy   string               `json:"order_by,omitempty" jsonschema:"Column to order keyset-paginated results by (e.g. id)"`
	Sort      string               `json:"sort,omitempty" jsonschema:"Sort direction for keyset pagination: asc or desc"`
	toolutil.PaginationInput
	toolutil.KeysetPaginationInput
}

ListIssueWeightEventsInput defines parameters for listing issue weight events.

type ListIterationEventsOutput

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

ListIterationEventsOutput wraps a list of iteration events.

func ListIssueIterationEvents

func ListIssueIterationEvents(ctx context.Context, client *gitlabclient.Client, input ListIssueIterationEventsInput) (ListIterationEventsOutput, error)

ListIssueIterationEvents lists iteration events for an issue.

type ListLabelEventsOutput

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

ListLabelEventsOutput wraps a list of label events.

func ListGroupEpicLabelEvents

func ListGroupEpicLabelEvents(ctx context.Context, client *gitlabclient.Client, input ListGroupEpicLabelEventsInput) (ListLabelEventsOutput, error)

ListGroupEpicLabelEvents lists label events for a group epic (Premium/Ultimate).

func ListIssueLabelEvents

func ListIssueLabelEvents(ctx context.Context, client *gitlabclient.Client, input ListIssueLabelEventsInput) (ListLabelEventsOutput, error)

ListIssueLabelEvents lists label events for an issue.

func ListMRLabelEvents

func ListMRLabelEvents(ctx context.Context, client *gitlabclient.Client, input ListMRLabelEventsInput) (ListLabelEventsOutput, error)

ListMRLabelEvents lists label events for a merge request.

type ListMRLabelEventsInput

type ListMRLabelEventsInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	MRIID     int64                `json:"merge_request_iid" jsonschema:"Merge request internal ID,required"`
	OrderBy   string               `json:"order_by,omitempty" jsonschema:"Column to order keyset-paginated results by (e.g. id)"`
	Sort      string               `json:"sort,omitempty" jsonschema:"Sort direction for keyset pagination: asc or desc"`
	toolutil.PaginationInput
	toolutil.KeysetPaginationInput
}

ListMRLabelEventsInput defines parameters for listing merge request label events.

type ListMRMilestoneEventsInput

type ListMRMilestoneEventsInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	MRIID     int64                `json:"merge_request_iid" jsonschema:"Merge request internal ID,required"`
	OrderBy   string               `json:"order_by,omitempty" jsonschema:"Column to order keyset-paginated results by (e.g. id)"`
	Sort      string               `json:"sort,omitempty" jsonschema:"Sort direction for keyset pagination: asc or desc"`
	toolutil.PaginationInput
	toolutil.KeysetPaginationInput
}

ListMRMilestoneEventsInput defines parameters for listing MR milestone events.

type ListMRStateEventsInput

type ListMRStateEventsInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	MRIID     int64                `json:"merge_request_iid" jsonschema:"Merge request internal ID,required"`
	OrderBy   string               `json:"order_by,omitempty" jsonschema:"Column to order keyset-paginated results by (e.g. id)"`
	Sort      string               `json:"sort,omitempty" jsonschema:"Sort direction for keyset pagination: asc or desc"`
	toolutil.PaginationInput
	toolutil.KeysetPaginationInput
}

ListMRStateEventsInput defines parameters for listing MR state events.

type ListMilestoneEventsOutput

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

ListMilestoneEventsOutput wraps a list of milestone events.

func ListIssueMilestoneEvents

func ListIssueMilestoneEvents(ctx context.Context, client *gitlabclient.Client, input ListIssueMilestoneEventsInput) (ListMilestoneEventsOutput, error)

ListIssueMilestoneEvents lists milestone events for an issue.

func ListMRMilestoneEvents

func ListMRMilestoneEvents(ctx context.Context, client *gitlabclient.Client, input ListMRMilestoneEventsInput) (ListMilestoneEventsOutput, error)

ListMRMilestoneEvents lists milestone events for a merge request.

type ListStateEventsOutput

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

ListStateEventsOutput wraps a list of state events.

func ListIssueStateEvents

func ListIssueStateEvents(ctx context.Context, client *gitlabclient.Client, input ListIssueStateEventsInput) (ListStateEventsOutput, error)

ListIssueStateEvents lists state events for an issue.

func ListMRStateEvents

func ListMRStateEvents(ctx context.Context, client *gitlabclient.Client, input ListMRStateEventsInput) (ListStateEventsOutput, error)

ListMRStateEvents lists state events for a merge request.

type ListWeightEventsOutput

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

ListWeightEventsOutput wraps a list of weight events.

func ListIssueWeightEvents

func ListIssueWeightEvents(ctx context.Context, client *gitlabclient.Client, input ListIssueWeightEventsInput) (ListWeightEventsOutput, error)

ListIssueWeightEvents lists weight events for an issue.

type MilestoneEventOutput

type MilestoneEventOutput struct {
	toolutil.HintableOutput
	ID           int64            `json:"id"`
	Action       string           `json:"action"`
	CreatedAt    string           `json:"created_at"`
	ResourceType string           `json:"resource_type"`
	ResourceID   int64            `json:"resource_id"`
	User         *EventUserOutput `json:"user,omitempty"`
	Milestone    *MilestoneOutput `json:"milestone,omitempty"`
	// State is the issue or merge request's own state at the moment the
	// milestone changed, not the state of the event.
	State string `json:"state,omitempty"`
}

MilestoneEventOutput represents a resource milestone event.

func GetIssueMilestoneEvent

func GetIssueMilestoneEvent(ctx context.Context, client *gitlabclient.Client, input GetIssueMilestoneEventInput) (MilestoneEventOutput, error)

GetIssueMilestoneEvent gets a single milestone event for an issue.

func GetMRMilestoneEvent

func GetMRMilestoneEvent(ctx context.Context, client *gitlabclient.Client, input GetMRMilestoneEventInput) (MilestoneEventOutput, error)

GetMRMilestoneEvent gets a single milestone event for a merge request.

type MilestoneOutput

type MilestoneOutput struct {
	ID          int64  `json:"id"`
	IID         int64  `json:"iid"`
	GroupID     int64  `json:"group_id"`
	ProjectID   int64  `json:"project_id"`
	Title       string `json:"title"`
	Description string `json:"description"`
	State       string `json:"state"`
	WebURL      string `json:"web_url"`
	StartDate   string `json:"start_date,omitempty"`
	DueDate     string `json:"due_date,omitempty"`
	CreatedAt   string `json:"created_at,omitempty"`
	UpdatedAt   string `json:"updated_at,omitempty"`
	Expired     *bool  `json:"expired,omitempty"`
}

MilestoneOutput mirrors gl.Milestone (the milestone object on a resource milestone event).

type StateEventOutput

type StateEventOutput struct {
	toolutil.HintableOutput
	ID           int64            `json:"id"`
	State        string           `json:"state"`
	CreatedAt    string           `json:"created_at"`
	ResourceType string           `json:"resource_type"`
	ResourceID   int64            `json:"resource_id"`
	User         *EventUserOutput `json:"user,omitempty"`
	// SourceCommit is the commit that closed the issue and
	// SourceMergeRequestID the merge request that did, each empty when
	// something else caused the change.
	SourceCommit         string `json:"source_commit,omitempty"`
	SourceMergeRequestID int64  `json:"source_merge_request_id,omitempty"`
}

StateEventOutput represents a resource state event.

func GetIssueStateEvent

func GetIssueStateEvent(ctx context.Context, client *gitlabclient.Client, input GetIssueStateEventInput) (StateEventOutput, error)

GetIssueStateEvent gets a single state event for an issue.

func GetMRStateEvent

func GetMRStateEvent(ctx context.Context, client *gitlabclient.Client, input GetMRStateEventInput) (StateEventOutput, error)

GetMRStateEvent gets a single state event for a merge request.

type WeightEventOutput

type WeightEventOutput struct {
	ID        int64            `json:"id"`
	CreatedAt string           `json:"created_at"`
	IssueID   int64            `json:"issue_id"`
	Weight    int64            `json:"weight"`
	User      *EventUserOutput `json:"user,omitempty"`
}

WeightEventOutput represents a resource weight event. The weight entity is the odd one among the resource-event entities: its siblings (iteration, state and milestone events) do expose resource_type and resource_id, and ee/lib/api/entities/resource_weight_event.rb exposes exactly id, user, created_at, issue_id and weight. client-go's WeightEvent carries the other three anyway, copied from those siblings, so publishing them here asserted an empty type, a zero id and an empty state on every event.

Jump to

Keyboard shortcuts

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