Package provides methods for pasing GitLab API and return structures that are easy to work with. Currently supports only last api version – v3.
Full API documentation with request params and response examples can be found here
apiToken := "123"
baseUrl := "https://git.example.com"
apiVersion := "v3"
client := &http.Client{}
gitLabClient := gl_client.NewClient(apiToken, baseUrl, apiVersion, client)Inhouse instances of GitLab sometimes use self signed SSL certificates. For proper work with this case you should skip verifying of certificate. So initializing process will look slightly different.
transport := &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
}
apiToken := "123"
baseUrl := "https://git.example.com"
apiVersion := "v3"
client := &http.Client{Transport: transport}
gitLabClient := gl_client.NewClient(apiToken, baseUrl, apiVersion, client)GET /users
users, err := gitLabClient.GetUsers()Response:
[{1 John Smith j_smith [email protected]} {2 John Galt j_galt [email protected]}]
GET /users/:id
user, err := gitLabClient.GetUser(1)Response:
{ 1 John Smith j_smith [email protected] }
GET /user
user, err := gitLabClient.GetCurrentUser()Response:
{ 1 John Smith j_smith [email protected] }