Documentation
¶
Overview ¶
Package accessrequests implements MCP tools for GitLab project and group access request operations.
The package wraps the GitLab Access requests API:
Index ¶
- func ActionSpecs(client *gitlabclient.Client) []toolutil.ActionSpec
- func DenyGroup(ctx context.Context, client *gitlabclient.Client, input DenyGroupInput) error
- func DenyGroupOutput(ctx context.Context, client *gitlabclient.Client, input DenyGroupInput) (toolutil.DeleteOutput, error)
- func DenyProject(ctx context.Context, client *gitlabclient.Client, input DenyProjectInput) error
- func DenyProjectOutput(ctx context.Context, client *gitlabclient.Client, input DenyProjectInput) (toolutil.DeleteOutput, error)
- func FormatListMarkdown(out ListOutput) string
- func FormatMemberOutputMarkdown(out MemberOutput) string
- func FormatOutputMarkdown(out Output) string
- type ApproveGroupInput
- type ApproveProjectInput
- type DenyGroupInput
- type DenyProjectInput
- type ListGroupInput
- type ListOutput
- type ListProjectInput
- type MemberOutput
- type Output
- type RequestGroupInput
- type RequestProjectInput
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 access request actions.
func DenyGroup ¶
func DenyGroup(ctx context.Context, client *gitlabclient.Client, input DenyGroupInput) error
DenyGroup denies a group access request.
func DenyGroupOutput ¶
func DenyGroupOutput(ctx context.Context, client *gitlabclient.Client, input DenyGroupInput) (toolutil.DeleteOutput, error)
DenyGroupOutput denies a group access request and returns the legacy success message shape.
func DenyProject ¶
func DenyProject(ctx context.Context, client *gitlabclient.Client, input DenyProjectInput) error
DenyProject denies a project access request.
func DenyProjectOutput ¶
func DenyProjectOutput(ctx context.Context, client *gitlabclient.Client, input DenyProjectInput) (toolutil.DeleteOutput, error)
DenyProjectOutput denies a project access request and returns the legacy success message shape.
func FormatListMarkdown ¶
func FormatListMarkdown(out ListOutput) string
FormatListMarkdown renders a list of access requests as a table.
There is no access-level column. GitLab answers these two routes with the access requester entity, which sends no such key, so every row used to read "No access (0)": a state none of those requests was in, rendered from a zero that came from the decode rather than from GitLab.
func FormatMemberOutputMarkdown ¶ added in v3.1.0
func FormatMemberOutputMarkdown(out MemberOutput) string
FormatMemberOutputMarkdown renders the membership an approved request became. It is the one card of this package with an access level on it, and the guard is what keeps a level GitLab did not send from reading as the role called "No access": the same reason the list table no longer has that column at all.
func FormatOutputMarkdown ¶
FormatOutputMarkdown renders one pending access request as a card. It carries no access level, no membership state and no expiry, because the entity behind it sends none of them: what a pending request has is a person and the moment they asked.
Types ¶
type ApproveGroupInput ¶
type ApproveGroupInput struct {
GroupID toolutil.StringOrInt `json:"group_id" jsonschema:"Group ID or path,required"`
UserID int64 `json:"user_id" jsonschema:"User ID of the access requester,required"`
AccessLevel *int `` /* 437-byte string literal not displayed */
}
ApproveGroupInput identifies the group access request to approve and the optional granted role.
AccessLevel is a pointer for the reason ApproveProjectInput gives.
type ApproveProjectInput ¶
type ApproveProjectInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or path,required"`
UserID int64 `json:"user_id" jsonschema:"User ID of the access requester,required"`
AccessLevel *int `` /* 239-byte string literal not displayed */
}
ApproveProjectInput identifies the project access request to approve and the optional granted role.
AccessLevel is a pointer because leaving it out and sending 0 are two different calls. Left out, GitLab grants its default, Developer; 0 used to be dropped as though it had been left out, so a caller asking for No access got a Developer, and sent it would be answered as an approval that GitLab never saved. It is refused instead, with every other level a project does not grant (see [refuseUngrantedLevel]).
type DenyGroupInput ¶
type DenyGroupInput struct {
GroupID toolutil.StringOrInt `json:"group_id" jsonschema:"Group ID or path,required"`
UserID int64 `json:"user_id" jsonschema:"User ID of the access requester,required"`
}
DenyGroupInput identifies the pending group access request to reject.
type DenyProjectInput ¶
type DenyProjectInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or path,required"`
UserID int64 `json:"user_id" jsonschema:"User ID of the access requester,required"`
}
DenyProjectInput identifies the pending project access request to reject.
type ListGroupInput ¶
type ListGroupInput struct {
GroupID toolutil.StringOrInt `json:"group_id" jsonschema:"Group ID or path,required"`
OrderBy string `json:"order_by,omitempty" jsonschema:"Column to order results by for keyset-paginated result sets (e.g. id)"`
Sort string `json:"sort,omitempty" jsonschema:"Sort order: asc or desc"`
toolutil.PaginationInput
toolutil.KeysetPaginationInput
}
ListGroupInput selects a group and pagination window for pending access requests.
type ListOutput ¶
type ListOutput struct {
toolutil.HintableOutput
AccessRequests []Output `json:"access_requests"`
Pagination toolutil.PaginationOutput `json:"pagination"`
}
ListOutput represents a paginated list of access requests.
func ListGroup ¶
func ListGroup(ctx context.Context, client *gitlabclient.Client, input ListGroupInput) (ListOutput, error)
ListGroup lists access requests for a group.
func ListProject ¶
func ListProject(ctx context.Context, client *gitlabclient.Client, input ListProjectInput) (ListOutput, error)
ListProject lists access requests for a project.
type ListProjectInput ¶
type ListProjectInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or path,required"`
OrderBy string `json:"order_by,omitempty" jsonschema:"Column to order results by for keyset-paginated result sets (e.g. id)"`
Sort string `json:"sort,omitempty" jsonschema:"Sort order: asc or desc"`
toolutil.PaginationInput
toolutil.KeysetPaginationInput
}
ListProjectInput selects a project and pagination window for pending access requests.
type MemberOutput ¶ added in v3.1.0
type MemberOutput struct {
toolutil.HintableOutput
ID int64 `json:"id"`
Username string `json:"username"`
Name string `json:"name"`
PublicEmail string `json:"public_email,omitempty"`
State string `json:"state"`
Locked bool `json:"locked"`
AvatarURL string `json:"avatar_url,omitempty"`
WebURL string `json:"web_url,omitempty"`
AccessLevel int `json:"access_level"`
CreatedAt string `json:"created_at,omitempty"`
CreatedBy *toolutil.MemberUserOutput `json:"created_by,omitempty"`
ExpiresAt string `json:"expires_at,omitempty"`
GroupSAMLIdentity *toolutil.SAMLIdentityOutput `json:"group_saml_identity,omitempty" tier:"premium"`
GroupSCIMIdentity *toolutil.SCIMIdentityOutput `json:"group_scim_identity,omitempty" tier:"premium"`
Email string `json:"email,omitempty"`
Override *bool `json:"override,omitempty" tier:"premium"`
MembershipState string `json:"membership_state,omitempty" tier:"premium"`
MemberRole *toolutil.MemberRoleOutput `json:"member_role,omitempty" tier:"ultimate"`
}
MemberOutput represents the membership an approved access request became: what gl.AccessRequest decodes, plus what lib/api/entities/member.rb sends beside it, read from the captured response (ADR-0021).
Approving is the one route of this family GitLab answers with Member instead of AccessRequester, which is why it is the one shape here with an access level in it. created_at, expires_at and membership_state are on every member; created_by, the two identities, email, override and member_role wait on a condition and are absent otherwise.
The entity can also send avatar_path, custom_attributes and is_using_seat, and none of them is published: each waits on a presenter option, and the approve route declares neither only_path, with_custom_attributes nor show_seat_info.
func ApproveGroup ¶
func ApproveGroup(ctx context.Context, client *gitlabclient.Client, input ApproveGroupInput) (MemberOutput, error)
ApproveGroup approves a group access request.
Minimal access is the one level a group grants in some places and not in others, and the approval route cannot say which happened: where GitLab does not grant it, the route still answers 201 with the requester, and the request stays pending. So it costs up to two reads beside the approval. The group is read before it, and a subgroup is refused, as the Free tier is without a request; after it, the requester is read among the group's members, and an approval that left them out is answered as the pending request it is (see [confirmMinimalAccess]).
func ApproveProject ¶
func ApproveProject(ctx context.Context, client *gitlabclient.Client, input ApproveProjectInput) (MemberOutput, error)
ApproveProject approves a project access request.
type Output ¶
type Output struct {
toolutil.HintableOutput
ID int64 `json:"id"`
Username string `json:"username"`
Name string `json:"name"`
PublicEmail string `json:"public_email,omitempty"`
State string `json:"state"`
Locked bool `json:"locked"`
AvatarURL string `json:"avatar_url,omitempty"`
WebURL string `json:"web_url,omitempty"`
RequestedAt string `json:"requested_at,omitempty"`
}
Output represents a single pending access request: what gl.AccessRequest decodes of it, plus what lib/api/entities/access_requester.rb sends that the SDK does not carry, read from the captured response (ADR-0021).
That entity is short, and the shortness is the point. It exposes `user`, merged from UserBasic, and `requested_at`, and nothing else: a pending request is a person asking, not a membership, so there is no access level to report, no expiry, no role, no membership state and no SAML or SCIM identity. GitLab answers with a membership only once the request is approved, which is MemberOutput.
This type carried all eleven Member keys until the entity was read rather than assumed. They reached a caller empty on every list and every request, and `access_level` reached one as a real-looking zero, which the list table rendered as "No access (0)" for every row: a state the request was not in, published from a key GitLab had not sent.
public_email, locked, avatar_url and web_url are the UserBasic keys client-go leaves out, and all four are on every access request. The same UserBasic can send avatar_path and custom_attributes, and neither is published: both wait on a presenter option, and no access-request route declares only_path or with_custom_attributes, so publishing them would advertise keys this endpoint cannot return.
func RequestGroup ¶
func RequestGroup(ctx context.Context, client *gitlabclient.Client, input RequestGroupInput) (Output, error)
RequestGroup requests access to a group for the authenticated user.
func RequestProject ¶
func RequestProject(ctx context.Context, client *gitlabclient.Client, input RequestProjectInput) (Output, error)
RequestProject requests access to a project for the authenticated user.
type RequestGroupInput ¶
type RequestGroupInput struct {
GroupID toolutil.StringOrInt `json:"group_id" jsonschema:"Group ID or path,required"`
}
RequestGroupInput identifies the group the authenticated user wants to join.
type RequestProjectInput ¶
type RequestProjectInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or path,required"`
}
RequestProjectInput identifies the project the authenticated user wants to join.