gitlab

package
v2.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 18 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const TokenExpirationThreshold int64 = 7000

Variables

This section is empty.

Functions

func UpdateGitlabToken

func UpdateGitlabToken(id int, accessToken string) (string, error)

Types

type AccessToken

type AccessToken struct {
	AccessToken  string `json:"access_token"`
	TokenType    string `json:"token_type"`
	ExpiresIn    int    `json:"expires_in"`
	RefreshToken string `json:"refresh_token"`
	Scope        string `json:"scope"`
	CreatedAt    int    `json:"created_at"`
}

type Client

type Client struct {
	*gitlab.Client
}

func NewClient

func NewClient(id int, address, accessToken, proxyAddr string, enableProxy bool) (*Client, error)

func (*Client) AddProjectHook

func (c *Client) AddProjectHook(owner, repo string, hook *git.Hook) (*gitlab.ProjectHook, error)

func (*Client) Compare

func (c *Client) Compare(projectID int, from, to string) ([]*gitlab.Diff, error)

func (*Client) DeleteProjectHook

func (c *Client) DeleteProjectHook(owner, repo string, id int) error

func (*Client) GetFileContent

func (c *Client) GetFileContent(owner, repo, path, branch string) ([]byte, error)

func (*Client) GetLatestRepositoryCommit

func (c *Client) GetLatestRepositoryCommit(owner, repo string, path, branch string) (*gitlab.Commit, error)

func (*Client) GetProjectID

func (c *Client) GetProjectID(owner, repo string) (int, error)

func (*Client) GetRawFile

func (c *Client) GetRawFile(owner, repo string, sha string, fileName string) ([]byte, error)

func (*Client) GetSingleCommitOfProject

func (c *Client) GetSingleCommitOfProject(owner, repo, commitSha string) (*gitlab.Commit, error)

func (*Client) GetTreeContents

func (c *Client) GetTreeContents(owner, repo, path, branch string) (afero.Fs, error)

GetTreeContents recursively gets all file contents under the given path, and writes to an in-memory file system.

func (*Client) GetYAMLContents

func (c *Client) GetYAMLContents(owner, repo, path, branch string, isDir, split bool) ([]string, error)

GetYAMLContents recursively gets all yaml contents under the given path. if split is true, manifests in the same file will be split to separated ones.

func (*Client) ListBranches

func (c *Client) ListBranches(owner, repo, key string, opts *ListOptions) ([]*gitlab.Branch, error)

ListBranches lists branches by projectID <- urlEncode(namespace/projectName)

func (*Client) ListChangedFiles

func (c *Client) ListChangedFiles(event *gitlab.MergeEvent) ([]string, error)

func (*Client) ListCommits

func (c *Client) ListCommits(owner, repo, branch string, opts *ListOptions) ([]*gitlab.Commit, error)

func (*Client) ListGroupProjects

func (c *Client) ListGroupProjects(namespace, keyword string, opts *ListOptions) ([]*gitlab.Project, error)

func (*Client) ListNamespaces

func (c *Client) ListNamespaces(keyword string, opts *ListOptions) ([]*gitlab.Namespace, error)

func (*Client) ListOpenedProjectMergeRequests

func (c *Client) ListOpenedProjectMergeRequests(owner, repo, targetBranch, key string, opts *ListOptions) ([]*gitlab.MergeRequest, error)

func (*Client) ListProjectHooks

func (c *Client) ListProjectHooks(owner, repo string, opts *ListOptions) ([]*gitlab.ProjectHook, error)

func (*Client) ListTags

func (c *Client) ListTags(owner, repo string, opts *ListOptions, key string) ([]*gitlab.Tag, error)

ListTags lists branches by projectID <- urlEncode(namespace/projectName)

func (*Client) ListTree

func (c *Client) ListTree(owner, repo, path, branch string, recursive bool, opts *ListOptions) ([]*gitlab.TreeNode, error)

func (*Client) ListUserProjects

func (c *Client) ListUserProjects(owner, keyword string, opts *ListOptions) ([]*gitlab.Project, error)

func (*Client) UpdateProjectHook

func (c *Client) UpdateProjectHook(owner, repo string, id int, hook *git.Hook) (*gitlab.ProjectHook, error)

type ListOptions

type ListOptions struct {
	// Page number of the results to fetch. Default: 1
	Page int
	// Results per page (max 100). Default: 30
	PerPage int

	// NoPaginated indicates if we need to fetch all result or just one page. True means fetching just one page
	NoPaginated bool
}

Jump to

Keyboard shortcuts

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