client

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2017 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	BaseUrl string
	ApiPath string
	Token   string
	Client  *http.Client
}

func New

func New(baseUrl, apiPath, token string, skipVerify bool) *Client

func (*Client) AddDroneService

func (c *Client) AddDroneService(id string, params QMap) error

func (*Client) AllGroups

func (g *Client) AllGroups() ([]*Namespace, error)

Get a list of all projects owned by the authenticated user.

func (*Client) AllProjects

func (g *Client) AllProjects(hide_archives bool) ([]*Project, error)

Get a list of all projects owned by the authenticated user.

func (*Client) CurrentUser

func (c *Client) CurrentUser() (User, error)

func (*Client) DeleteDroneService

func (c *Client) DeleteDroneService(id string) error

func (*Client) Do

func (c *Client) Do(method, url, opaque string, body []byte) ([]byte, error)

func (*Client) Groups

func (g *Client) Groups(page, perPage int) ([]*Namespace, error)

func (*Client) Project

func (c *Client) Project(id string) (*Project, error)

Get a project by id

func (*Client) Projects

func (c *Client) Projects(page int, per_page int, hide_archives bool) ([]*Project, error)

Get a list of projects owned by the authenticated user.

func (*Client) RepoRawFile

func (c *Client) RepoRawFile(id, sha, filepath string) ([]byte, error)

Get Raw file content

func (*Client) RepoRawFileRef added in v0.6.0

func (c *Client) RepoRawFileRef(id, ref, filepath string) ([]byte, error)

func (*Client) ResourceUrl

func (c *Client) ResourceUrl(u string, params, query QMap) (string, string)

func (*Client) SearchProjectId

func (c *Client) SearchProjectId(namespace string, name string) (id int, err error)

Get a list of projects by query owned by the authenticated user.

func (*Client) SetStatus

func (c *Client) SetStatus(id, sha, state, desc, ref, link string) error

type GroupAccess

type GroupAccess struct {
	AccessLevel       int `json:"access_level,omitempty"`
	NotificationLevel int `json:"notification_level,omitempty"`
}

type HookObjAttr

type HookObjAttr struct {
	Id              int       `json:"id,omitempty"`
	Title           string    `json:"title,omitempty"`
	AssigneeId      int       `json:"assignee_id,omitempty"`
	AuthorId        int       `json:"author_id,omitempty"`
	ProjectId       int       `json:"project_id,omitempty"`
	CreatedAt       string    `json:"created_at,omitempty"`
	UpdatedAt       string    `json:"updated_at,omitempty"`
	Position        int       `json:"position,omitempty"`
	BranchName      string    `json:"branch_name,omitempty"`
	Description     string    `json:"description,omitempty"`
	MilestoneId     int       `json:"milestone_id,omitempty"`
	State           string    `json:"state,omitempty"`
	IId             int       `json:"iid,omitempty"`
	TargetBranch    string    `json:"target_branch,omitempty"`
	SourceBranch    string    `json:"source_branch,omitempty"`
	SourceProjectId int       `json:"source_project_id,omitempty"`
	StCommits       string    `json:"st_commits,omitempty"`
	StDiffs         string    `json:"st_diffs,omitempty"`
	MergeStatus     string    `json:"merge_status,omitempty"`
	TargetProjectId int       `json:"target_project_id,omitempty"`
	Url             string    `json:"url,omiyempty"`
	Source          *hProject `json:"source,omitempty"`
	Target          *hProject `json:"target,omitempty"`
	LastCommit      *hCommit  `json:"last_commit,omitempty"`
}

type HookPayload

type HookPayload struct {
	Before            string       `json:"before,omitempty"`
	After             string       `json:"after,omitempty"`
	Ref               string       `json:"ref,omitempty"`
	UserId            int          `json:"user_id,omitempty"`
	UserName          string       `json:"user_name,omitempty"`
	ProjectId         int          `json:"project_id,omitempty"`
	Project           *hProject    `json:"project,omitempty"`
	Repository        *hRepository `json:"repository,omitempty"`
	Commits           []hCommit    `json:"commits,omitempty"`
	TotalCommitsCount int          `json:"total_commits_count,omitempty"`
	ObjectKind        string       `json:"object_kind,omitempty"`
	ObjectAttributes  *HookObjAttr `json:"object_attributes,omitempty"`
}

func ParseHook

func ParseHook(payload []byte) (*HookPayload, error)

ParseHook parses hook payload from GitLab

func (*HookPayload) Branch

func (h *HookPayload) Branch() string

Branch returns current branch for push event hook payload This function returns empty string for any other events

func (*HookPayload) Head

func (h *HookPayload) Head() hCommit

Head returns the latest changeset for push event hook payload

func (*HookPayload) Tag

func (h *HookPayload) Tag() string

Tag returns current tag for push event hook payload This function returns empty string for any other events

type Member

type Member struct {
	Id        int
	Username  string
	Email     string
	Name      string
	State     string
	CreatedAt string `json:"created_at,omitempty"`
}

type Namespace

type Namespace struct {
	Id   int    `json:"id,omitempty"`
	Name string `json:"name,omitempty"`
	Path string `json:"path,omitempty"`
}

type Permissions

type Permissions struct {
	ProjectAccess *ProjectAccess `json:"project_access,omitempty"`
	GroupAccess   *GroupAccess   `json:"group_access,omitempty"`
}

type Person

type Person struct {
	Name  string `json:"name"`
	Email string `json:"email"`
}

type Project

type Project struct {
	Id                int          `json:"id,omitempty"`
	Owner             *Member      `json:"owner,omitempty"`
	Name              string       `json:"name,omitempty"`
	Description       string       `json:"description,omitempty"`
	DefaultBranch     string       `json:"default_branch,omitempty"`
	Public            bool         `json:"public,omitempty"`
	Path              string       `json:"path,omitempty"`
	PathWithNamespace string       `json:"path_with_namespace,omitempty"`
	Namespace         *Namespace   `json:"namespace,omitempty"`
	SshRepoUrl        string       `json:"ssh_url_to_repo"`
	HttpRepoUrl       string       `json:"http_url_to_repo"`
	Url               string       `json:"web_url"`
	AvatarUrl         string       `json:"avatar_url"`
	Permissions       *Permissions `json:"permissions,omitempty"`
}

type ProjectAccess

type ProjectAccess struct {
	AccessLevel       int `json:"access_level,omitempty"`
	NotificationLevel int `json:"notification_level,omitempty"`
}

type QMap

type QMap map[string]string

type User

type User struct {
	Id        int    `json:"id,omitempty"`
	Username  string `json:"username,omitempty"`
	Email     string `json:"email,omitempty"`
	AvatarUrl string `json:"avatar_url,omitempty"`
	Name      string `json:"name,omitempty"`
}

Jump to

Keyboard shortcuts

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