app

package
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 12, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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")
	ErrUpdateEpicOptionsRequired = errors.New("update epic options are required")
	ErrNoteBodyRequired          = errors.New("note body is required")
	ErrLabelValidationFailed     = errors.New("label validation failed")
	ErrEpicsTierRequired         = errors.New("epics require GitLab Premium or Ultimate tier")
	ErrEpicTitleRequired         = errors.New("epic title is required")
	ErrInvalidDateFormat         = errors.New("date must be in YYYY-MM-DD format")
	ErrEpicIIDRequired           = errors.New("epic IID is required")
	ErrInvalidEpicState          = errors.New("epic state must be 'opened' or 'closed'")
	ErrProjectPathRequired       = errors.New("project path is required")
	ErrGroupPathRequired         = errors.New("group path is required")
	ErrIssueNotFound             = errors.New("issue not found")
	ErrNoPipelinesFound          = errors.New("no pipelines found")
	ErrJobLogOptionsRequired     = errors.New("options cannot be nil")
	ErrInvalidJobID              = errors.New("job_id must be positive")
	ErrJobNotFoundInPipeline     = errors.New("job not found in pipeline")
	ErrInvalidOutputPath         = errors.New("invalid output path")
	ErrFileWriteFailed           = errors.New("failed to write trace file")
	ErrPathTraversalAttempt      = errors.New("path traversal attempt detected")
)

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 AddIssueToEpicOptions added in v0.8.0

type AddIssueToEpicOptions struct {
	GroupPath   string
	EpicIID     int
	ProjectPath string
	IssueIID    int64
}

AddIssueToEpicOptions contains options for attaching an issue to an epic.

type App

type App struct {
	GitLabToken    string
	GitLabURI      string
	ValidateLabels bool
	// contains filtered or unexported fields
}

func New

func New() (*App, error)

func NewWithClient

func NewWithClient(token, uri string, client GitLabClient) *App

NewWithClient creates a new App instance with an injected GitLabClient (for testing).

func NewWithClientAndValidation added in v0.5.0

func NewWithClientAndValidation(token, uri string, client GitLabClient, validateLabels bool) *App

NewWithClientAndValidation creates a new App instance with an injected GitLabClient and validation setting (for testing).

func (*App) AddIssueNote added in v0.2.0

func (a *App) AddIssueNote(projectPath string, issueIID int64, opts *AddIssueNoteOptions) (*Note, error)

AddIssueNote adds a note/comment to an existing issue.

func (*App) AddIssueToEpic added in v0.8.0

func (a *App) AddIssueToEpic(opts *AddIssueToEpicOptions) (*EpicIssueAssignment, error)

AddIssueToEpic attaches an issue to an epic.

func (*App) CreateGroupEpic added in v0.7.0

func (a *App) CreateGroupEpic(groupPath string, opts *CreateEpicOptions) (*Epic, error)

CreateGroupEpic creates a new epic in a GitLab group.

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) DownloadJobTrace added in v0.9.0

func (a *App) DownloadJobTrace(projectPath string, opts *DownloadJobTraceOptions) (*DownloadJobTraceResult, error)

DownloadJobTrace downloads the trace for a specific GitLab CI/CD job to a local file.

func (*App) GetAPIURL

func (a *App) GetAPIURL() string

func (*App) GetJobLog added in v0.9.0

func (a *App) GetJobLog(projectPath string, opts *GetJobLogOptions) (*JobLog, error)

GetJobLog retrieves the complete log output for a specific GitLab CI/CD job.

func (*App) GetLatestPipeline added in v0.9.0

func (a *App) GetLatestPipeline(projectPath string, opts *GetLatestPipelineOptions) (*Pipeline, error)

GetLatestPipeline retrieves the latest pipeline 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) ListGroupEpics added in v0.7.0

func (a *App) ListGroupEpics(groupPath string, opts *ListEpicsOptions) ([]Epic, error)

ListGroupEpics retrieves epics for a given group path.

func (*App) ListPipelineJobs added in v0.9.0

func (a *App) ListPipelineJobs(projectPath string, opts *ListPipelineJobsOptions) ([]PipelineJob, error)

ListPipelineJobs retrieves all jobs for a pipeline with optional filtering.

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) SetLogger

func (a *App) SetLogger(l *slog.Logger)

func (*App) UpdateGroupEpic added in v0.11.0

func (a *App) UpdateGroupEpic(groupPath string, epicIID int, opts *UpdateEpicOptions) (*Epic, error)

UpdateGroupEpic updates an existing epic in a GitLab group.

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 int64, 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

func (a *App) ValidateConnection() error

type CreateEpicOptions added in v0.7.0

type CreateEpicOptions struct {
	Title        string
	Description  string
	Labels       []string
	StartDate    string
	DueDate      string
	Confidential bool
}

CreateEpicOptions contains options for creating a group epic.

type CreateIssueOptions

type CreateIssueOptions struct {
	Title       string
	Description string
	Labels      []string
	Assignees   []int64
}

CreateIssueOptions contains options for creating a project issue.

type DownloadJobTraceOptions added in v0.9.0

type DownloadJobTraceOptions struct {
	JobID      int64  // Required: job ID to download trace for
	PipelineID *int64 // Optional: pipeline context
	Ref        string // Optional: branch/tag for latest pipeline lookup
	OutputPath string // Optional: local file path (defaults to "./job_<id>_trace.log")
}

DownloadJobTraceOptions specifies parameters for downloading a job's trace to a file.

type DownloadJobTraceResult added in v0.9.0

type DownloadJobTraceResult struct {
	JobID      int64  `json:"job_id"`
	JobName    string `json:"job_name"`
	Status     string `json:"status"`
	Stage      string `json:"stage"`
	Ref        string `json:"ref"`
	PipelineID int64  `json:"pipeline_id"`
	WebURL     string `json:"web_url"`
	FilePath   string `json:"file_path"` // Absolute path where trace was saved
	FileSize   int64  `json:"file_size"` // Size in bytes
	SavedAt    string `json:"saved_at"`  // ISO 8601 timestamp
}

DownloadJobTraceResult represents the result of downloading a job trace to a file.

type Epic added in v0.7.0

type Epic struct {
	ID          int64          `json:"id"`
	IID         int64          `json:"iid"`
	GroupID     int64          `json:"group_id"`
	Title       string         `json:"title"`
	Description string         `json:"description"`
	State       string         `json:"state"`
	WebURL      string         `json:"web_url"`
	Author      map[string]any `json:"author"`
	StartDate   string         `json:"start_date"`
	DueDate     string         `json:"due_date"`
	Labels      []string       `json:"labels"`
	CreatedAt   string         `json:"created_at"`
	UpdatedAt   string         `json:"updated_at"`
}

Epic represents a GitLab epic.

type EpicIssueAssignment added in v0.8.0

type EpicIssueAssignment struct {
	ID          int64          `json:"id"`
	IID         int64          `json:"iid"`
	EpicID      int64          `json:"epic_id"`
	EpicIID     int64          `json:"epic_iid"`
	Title       string         `json:"title"`
	Description string         `json:"description"`
	State       string         `json:"state"`
	WebURL      string         `json:"web_url"`
	Labels      []string       `json:"labels"`
	Author      map[string]any `json:"author"`
}

EpicIssueAssignment represents an issue associated with an epic.

type EpicIssuesService added in v0.8.0

type EpicIssuesService interface {
	AssignEpicIssue(gid any, epic, issue int64) (*gitlab.EpicIssueAssignment, *gitlab.Response, error)
}

EpicIssuesService interface for GitLab Epic Issues operations.

type EpicIssuesServiceWrapper added in v0.8.0

type EpicIssuesServiceWrapper struct {
	// contains filtered or unexported fields
}

EpicIssuesServiceWrapper wraps the real EpicIssues service.

func (*EpicIssuesServiceWrapper) AssignEpicIssue added in v0.8.0

func (e *EpicIssuesServiceWrapper) AssignEpicIssue(
	gid any,
	epic, issue int64,
) (*gitlab.EpicIssueAssignment, *gitlab.Response, error)

type EpicsService added in v0.7.0

type EpicsService interface {
	ListGroupEpics(gid any, opt *gitlab.ListGroupEpicsOptions) ([]*gitlab.Epic, *gitlab.Response, error)
	CreateEpic(gid any, opt *gitlab.CreateEpicOptions) (*gitlab.Epic, *gitlab.Response, error)
	UpdateEpic(gid any, epic int, opt *gitlab.UpdateEpicOptions) (*gitlab.Epic, *gitlab.Response, error)
}

EpicsService interface for GitLab Epics operations.

type EpicsServiceWrapper added in v0.7.0

type EpicsServiceWrapper struct {
	// contains filtered or unexported fields
}

EpicsServiceWrapper wraps the real Epics service.

func (*EpicsServiceWrapper) CreateEpic added in v0.7.0

func (e *EpicsServiceWrapper) CreateEpic(
	gid any,
	opt *gitlab.CreateEpicOptions,
) (*gitlab.Epic, *gitlab.Response, error)

func (*EpicsServiceWrapper) ListGroupEpics added in v0.7.0

func (e *EpicsServiceWrapper) ListGroupEpics(
	gid any,
	opt *gitlab.ListGroupEpicsOptions,
) ([]*gitlab.Epic, *gitlab.Response, error)

func (*EpicsServiceWrapper) UpdateEpic added in v0.11.0

func (e *EpicsServiceWrapper) UpdateEpic(
	gid any,
	epic int,
	opt *gitlab.UpdateEpicOptions,
) (*gitlab.Epic, *gitlab.Response, error)

type GetJobLogOptions added in v0.9.0

type GetJobLogOptions struct {
	JobID      int64  // Required: job ID to retrieve logs for
	PipelineID *int64 // Optional: pipeline context
	Ref        string // Optional: branch/tag for latest pipeline lookup
}

GetJobLogOptions specifies parameters for retrieving a job's log.

type GetLatestPipelineOptions added in v0.9.0

type GetLatestPipelineOptions struct {
	Ref string // Optional: filter by branch/tag name
}

GetLatestPipelineOptions contains options for getting the latest pipeline.

type GitLabClient

type GitLabClient interface {
	Projects() ProjectsService
	Issues() IssuesService
	Labels() LabelsService
	GroupLabels() GroupLabelsService
	Users() UsersService
	Notes() NotesService
	Groups() GroupsService
	Epics() EpicsService
	EpicIssues() EpicIssuesService
	Pipelines() PipelinesService
	Jobs() JobsService
}

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) EpicIssues added in v0.8.0

func (g *GitLabClientWrapper) EpicIssues() EpicIssuesService

EpicIssues returns the EpicIssues service.

func (*GitLabClientWrapper) Epics added in v0.7.0

func (g *GitLabClientWrapper) Epics() EpicsService

Epics returns the Epics service.

func (*GitLabClientWrapper) GroupLabels added in v0.10.1

func (g *GitLabClientWrapper) GroupLabels() GroupLabelsService

GroupLabels returns the GroupLabels service.

func (*GitLabClientWrapper) Groups added in v0.7.0

func (g *GitLabClientWrapper) Groups() GroupsService

Groups returns the Groups service.

func (*GitLabClientWrapper) Issues

func (g *GitLabClientWrapper) Issues() IssuesService

Issues returns the Issues service.

func (*GitLabClientWrapper) Jobs added in v0.9.0

func (g *GitLabClientWrapper) Jobs() JobsService

Jobs returns the Jobs service.

func (*GitLabClientWrapper) Labels

func (g *GitLabClientWrapper) Labels() LabelsService

Labels returns the Labels service.

func (*GitLabClientWrapper) Notes added in v0.2.0

func (g *GitLabClientWrapper) Notes() NotesService

Notes returns the Notes service.

func (*GitLabClientWrapper) Pipelines added in v0.9.0

func (g *GitLabClientWrapper) Pipelines() PipelinesService

Pipelines returns the Pipelines 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 GroupLabelsService added in v0.10.1

type GroupLabelsService interface {
	ListGroupLabels(gid any, opt *gitlab.ListGroupLabelsOptions) ([]*gitlab.GroupLabel, *gitlab.Response, error)
}

GroupLabelsService interface for GitLab Group Labels operations.

type GroupLabelsServiceWrapper added in v0.10.1

type GroupLabelsServiceWrapper struct {
	// contains filtered or unexported fields
}

GroupLabelsServiceWrapper wraps the real GroupLabels service.

func (*GroupLabelsServiceWrapper) ListGroupLabels added in v0.10.1

func (g *GroupLabelsServiceWrapper) ListGroupLabels(
	gid any,
	opt *gitlab.ListGroupLabelsOptions,
) ([]*gitlab.GroupLabel, *gitlab.Response, error)

type GroupsService added in v0.7.0

type GroupsService interface {
	GetGroup(gid any, opt *gitlab.GetGroupOptions) (*gitlab.Group, *gitlab.Response, error)
}

GroupsService interface for GitLab Groups operations.

type GroupsServiceWrapper added in v0.7.0

type GroupsServiceWrapper struct {
	// contains filtered or unexported fields
}

GroupsServiceWrapper wraps the real Groups service.

func (*GroupsServiceWrapper) GetGroup added in v0.7.0

func (g *GroupsServiceWrapper) GetGroup(
	gid any,
	opt *gitlab.GetGroupOptions,
) (*gitlab.Group, *gitlab.Response, error)

type Issue

type Issue struct {
	ID          int64            `json:"id"`
	IID         int64            `json:"iid"`
	Title       string           `json:"title"`
	Description string           `json:"description"`
	State       string           `json:"state"`
	Labels      []string         `json:"labels"`
	Assignees   []map[string]any `json:"assignees"`
	CreatedAt   string           `json:"created_at"`
	UpdatedAt   string           `json:"updated_at"`
}

Issue represents a GitLab issue.

type IssuesService

type IssuesService interface {
	ListProjectIssues(
		pid any,
		opt *gitlab.ListProjectIssuesOptions,
	) ([]*gitlab.Issue, *gitlab.Response, error)
	ListGroupIssues(
		gid any,
		opt *gitlab.ListGroupIssuesOptions,
		options ...gitlab.RequestOptionFunc,
	) ([]*gitlab.Issue, *gitlab.Response, error)
	CreateIssue(pid any, opt *gitlab.CreateIssueOptions) (*gitlab.Issue, *gitlab.Response, error)
	UpdateIssue(
		pid any,
		issue int64,
		opt *gitlab.UpdateIssueOptions,
	) (*gitlab.Issue, *gitlab.Response, error)
	GetIssue(pid any, issue int) (*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 any,
	opt *gitlab.CreateIssueOptions,
) (*gitlab.Issue, *gitlab.Response, error)

func (*IssuesServiceWrapper) GetIssue added in v0.8.0

func (i *IssuesServiceWrapper) GetIssue(
	pid any,
	issue int,
) (*gitlab.Issue, *gitlab.Response, error)

func (*IssuesServiceWrapper) ListGroupIssues added in v0.9.1

func (i *IssuesServiceWrapper) ListGroupIssues(
	gid any,
	opt *gitlab.ListGroupIssuesOptions,
	options ...gitlab.RequestOptionFunc,
) ([]*gitlab.Issue, *gitlab.Response, error)

func (*IssuesServiceWrapper) ListProjectIssues

func (i *IssuesServiceWrapper) ListProjectIssues(
	pid any,
	opt *gitlab.ListProjectIssuesOptions,
) ([]*gitlab.Issue, *gitlab.Response, error)

func (*IssuesServiceWrapper) UpdateIssue

func (i *IssuesServiceWrapper) UpdateIssue(
	pid any,
	issue int64,
	opt *gitlab.UpdateIssueOptions,
) (*gitlab.Issue, *gitlab.Response, error)

type JobLog added in v0.9.0

type JobLog struct {
	JobID      int64  `json:"job_id"`
	JobName    string `json:"job_name"`
	Status     string `json:"status"`
	Stage      string `json:"stage"`
	Ref        string `json:"ref"`
	PipelineID int64  `json:"pipeline_id"`
	WebURL     string `json:"web_url"`
	LogContent string `json:"log_content"`
	LogSize    int64  `json:"log_size"`
}

JobLog represents the log output from a GitLab CI/CD job.

type JobRunner added in v0.9.0

type JobRunner struct {
	ID          int64  `json:"id"`
	Description string `json:"description"`
	Active      bool   `json:"active"`
}

JobRunner represents runner information for a job.

type JobsService added in v0.9.0

type JobsService interface {
	ListPipelineJobs(
		pid any,
		pipelineID int64,
		opt *gitlab.ListJobsOptions,
	) ([]*gitlab.Job, *gitlab.Response, error)
	GetTraceFile(
		pid any,
		jobID int64,
		options ...gitlab.RequestOptionFunc,
	) (io.Reader, *gitlab.Response, error)
}

JobsService interface for GitLab Jobs operations.

type JobsServiceWrapper added in v0.9.0

type JobsServiceWrapper struct {
	// contains filtered or unexported fields
}

JobsServiceWrapper wraps the real Jobs service.

func (*JobsServiceWrapper) GetTraceFile added in v0.9.0

func (j *JobsServiceWrapper) GetTraceFile(
	pid any,
	jobID int64,
	options ...gitlab.RequestOptionFunc,
) (io.Reader, *gitlab.Response, error)

func (*JobsServiceWrapper) ListPipelineJobs added in v0.9.0

func (j *JobsServiceWrapper) ListPipelineJobs(
	pid any,
	pipelineID int64,
	opt *gitlab.ListJobsOptions,
) ([]*gitlab.Job, *gitlab.Response, error)

type Label

type Label struct {
	ID                     int64  `json:"id"`
	Name                   string `json:"name"`
	Color                  string `json:"color"`
	TextColor              string `json:"text_color"`
	Description            string `json:"description"`
	OpenIssuesCount        int64  `json:"open_issues_count"`
	ClosedIssuesCount      int64  `json:"closed_issues_count"`
	OpenMergeRequestsCount int64  `json:"open_merge_requests_count"`
	Subscribed             bool   `json:"subscribed"`
	Priority               int64  `json:"priority"`
	IsProjectLabel         bool   `json:"is_project_label"`
}

Label represents a GitLab label.

type LabelsService

type LabelsService interface {
	ListLabels(pid any, 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 any,
	opt *gitlab.ListLabelsOptions,
) ([]*gitlab.Label, *gitlab.Response, error)

type ListEpicsOptions added in v0.7.0

type ListEpicsOptions struct {
	State string
	Limit int64
}

ListEpicsOptions contains options for listing group epics.

type ListIssuesOptions

type ListIssuesOptions struct {
	State              string
	Labels             string
	Limit              int64
	IncludeGroupIssues bool // defaults to true for comprehensive results
}

ListIssuesOptions contains options for listing project issues.

type ListLabelsOptions

type ListLabelsOptions struct {
	WithCounts            *bool
	IncludeAncestorGroups *bool
	Search                string
	Limit                 int64
}

ListLabelsOptions contains options for listing project labels.

type ListPipelineJobsOptions added in v0.9.0

type ListPipelineJobsOptions struct {
	PipelineID *int64   // Optional: specific pipeline ID (nil = use latest)
	Ref        string   // Optional: branch/tag for finding latest pipeline
	Scope      []string // Optional: filter by job status (API-side)
	Stage      string   // Optional: filter by stage name (client-side)
}

ListPipelineJobsOptions specifies the parameters for listing pipeline jobs.

type MockEpicIssuesService added in v0.8.0

type MockEpicIssuesService struct {
	mock.Mock
}

MockEpicIssuesService is a mock implementation of EpicIssuesService.

func (*MockEpicIssuesService) AssignEpicIssue added in v0.8.0

func (m *MockEpicIssuesService) AssignEpicIssue(
	gid any,
	epic, issue int64,
) (*gitlab.EpicIssueAssignment, *gitlab.Response, error)

type MockEpicsService added in v0.7.0

type MockEpicsService struct {
	mock.Mock
}

MockEpicsService is a mock implementation of EpicsService.

func (*MockEpicsService) CreateEpic added in v0.7.0

func (m *MockEpicsService) CreateEpic(
	gid any,
	opt *gitlab.CreateEpicOptions,
) (*gitlab.Epic, *gitlab.Response, error)

func (*MockEpicsService) ListGroupEpics added in v0.7.0

func (m *MockEpicsService) ListGroupEpics(
	gid any,
	opt *gitlab.ListGroupEpicsOptions,
) ([]*gitlab.Epic, *gitlab.Response, error)

func (*MockEpicsService) UpdateEpic added in v0.11.0

func (m *MockEpicsService) UpdateEpic(
	gid any,
	epic int,
	opt *gitlab.UpdateEpicOptions,
) (*gitlab.Epic, *gitlab.Response, error)

type MockGitLabClient

type MockGitLabClient struct {
	mock.Mock
}

MockGitLabClient is a mock implementation of GitLabClient.

func (*MockGitLabClient) EpicIssues added in v0.8.0

func (m *MockGitLabClient) EpicIssues() EpicIssuesService

func (*MockGitLabClient) Epics added in v0.7.0

func (m *MockGitLabClient) Epics() EpicsService

func (*MockGitLabClient) GroupLabels added in v0.10.1

func (m *MockGitLabClient) GroupLabels() GroupLabelsService

func (*MockGitLabClient) Groups added in v0.7.0

func (m *MockGitLabClient) Groups() GroupsService

func (*MockGitLabClient) Issues

func (m *MockGitLabClient) Issues() IssuesService

func (*MockGitLabClient) Jobs added in v0.9.0

func (m *MockGitLabClient) Jobs() JobsService

func (*MockGitLabClient) Labels

func (m *MockGitLabClient) Labels() LabelsService

func (*MockGitLabClient) Notes added in v0.2.0

func (m *MockGitLabClient) Notes() NotesService

func (*MockGitLabClient) Pipelines added in v0.9.0

func (m *MockGitLabClient) Pipelines() PipelinesService

func (*MockGitLabClient) Projects

func (m *MockGitLabClient) Projects() ProjectsService

func (*MockGitLabClient) Users

func (m *MockGitLabClient) Users() UsersService

type MockGroupLabelsService added in v0.10.1

type MockGroupLabelsService struct {
	mock.Mock
}

MockGroupLabelsService is a mock implementation of GroupLabelsService.

func (*MockGroupLabelsService) ListGroupLabels added in v0.10.1

func (m *MockGroupLabelsService) ListGroupLabels(
	gid any,
	opt *gitlab.ListGroupLabelsOptions,
) ([]*gitlab.GroupLabel, *gitlab.Response, error)

type MockGroupsService added in v0.7.0

type MockGroupsService struct {
	mock.Mock
}

MockGroupsService is a mock implementation of GroupsService.

func (*MockGroupsService) GetGroup added in v0.7.0

func (m *MockGroupsService) GetGroup(
	gid any,
	opt *gitlab.GetGroupOptions,
) (*gitlab.Group, *gitlab.Response, error)

type MockIssuesService

type MockIssuesService struct {
	mock.Mock
}

MockIssuesService is a mock implementation of IssuesService.

func (*MockIssuesService) CreateIssue

func (m *MockIssuesService) CreateIssue(
	pid any,
	opt *gitlab.CreateIssueOptions,
) (*gitlab.Issue, *gitlab.Response, error)

func (*MockIssuesService) GetIssue added in v0.8.0

func (m *MockIssuesService) GetIssue(
	pid any,
	issue int,
) (*gitlab.Issue, *gitlab.Response, error)

func (*MockIssuesService) ListGroupIssues added in v0.9.1

func (m *MockIssuesService) ListGroupIssues(
	gid any,
	opt *gitlab.ListGroupIssuesOptions,
	options ...gitlab.RequestOptionFunc,
) ([]*gitlab.Issue, *gitlab.Response, error)

func (*MockIssuesService) ListProjectIssues

func (m *MockIssuesService) ListProjectIssues(
	pid any,
	opt *gitlab.ListProjectIssuesOptions,
) ([]*gitlab.Issue, *gitlab.Response, error)

func (*MockIssuesService) UpdateIssue

func (m *MockIssuesService) UpdateIssue(
	pid any,
	issue int64,
	opt *gitlab.UpdateIssueOptions,
) (*gitlab.Issue, *gitlab.Response, error)

type MockJobsService added in v0.9.0

type MockJobsService struct {
	mock.Mock
}

MockJobsService is a mock implementation of JobsService.

func (*MockJobsService) GetTraceFile added in v0.9.0

func (m *MockJobsService) GetTraceFile(
	pid any,
	jobID int64,
	options ...gitlab.RequestOptionFunc,
) (io.Reader, *gitlab.Response, error)

func (*MockJobsService) ListPipelineJobs added in v0.9.0

func (m *MockJobsService) ListPipelineJobs(
	pid any,
	pipelineID int64,
	opt *gitlab.ListJobsOptions,
) ([]*gitlab.Job, *gitlab.Response, error)

type MockLabelsService

type MockLabelsService struct {
	mock.Mock
}

MockLabelsService is a mock implementation of LabelsService.

func (*MockLabelsService) ListLabels

func (m *MockLabelsService) ListLabels(
	pid any,
	opt *gitlab.ListLabelsOptions,
) ([]*gitlab.Label, *gitlab.Response, error)

type MockNotesService added in v0.2.0

type MockNotesService struct {
	mock.Mock
}

MockNotesService is a mock implementation of NotesService.

func (*MockNotesService) CreateIssueNote added in v0.2.0

func (m *MockNotesService) CreateIssueNote(
	pid any,
	issue int64,
	opt *gitlab.CreateIssueNoteOptions,
) (*gitlab.Note, *gitlab.Response, error)

type MockPipelinesService added in v0.9.0

type MockPipelinesService struct {
	mock.Mock
}

MockPipelinesService is a mock implementation of PipelinesService.

func (*MockPipelinesService) ListProjectPipelines added in v0.9.0

func (m *MockPipelinesService) ListProjectPipelines(
	pid any,
	opt *gitlab.ListProjectPipelinesOptions,
) ([]*gitlab.PipelineInfo, *gitlab.Response, error)

type MockProjectsService

type MockProjectsService struct {
	mock.Mock
}

MockProjectsService is a mock implementation of ProjectsService.

func (*MockProjectsService) EditProject added in v0.4.0

func (m *MockProjectsService) EditProject(
	pid any,
	opt *gitlab.EditProjectOptions,
) (*gitlab.Project, *gitlab.Response, error)

func (*MockProjectsService) GetProject

func (m *MockProjectsService) GetProject(
	pid any,
	opt *gitlab.GetProjectOptions,
) (*gitlab.Project, *gitlab.Response, error)

type MockUsersService

type MockUsersService struct {
	mock.Mock
}

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.0

func (m *MockUsersService) ListUsers(opt *gitlab.ListUsersOptions) ([]*gitlab.User, *gitlab.Response, error)

type Note added in v0.2.0

type Note struct {
	ID        int64          `json:"id"`
	Body      string         `json:"body"`
	Author    map[string]any `json:"author"`
	CreatedAt string         `json:"created_at"`
	UpdatedAt string         `json:"updated_at"`
	System    bool           `json:"system"`
	Noteable  map[string]any `json:"noteable"`
}

Note represents a GitLab note/comment.

type NotesService added in v0.2.0

type NotesService interface {
	CreateIssueNote(
		pid any,
		issue int64,
		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 any,
	issue int64,
	opt *gitlab.CreateIssueNoteOptions,
) (*gitlab.Note, *gitlab.Response, error)

type Pipeline added in v0.9.0

type Pipeline struct {
	ID        int64  `json:"id"`
	IID       int64  `json:"iid"`
	ProjectID int64  `json:"project_id"`
	Status    string `json:"status"`
	Source    string `json:"source"`
	Ref       string `json:"ref"`
	SHA       string `json:"sha"`
	WebURL    string `json:"web_url"`
	CreatedAt string `json:"created_at"`
	UpdatedAt string `json:"updated_at"`
}

Pipeline represents a GitLab pipeline.

type PipelineJob added in v0.9.0

type PipelineJob struct {
	ID             int64      `json:"id"`
	Name           string     `json:"name"`
	Stage          string     `json:"stage"`
	Status         string     `json:"status"`
	Ref            string     `json:"ref"`
	CreatedAt      string     `json:"created_at"`
	StartedAt      string     `json:"started_at"`
	FinishedAt     string     `json:"finished_at"`
	Duration       float64    `json:"duration"`
	QueuedDuration float64    `json:"queued_duration"`
	FailureReason  string     `json:"failure_reason"`
	WebURL         string     `json:"web_url"`
	Runner         *JobRunner `json:"runner,omitempty"`
}

PipelineJob represents a GitLab pipeline job.

type PipelinesService added in v0.9.0

type PipelinesService interface {
	ListProjectPipelines(
		pid any,
		opt *gitlab.ListProjectPipelinesOptions,
	) ([]*gitlab.PipelineInfo, *gitlab.Response, error)
}

PipelinesService interface for GitLab Pipelines operations.

type PipelinesServiceWrapper added in v0.9.0

type PipelinesServiceWrapper struct {
	// contains filtered or unexported fields
}

PipelinesServiceWrapper wraps the real Pipelines service.

func (*PipelinesServiceWrapper) ListProjectPipelines added in v0.9.0

func (p *PipelinesServiceWrapper) ListProjectPipelines(
	pid any,
	opt *gitlab.ListProjectPipelinesOptions,
) ([]*gitlab.PipelineInfo, *gitlab.Response, error)

type ProjectInfo added in v0.4.0

type ProjectInfo struct {
	ID          int64    `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 any, opt *gitlab.GetProjectOptions) (*gitlab.Project, *gitlab.Response, error)
	EditProject(pid any, 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 any,
	opt *gitlab.EditProjectOptions,
) (*gitlab.Project, *gitlab.Response, error)

func (*ProjectsServiceWrapper) GetProject

func (p *ProjectsServiceWrapper) GetProject(
	pid any,
	opt *gitlab.GetProjectOptions,
) (*gitlab.Project, *gitlab.Response, error)

type UpdateEpicOptions added in v0.11.0

type UpdateEpicOptions struct {
	Title        string
	Description  string
	Labels       []string
	StartDate    string // YYYY-MM-DD
	DueDate      string // YYYY-MM-DD
	State        string // "opened" or "closed"
	Confidential *bool  // Pointer: nil=no change, true/false=set value
}

UpdateEpicOptions contains options for updating a group epic.

type UpdateIssueOptions

type UpdateIssueOptions struct {
	Title       string
	Description string
	State       string
	Labels      []string
	Assignees   []int64
}

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.0

func (u *UsersServiceWrapper) ListUsers(opt *gitlab.ListUsersOptions) ([]*gitlab.User, *gitlab.Response, error)

Jump to

Keyboard shortcuts

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