• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

go-gitlab-0.18.0/H25-May-2019-

.gitignoreH A D30-Aug-2019312

.travis.ymlH A D30-Aug-2019362

CHANGELOG.mdH A D30-Aug-2019789

LICENSEH A D30-Aug-201911.1 KiB

README.mdH A D30-Aug-20194.9 KiB

access_requests.goH A D30-Aug-20196.9 KiB

award_emojis.goH A D30-Aug-201916.8 KiB

boards.goH A D30-Aug-20199.7 KiB

branches.goH A D30-Aug-20197 KiB

broadcast_messages.goH A D30-Aug-20195.5 KiB

build_variables.goH A D30-Aug-20194.9 KiB

ci_yml_templates.goH A D30-Aug-20191.9 KiB

commits.goH A D30-Aug-201916.4 KiB

custom_attributes.goH A D30-Aug-20196.7 KiB

deploy_keys.goH A D30-Aug-20195.5 KiB

deployments.goH A D30-Aug-20193.7 KiB

discussions.goH A D30-Aug-201932.2 KiB

environments.goH A D30-Aug-20195.6 KiB

epics.goH A D30-Aug-20197.1 KiB

event_parsing.goH A D30-Aug-20193.1 KiB

event_types.goH A D30-Aug-201930.6 KiB

events.goH A D30-Aug-20194.7 KiB

feature_flags.goH A D30-Aug-20191.8 KiB

gitignore_templates.goH A D30-Aug-20192.5 KiB

gitlab.goH A D30-Aug-201927.2 KiB

go.modH A D30-Aug-2019359

go.sumH A D30-Aug-20191.9 KiB

group_badges.goH A D30-Aug-20195.9 KiB

group_boards.goH A D30-Aug-20197.1 KiB

group_labels.goH A D30-Aug-20195.5 KiB

group_members.goH A D30-Aug-20196.6 KiB

group_milestones.goH A D30-Aug-20197.8 KiB

group_variables.goH A D30-Aug-20194.4 KiB

groups.goH A D30-Aug-201911 KiB

issue_links.goH A D30-Aug-20193.6 KiB

issues.goH A D30-Aug-201920.2 KiB

jobs.goH A D30-Aug-201910.5 KiB

keys.goH A D30-Aug-20191.7 KiB

labels.goH A D30-Aug-20197.3 KiB

license.goH A D30-Aug-20192.5 KiB

license_templates.goH A D30-Aug-20192.8 KiB

merge_request_approvals.goH A D30-Aug-20194.6 KiB

merge_requests.goH A D30-Aug-201932.1 KiB

milestones.goH A D30-Aug-20198.1 KiB

namespaces.goH A D30-Aug-20193.4 KiB

notes.goH A D30-Aug-201919.4 KiB

notifications.goH A D30-Aug-20197.6 KiB

pages_domains.goH A D30-Aug-20195.5 KiB

pipeline_schedules.goH A D30-Aug-201910.1 KiB

pipeline_triggers.goH A D30-Aug-20196.8 KiB

pipelines.goH A D30-Aug-20197.5 KiB

project_badges.goH A D30-Aug-20196.1 KiB

project_clusters.goH A D30-Aug-20197.7 KiB

project_import_export.goH A D30-Aug-20195.8 KiB

project_members.goH A D30-Aug-20196.3 KiB

project_snippets.goH A D30-Aug-20196.3 KiB

project_variables.goH A D30-Aug-20195.5 KiB

projects.goH A D30-Aug-201952.2 KiB

protected_branches.goH A D30-Aug-20195.3 KiB

protected_tags.goH A D30-Aug-20194.2 KiB

registry.goH A D30-Aug-20196.5 KiB

releaselinks.goH A D30-Aug-20194.8 KiB

releases.goH A D30-Aug-20195.8 KiB

repositories.goH A D30-Aug-20199 KiB

repository_files.goH A D30-Aug-20199.1 KiB

runners.goH A D30-Aug-201912.4 KiB

search.goH A D30-Aug-201912 KiB

services.goH A D30-Aug-201925.7 KiB

settings.goH A D30-Aug-201922.2 KiB

sidekiq_metrics.goH A D30-Aug-20194.5 KiB

snippets.goH A D30-Aug-20196.8 KiB

strings.goH A D30-Aug-20192 KiB

system_hooks.goH A D30-Aug-20193.7 KiB

tags.goH A D30-Aug-20197 KiB

time_stats.goH A D30-Aug-20194.5 KiB

todos.goH A D30-Aug-20196 KiB

users.goH A D30-Aug-201927.5 KiB

validate.goH A D30-Aug-2019993

version.goH A D30-Aug-20191.5 KiB

wikis.goH A D30-Aug-20195.6 KiB

README.md

1# go-gitlab
2
3A GitLab API client enabling Go programs to interact with GitLab in a simple and uniform way
4
5[![Build Status](https://travis-ci.org/xanzy/go-gitlab.svg?branch=master)](https://travis-ci.org/xanzy/go-gitlab)
6[![GitHub license](https://img.shields.io/github/license/xanzy/go-gitlab.svg)](https://github.com/xanzy/go-gitlab/blob/master/LICENSE)
7[![Sourcegraph](https://sourcegraph.com/github.com/xanzy/go-gitlab/-/badge.svg)](https://sourcegraph.com/github.com/xanzy/go-gitlab?badge)
8[![GoDoc](https://godoc.org/github.com/xanzy/go-gitlab?status.svg)](https://godoc.org/github.com/xanzy/go-gitlab)
9[![Go Report Card](https://goreportcard.com/badge/github.com/xanzy/go-gitlab)](https://goreportcard.com/report/github.com/xanzy/go-gitlab)
10[![GitHub issues](https://img.shields.io/github/issues/xanzy/go-gitlab.svg)](https://github.com/xanzy/go-gitlab/issues)
11
12## NOTE
13
14Release v0.6.0 (released on 25-08-2017) no longer supports the older V3 Gitlab API. If
15you need V3 support, please use the `f-api-v3` branch. This release contains some backwards
16incompatible changes that were needed to fully support the V4 Gitlab API.
17
18## Coverage
19
20This API client package covers most of the existing Gitlab API calls and is updated regularly
21to add new and/or missing endpoints. Currently the following services are supported:
22
23- [ ] Discussions (threaded comments)
24- [ ] Epic Issues
25- [ ] Epics
26- [ ] Geo Nodes
27- [x] Award Emojis
28- [x] Branches
29- [x] Broadcast Messages
30- [x] Commits
31- [x] Container Registry
32- [x] Custom Attributes
33- [x] Deploy Keys
34- [x] Deployments
35- [x] Environments
36- [x] Events
37- [x] Feature Flags
38- [x] GitLab CI Config Templates
39- [x] Gitignores Templates
40- [x] Group Access Requests
41- [x] Group Issue Boards
42- [x] Group Members
43- [x] Group Milestones
44- [x] Group-Level Variables
45- [x] Groups
46- [x] Issue Boards
47- [x] Issues
48- [x] Jobs
49- [x] Keys
50- [x] Labels
51- [x] License
52- [x] Merge Request Approvals
53- [x] Merge Requests
54- [x] Namespaces
55- [x] Notes (comments)
56- [x] Notification Settings
57- [x] Open Source License Templates
58- [x] Pages Domains
59- [x] Pipeline Schedules
60- [x] Pipeline Triggers
61- [x] Pipelines
62- [x] Project Access Requests
63- [x] Project Badges
64- [x] Project Clusters
65- [x] Project Import/export
66- [x] Project Members
67- [x] Project Milestones
68- [x] Project Snippets
69- [x] Project-Level Variables
70- [x] Projects (including setting Webhooks)
71- [x] Protected Branches
72- [x] Protected Tags
73- [x] Repositories
74- [x] Repository Files
75- [x] Runners
76- [x] Search
77- [x] Services
78- [x] Settings
79- [x] Sidekiq Metrics
80- [x] System Hooks
81- [x] Tags
82- [x] Todos
83- [x] Users
84- [x] Validate CI Configuration
85- [x] Version
86- [x] Wikis
87
88## Usage
89
90```go
91import "github.com/xanzy/go-gitlab"
92```
93
94Construct a new GitLab client, then use the various services on the client to
95access different parts of the GitLab API. For example, to list all
96users:
97
98```go
99git := gitlab.NewClient(nil, "yourtokengoeshere")
100//git.SetBaseURL("https://git.mydomain.com/api/v3")
101users, _, err := git.Users.ListUsers()
102```
103
104Some API methods have optional parameters that can be passed. For example,
105to list all projects for user "svanharmelen":
106
107```go
108git := gitlab.NewClient(nil)
109opt := &ListProjectsOptions{Search: gitlab.String("svanharmelen")}
110projects, _, err := git.Projects.ListProjects(opt)
111```
112
113### Examples
114
115The [examples](https://github.com/xanzy/go-gitlab/tree/master/examples) directory
116contains a couple for clear examples, of which one is partially listed here as well:
117
118```go
119package main
120
121import (
122	"log"
123
124	"github.com/xanzy/go-gitlab"
125)
126
127func main() {
128	git := gitlab.NewClient(nil, "yourtokengoeshere")
129
130	// Create new project
131	p := &gitlab.CreateProjectOptions{
132		Name:                 gitlab.String("My Project"),
133		Description:          gitlab.String("Just a test project to play with"),
134		MergeRequestsEnabled: gitlab.Bool(true),
135		SnippetsEnabled:      gitlab.Bool(true),
136		Visibility:           gitlab.Visibility(gitlab.PublicVisibility),
137	}
138	project, _, err := git.Projects.CreateProject(p)
139	if err != nil {
140		log.Fatal(err)
141	}
142
143	// Add a new snippet
144	s := &gitlab.CreateProjectSnippetOptions{
145		Title:           gitlab.String("Dummy Snippet"),
146		FileName:        gitlab.String("snippet.go"),
147		Code:            gitlab.String("package main...."),
148		Visibility:      gitlab.Visibility(gitlab.PublicVisibility),
149	}
150	_, _, err = git.ProjectSnippets.CreateSnippet(project.ID, s)
151	if err != nil {
152		log.Fatal(err)
153	}
154}
155```
156
157For complete usage of go-gitlab, see the full [package docs](https://godoc.org/github.com/xanzy/go-gitlab).
158
159## ToDo
160
161- The biggest thing this package still needs is tests :disappointed:
162
163## Issues
164
165- If you have an issue: report it on the [issue tracker](https://github.com/xanzy/go-gitlab/issues)
166
167## Author
168
169Sander van Harmelen (<sander@xanzy.io>)
170
171## License
172
173Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at <http://www.apache.org/licenses/LICENSE-2.0>
174