gitlab

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//
	ErrGitLabInvalidToken = errors.New("Invalid Token")

	//
	ErrGitLabInvalidEndpoint = errors.New("Invalid GitLab endpoint")
)

Functions

This section is empty.

Types

type Client

type Client struct {
	HasV4Support bool
	HasV3Support bool
	Endpoint     string
	Token        string
	APIPrefix    string
}

func NewClient

func NewClient(endpoint string, token string) (*Client, error)

func (*Client) GetFile

func (c *Client) GetFile(project *Project, path, ref string) ([]byte, error)

@see https://gitlab.com/gitlab-org/gitlab-ce/blob/8-5-stable/doc/api/repository_files.md#get-file-from-repository for v3 file_path should be QueryString parameter.

@see https://docs.gitlab.com/ee/api/repository_files.html#get-file-from-repository for v4 file_path is not a parameter but part of URI. Should be encoded anyway. update, right now this one doesn't seem's to work.

GitLab < v9.4.2: v4 method doesn't work as documented, uses v3 signature. GitLab >= v9.4.2: v4 work as documented.

To maintain compatibility between all v3, v4-pre and v4 versions, one extra HEAD request should be executed.

type File

type File struct {
	Content  string `json:"content"`
	Encoding string `json:"encoding"`
}

type Project

type Project struct {
	ID                int      `json:"id"`
	Name              string   `json:"name"`
	PathWithNamespace string   `json:"path_with_namespace"`
	SSHURL            string   `json:"ssh_url_to_repo"`
	HTTPURL           string   `json:"http_url_to_repo"`
	WWWURL            string   `json:"web_url"`
	TagList           []string `json:"tag_list"`
}

type Tag

type Tag struct {
	Name   string        `json:"name"`
	Commit commitInlined `json:"commit"`
}

Jump to

Keyboard shortcuts

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