Commit 4c533b2a authored by Zaq? Wiedmann's avatar Zaq? Wiedmann Committed by Sander van Harmelen

(ci/lint) expose ci lint API (#293)

parent 73276272
......@@ -209,6 +209,7 @@ type Client struct {
Issues *IssuesService
Jobs *JobsService
Labels *LabelsService
Lint *LintService
MergeRequests *MergeRequestsService
Milestones *MilestonesService
Namespaces *NamespacesService
......@@ -284,6 +285,7 @@ func newClient(httpClient *http.Client, tokenType tokenType, token string) *Clie
c.Issues = &IssuesService{client: c, timeStats: timeStats}
c.Jobs = &JobsService{client: c}
c.Labels = &LabelsService{client: c}
c.Lint = &LintService{client: c}
c.MergeRequests = &MergeRequestsService{client: c, timeStats: timeStats}
c.Milestones = &MilestonesService{client: c}
c.Namespaces = &NamespacesService{client: c}
......
package gitlab
type LintService struct {
client *Client
}
type LintResponse struct {
Status string `json:"status"`
Errors []string `json:"errors"`
}
// Lint validates .gitlab-ci content
//
// GitLab API docs: https://docs.gitlab.com/ce/api/lint.html
func (l *LintService) Lint(content string, options ...OptionFunc) (*LintResponse, *Response, error) {
opts := struct {
Content string `json:"content"`
}{
Content: content,
}
req, err := l.client.NewRequest("POST", "ci/lint", opts, options)
if err != nil {
return nil, nil, err
}
var lint LintResponse
resp, err := l.client.Do(req, &lint)
if err != nil {
return nil, resp, err
}
return &lint, resp, nil
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment