/gitlab-api-go

GitLab API client in GO

Primary LanguageGo

Simple sdk for gitlab api

###Install

go get github.com/cnam/gitlab-api-go/gitlabapi

    import(
        "github.com/cnam/gitlab-api-go/gitlabapi"
    )

Example usage

func main (){
    type Issue struct {
        IssueId int `json:"id"`
        ProjectId int `json:"project_id"`
        Title  string `json:"title"`
    }

    var issues []Issue
	var issue Issue

	api := gitlabapi.NewApi("https://gitlab.com/api/v3", "qwerty")

	p := make(map[string]string)

	p["project_id"] = "1"

	command := api.NewCommand("GetIssuesByProject", p, &issues)
	log.Printf("Request url %v", command.Request.URL)

	command.Execute()

	log.Printf("%+v", issues)

	p["project_id"] = "1"
	p["issue_id"] = "1"

	command = api.NewCommand("GetIssue", p, &issue)

	log.Printf("Request url %v", command.Request.URL)

	command.Execute()

	log.Printf("%+v", issue)

	p["project_id"] = "1"
	p["title"] = "new issue"

	command = api.NewCommand("CreateIssue", p, &issue)

	log.Printf("Request url %v", command.Request.URL)

	command.Execute()

	log.Printf("%+v", issue)
}