gitlab

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2017 License: BSD-3-Clause Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseBody

func ParseBody(body []byte) (kind string, hook interface{}, err error)

ParseBody parses a GitLab hook from the specified JSON document

func ParseReader

func ParseReader(in io.Reader) (kind string, hook interface{}, err error)

ParseReader reads everything from the specified io.Reader and attempts to parse it as a JSON document with a GitLab hook payload.

Types

type ArtifactFile

type ArtifactFile struct {
	Filename *string `json:"filename"`
	Size     *int    `json:"size"`
}

type Build

type Build struct {
	Id            int          `json:"id"`
	Stage         string       `json:"stage"`
	Name          string       `json:"name"`
	Status        string       `json:"status"`
	CreatedAt     string       `json:"created_at"`
	StartedAt     *string      `json:"started_at"`
	FinishedAt    *string      `json:"finished_at"`
	When          string       `json:"when"`
	Manual        bool         `json:"manual"`
	User          User         `json:"user"`
	Runner        *string      `json:"runner"`
	ArtifactsFile ArtifactFile `json:"artifacts_file"`
}

type BuildCommit

type BuildCommit struct {
	Id          int     `json:"id"`
	Sha         string  `json:"sha"`
	Message     string  `json:"message"`
	AuthorName  string  `json:"author_name,omitempty"`
	AuthorEmail string  `json:"author_email,omitempty"`
	Status      string  `json:"status"`
	Duration    *int    `json:"duration"`
	StartedAt   *string `json:"started_at"`
	FinishedAt  *string `json:"finished_at"`
}

type BuildHook

type BuildHook struct {
	Hook

	Ref               string      `json:"ref"`
	Tag               bool        `json:"tag"`
	BeforeSHA         string      `json:"before_sha"`
	SHA               string      `json:"sha"`
	BuildID           int         `json:"build_id"`
	BuildName         string      `json:"build_name"`
	BuildStage        string      `json:"build_stage"`
	BuildStatus       string      `json:"build_status"`
	BuildStartedAt    *string     `json:"build_started_at"`
	BuildFinishedAt   *string     `json:"build_finished_at"`
	BuildDuration     *int        `json:"build_duration"`
	BuildAllowFailure bool        `json:"build_allow_failure"`
	ProjectID         int         `json:"project_id"`
	ProjectName       string      `json:"project_name"`
	User              User        `json:"user"`
	Commit            BuildCommit `json:"commit"`
	Repository        Repository  `json:"repository"`
}

See https://gitlab.com/help/user/project/integrations/webhooks.md#build-events

type Commit

type Commit struct {
	Id        string   `json:"id"`
	Message   string   `json:"message"`
	Timestamp string   `json:"timestamp"`
	Url       string   `json:"url"`
	Author    User     `json:"author,omitempty"`
	Added     []string `json:"added"`
	Modified  []string `json:"modified"`
	Removed   []string `json:"removed"`
}

type Diff

type Diff struct {
	Diff        string `json:"diff"`
	NewPath     string `json:"new_path"`
	OldPath     string `json:"old_path"`
	AMode       string `json:"a_mode"`
	BMode       string `json:"b_mode"`
	NewFile     bool   `json:"new_file"`
	RenamedFile bool   `json:"renamed_file"`
	DeletedFile bool   `json:"deleted_file"`
}

type Hook

type Hook struct {
	ObjectKind string `json:"object_kind"`
}

type Issue

type Issue struct {
	Id          int     `json:"id"`
	Title       string  `json:"title"`
	AssigneeIDs []int   `json:"assignee_ids"`
	AssigneeID  *int    `json:"assignee_id"`
	AuthorID    int     `json:"author_id"`
	ProjectID   int     `json:"project_id"`
	CreatedAt   string  `json:"created_at"`
	UpdatedAt   string  `json:"updated_at"`
	Position    int     `json:"position"`
	BranchName  *string `json:"branch_name"`
	Description string  `json:"description"`
	MilestoneId *int    `json:"milestone_id"`
	State       string  `json:"state"`
	IId         int     `json:"iid"`
	Url         string  `json:"url"`
	Action      string  `json:"action"`
}

type IssueHook

type IssueHook struct {
	Hook

	User             User       `json:"user"`
	Project          Project    `json:"project"`
	Repository       Repository `json:"repository"`
	ObjectAttributes Issue      `json:"object_attributes"`
	Assignees        []User     `json:"assignees"`
	Assignee         *User      `json:"assignee"`
	Labels           []Label    `json:"labels"`
}

See https://gitlab.com/help/user/project/integrations/webhooks.md#issues-events

type Label

type Label struct {
	Id          int    `json:"id"`
	Title       string `json:"title"`
	Color       string `json:"color"`
	ProjectID   int    `json:"project_id"`
	CreatedAt   string `json:"created_at"`
	UpdatedAt   string `json:"updated_at"`
	Template    bool   `json:"template"`
	Description string `json:"description"`
	Type        string `json:"type"`
	GroupID     int    `json:"group_id"`
}

type MergeRequest

type MergeRequest struct {
	Id              int      `json:"id"`
	TargetBranch    string   `json:"target_branch"`
	SourceBranch    string   `json:"source_branch"`
	SourceProjectID int      `json:"source_project_id"`
	AuthorID        int      `json:"author_id"`
	AssigneeID      *int     `json:"assignee_id"`
	Title           string   `json:"title"`
	CreatedAt       string   `json:"created_at"`
	UpdatedAt       string   `json:"updated_at"`
	StCommits       []Commit `json:"st_commits"`
	StDiffs         []Diff   `json:"st_diffs"`
	MilestoneId     *int     `json:"milestone_id"`
	State           string   `json:"state"`
	MergeStatus     string   `json:"merge_status"`
	TargetProjectID int      `json:"target_project_id"`
	IId             int      `json:"iid"`
	Description     string   `json:"description"`
	Position        int      `json:"position"`
	Source          Project  `json:"source"`
	Target          Project  `json:"target"`
	LastCommit      Commit   `json:"last_commit"`
	WorkInProgress  bool     `json:"work_in_progress"`
	Url             string   `json:"url"`
	Action          string   `json:"action"`
	Assignee        User     `json:"assignee"`
}

type MergeRequestHook

type MergeRequestHook struct {
	Hook

	User             User         `json:"user"`
	ObjectAttributes MergeRequest `json:"object_attributes"`
}

See https://gitlab.com/help/user/project/integrations/webhooks.md#merge-request-events

type Note

type Note struct {
	Id           int     `json:"id"`
	Note         string  `json:"note"`
	NoteableType string  `json:"noteable_type"`
	AuthorID     int     `json:"author_id"`
	CreatedAt    string  `json:"created_at"`
	UpdatedAt    string  `json:"updated_at"`
	ProjectID    int     `json:"project_id"`
	Attachment   *string `json:"attachment"`
	LineCode     *string `json:"line_code"`
	CommitID     string  `json:"commit_id"`
	NoteableID   *int    `json:"noteable_id"`
	System       bool    `json:"system"`
	StDiff       *Diff   `json:"st_diff"`
	Url          string  `json:"url"`
}

type NoteHook

type NoteHook struct {
	Hook

	User             User         `json:"user"`
	ProjectID        int          `json:"project_id"`
	Project          Project      `json:"project"`
	Repository       Repository   `json:"repository"`
	ObjectAttributes Note         `json:"object_attributes"`
	Commit           Commit       `json:"commit"`
	MergeRequest     MergeRequest `json:"merge_request"`
	Issue            Issue        `json:"issue"`
	Snippet          Snippet      `json:"snippet"`
}

See https://gitlab.com/help/user/project/integrations/webhooks.md#comment-events

type Pipeline

type Pipeline struct {
	Id         int      `json:"id"`
	Ref        string   `json:"ref"`
	Tag        bool     `json:"tag"`
	SHA        string   `json:"sha"`
	BeforeSHA  string   `json:"before_sha"`
	Status     string   `json:"status"`
	Stages     []string `json:"stages"`
	CreatedAt  string   `json:"created_at"`
	FinishedAt string   `json:"finished_at"`
	Duration   *int     `json:"duration"`
}

type PipelineHook

type PipelineHook struct {
	Hook

	ObjectAttributes Pipeline `json:"object_attributes"`
	User             User     `json:"user"`
	Project          Project  `json:"project"`
	Commit           Commit   `json:"commit"`
	Builds           []Build  `json:"builds"`
}

See https://gitlab.com/help/user/project/integrations/webhooks.md#pipeline-events

type Project

type Project struct {
	Name              string  `json:"name"`
	Description       string  `json:"description"`
	WebUrl            string  `json:"web_url"`
	AvatarUrl         *string `json:"avatar_url"`
	GitSshUrl         string  `json:"git_ssh_url"`
	GitHttpUrl        string  `json:"git_http_url"`
	Namespace         string  `json:"namespace"`
	VisibilityLevel   int     `json:"visibility_level"`
	PathWithNamespace string  `json:"path_with_namespace"`
	DefaultBranch     string  `json:"default_branch"`
	Homepage          string  `json:"homepage"`
	Url               string  `json:"url"`
	SshUrl            string  `json:"ssh_url"`
	HttpUrl           string  `json:"http_url"`
}

type PushHook

type PushHook struct {
	Hook

	Before            string     `json:"before"`
	After             string     `json:"after"`
	Ref               string     `json:"ref"`
	CheckoutSHA       string     `json:"checkout_sha"`
	UserID            int        `json:"user_id"`
	UserName          string     `json:"user_name"`
	UserUsername      string     `json:"user_username"`
	UserEmail         string     `json:"user_email"`
	UserAvatar        string     `json:"user_avatar"`
	ProjectID         int        `json:"project_id"`
	Project           Project    `json:"project"`
	Repository        Repository `json:"repository"`
	Commits           []Commit   `json:"commits"`
	TotalCommitsCount int        `json:"total_commits_count"`
}

See https://gitlab.com/help/user/project/integrations/webhooks.md#push-events

type Repository

type Repository struct {
	Name            string `json:"name"`
	Url             string `json:"url"`
	Description     string `json:"description"`
	Homepage        string `json:"homepage"`
	GitSshUrl       string `json:"git_ssh_url"`
	GitHttpUrl      string `json:"git_http_url"`
	VisibilityLevel int    `json:"visibility_level"`
}

type Snippet

type Snippet struct {
	Id              int    `json:"id"`
	Title           string `json:"title"`
	Content         string `json:"content"`
	AuthorID        int    `json:"author_id"`
	ProjectID       int    `json:"project_id"`
	CreatedAt       string `json:"created_at"`
	UpdatedAt       string `json:"updated_at"`
	FileName        string `json:"file_name"`
	ExpiresAt       string `json:"expires_at"`
	Type            string `json:"type"`
	VisibilityLevel int    `json:"visibility_level"`
}

type TagHook

type TagHook struct {
	Hook

	Before            string     `json:"before"`
	After             string     `json:"after"`
	Ref               string     `json:"ref"`
	CheckoutSHA       string     `json:"checkout_sha"`
	UserID            int        `json:"user_id"`
	UserName          string     `json:"user_name"`
	UserAvatar        string     `json:"user_avatar"`
	ProjectID         int        `json:"project_id"`
	Project           Project    `json:"project"`
	Repository        Repository `json:"repository"`
	Commits           []Commit   `json:"commits"`
	TotalCommitsCount int        `json:"total_commits_count"`
}

See https://gitlab.com/help/user/project/integrations/webhooks.md#tag-events

type User

type User struct {
	Name      string `json:"name"`
	Username  string `json:"username"`
	Email     string `json:"email"`
	AvatarUrl string `json:"avatar_url"`
}

type Wiki

type Wiki struct {
	WebUrl            string `json:"web_url"`
	GitSshUrl         string `json:"git_ssh_url"`
	GitHttpUrl        string `json:"git_http_url"`
	PathWithNamespace string `json:"path_with_namespace"`
	DefaultBranch     string `json:"default_branch"`
}

type WikiPage

type WikiPage struct {
	Title   string `json:"title"`
	Content string `json:"content"`
	Format  string `json:"format"`
	Message string `json:"message"`
	Slug    string `json:"slug"`
	Url     string `json:"url"`
	Action  string `json:"action"`
}

type WikiPageHook

type WikiPageHook struct {
	Hook

	User             User     `json:"user"`
	Project          Project  `json:"project"`
	Wiki             Wiki     `json:"wiki"`
	ObjectAttributes WikiPage `json:"object_attributes"`
}

See https://gitlab.com/help/user/project/integrations/webhooks.md#wiki-page-events

Jump to

Keyboard shortcuts

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