diff options
author | Michael Muré <batolettre@gmail.com> | 2019-07-23 19:50:58 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-23 19:50:58 +0200 |
commit | 9ecbcb1cf6348b95b31ccef3f9722be078dbe223 (patch) | |
tree | d855b993905051d5ff5dbc3e30460bc09fa2e2c4 /vendor/github.com/xanzy/go-gitlab/validate.go | |
parent | ca00c9c6b84f0b1333e40666ab979d0d8fdc4036 (diff) | |
parent | 29fdd37ce69b48aa9fc3c1b829ff67818041068f (diff) | |
download | git-bug-9ecbcb1cf6348b95b31ccef3f9722be078dbe223.tar.gz |
Merge pull request #179 from MichaelMure/gitlab-support
Add gitlab bridge configuration and importer
Diffstat (limited to 'vendor/github.com/xanzy/go-gitlab/validate.go')
-rw-r--r-- | vendor/github.com/xanzy/go-gitlab/validate.go | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/vendor/github.com/xanzy/go-gitlab/validate.go b/vendor/github.com/xanzy/go-gitlab/validate.go new file mode 100644 index 00000000..a88e1884 --- /dev/null +++ b/vendor/github.com/xanzy/go-gitlab/validate.go @@ -0,0 +1,40 @@ +package gitlab + +// ValidateService handles communication with the validation related methods of +// the GitLab API. +// +// GitLab API docs: https://docs.gitlab.com/ce/api/lint.html +type ValidateService struct { + client *Client +} + +// LintResult represents the linting results. +// +// GitLab API docs: https://docs.gitlab.com/ce/api/lint.html +type LintResult struct { + Status string `json:"status"` + Errors []string `json:"errors"` +} + +// Lint validates .gitlab-ci.yml content. +// +// GitLab API docs: https://docs.gitlab.com/ce/api/lint.html +func (s *ValidateService) Lint(content string, options ...OptionFunc) (*LintResult, *Response, error) { + var opts struct { + Content string `url:"content,omitempty" json:"content,omitempty"` + } + opts.Content = content + + req, err := s.client.NewRequest("POST", "ci/lint", &opts, options) + if err != nil { + return nil, nil, err + } + + l := new(LintResult) + resp, err := s.client.Do(req, l) + if err != nil { + return nil, resp, err + } + + return l, resp, nil +} |