gitlab

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2022 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const EnvBaseURL = "GITLAB_BASE_URL"

EnvBaseURL is GitLab base URL. This can be set to a domain endpoint to use with Private GitLab.

View Source
const EnvToken = "GITLAB_TOKEN"

EnvToken is GitLab API Token

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API interface {
	CreateMergeRequestNote(mergeRequest int, opt *gitlab.CreateMergeRequestNoteOptions, options ...gitlab.RequestOptionFunc) (*gitlab.Note, *gitlab.Response, error)
	DeleteMergeRequestNote(mergeRequest, note int, options ...gitlab.RequestOptionFunc) (*gitlab.Response, error)
	ListMergeRequestNotes(mergeRequest int, opt *gitlab.ListMergeRequestNotesOptions, options ...gitlab.RequestOptionFunc) ([]*gitlab.Note, *gitlab.Response, error)
	PostCommitComment(sha string, opt *gitlab.PostCommitCommentOptions, options ...gitlab.RequestOptionFunc) (*gitlab.CommitComment, *gitlab.Response, error)
	ListCommits(opt *gitlab.ListCommitsOptions, options ...gitlab.RequestOptionFunc) ([]*gitlab.Commit, *gitlab.Response, error)
}

API is GitLab API interface

type Client

type Client struct {
	*gitlab.Client
	Debug  bool
	Config Config

	Comment *CommentService
	Commits *CommitsService
	Notify  *NotifyService

	API API
	// contains filtered or unexported fields
}

Client ...

func NewClient

func NewClient(cfg Config) (*Client, error)

NewClient returns Client initialized with Config

type CommentService

type CommentService service

CommentService handles communication with the comment related methods of GitLab API

func (*CommentService) Delete

func (g *CommentService) Delete(note int) error

Delete deletes comment on GitLab merge requests

func (*CommentService) DeleteDuplicates

func (g *CommentService) DeleteDuplicates(title string)

DeleteDuplicates deletes duplicate comments containing arbitrary character strings

func (*CommentService) List

func (g *CommentService) List(number int) ([]*gitlab.Note, error)

List lists comments on GitLab merge requests

func (*CommentService) Post

func (g *CommentService) Post(body string, opt PostOptions) error

Post posts comment

type CommitsService

type CommitsService service

CommitsService handles communication with the commits related methods of GitLab API

func (*CommitsService) List

func (g *CommitsService) List(revision string) ([]string, error)

List lists commits on a repository

type Config

type Config struct {
	Token     string
	BaseURL   string
	NameSpace string
	Project   string
	MR        MergeRequest
	CI        string
	Parser    terraform.Parser
	Template  terraform.Template
}

Config is a configuration for GitHub client

type GitLab

type GitLab struct {
	*gitlab.Client
	// contains filtered or unexported fields
}

GitLab represents the attribute information necessary for requesting GitLab API

func (*GitLab) CreateMergeRequestNote

func (g *GitLab) CreateMergeRequestNote(mergeRequest int, opt *gitlab.CreateMergeRequestNoteOptions, options ...gitlab.RequestOptionFunc) (*gitlab.Note, *gitlab.Response, error)

CreateMergeRequestNote is a wrapper of https://godoc.org/github.com/xanzy/go-gitlab#NotesService.CreateMergeRequestNote

func (*GitLab) DeleteMergeRequestNote

func (g *GitLab) DeleteMergeRequestNote(mergeRequest, note int, options ...gitlab.RequestOptionFunc) (*gitlab.Response, error)

DeleteMergeRequestNote is a wrapper of https://godoc.org/github.com/xanzy/go-gitlab#NotesService.DeleteMergeRequestNote

func (*GitLab) ListMergeRequestNotes

func (g *GitLab) ListMergeRequestNotes(mergeRequest int, opt *gitlab.ListMergeRequestNotesOptions, options ...gitlab.RequestOptionFunc) ([]*gitlab.Note, *gitlab.Response, error)

ListMergeRequestNotes is a wrapper of https://godoc.org/github.com/xanzy/go-gitlab#NotesService.ListMergeRequestNotes

type MergeRequest

type MergeRequest struct {
	Revision string
	Title    string
	Message  string
	Number   int
}

MergeRequest represents GitLab Merge Request metadata

func (*MergeRequest) IsNumber

func (mr *MergeRequest) IsNumber() bool

IsNumber returns true if MergeRequest is Merge Request build

type NotifyService

type NotifyService service

NotifyService handles communication with the notification related methods of GitHub API

func (*NotifyService) Notify

func (g *NotifyService) Notify(body string) (exit int, err error)

Notify posts comment optimized for notifications

type PostOptions

type PostOptions struct {
	Number   int
	Revision string
}

PostOptions specifies the optional parameters to post comments to a pull request

Jump to

Keyboard shortcuts

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