gitlab

package
v0.0.0-...-d73a582 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultRequestTimeout = 5 * time.Second

DefaultRequestTimeout specifies default value for request timeouts.

View Source
const SettingButtonsTeam = "team"

Variables

View Source
var (
	ErrNotFound        = errors.New("not found")
	ErrPrivateResource = errors.New("private resource")
)

Errors returned by this package.

Functions

This section is empty.

Types

type AddWebhookOptions

type AddWebhookOptions struct {
	URL                      string
	ConfidentialNoteEvents   bool
	PushEvents               bool
	IssuesEvents             bool
	ConfidentialIssuesEvents bool
	MergeRequestsEvents      bool
	TagPushEvents            bool
	NoteEvents               bool
	JobEvents                bool
	PipelineEvents           bool
	WikiPageEvents           bool
	EnableSSLVerification    bool
	Token                    string
}

AddWebhookOptions is a paramater object with options for creating a project or group hook.

type Gitlab

type Gitlab interface {
	GetCurrentUser(userID string, token oauth2.Token) (*UserInfo, error)
	GetUserDetails(user *UserInfo) (*internGitlab.User, error)
	GetProject(user *UserInfo, owner, repo string) (*internGitlab.Project, error)
	GetReviews(user *UserInfo) ([]*internGitlab.MergeRequest, error)
	GetYourPrs(user *UserInfo) ([]*internGitlab.MergeRequest, error)
	GetYourAssignments(user *UserInfo) ([]*internGitlab.Issue, error)
	GetUnreads(user *UserInfo) ([]*internGitlab.Todo, error)
	GetProjectHooks(user *UserInfo, owner string, repo string) ([]*WebhookInfo, error)
	GetGroupHooks(user *UserInfo, owner string) ([]*WebhookInfo, error)
	NewProjectHook(user *UserInfo, projectID interface{}, projectHookOptions *AddWebhookOptions) (*WebhookInfo, error)
	NewGroupHook(user *UserInfo, groupName string, groupHookOptions *AddWebhookOptions) (*WebhookInfo, error)
	// ResolveNamespaceAndProject accepts full path to User, Group or namespaced Project and returns corresponding
	// namespace and project name.
	//
	// ErrNotFound will be returned if no resource can be found.
	// If allowPrivate is set to false, and resolved group/project is private, ErrPrivateResource will be returned.
	ResolveNamespaceAndProject(
		userInfo *UserInfo,
		fullPath string,
		allowPrivate bool,
	) (namespace string, project string, err error)
}

Gitlab is a client to call GitLab api see New() to build one

func New

func New(enterpriseBaseURL string, gitlabGroup string, checkGroup func(projectNameWithGroup string) error) Gitlab

New return a client to call GitLab API

type Scope

type Scope int

Scope identifies the scope of a webhook

const (
	// Group is a type for group hooks
	Group Scope = iota
	// Project is a type for project hooks
	Project
)

func (Scope) String

func (s Scope) String() string

type UserInfo

type UserInfo struct {
	UserID              string
	Token               *oauth2.Token
	GitlabUsername      string
	GitlabUserID        int
	LastToDoPostAt      int64
	Settings            *UserSettings
	AllowedPrivateRepos bool
}

type UserSettings

type UserSettings struct {
	SidebarButtons string `json:"sidebar_buttons"`
	DailyReminder  bool   `json:"daily_reminder"`
	Notifications  bool   `json:"notifications"`
}

type WebhookInfo

type WebhookInfo struct {
	ID                       int
	URL                      string
	ConfidentialNoteEvents   bool
	PushEvents               bool
	IssuesEvents             bool
	ConfidentialIssuesEvents bool
	MergeRequestsEvents      bool
	TagPushEvents            bool
	NoteEvents               bool
	JobEvents                bool
	PipelineEvents           bool
	WikiPageEvents           bool
	EnableSSLVerification    bool
	CreatedAt                *time.Time
	Scope                    Scope
}

WebhookInfo Provides information about group or project hooks.

func (*WebhookInfo) String

func (w *WebhookInfo) String() string

String produces a multiline bulleted string for displaying webhook information.

Directories

Path Synopsis
Package mock_gitlab is a generated GoMock package.
Package mock_gitlab is a generated GoMock package.

Jump to

Keyboard shortcuts

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