gitlabop

package
v1.9.4 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2025 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// SecretKey is used to encrypt and decrypt access token and refresh token.
	// NOTE: this key must be 8 bytes long.
	SecretKey = "aflowcli"
)

Functions

This section is empty.

Types

type Config added in v1.7.0

type Config struct {
	AppID        string
	AppSecret    string
	AccessToken  string
	RefreshToken string
	Host         string
	ApiURL       string
}

type CreateBranchRequest

type CreateBranchRequest struct {
	TargetBranch string
	SrcBranch    string
	ProjectID    int
}

CreateBranchRequest

type CreateBranchResult

type CreateBranchResult struct {
	Name   string
	WebURL string
}

type CreateIssueRequest

type CreateIssueRequest struct {
	Title, Desc, RelatedBranch string
	MilestoneID                int
	ProjectID                  int
}

CreateIssueRequest

type CreateIssueResult

type CreateIssueResult struct {
	ID     int
	IID    int
	WebURL string
}

type CreateMergeRequest

type CreateMergeRequest struct {
	Title, Desc, SrcBranch, TargetBranch string
	MilestoneID, IssueIID                int
	ProjectID                            int
	AutoMerge                            bool
}

CreateMergeRequest

type CreateMergeResult

type CreateMergeResult struct {
	ID     int
	IID    int
	WebURL string
}

type CreateMilestoneRequest

type CreateMilestoneRequest struct {
	Title     string
	Desc      string
	ProjectID int
}

CreateMilestoneRequest

type CreateMilestoneResult

type CreateMilestoneResult struct {
	ID     int
	WebURL string
}

type GetMilestoneIssuesRequest

type GetMilestoneIssuesRequest struct {
	MilestoneID int
	ProjectID   int
}

GetMilestoneIssuesRequest

type GetMilestoneIssuesResult

type GetMilestoneIssuesResult struct {
	Data []IssueShort
}

type GetMilestoneMergeRequestsRequest

type GetMilestoneMergeRequestsRequest struct {
	MilestoneID int
	ProjectID   int
}

GetMilestoneMergeRequestsRequest

type GetMilestoneMergeRequestsResult

type GetMilestoneMergeRequestsResult struct {
	Data []MergeRequestShort
}

type GetMilestoneRequest

type GetMilestoneRequest struct {
	MilestoneID int
	ProjectID   int
}

GetMilestoneRequest .

type GetMilestoneResult

type GetMilestoneResult struct {
	ID          int
	Title       string
	Description string
	WebURL      string
}

type IGitlabOauth2Support added in v1.7.0

type IGitlabOauth2Support interface {
	// Enter is an asynchronous process that would not return accessToken and refreshToken synchronized.
	// IGitlabOauth2Support.Load will return the refreshToken and accessToken after signaling.
	Enter(refreshToken string) (err error)

	// Load only uses this after any signal from Enter channel. Blocked method.
	Load() (accessToken, refreshToken string)
}

func NewOAuth2Support added in v1.7.0

func NewOAuth2Support(c *OAuth2Config) IGitlabOauth2Support

type IGitlabOperator

type IGitlabOperator interface {
	// CreateBranch create a branch on remote gitlab repository, but this would check remote
	// resource if create failed.
	CreateBranch(ctx context.Context, req *CreateBranchRequest) (*CreateBranchResult, error)

	// CreateMilestone create a milestone on remote gitlab repository, but this would check remote
	// resource if create failed.
	CreateMilestone(ctx context.Context, req *CreateMilestoneRequest) (*CreateMilestoneResult, error)
	GetMilestone(ctx context.Context, req *GetMilestoneRequest) (*GetMilestoneResult, error)
	GetMilestoneMergeRequests(
		ctx context.Context, req *GetMilestoneMergeRequestsRequest) (*GetMilestoneMergeRequestsResult, error)
	GetMilestoneIssues(ctx context.Context, req *GetMilestoneIssuesRequest) (*GetMilestoneIssuesResult, error)

	// CreateIssue create an issue on remote repository, but this would check remote
	// resource if create failed.
	CreateIssue(ctx context.Context, req *CreateIssueRequest) (*CreateIssueResult, error)
	// CreateMergeRequest create an merge request on remote repository, but this would check remote
	// resource if create failed.
	CreateMergeRequest(ctx context.Context, req *CreateMergeRequest) (*CreateMergeResult, error)
	MergeMergeRequest(ctx context.Context, req *MergeMergeRequest) error

	ListMilestones(ctx context.Context, req *ListMilestoneRequest) (*ListMilestoneResult, error)
	ListProjects(ctx context.Context, req *ListProjectRequest) (*ListProjectResult, error)
}

IGitlabOperator contains all operations those manage repository, milestones, branch, issue and merge requests.

func NewGitlabOperator

func NewGitlabOperator(accessToken, apiURL string) IGitlabOperator

NewGitlabOperator generate IGitlabOperator.

type IssueShort

type IssueShort struct {
	ID          int
	IID         int
	Title       string
	Description string
	WebURL      string
	ProjectID   int
	MilestoneID int
}

type ListMilestoneRequest

type ListMilestoneRequest struct {
	Page      int
	PerPage   int
	ProjectID int
}

ListMilestoneRequest

type ListMilestoneResult

type ListMilestoneResult struct {
	Data []MilestoneShort
}

type ListProjectRequest

type ListProjectRequest struct {
	Page        int
	PerPage     int
	ProjectName string
}

type ListProjectResult

type ListProjectResult struct {
	Data []ProjectShort
}

type MergeMergeRequest added in v1.9.0

type MergeMergeRequest struct {
	MergeRequestID int
	ProjectID      int
}

type MergeRequestShort

type MergeRequestShort struct {
	ID           int
	IID          int
	Title        string
	Description  string
	WebURL       string
	SourceBranch string
	TargetBranch string
}

type MilestoneShort

type MilestoneShort struct {
	ID          int
	IID         int
	Name        string
	WebURL      string
	Description string
}

type OAuth2Config added in v1.7.0

type OAuth2Config struct {
	// Host of gitlab code repository web application, such as https://git.example.com
	Host string

	// ServeAddr indicates which port will gitlabOAuth2Support will listen
	// to receive callback request from gitlab oauth server.
	ServeAddr string

	// AppID and AppSecret are application id and secret of gitlab oauth2 application.
	AppID, AppSecret string

	// AccessToken, RefreshToken represent tokens stored before,
	// if they are empty, means authorization is needed.
	AccessToken, RefreshToken string

	// Scopes is a string of scopes, such as "api read_user"
	Scopes string

	// Mode represents the mode of OAuth2 authorization.
	Mode types.OAuth2Mode
}

OAuth2Config helps construct gitlab OAuth2 support.

func NewOAuth2ConfigFrom added in v1.9.3

func NewOAuth2ConfigFrom(cfg *types.Config) *OAuth2Config

func (*OAuth2Config) CallbackURI added in v1.8.0

func (c *OAuth2Config) CallbackURI() string

type ProjectShort

type ProjectShort struct {
	ID     int
	Name   string
	WebURL string
}

Jump to

Keyboard shortcuts

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