Documentation
¶
Index ¶
- Variables
- func CheckResponse(r *http.Response) error
- func PathEscape(s string) string
- func WithOffsetPagination(url *url.URL, nextPageToken string)
- func WithSearch(url *url.URL, search string)
- type AccessLevelValue
- type AddGroupMemberRequest
- type AddProjectMemberRequest
- type CreateUserOptions
- type ErrorResponse
- type GitlabClient
- func (c *GitlabClient) AddGroupMember(ctx context.Context, groupID string, memberRequest *AddGroupMemberRequest) (*GroupMember, *v2.RateLimitDescription, error)
- func (c *GitlabClient) AddProjectMember(ctx context.Context, projectID string, memberRequest *AddProjectMemberRequest) (*ProjectMember, *v2.RateLimitDescription, error)
- func (c *GitlabClient) CreateUser(ctx context.Context, userRequest *CreateUserOptions) (*User, *v2.RateLimitDescription, error)
- func (c *GitlabClient) DeleteUser(ctx context.Context, userID string) (*v2.RateLimitDescription, error)
- func (c *GitlabClient) FindGroupByName(ctx context.Context, groupName string) (*Group, *v2.RateLimitDescription, error)
- func (c *GitlabClient) GetCurrentlyAuthenticatedUser(ctx context.Context) (*User, *v2.RateLimitDescription, error)
- func (c *GitlabClient) GetGroup(ctx context.Context, groupID string) (*Group, *v2.RateLimitDescription, error)
- func (c *GitlabClient) GetProject(ctx context.Context, projectID string) (*Project, *v2.RateLimitDescription, error)
- func (c *GitlabClient) InviteGroupMember(ctx context.Context, groupID string, userEmail string, ...) (*v2.RateLimitDescription, error)
- func (c *GitlabClient) ListAllGroupMembers(ctx context.Context, groupID string, nextPageToken string) ([]*GroupMember, string, *v2.RateLimitDescription, error)
- func (c *GitlabClient) ListAllProjectMembers(ctx context.Context, projectID string, nextPageToken string) ([]*ProjectMember, string, *v2.RateLimitDescription, error)
- func (c *GitlabClient) ListGroupMembers(ctx context.Context, groupID string, nextPageToken string) ([]*GroupMember, string, *v2.RateLimitDescription, error)
- func (c *GitlabClient) ListGroups(ctx context.Context, nextLink string) ([]*Group, string, *v2.RateLimitDescription, error)
- func (c *GitlabClient) ListPendingGroupInvitations(ctx context.Context, groupID string, nextPageToken string) ([]*PendingInviteUser, string, *v2.RateLimitDescription, error)
- func (c *GitlabClient) ListProjectMembers(ctx context.Context, projectID string, nextPageToken string) ([]*ProjectMember, string, *v2.RateLimitDescription, error)
- func (c *GitlabClient) ListProjects(ctx context.Context, groupID string, nextLink string) ([]*Project, string, *v2.RateLimitDescription, error)
- func (c *GitlabClient) ListUsers(ctx context.Context, nextLink string) ([]*User, string, *v2.RateLimitDescription, error)
- func (c *GitlabClient) RemoveGroupMember(ctx context.Context, groupID, userID string) (*v2.RateLimitDescription, error)
- func (c *GitlabClient) RemoveProjectMember(ctx context.Context, projectID, userID string) (*v2.RateLimitDescription, error)
- func (c *GitlabClient) SearchGroups(ctx context.Context, search string, nextPageToken string) ([]*Group, string, *v2.RateLimitDescription, error)
- type GitlabError
- type Group
- type GroupMember
- type ISOTime
- type InviteGroupMemberRequest
- type KeysetPaginationOpts
- type Namespace
- type PendingInviteUser
- type Project
- type ProjectMember
- type ReqOpt
- type SAMLIdentity
- type User
Constants ¶
This section is empty.
Variables ¶
var ErrForbidden = errors.New("403 Forbidden")
var ErrNotFound = errors.New("404 Not Found")
Functions ¶
func CheckResponse ¶
CheckResponse checks the API response for errors, and returns them if present.
func PathEscape ¶
func WithOffsetPagination ¶
func WithSearch ¶
Types ¶
type AccessLevelValue ¶
type AccessLevelValue int
const ( NoPermissions AccessLevelValue = 0 MinimalAccessPermissions AccessLevelValue = 5 GuestPermissions AccessLevelValue = 10 ReporterPermissions AccessLevelValue = 20 DeveloperPermissions AccessLevelValue = 30 MaintainerPermissions AccessLevelValue = 40 OwnerPermissions AccessLevelValue = 50 AdminPermissions AccessLevelValue = 60 )
func GetAccessLevelByName ¶
func GetAccessLevelByName(name string) (AccessLevelValue, bool)
func (AccessLevelValue) String ¶
func (a AccessLevelValue) String() string
type AddGroupMemberRequest ¶
type AddGroupMemberRequest struct {
UserID int `json:"user_id"`
AccessLevel AccessLevelValue `json:"access_level"`
}
type AddProjectMemberRequest ¶
type AddProjectMemberRequest struct {
UserID int `json:"user_id"`
AccessLevel AccessLevelValue `json:"access_level"`
}
type CreateUserOptions ¶
type CreateUserOptions struct {
Email *string `url:"email,omitempty" json:"email,omitempty"`
ForceRandomPassword *bool `url:"force_random_password,omitempty" json:"force_random_password,omitempty"`
GroupIDForSAML *string `url:"group_id_for_saml,omitempty" json:"group_id_for_saml,omitempty"`
Name *string `url:"name,omitempty" json:"name,omitempty"`
Password *string `url:"password,omitempty" json:"password,omitempty"`
Username *string `url:"username,omitempty" json:"username,omitempty"`
}
type ErrorResponse ¶
func (*ErrorResponse) Error ¶
func (e *ErrorResponse) Error() string
type GitlabClient ¶
type GitlabClient struct {
AccountCreationGroup string
IsOnPremise bool
SyncDirectMembersOnly bool
// contains filtered or unexported fields
}
func (*GitlabClient) AddGroupMember ¶
func (c *GitlabClient) AddGroupMember(ctx context.Context, groupID string, memberRequest *AddGroupMemberRequest) (*GroupMember, *v2.RateLimitDescription, error)
AddGroupMember adds a member to a group.
func (*GitlabClient) AddProjectMember ¶
func (c *GitlabClient) AddProjectMember(ctx context.Context, projectID string, memberRequest *AddProjectMemberRequest) (*ProjectMember, *v2.RateLimitDescription, error)
AddProjectMember adds a member to a project.
func (*GitlabClient) CreateUser ¶
func (c *GitlabClient) CreateUser(ctx context.Context, userRequest *CreateUserOptions) (*User, *v2.RateLimitDescription, error)
CreateUser creates a new user in GitLab.
func (*GitlabClient) DeleteUser ¶
func (c *GitlabClient) DeleteUser(ctx context.Context, userID string) (*v2.RateLimitDescription, error)
DeleteUser deletes a user from GitLab.
func (*GitlabClient) FindGroupByName ¶
func (c *GitlabClient) FindGroupByName(ctx context.Context, groupName string) (*Group, *v2.RateLimitDescription, error)
FindGroupByName searches for groups across all pages and then filters for an exact match.
func (*GitlabClient) GetCurrentlyAuthenticatedUser ¶ added in v0.0.26
func (c *GitlabClient) GetCurrentlyAuthenticatedUser(ctx context.Context) (*User, *v2.RateLimitDescription, error)
func (*GitlabClient) GetGroup ¶
func (c *GitlabClient) GetGroup(ctx context.Context, groupID string) (*Group, *v2.RateLimitDescription, error)
GetGroup retrieves a specific group by ID.
func (*GitlabClient) GetProject ¶
func (c *GitlabClient) GetProject(ctx context.Context, projectID string) (*Project, *v2.RateLimitDescription, error)
GetProject retrieves a specific project by ID.
func (*GitlabClient) InviteGroupMember ¶
func (c *GitlabClient) InviteGroupMember(ctx context.Context, groupID string, userEmail string, accessLevel AccessLevelValue) (*v2.RateLimitDescription, error)
InviteGroupMember invites a member to a group.
func (*GitlabClient) ListAllGroupMembers ¶ added in v0.0.26
func (c *GitlabClient) ListAllGroupMembers(ctx context.Context, groupID string, nextPageToken string) ([]*GroupMember, string, *v2.RateLimitDescription, error)
ListAllGroupMembers retrieves members and pending invites of a specific group including inherited members through ancestor groups.
func (*GitlabClient) ListAllProjectMembers ¶ added in v0.0.29
func (c *GitlabClient) ListAllProjectMembers(ctx context.Context, projectID string, nextPageToken string) ([]*ProjectMember, string, *v2.RateLimitDescription, error)
func (*GitlabClient) ListGroupMembers ¶
func (c *GitlabClient) ListGroupMembers(ctx context.Context, groupID string, nextPageToken string) ([]*GroupMember, string, *v2.RateLimitDescription, error)
ListGroupMembers retrieves members of a specific group.
func (*GitlabClient) ListGroups ¶
func (c *GitlabClient) ListGroups(ctx context.Context, nextLink string) ([]*Group, string, *v2.RateLimitDescription, error)
ListGroups retrieves all groups from GitLab API using keyset pagination.
func (*GitlabClient) ListPendingGroupInvitations ¶
func (c *GitlabClient) ListPendingGroupInvitations(ctx context.Context, groupID string, nextPageToken string) ([]*PendingInviteUser, string, *v2.RateLimitDescription, error)
ListPendingGroupInvitations lists pending invitations for a group.
func (*GitlabClient) ListProjectMembers ¶
func (c *GitlabClient) ListProjectMembers(ctx context.Context, projectID string, nextPageToken string) ([]*ProjectMember, string, *v2.RateLimitDescription, error)
ListProjectMembers retrieves members of a specific project.
func (*GitlabClient) ListProjects ¶
func (c *GitlabClient) ListProjects(ctx context.Context, groupID string, nextLink string) ([]*Project, string, *v2.RateLimitDescription, error)
ListProjects retrieves all projects from GitLab API.
func (*GitlabClient) ListUsers ¶
func (c *GitlabClient) ListUsers(ctx context.Context, nextLink string) ([]*User, string, *v2.RateLimitDescription, error)
ListUsers retrieves all users from GitLab API.
func (*GitlabClient) RemoveGroupMember ¶
func (c *GitlabClient) RemoveGroupMember(ctx context.Context, groupID, userID string) (*v2.RateLimitDescription, error)
RemoveGroupMember removes a member from a group.
func (*GitlabClient) RemoveProjectMember ¶
func (c *GitlabClient) RemoveProjectMember(ctx context.Context, projectID, userID string) (*v2.RateLimitDescription, error)
RemoveProjectMember removes a member from a project.
func (*GitlabClient) SearchGroups ¶
func (c *GitlabClient) SearchGroups(ctx context.Context, search string, nextPageToken string) ([]*Group, string, *v2.RateLimitDescription, error)
SearchGroups searches for groups by name.
type GitlabError ¶ added in v0.0.25
type GitlabError struct {
Detail string `json:"message"`
}
func (*GitlabError) Message ¶ added in v0.0.25
func (e *GitlabError) Message() string
Message implements the uhttp.ErrorResponse interface.
type GroupMember ¶
type GroupMember struct {
ID int `json:"id"`
Email string `json:"email"`
Username string `json:"username"`
Name string `json:"name"`
State string `json:"state"`
AccessLevel int `json:"access_level"`
GroupSAMLIdentity *SAMLIdentity `json:"group_saml_identity"`
MembershipState string `json:"membership_state"`
Locked bool `json:"locked"`
}
type InviteGroupMemberRequest ¶
type InviteGroupMemberRequest struct {
Email string `json:"email"`
AccessLevel AccessLevelValue `json:"access_level"`
}
type KeysetPaginationOpts ¶ added in v0.0.28
type PendingInviteUser ¶
type PendingInviteUser struct {
InviteEmail string `json:"invite_email"`
}
type ProjectMember ¶
type ProjectMember struct {
ID int `json:"id"`
Username string `json:"username"`
Name string `json:"name"`
State string `json:"state"`
AvatarURL string `json:"avatar_url"`
WebURL string `json:"web_url"`
AccessLevel int `json:"access_level"`
ExpiresAt *ISOTime `json:"expires_at"`
GroupSAMLIdentity *SAMLIdentity `json:"group_saml_identity"`
Email string `json:"email"`
}
type ReqOpt ¶ added in v0.0.29
func WithQueryParam ¶ added in v0.0.29
type SAMLIdentity ¶
type SAMLIdentity struct {
ExternUID string `json:"extern_uid"`
Provider string `json:"provider"`
SAMLProviderID int `json:"saml_provider_id"`
}
SAMLIdentity represents SAML identity information.