gitlab

package
v3.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2017 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArtifactsFile

type ArtifactsFile struct {
	Filename string `json:"filename"`
	Size     string `json:"size"`
}

ArtifactsFile contais all of the GitLab artifact information

type Assignee

type Assignee struct {
	Name      string `json:"name"`
	Username  string `json:"username"`
	AvatarURL string `json:"avatar_url"`
}

Assignee contais all of the GitLab assignee information

type Author

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

Author contais all of the GitLab author information

type Build

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

Build contais all of the GitLab build information

type BuildCommit

type BuildCommit struct {
	ID          int        `json:"id"`
	SHA         string     `json:"sha"`
	Message     string     `json:"message"`
	AuthorName  string     `json:"auuthor_name"`
	AuthorEmail string     `json:"author_email"`
	Status      string     `json:"status"`
	Duration    int        `json:"duration"`
	StartedAt   customTime `json:"started_at"`
	FinishedAt  customTime `json:"finished_at"`
}

BuildCommit contais all of the GitLab build commit information

type BuildEventPayload

type BuildEventPayload struct {
	ObjectKind        string      `json:"object_kind"`
	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    customTime  `json:"build_started_at"`
	BuildFinishedAt   customTime  `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"`
}

BuildEventPayload contains the information for GitLab's build status change event

type CommentEventPayload

type CommentEventPayload struct {
	ObjectKind       string           `json:"object_kind"`
	User             User             `json:"user"`
	ProjectID        int              `json:"project_id"`
	Project          Project          `json:"project"`
	Repository       Repository       `json:"repository"`
	ObjectAttributes ObjectAttributes `json:"object_attributes"`
	MergeRequest     MergeRequest     `json:"merge_request"`
	Commit           Commit           `json:"commit"`
	Issue            Issue            `json:"issue"`
	Snippet          Snippet          `json:"snippet"`
}

CommentEventPayload contains the information for GitLab's comment event

type Commit

type Commit struct {
	ID        string     `json:"id"`
	Message   string     `json:"message"`
	Timestamp customTime `json:"timestamp"`
	URL       string     `json:"url"`
	Author    Author     `json:"author"`
	Added     []string   `json:"added"`
	Modified  []string   `json:"modified"`
	Removed   []string   `json:"removed"`
}

Commit contais all of the GitLab commit information

type Config

type Config struct {
	Secret string
}

Config defines the configuration to create a new GitHub Webhook instance

type Event

type Event string

Event defines a GitHub hook event type

const (
	PushEvents          Event = "Push Hook"
	TagEvents           Event = "Tag Push Hook"
	IssuesEvents        Event = "Issue Hook"
	CommentEvents       Event = "Note Hook"
	MergerRequestEvents Event = "Merge Request Hook"
	WikiPageEvents      Event = "Wiki Page Hook"
	PipelineEvents      Event = "Pipeline Hook"
	BuildEvents         Event = "Build Hook"
)

GitLab hook types

type Issue

type Issue struct {
	ID          int        `json:"id"`
	Title       string     `json:"title"`
	AssigneeID  int        `json:"assignee_id"`
	AuthorID    int        `json:"author_id"`
	ProjectID   int        `json:"project_id"`
	CreatedAt   customTime `json:"created_at"`
	UpdatedAt   customTime `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"`
}

Issue contais all of the GitLab issue information

type IssueEventPayload

type IssueEventPayload struct {
	ObjectKind       string           `json:"object_kind"`
	User             User             `json:"user"`
	Project          Project          `json:"project"`
	Repository       Repository       `json:"repository"`
	ObjectAttributes ObjectAttributes `json:"object_attributes"`
	Assignee         Assignee         `json:"assignee"`
}

IssueEventPayload contains the information for GitLab's issue event

type LastCommit

type LastCommit struct {
	ID        string     `json:"id"`
	Message   string     `json:"message"`
	Timestamp customTime `json:"timestamp"`
	URL       string     `json:"url"`
	Author    Author     `json:"author"`
}

LastCommit contais all of the GitLab last commit information

type MergeRequest

type MergeRequest struct {
	ID              int        `json:"id"`
	TargetBranch    string     `json:"target_branch"`
	SourceBranch    string     `json:"source_branch"`
	SourceProjectID string     `json:"source_project_id"`
	AssigneeID      int        `json:"assignee_id"`
	AuthorID        int        `json:"author_id"`
	Title           string     `json:"title"`
	CreatedAt       customTime `json:"created_at"`
	UpdatedAt       customTime `json:"updated_at"`
	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"`
	LockedAt        customTime `json:"locked_at"`
	Source          Source     `json:"source"`
	Target          Target     `json:"target"`
	LastCommit      LastCommit `json:"last_commit"`
	WorkInProgress  bool       `json:"work_in_progress"`
	Assignee        Assignee   `json:"assignee"`
}

MergeRequest contais all of the GitLab merge request information

type MergeRequestEventPayload

type MergeRequestEventPayload struct {
	ObjectKind       string           `json:"object_kind"`
	User             User             `json:"user"`
	ObjectAttributes ObjectAttributes `json:"object_attributes"`
}

MergeRequestEventPayload contains the information for GitLab's merge request event

type ObjectAttributes

type ObjectAttributes struct {
	ID              int        `json:"id"`
	Title           string     `json:"title"`
	AssigneeID      int        `json:"assignee_id"`
	AuthorID        int        `json:"author_id"`
	ProjectID       int        `json:"project_id"`
	CreatedAt       customTime `json:"created_at"`
	UpdatedAt       customTime `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"`
	TargetBranch    string     `json:"target_branch"`
	SourceBranch    string     `json:"source_branch"`
	SourceProjectID int        `json:"source_project_id"`
	TargetProjectID int        `json:"target_project_id"`
	StCommits       string     `json:"st_commits"`
	MergeStatus     string     `json:"merge_status"`
	Content         string     `json:"content"`
	Format          string     `json:"format"`
	Message         string     `json:"message"`
	Slug            string     `json:"slug"`
	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"`
	Duration        int        `json:"duration"`
	Note            string     `json:"note"`
	NotebookType    string     `json:"noteable_type"`
	At              customTime `json:"attachment"`
	LineCode        string     `json:"line_code"`
	CommitID        string     `json:"commit_id"`
	NoteableID      int        `json:"noteable_id"`
	System          bool       `json:"system"`
	WorkInProgress  bool       `json:"work_in_progress"`
	StDiffs         []StDiff   `json:"st_diffs"`
	Source          Source     `json:"source"`
	Target          Target     `json:"target"`
	LastCommit      LastCommit `json:"last_commit"`
	Assignee        Assignee   `json:"assignee"`
}

ObjectAttributes contais all of the GitLab object attributes information

type PipelineEventPayload

type PipelineEventPayload struct {
	ObjectKind       string           `json:"object_kind"`
	User             User             `json:"user"`
	Project          Project          `json:"project"`
	Commit           Commit           `json:"commit"`
	ObjectAttributes ObjectAttributes `json:"object_attributes"`
	Builds           []Build          `json:"builds"`
}

PipelineEventPayload contains the information for GitLab's pipeline status change event

type Project

type Project struct {
	Name              string `json:"name"`
	Description       string `json:"description"`
	WebURL            string `json:"web_url"`
	AvatarURL         string `json:"avatar_url"`
	GitSSSHURL        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"`
}

Project contais all of the GitLab project information

type PushEventPayload

type PushEventPayload struct {
	ObjectKind        string     `json:"object_kind"`
	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"`
	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"`
}

PushEventPayload contains the information for GitLab's push event

type Repository

type Repository struct {
	Name        string `json:"name"`
	URL         string `json:"url"`
	Description string `json:"description"`
	Homepage    string `json:"homepage"`
}

Repository contais all of the GitLab repository information

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       customTime `json:"created_at"`
	UpdatedAt       customTime `json:"updated_at"`
	FileName        string     `json:"file_name"`
	ExpiresAt       customTime `json:"expires_at"`
	Type            string     `json:"type"`
	VisibilityLevel int        `json:"visibility_level"`
}

Snippet contais all of the GitLab snippet information

type Source

type Source 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"`
}

Source contais all of the GitLab source information

type StDiff

type StDiff 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"`
}

StDiff contais all of the GitLab diff information

type TagEventPayload

type TagEventPayload struct {
	ObjectKind        string     `json:"object_kind"`
	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"`
}

TagEventPayload contains the information for GitLab's tag push event

type Target

type Target 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"`
}

Target contais all of the GitLab target information

type User

type User struct {
	Name      string `json:"name"`
	UserName  string `json:"username"`
	AvatarURL string `json:"avatar_url"`
}

User contais all of the GitLab user information

type Webhook

type Webhook struct {
	// contains filtered or unexported fields
}

Webhook instance contains all methods needed to process events

func New

func New(config *Config) *Webhook

New creates and returns a WebHook instance denoted by the Provider type

func (Webhook) ParsePayload

func (hook Webhook) ParsePayload(w http.ResponseWriter, r *http.Request)

ParsePayload parses and verifies the payload and fires off the mapped function, if it exists.

func (Webhook) Provider

func (hook Webhook) Provider() webhooks.Provider

Provider returns the current hooks provider ID

func (Webhook) RegisterEvents

func (hook Webhook) RegisterEvents(fn webhooks.ProcessPayloadFunc, events ...Event)

RegisterEvents registers the function to call when the specified event(s) are encountered

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"`
}

Wiki contais all of the GitLab wiki information

type WikiPageEventPayload

type WikiPageEventPayload struct {
	ObjectKind       string           `json:"object_kind"`
	User             User             `json:"user"`
	Project          Project          `json:"project"`
	Wiki             Wiki             `json:"wiki"`
	ObjectAttributes ObjectAttributes `json:"object_attributes"`
}

WikiPageEventPayload contains the information for GitLab's wiki created/updated event

Jump to

Keyboard shortcuts

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