gitlab

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2021 License: MIT Imports: 4 Imported by: 1

README

GitLab Events

Events

  1. Push event: A push is made to the repository.
  2. Tag event: Tags are created or deleted in the repository.
  3. Issue event: A new issue is created or an existing issue is updated, closed, or reopened.
  4. Comment event A new comment is made on commits, merge requests, issues, and code snippets.
  5. Merge request event: A merge request is created, updated, merged, or closed, or a commit is added in the source branch.
  6. Wiki page event: A wiki page is created, updated, or deleted.
  7. Pipeline event: A pipeline status changes.
  8. Job event: A job status changes.
  9. Deployment event: A deployment starts, succeeds, fails, or is canceled.
  10. Group member event: A user is added or removed from a group, or a user’s access level or access expiration date changes.
  11. Subgroup event: A subgroup is created or removed from a group.
  12. Feature flag event: A feature flag is turned on or off.
  13. Release event: A release is created or updated.

References:

See: https://docs.gitlab.com/ee/user/project/integrations/webhook_events.html

Documentation

Index

Constants

View Source
const (
	ServiceSlug = "gitlab"
	DomainName  = "gitlab.com"
	EventSlugs  = "comment-on-commit,comment-onissue,comment-on-merge-request,issue,merge-request,push,release,tag-push"
)

Variables

This section is empty.

Functions

func NewEvents

func NewEvents() gowebhooks.Events

func ReadExampleFile

func ReadExampleFile(filename string) ([]byte, error)

ReadExampleFile reads an embedded example file.

Types

type Author

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

Author is used by `push` event

type Commit

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

Commit is used by `push` event

type EventMergeRequest

type EventMergeRequest struct {
	ObjectKind string     `json:"object_kind,omitempty"`
	EventName  string     `json:"event_name,omitempty"`
	User       User       `json:"user,omitempty"`
	Project    Project    `json:"project,omitempty"`
	Repository Repository `json:"repository,omitempty"`
}

type EventPush

type EventPush struct {
	ObjectKind        string     `json:"object_kind,omitempty"`
	EventName         string     `json:"event_name,omitempty"`
	Before            string     `json:"before,omitempty"`
	After             string     `json:"after,omitempty"`
	Ref               string     `json:"ref,omitempty"`
	CheckoutSha       string     `json:"checkout_sha,omitempty"`
	UserId            string     `json:"user_id"`
	UserName          string     `json:"user_name,omitempty"`
	UserUsername      string     `json:"user_username,omitempty"`
	UserEmail         string     `json:"user_email,omitempty"`
	UserAvatar        string     `json:"user_avatar,omitempty"`
	ProjectId         string     `json:"project_id"`
	Project           Project    `json:"project,omitempty"`
	Repository        Repository `json:"repository,omitempty"`
	Commits           []Commit   `json:"commits,omitempty"`
	TotalCommitsCount int        `json:"total_commits_count"` // include `0`
}

EventPush is defined at https://docs.gitlab.com/ee/user/project/integrations/webhook_events.html#push-events

type Project

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

Project is used by `push` event

type Repository

type Repository struct {
	Name            string `json:"name,omitempty"`
	URL             string `json:"url,omitempty"`
	Description     string `json:"description,omitempty"`
	Homepage        string `json:"homepage,omitempty"`
	GitHttpUrl      string `json:"git_http_url,omitempty"`
	GitSshUrl       string `json:"git_ssh_url,omitempty"`
	VisibilityLevel int    `json:"visibility_level"` // include `0`
}

Repository is used by `push` event

type User

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

User is used by `merge_request` event

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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