gitlab

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultOrgID = 1

Variables

This section is empty.

Functions

This section is empty.

Types

type Branch

type Branch struct {
	Name      string `json:"name"`
	Protected bool   `json:"protected"`
	Merged    bool   `json:"merged"`
}

type Client

type Client struct {
	*gitlab.Client
}

func NewGitlabClient

func NewGitlabClient(address, accessToken string) (*Client, error)

func (*Client) Compare

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

func (*Client) CreateCommitDiscussion

func (c *Client) CreateCommitDiscussion(projectPath, commitHash, comment string) error

func (*Client) GetFileContent

func (c *Client) GetFileContent(projectID int, ref, path string) ([]byte, error)

func (*Client) GetLatestCommit

func (c *Client) GetLatestCommit(projectID int, branch, path string) (*RepoCommit, error)

func (*Client) GetLatestCommitByProName

func (c *Client) GetLatestCommitByProName(projectID, branch, path string) (*RepoCommit, error)

GetLatestCommit By string pro

func (*Client) GetProject

func (c *Client) GetProject(owner, repo string) (*Project, error)

func (*Client) GetRawFile

func (c *Client) GetRawFile(projectID int, sha string, fileName string) (content []byte, err error)

func (*Client) GetSingleCommitOfProject

func (c *Client) GetSingleCommitOfProject(address, token, projectPath, commitSha string) (*gitlab.Commit, error)

func (*Client) ListBranches

func (c *Client) ListBranches(projectID string) ([]*Branch, error)

List branches by projectID <- urlEncode(namespace/projectName)

func (*Client) ListChangedFiles

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

func (*Client) ListGroupProjects

func (c *Client) ListGroupProjects(namespace, keyword string) ([]*Project, error)

func (*Client) ListNamespaces

func (c *Client) ListNamespaces(keyword string) ([]*Namespace, error)

func (*Client) ListOpened

func (c *Client) ListOpened(projectID, targetBranch string) ([]*MergeRequest, error)

func (*Client) ListTags

func (c *Client) ListTags(projectID string) ([]*Tag, error)

List branches by projectID <- urlEncode(namespace/projectName)

func (*Client) ListTree

func (c *Client) ListTree(projectID int, ref string, path string) ([]*gitlab.TreeNode, error)

func (*Client) ListUserProjects

func (c *Client) ListUserProjects(owner, keyword string) ([]*Project, error)

type MergeRequest

type MergeRequest struct {
	MRID           int    `json:"id"`
	TargetBranch   string `json:"targetBranch"`
	SourceBranch   string `json:"sourceBranch"`
	ProjectID      int    `json:"projectId"`
	Title          string `json:"title"`
	State          string `json:"state"`
	CreatedAt      int64  `json:"createdAt"`
	UpdatedAt      int64  `json:"updatedAt"`
	AuthorUsername string `json:"authorUsername"`
	Number         int    `json:"number"`
	User           string `json:"user"`
	Base           string `json:"base,omitempty"`
}

type Namespace

type Namespace struct {
	Name string `json:"name"`
	Path string `json:"path"`
	Kind string `json:"kind"`
}

type Project

type Project struct {
	ID            int    `json:"id"`
	Name          string `json:"name"`
	Description   string `json:"description"`
	DefaultBranch string `json:"defaultBranch"`
	Namespace     string `json:"namespace"`
}

type RepoCommit

type RepoCommit struct {
	ID         string     `json:"id"`
	Title      string     `json:"title"`
	AuthorName string     `json:"author_name"`
	CreatedAt  *time.Time `json:"created_at"`
	Message    string     `json:"message"`
}

RepoCommit : Repository commit struct

type Tag

type Tag struct {
	Name       string `json:"name"`
	ZipballURL string `json:"zipball_url"`
	TarballURL string `json:"tarball_url"`
	Message    string `json:"message"`
}

Jump to

Keyboard shortcuts

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