Documentation
¶
Index ¶
- Variables
- type AddIssueNoteOptions
- type App
- func (a *App) AddIssueNote(projectPath string, issueIID int, opts *AddIssueNoteOptions) (*Note, error)
- func (a *App) CreateProjectIssue(projectPath string, opts *CreateIssueOptions) (*Issue, error)
- func (a *App) CreateProjectMergeRequest(projectPath string, opts *CreateMergeRequestOptions) (*MergeRequest, error)
- func (a *App) GetAPIURL() string
- func (a *App) GetProjectDescription(projectPath string) (*ProjectInfo, error)
- func (a *App) GetProjectTopics(projectPath string) (*ProjectInfo, error)
- func (a *App) ListProjectIssues(projectPath string, opts *ListIssuesOptions) ([]Issue, error)
- func (a *App) ListProjectLabels(projectPath string, opts *ListLabelsOptions) ([]Label, error)
- func (a *App) SetLogger(l *slog.Logger)
- func (a *App) UpdateProjectDescription(projectPath string, description string) (*ProjectInfo, error)
- func (a *App) UpdateProjectIssue(projectPath string, issueIID int, opts *UpdateIssueOptions) (*Issue, error)
- func (a *App) UpdateProjectTopics(projectPath string, topics []string) (*ProjectInfo, error)
- func (a *App) ValidateConnection() error
- type CreateIssueOptions
- type CreateMergeRequestOptions
- type GitLabClient
- type GitLabClientWrapper
- func (g *GitLabClientWrapper) Issues() IssuesService
- func (g *GitLabClientWrapper) Labels() LabelsService
- func (g *GitLabClientWrapper) MergeRequests() MergeRequestsService
- func (g *GitLabClientWrapper) Milestones() MilestonesService
- func (g *GitLabClientWrapper) Notes() NotesService
- func (g *GitLabClientWrapper) Projects() ProjectsService
- func (g *GitLabClientWrapper) Users() UsersService
- type Issue
- type IssuesService
- type IssuesServiceWrapper
- func (i *IssuesServiceWrapper) CreateIssue(pid interface{}, opt *gitlab.CreateIssueOptions) (*gitlab.Issue, *gitlab.Response, error)
- func (i *IssuesServiceWrapper) ListProjectIssues(pid interface{}, opt *gitlab.ListProjectIssuesOptions) ([]*gitlab.Issue, *gitlab.Response, error)
- func (i *IssuesServiceWrapper) UpdateIssue(pid interface{}, issue int, opt *gitlab.UpdateIssueOptions) (*gitlab.Issue, *gitlab.Response, error)
- type Label
- type LabelsService
- type LabelsServiceWrapper
- type ListIssuesOptions
- type ListLabelsOptions
- type MergeRequest
- type MergeRequestsService
- type MergeRequestsServiceWrapper
- type MilestonesService
- type MilestonesServiceWrapper
- type MockGitLabClient
- func (m *MockGitLabClient) Issues() IssuesService
- func (m *MockGitLabClient) Labels() LabelsService
- func (m *MockGitLabClient) MergeRequests() MergeRequestsService
- func (m *MockGitLabClient) Milestones() MilestonesService
- func (m *MockGitLabClient) Notes() NotesService
- func (m *MockGitLabClient) Projects() ProjectsService
- func (m *MockGitLabClient) Users() UsersService
- type MockIssuesService
- func (m *MockIssuesService) CreateIssue(pid interface{}, opt *gitlab.CreateIssueOptions) (*gitlab.Issue, *gitlab.Response, error)
- func (m *MockIssuesService) ListProjectIssues(pid interface{}, opt *gitlab.ListProjectIssuesOptions) ([]*gitlab.Issue, *gitlab.Response, error)
- func (m *MockIssuesService) UpdateIssue(pid interface{}, issue int, opt *gitlab.UpdateIssueOptions) (*gitlab.Issue, *gitlab.Response, error)
- type MockLabelsService
- type MockMergeRequestsService
- type MockMilestonesService
- type MockNotesService
- type MockProjectsService
- type MockUsersService
- type Note
- type NotesService
- type NotesServiceWrapper
- type ProjectInfo
- type ProjectsService
- type ProjectsServiceWrapper
- type UpdateIssueOptions
- type UsersService
- type UsersServiceWrapper
Constants ¶
This section is empty.
Variables ¶
var ( ErrGitLabTokenRequired = errors.New("GITLAB_TOKEN environment variable is required") ErrCreateOptionsRequired = errors.New("create issue options are required") ErrIssueTitleRequired = errors.New("issue title is required") ErrInvalidIssueIID = errors.New("issue IID must be a positive integer") ErrUpdateOptionsRequired = errors.New("update issue options are required") ErrNoteBodyRequired = errors.New("note body is required") ErrCreateMROptionsRequired = errors.New("create merge request options are required") ErrMRTitleRequired = errors.New("merge request title is required") ErrMRSourceBranchRequired = errors.New("merge request source branch is required") ErrMRTargetBranchRequired = errors.New("merge request target branch is required") ErrInvalidUserIdentifierType = errors.New("invalid user identifier type") ErrUserNotFound = errors.New("user not found") ErrInvalidMilestoneIdentifierType = errors.New("invalid milestone identifier type") ErrMilestoneNotFound = errors.New("milestone not found") )
Error variables for static errors.
Functions ¶
This section is empty.
Types ¶
type AddIssueNoteOptions ¶ added in v0.2.0
type AddIssueNoteOptions struct {
Body string
}
AddIssueNoteOptions contains options for adding a note to an issue.
type App ¶
func NewWithClient ¶
func NewWithClient(token, uri string, client GitLabClient) *App
NewWithClient creates a new App instance with an injected GitLabClient (for testing).
func (*App) AddIssueNote ¶ added in v0.2.0
func (a *App) AddIssueNote(projectPath string, issueIID int, opts *AddIssueNoteOptions) (*Note, error)
AddIssueNote adds a note/comment to an existing issue.
func (*App) CreateProjectIssue ¶
func (a *App) CreateProjectIssue(projectPath string, opts *CreateIssueOptions) (*Issue, error)
CreateProjectIssue creates a new issue for a given project path.
func (*App) CreateProjectMergeRequest ¶ added in v0.3.1
func (a *App) CreateProjectMergeRequest(projectPath string, opts *CreateMergeRequestOptions) (*MergeRequest, error)
CreateProjectMergeRequest creates a new merge request for a given project path.
func (*App) GetProjectDescription ¶ added in v0.4.0
func (a *App) GetProjectDescription(projectPath string) (*ProjectInfo, error)
GetProjectDescription retrieves the description of a GitLab project.
func (*App) GetProjectTopics ¶ added in v0.4.0
func (a *App) GetProjectTopics(projectPath string) (*ProjectInfo, error)
GetProjectTopics retrieves the topics of a GitLab project.
func (*App) ListProjectIssues ¶
func (a *App) ListProjectIssues(projectPath string, opts *ListIssuesOptions) ([]Issue, error)
ListProjectIssues retrieves issues for a given project path.
func (*App) ListProjectLabels ¶
func (a *App) ListProjectLabels(projectPath string, opts *ListLabelsOptions) ([]Label, error)
ListProjectLabels retrieves labels for a given project path.
func (*App) UpdateProjectDescription ¶ added in v0.4.0
func (a *App) UpdateProjectDescription(projectPath string, description string) (*ProjectInfo, error)
UpdateProjectDescription updates the description of a GitLab project.
func (*App) UpdateProjectIssue ¶
func (a *App) UpdateProjectIssue(projectPath string, issueIID int, opts *UpdateIssueOptions) (*Issue, error)
UpdateProjectIssue updates an existing issue for a given project path.
func (*App) UpdateProjectTopics ¶ added in v0.4.0
func (a *App) UpdateProjectTopics(projectPath string, topics []string) (*ProjectInfo, error)
UpdateProjectTopics updates the topics of a GitLab project.
func (*App) ValidateConnection ¶
type CreateIssueOptions ¶
CreateIssueOptions contains options for creating a project issue.
type CreateMergeRequestOptions ¶ added in v0.3.1
type CreateMergeRequestOptions struct { SourceBranch string TargetBranch string Title string Description string Assignees []interface{} // Can be usernames (string) or IDs (int) Reviewers []interface{} // Can be usernames (string) or IDs (int) Labels []string Milestone interface{} // Can be title (string) or ID (int) RemoveSourceBranch bool Draft bool }
CreateMergeRequestOptions contains options for creating a merge request.
type GitLabClient ¶
type GitLabClient interface { Projects() ProjectsService Issues() IssuesService Labels() LabelsService Users() UsersService Notes() NotesService MergeRequests() MergeRequestsService Milestones() MilestonesService }
GitLabClient interface that provides access to all GitLab services.
func NewGitLabClient ¶
func NewGitLabClient(client *gitlab.Client) GitLabClient
NewGitLabClient creates a new GitLab client wrapper.
type GitLabClientWrapper ¶
type GitLabClientWrapper struct {
// contains filtered or unexported fields
}
GitLabClientWrapper wraps the real GitLab client to implement our interfaces.
func (*GitLabClientWrapper) Issues ¶
func (g *GitLabClientWrapper) Issues() IssuesService
Issues returns the Issues service.
func (*GitLabClientWrapper) Labels ¶
func (g *GitLabClientWrapper) Labels() LabelsService
Labels returns the Labels service.
func (*GitLabClientWrapper) MergeRequests ¶ added in v0.3.1
func (g *GitLabClientWrapper) MergeRequests() MergeRequestsService
MergeRequests returns the MergeRequests service.
func (*GitLabClientWrapper) Milestones ¶ added in v0.3.1
func (g *GitLabClientWrapper) Milestones() MilestonesService
Milestones returns the Milestones service.
func (*GitLabClientWrapper) Notes ¶ added in v0.2.0
func (g *GitLabClientWrapper) Notes() NotesService
Notes returns the Notes service.
func (*GitLabClientWrapper) Projects ¶
func (g *GitLabClientWrapper) Projects() ProjectsService
Projects returns the Projects service.
func (*GitLabClientWrapper) Users ¶
func (g *GitLabClientWrapper) Users() UsersService
Users returns the Users service.
type Issue ¶
type Issue struct { ID int `json:"id"` IID int `json:"iid"` Title string `json:"title"` Description string `json:"description"` State string `json:"state"` Labels []string `json:"labels"` Assignees []map[string]interface{} `json:"assignees"` CreatedAt string `json:"created_at"` UpdatedAt string `json:"updated_at"` }
Issue represents a GitLab issue.
type IssuesService ¶
type IssuesService interface { ListProjectIssues(pid interface{}, opt *gitlab.ListProjectIssuesOptions) ([]*gitlab.Issue, *gitlab.Response, error) CreateIssue(pid interface{}, opt *gitlab.CreateIssueOptions) (*gitlab.Issue, *gitlab.Response, error) UpdateIssue(pid interface{}, issue int, opt *gitlab.UpdateIssueOptions) (*gitlab.Issue, *gitlab.Response, error) }
IssuesService interface for GitLab Issues operations.
type IssuesServiceWrapper ¶
type IssuesServiceWrapper struct {
// contains filtered or unexported fields
}
IssuesServiceWrapper wraps the real Issues service.
func (*IssuesServiceWrapper) CreateIssue ¶
func (i *IssuesServiceWrapper) CreateIssue( pid interface{}, opt *gitlab.CreateIssueOptions, ) (*gitlab.Issue, *gitlab.Response, error)
func (*IssuesServiceWrapper) ListProjectIssues ¶
func (i *IssuesServiceWrapper) ListProjectIssues( pid interface{}, opt *gitlab.ListProjectIssuesOptions, ) ([]*gitlab.Issue, *gitlab.Response, error)
func (*IssuesServiceWrapper) UpdateIssue ¶
func (i *IssuesServiceWrapper) UpdateIssue( pid interface{}, issue int, opt *gitlab.UpdateIssueOptions, ) (*gitlab.Issue, *gitlab.Response, error)
type Label ¶
type Label struct { ID int `json:"id"` Name string `json:"name"` Color string `json:"color"` TextColor string `json:"text_color"` Description string `json:"description"` OpenIssuesCount int `json:"open_issues_count"` ClosedIssuesCount int `json:"closed_issues_count"` OpenMergeRequestsCount int `json:"open_merge_requests_count"` Subscribed bool `json:"subscribed"` Priority int `json:"priority"` IsProjectLabel bool `json:"is_project_label"` }
Label represents a GitLab label.
type LabelsService ¶
type LabelsService interface {
ListLabels(pid interface{}, opt *gitlab.ListLabelsOptions) ([]*gitlab.Label, *gitlab.Response, error)
}
LabelsService interface for GitLab Labels operations.
type LabelsServiceWrapper ¶
type LabelsServiceWrapper struct {
// contains filtered or unexported fields
}
LabelsServiceWrapper wraps the real Labels service.
func (*LabelsServiceWrapper) ListLabels ¶
func (l *LabelsServiceWrapper) ListLabels( pid interface{}, opt *gitlab.ListLabelsOptions, ) ([]*gitlab.Label, *gitlab.Response, error)
type ListIssuesOptions ¶
ListIssuesOptions contains options for listing project issues.
type ListLabelsOptions ¶
type ListLabelsOptions struct { WithCounts bool IncludeAncestorGroups bool Search string Limit int }
ListLabelsOptions contains options for listing project labels.
type MergeRequest ¶ added in v0.3.1
type MergeRequest struct { ID int `json:"id"` IID int `json:"iid"` Title string `json:"title"` Description string `json:"description"` State string `json:"state"` SourceBranch string `json:"source_branch"` TargetBranch string `json:"target_branch"` Author map[string]interface{} `json:"author"` Assignees []map[string]interface{} `json:"assignees"` Reviewers []map[string]interface{} `json:"reviewers"` Labels []string `json:"labels"` Milestone map[string]interface{} `json:"milestone"` WebURL string `json:"web_url"` Draft bool `json:"draft"` CreatedAt string `json:"created_at"` UpdatedAt string `json:"updated_at"` }
MergeRequest represents a GitLab merge request.
type MergeRequestsService ¶ added in v0.3.1
type MergeRequestsService interface { CreateMergeRequest( pid interface{}, opt *gitlab.CreateMergeRequestOptions, ) (*gitlab.MergeRequest, *gitlab.Response, error) }
MergeRequestsService interface for GitLab MergeRequests operations.
type MergeRequestsServiceWrapper ¶ added in v0.3.1
type MergeRequestsServiceWrapper struct {
// contains filtered or unexported fields
}
MergeRequestsServiceWrapper wraps the real MergeRequests service.
func (*MergeRequestsServiceWrapper) CreateMergeRequest ¶ added in v0.3.1
func (m *MergeRequestsServiceWrapper) CreateMergeRequest( pid interface{}, opt *gitlab.CreateMergeRequestOptions, ) (*gitlab.MergeRequest, *gitlab.Response, error)
type MilestonesService ¶ added in v0.3.1
type MilestonesService interface {
ListMilestones(pid interface{}, opt *gitlab.ListMilestonesOptions) ([]*gitlab.Milestone, *gitlab.Response, error)
}
MilestonesService interface for GitLab Milestones operations.
type MilestonesServiceWrapper ¶ added in v0.3.1
type MilestonesServiceWrapper struct {
// contains filtered or unexported fields
}
MilestonesServiceWrapper wraps the real Milestones service.
func (*MilestonesServiceWrapper) ListMilestones ¶ added in v0.3.1
func (m *MilestonesServiceWrapper) ListMilestones( pid interface{}, opt *gitlab.ListMilestonesOptions, ) ([]*gitlab.Milestone, *gitlab.Response, error)
type MockGitLabClient ¶
MockGitLabClient is a mock implementation of GitLabClient.
func (*MockGitLabClient) Issues ¶
func (m *MockGitLabClient) Issues() IssuesService
func (*MockGitLabClient) Labels ¶
func (m *MockGitLabClient) Labels() LabelsService
func (*MockGitLabClient) MergeRequests ¶ added in v0.3.1
func (m *MockGitLabClient) MergeRequests() MergeRequestsService
func (*MockGitLabClient) Milestones ¶ added in v0.3.1
func (m *MockGitLabClient) Milestones() MilestonesService
func (*MockGitLabClient) Notes ¶ added in v0.2.0
func (m *MockGitLabClient) Notes() NotesService
func (*MockGitLabClient) Projects ¶
func (m *MockGitLabClient) Projects() ProjectsService
func (*MockGitLabClient) Users ¶
func (m *MockGitLabClient) Users() UsersService
type MockIssuesService ¶
MockIssuesService is a mock implementation of IssuesService.
func (*MockIssuesService) CreateIssue ¶
func (m *MockIssuesService) CreateIssue( pid interface{}, opt *gitlab.CreateIssueOptions, ) (*gitlab.Issue, *gitlab.Response, error)
func (*MockIssuesService) ListProjectIssues ¶
func (m *MockIssuesService) ListProjectIssues( pid interface{}, opt *gitlab.ListProjectIssuesOptions, ) ([]*gitlab.Issue, *gitlab.Response, error)
func (*MockIssuesService) UpdateIssue ¶
func (m *MockIssuesService) UpdateIssue( pid interface{}, issue int, opt *gitlab.UpdateIssueOptions, ) (*gitlab.Issue, *gitlab.Response, error)
type MockLabelsService ¶
MockLabelsService is a mock implementation of LabelsService.
func (*MockLabelsService) ListLabels ¶
func (m *MockLabelsService) ListLabels( pid interface{}, opt *gitlab.ListLabelsOptions, ) ([]*gitlab.Label, *gitlab.Response, error)
type MockMergeRequestsService ¶ added in v0.3.1
MockMergeRequestsService is a mock implementation of MergeRequestsService.
func (*MockMergeRequestsService) CreateMergeRequest ¶ added in v0.3.1
func (m *MockMergeRequestsService) CreateMergeRequest( pid interface{}, opt *gitlab.CreateMergeRequestOptions, ) (*gitlab.MergeRequest, *gitlab.Response, error)
type MockMilestonesService ¶ added in v0.3.1
MockMilestonesService is a mock implementation of MilestonesService.
func (*MockMilestonesService) ListMilestones ¶ added in v0.3.1
func (m *MockMilestonesService) ListMilestones( pid interface{}, opt *gitlab.ListMilestonesOptions, ) ([]*gitlab.Milestone, *gitlab.Response, error)
type MockNotesService ¶ added in v0.2.0
MockNotesService is a mock implementation of NotesService.
func (*MockNotesService) CreateIssueNote ¶ added in v0.2.0
func (m *MockNotesService) CreateIssueNote( pid interface{}, issue int, opt *gitlab.CreateIssueNoteOptions, ) (*gitlab.Note, *gitlab.Response, error)
type MockProjectsService ¶
MockProjectsService is a mock implementation of ProjectsService.
func (*MockProjectsService) EditProject ¶ added in v0.4.0
func (m *MockProjectsService) EditProject( pid interface{}, opt *gitlab.EditProjectOptions, ) (*gitlab.Project, *gitlab.Response, error)
func (*MockProjectsService) GetProject ¶
func (m *MockProjectsService) GetProject( pid interface{}, opt *gitlab.GetProjectOptions, ) (*gitlab.Project, *gitlab.Response, error)
type MockUsersService ¶
MockUsersService is a mock implementation of UsersService.
func (*MockUsersService) CurrentUser ¶
func (m *MockUsersService) CurrentUser() (*gitlab.User, *gitlab.Response, error)
func (*MockUsersService) ListUsers ¶ added in v0.3.1
func (m *MockUsersService) ListUsers(opt *gitlab.ListUsersOptions) ([]*gitlab.User, *gitlab.Response, error)
type Note ¶ added in v0.2.0
type Note struct { ID int `json:"id"` Body string `json:"body"` Author map[string]interface{} `json:"author"` CreatedAt string `json:"created_at"` UpdatedAt string `json:"updated_at"` System bool `json:"system"` Noteable map[string]interface{} `json:"noteable"` }
Note represents a GitLab note/comment.
type NotesService ¶ added in v0.2.0
type NotesService interface {
CreateIssueNote(pid interface{}, issue int, opt *gitlab.CreateIssueNoteOptions) (*gitlab.Note, *gitlab.Response, error)
}
NotesService interface for GitLab Notes operations.
type NotesServiceWrapper ¶ added in v0.2.0
type NotesServiceWrapper struct {
// contains filtered or unexported fields
}
NotesServiceWrapper wraps the real Notes service.
func (*NotesServiceWrapper) CreateIssueNote ¶ added in v0.2.0
func (n *NotesServiceWrapper) CreateIssueNote( pid interface{}, issue int, opt *gitlab.CreateIssueNoteOptions, ) (*gitlab.Note, *gitlab.Response, error)
type ProjectInfo ¶ added in v0.4.0
type ProjectInfo struct { ID int `json:"id"` Name string `json:"name"` Path string `json:"path"` Description string `json:"description"` Topics []string `json:"topics"` }
ProjectInfo represents basic project information.
type ProjectsService ¶
type ProjectsService interface { GetProject(pid interface{}, opt *gitlab.GetProjectOptions) (*gitlab.Project, *gitlab.Response, error) EditProject(pid interface{}, opt *gitlab.EditProjectOptions) (*gitlab.Project, *gitlab.Response, error) }
ProjectsService interface for GitLab Projects operations.
type ProjectsServiceWrapper ¶
type ProjectsServiceWrapper struct {
// contains filtered or unexported fields
}
ProjectsServiceWrapper wraps the real Projects service.
func (*ProjectsServiceWrapper) EditProject ¶ added in v0.4.0
func (p *ProjectsServiceWrapper) EditProject( pid interface{}, opt *gitlab.EditProjectOptions, ) (*gitlab.Project, *gitlab.Response, error)
func (*ProjectsServiceWrapper) GetProject ¶
func (p *ProjectsServiceWrapper) GetProject( pid interface{}, opt *gitlab.GetProjectOptions, ) (*gitlab.Project, *gitlab.Response, error)
type UpdateIssueOptions ¶
type UpdateIssueOptions struct { Title string Description string State string Labels []string Assignees []int }
UpdateIssueOptions contains options for updating a project issue.
type UsersService ¶
type UsersService interface { CurrentUser() (*gitlab.User, *gitlab.Response, error) ListUsers(opt *gitlab.ListUsersOptions) ([]*gitlab.User, *gitlab.Response, error) }
UsersService interface for GitLab Users operations.
type UsersServiceWrapper ¶
type UsersServiceWrapper struct {
// contains filtered or unexported fields
}
UsersServiceWrapper wraps the real Users service.
func (*UsersServiceWrapper) CurrentUser ¶
func (u *UsersServiceWrapper) CurrentUser() (*gitlab.User, *gitlab.Response, error)
func (*UsersServiceWrapper) ListUsers ¶ added in v0.3.1
func (u *UsersServiceWrapper) ListUsers(opt *gitlab.ListUsersOptions) ([]*gitlab.User, *gitlab.Response, error)