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

invites

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: 12 Imported by: 0

Documentation

Overview

Package invites implements MCP tools for GitLab project and group invitation operations.

The package wraps the GitLab Invitations 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 project and group invitation actions.

func FormatInviteResultMarkdown

func FormatInviteResultMarkdown(out InviteResultOutput) *mcp.CallToolResult

FormatInviteResultMarkdown formats an invitation result as a Markdown CallToolResult.

func FormatInviteResultMarkdownString

func FormatInviteResultMarkdownString(out InviteResultOutput) string

FormatInviteResultMarkdownString renders an invitation result as a Markdown string.

func FormatListPendingMarkdown

func FormatListPendingMarkdown(out ListPendingInvitationsOutput) *mcp.CallToolResult

FormatListPendingMarkdown formats pending invitations as a Markdown CallToolResult.

func FormatListPendingMarkdownString

func FormatListPendingMarkdownString(out ListPendingInvitationsOutput) string

FormatListPendingMarkdownString renders pending invitations as a Markdown string.

The invitation token is deliberately absent from every column: it is carried in the JSON, where a caller who asked for it finds it, and a rendered table would paste a live credential into the conversation.

Types

type GroupInvitesInput

type GroupInvitesInput struct {
	GroupID      toolutil.StringOrInt `json:"group_id" jsonschema:"Group ID or URL-encoded path,required"`
	ID           toolutil.StringOrInt `` /* 147-byte string literal not displayed */
	Email        string               `json:"email,omitempty" jsonschema:"Email address to invite (either email or user_id required)"`
	UserID       int64                `json:"user_id,omitempty" jsonschema:"User ID to invite (either email or user_id required)"`
	AccessLevel  int                  `` /* 219-byte string literal not displayed */
	ExpiresAt    string               `json:"expires_at,omitempty" jsonschema:"Expiration date for the invitation (YYYY-MM-DD)"`
	InviteSource string               `json:"invite_source,omitempty" jsonschema:"Source of the invitation that starts the member creation process"`
	MemberRoleID int64                `json:"member_role_id,omitempty" jsonschema:"Custom role to assign the new member (Ultimate only)" tier:"ultimate"`
}

GroupInvitesInput contains parameters for inviting a user to a group.

type InviteResultOutput

type InviteResultOutput struct {
	toolutil.HintableOutput
	Status  string            `json:"status"`
	Message map[string]string `json:"message,omitempty"`
	// QueuedUsers is what GitLab answers with instead of inviting outright when
	// the instance has member promotion management enabled: the username of
	// each invitee whose promotion an administrator has to approve, against the
	// reason it was queued. That setting is Ultimate on GitLab Self-Managed and
	// GitLab Dedicated only, hence the tier tag. Documented in invitations.md
	// and absent from gl.InvitesResult, so it arrives through the raw request
	// the handlers issue.
	QueuedUsers map[string]string `json:"queued_users,omitempty" tier:"ultimate"`
}

InviteResultOutput represents the result of an invitation operation.

func GroupInvites

func GroupInvites(ctx context.Context, client *gitlabclient.Client, input GroupInvitesInput) (InviteResultOutput, error)

GroupInvites invites a user to a group by email or user ID.

The &gl.InvitesOptions{} literal is built here, in the handler that takes the model-facing GroupInvitesInput, so every documented add-a-member POST body parameter (id, email, user_id, access_level, expires_at) is mapped 1:1 from a public input field, with invite_source and member_role_id beside it on [invitesRequest] for the same reason ProjectInvites records.

func ProjectInvites

func ProjectInvites(ctx context.Context, client *gitlabclient.Client, input ProjectInvitesInput) (InviteResultOutput, error)

ProjectInvites invites a user to a project by email or user ID.

The &gl.InvitesOptions{} literal is built here, in the handler that takes the model-facing ProjectInvitesInput, so every documented add-a-member POST body parameter (id, email, user_id, access_level, expires_at) is mapped 1:1 from a public input field. invite_source and member_role_id sit beside it on [invitesRequest]: invitations.md documents both and gl.InvitesOptions carries neither.

type ListPendingGroupInvitationsInput

type ListPendingGroupInvitationsInput struct {
	GroupID toolutil.StringOrInt `json:"group_id" jsonschema:"Group ID or URL-encoded path,required"`
	Query   string               `json:"query,omitempty" jsonschema:"Filter invitations by email or name"`
	OrderBy string               `json:"order_by,omitempty" jsonschema:"Column to order keyset-paginated results by"`
	Sort    string               `json:"sort,omitempty" jsonschema:"Sort order for keyset-paginated results: 'asc' or 'desc'"`
	toolutil.PaginationInput
	toolutil.KeysetPaginationInput
}

ListPendingGroupInvitationsInput contains parameters for listing pending group invitations.

type ListPendingInvitationsOutput

type ListPendingInvitationsOutput struct {
	toolutil.HintableOutput
	Invitations []PendingInviteOutput     `json:"invitations"`
	Pagination  toolutil.PaginationOutput `json:"pagination"`
}

ListPendingInvitationsOutput holds a paginated list of pending invitations.

func ListPendingGroupInvitations

func ListPendingGroupInvitations(ctx context.Context, client *gitlabclient.Client, input ListPendingGroupInvitationsInput) (ListPendingInvitationsOutput, error)

ListPendingGroupInvitations returns pending invitations for a group.

The &gl.ListPendingInvitationsOptions{} literal is built here, in the handler that takes the model-facing ListPendingGroupInvitationsInput, so every documented list query parameter (query, order_by, sort, and the embedded page/per_page/page_token/pagination) is mapped 1:1 from a public input field.

func ListPendingProjectInvitations

func ListPendingProjectInvitations(ctx context.Context, client *gitlabclient.Client, input ListPendingProjectInvitationsInput) (ListPendingInvitationsOutput, error)

ListPendingProjectInvitations returns pending invitations for a project.

The &gl.ListPendingInvitationsOptions{} literal is built here, in the handler that takes the model-facing ListPendingProjectInvitationsInput, so every documented list query parameter (query, order_by, sort, and the embedded page/per_page/page_token/pagination) is mapped 1:1 from a public input field.

type ListPendingProjectInvitationsInput

type ListPendingProjectInvitationsInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	Query     string               `json:"query,omitempty" jsonschema:"Filter invitations by email or name"`
	OrderBy   string               `json:"order_by,omitempty" jsonschema:"Column to order keyset-paginated results by"`
	Sort      string               `json:"sort,omitempty" jsonschema:"Sort order for keyset-paginated results: 'asc' or 'desc'"`
	toolutil.PaginationInput
	toolutil.KeysetPaginationInput
}

ListPendingProjectInvitationsInput contains parameters for listing pending project invitations.

type PendingInviteOutput

type PendingInviteOutput struct {
	InviteEmail string `json:"invite_email"`
	// InviteToken is what lib/api/entities/invitation.rb sends beside the
	// address and client-go's PendingInvite does not model: the token the
	// invitation URL is built from, exposed under no condition. It is carried
	// in the JSON and deliberately left out of the Markdown, where a rendered
	// table would paste a live credential into the conversation.
	//
	// Keeping it in the JSON is a decision rather than an oversight, taken
	// after a security review asked for its removal. GitLab sends it to any
	// caller whose token can list invitations, so dropping it here would not
	// deny anyone the value; it would only make this server misreport what the
	// endpoint returns, which this project treats as a defect of its own. The
	// Markdown exclusion is where the line is drawn: the transcript is the
	// surface a person reads without asking for it.
	InviteToken   string `json:"invite_token,omitempty"`
	CreatedAt     string `json:"created_at,omitempty"`
	AccessLevel   int    `json:"access_level"`
	ExpiresAt     string `json:"expires_at,omitempty"`
	UserName      string `json:"user_name,omitempty"`
	CreatedByName string `json:"created_by_name,omitempty"`
}

PendingInviteOutput represents a single pending invitation.

type ProjectInvitesInput

type ProjectInvitesInput struct {
	ProjectID    toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	ID           toolutil.StringOrInt `` /* 151-byte string literal not displayed */
	Email        string               `json:"email,omitempty" jsonschema:"Email address to invite (either email or user_id required)"`
	UserID       int64                `json:"user_id,omitempty" jsonschema:"User ID to invite (either email or user_id required)"`
	AccessLevel  int                  `` /* 219-byte string literal not displayed */
	ExpiresAt    string               `json:"expires_at,omitempty" jsonschema:"Expiration date for the invitation (YYYY-MM-DD)"`
	InviteSource string               `json:"invite_source,omitempty" jsonschema:"Source of the invitation that starts the member creation process"`
	MemberRoleID int64                `json:"member_role_id,omitempty" jsonschema:"Custom role to assign the new member (Ultimate only)" tier:"ultimate"`
}

ProjectInvitesInput contains parameters for inviting a user to a project.

Jump to

Keyboard shortcuts

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