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

..24-Mar-2022-

.gitignoreH A D24-Mar-2022312 2922

.golangci.ymlH A D24-Mar-20221.1 KiB6053

LICENSEH A D24-Mar-202211.1 KiB202169

README.mdH A D24-Mar-20225.4 KiB200167

access_requests.goH A D24-Mar-20227.6 KiB254148

applications.goH A D24-Mar-20223.4 KiB10755

audit_events.goH A D24-Mar-20226 KiB200132

avatar.goH A D24-Mar-20221.9 KiB6526

award_emojis.goH A D24-Mar-202217.1 KiB469266

boards.goH A D24-Mar-20229.9 KiB346216

branches.goH A D24-Mar-20227.3 KiB246144

broadcast_messages.goH A D24-Mar-20225.6 KiB17491

ci_yml_templates.goH A D24-Mar-20222.5 KiB8738

client_options.goH A D24-Mar-20223 KiB10967

commits.goH A D24-Mar-202219.9 KiB595388

container_registry.goH A D24-Mar-20229.9 KiB308187

custom_attributes.goH A D24-Mar-20227.5 KiB18995

deploy_keys.goH A D24-Mar-20226.6 KiB236138

deploy_tokens.goH A D24-Mar-20227.3 KiB239138

deployments.goH A D24-Mar-20226.8 KiB204133

discussions.goH A D24-Mar-202232.8 KiB1,115703

environments.goH A D24-Mar-20226.7 KiB219126

epic_issues.goH A D24-Mar-20224.4 KiB15386

epics.goH A D24-Mar-20229.6 KiB265180

event_parsing.goH A D24-Mar-20227.7 KiB285186

event_systemhook_types.goH A D24-Mar-20224.8 KiB15080

event_webhook_types.goH A D24-Mar-202238.9 KiB983877

events.goH A D24-Mar-20224.8 KiB14994

external_status_checks.goH A D24-Mar-20222.8 KiB9164

feature_flags.goH A D24-Mar-20222.4 KiB9751

freeze_periods.goH A D24-Mar-20226 KiB195108

generic_packages.goH A D24-Mar-20225 KiB159100

geo_nodes.goH A D24-Mar-202225.5 KiB434323

gitignore_templates.goH A D24-Mar-20222.5 KiB8639

gitlab.goH A D24-Mar-202229.1 KiB935671

group_access_tokens.goH A D24-Mar-20224.4 KiB14177

group_badges.goH A D24-Mar-20226.6 KiB231131

group_boards.goH A D24-Mar-202210 KiB353208

group_clusters.goH A D24-Mar-20227.8 KiB218136

group_hooks.goH A D24-Mar-20228.2 KiB207139

group_import_export.goH A D24-Mar-20224.5 KiB181114

group_iterations.goH A D24-Mar-20222.7 KiB9149

group_labels.goH A D24-Mar-20227.5 KiB250144

group_members.goH A D24-Mar-202210.9 KiB348209

group_milestones.goH A D24-Mar-20229.7 KiB297173

group_variables.goH A D24-Mar-20226.4 KiB204116

group_wikis.goH A D24-Mar-20225.8 KiB195111

groups.goH A D24-Mar-202234.5 KiB849569

instance_clusters.goH A D24-Mar-20224.5 KiB15486

instance_variables.goH A D24-Mar-20225.8 KiB18193

invites.goH A D24-Mar-20225.4 KiB176100

issue_links.goH A D24-Mar-20223.7 KiB13172

issues.goH A D24-Mar-202229.2 KiB746512

issues_statistics.goH A D24-Mar-20228 KiB188119

jobs.goH A D24-Mar-202214.7 KiB512339

keys.goH A D24-Mar-20221.7 KiB6729

labels.goH A D24-Mar-20229.2 KiB310200

license.goH A D24-Mar-20223.3 KiB11363

license_templates.goH A D24-Mar-20223.4 KiB11054

markdown.goH A D24-Mar-20221.3 KiB4825

merge_request_approvals.goH A D24-Mar-202215.9 KiB420260

merge_requests.goH A D24-Mar-202239.5 KiB939620

milestones.goH A D24-Mar-20228.5 KiB272163

namespaces.goH A D24-Mar-20225.3 KiB176103

notes.goH A D24-Mar-202220.2 KiB694438

notifications.goH A D24-Mar-20228.3 KiB231145

packages.goH A D24-Mar-20226.8 KiB227137

pages.goH A D24-Mar-20221.2 KiB4620

pages_domains.goH A D24-Mar-20226.5 KiB214126

pipeline_schedules.goH A D24-Mar-202211.1 KiB348212

pipeline_triggers.goH A D24-Mar-20227.5 KiB249145

pipelines.goH A D24-Mar-202211.9 KiB366253

plan_limits.goH A D24-Mar-20224.1 KiB10553

project_access_tokens.goH A D24-Mar-20224.5 KiB14177

project_badges.goH A D24-Mar-20227 KiB231132

project_clusters.goH A D24-Mar-20228.6 KiB237151

project_import_export.goH A D24-Mar-20226.6 KiB223139

project_iterations.goH A D24-Mar-20222.8 KiB9149

project_managed_licenses.goH A D24-Mar-20225.6 KiB189112

project_members.goH A D24-Mar-20227.3 KiB236135

project_mirror.goH A D24-Mar-20225 KiB14984

project_snippets.goH A D24-Mar-20226.5 KiB209122

project_variables.goH A D24-Mar-20227.4 KiB227126

projects.goH A D24-Mar-202289.7 KiB1,9371,384

protected_branches.goH A D24-Mar-20228.3 KiB218120

protected_environments.goH A D24-Mar-20226.1 KiB17791

protected_tags.goH A D24-Mar-20224.9 KiB16384

releaselinks.goH A D24-Mar-20226 KiB200124

releases.goH A D24-Mar-20227.2 KiB238144

repositories.goH A D24-Mar-20229.3 KiB333201

repository_files.goH A D24-Mar-202211.6 KiB379246

repository_submodules.goH A D24-Mar-20223.1 KiB9453

request_options.goH A D24-Mar-20221.7 KiB6235

resource_label_events.goH A D24-Mar-20226.6 KiB221136

resource_state_events.goH A D24-Mar-20224.6 KiB15588

runners.goH A D24-Mar-202215.5 KiB485293

search.goH A D24-Mar-202213.5 KiB359190

services.goH A D24-Mar-202253.5 KiB1,518939

settings.goH A D24-Mar-202241 KiB415368

sidekiq_metrics.goH A D24-Mar-20224.6 KiB15886

snippets.goH A D24-Mar-20227.4 KiB246139

strings.goH A D24-Mar-20222 KiB9561

system_hooks.goH A D24-Mar-20225.3 KiB177100

tags.goH A D24-Mar-20227.3 KiB248139

time_stats.goH A D24-Mar-20225.2 KiB180108

todos.goH A D24-Mar-20226.2 KiB163104

topics.goH A D24-Mar-20224.8 KiB16888

types.goH A D24-Mar-202223.4 KiB815491

users.goH A D24-Mar-202242.7 KiB1,329851

validate.goH A D24-Mar-20224.1 KiB14277

version.goH A D24-Mar-20221.6 KiB5924

wikis.goH A D24-Mar-20225.5 KiB195111

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://github.com/xanzy/go-gitlab/workflows/Lint%20and%20Test/badge.svg)](https://github.com/xanzy/go-gitlab/actions?workflow=Lint%20and%20Test)
6[![Sourcegraph](https://sourcegraph.com/github.com/xanzy/go-gitlab/-/badge.svg)](https://sourcegraph.com/github.com/xanzy/go-gitlab?badge)
7[![GoDoc](https://godoc.org/github.com/xanzy/go-gitlab?status.svg)](https://godoc.org/github.com/xanzy/go-gitlab)
8[![Go Report Card](https://goreportcard.com/badge/github.com/xanzy/go-gitlab)](https://goreportcard.com/report/github.com/xanzy/go-gitlab)
9
10## NOTE
11
12Release v0.6.0 (released on 25-08-2017) no longer supports the older V3 GitLab API. If
13you need V3 support, please use the `f-api-v3` branch. This release contains some backwards
14incompatible changes that were needed to fully support the V4 GitLab API.
15
16## Coverage
17
18This API client package covers most of the existing GitLab API calls and is updated regularly
19to add new and/or missing endpoints. Currently, the following services are supported:
20
21- [x] Applications
22- [x] Award Emojis
23- [x] Branches
24- [x] Broadcast Messages
25- [x] Commits
26- [x] Container Registry
27- [x] Custom Attributes
28- [x] Deploy Keys
29- [x] Deployments
30- [ ] Discussions (threaded comments)
31- [x] Environments
32- [ ] Epic Issues
33- [ ] Epics
34- [x] Events
35- [x] Feature Flags
36- [ ] Geo Nodes
37- [x] Generic Packages
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 Wikis
45- [x] Group-Level Variables
46- [x] Groups
47- [x] Instance Clusters
48- [x] Invites
49- [x] Issue Boards
50- [x] Issues
51- [x] Jobs
52- [x] Keys
53- [x] Labels
54- [x] License
55- [x] Markdown
56- [x] Merge Request Approvals
57- [x] Merge Requests
58- [x] Namespaces
59- [x] Notes (comments)
60- [x] Notification Settings
61- [x] Open Source License Templates
62- [x] Packages
63- [x] Pages
64- [x] Pages Domains
65- [x] Personal Access Tokens
66- [x] Pipeline Schedules
67- [x] Pipeline Triggers
68- [x] Pipelines
69- [x] Plan limits
70- [x] Project Access Requests
71- [x] Project Badges
72- [x] Project Clusters
73- [x] Project Import/export
74- [x] Project Members
75- [x] Project Milestones
76- [x] Project Snippets
77- [x] Project-Level Variables
78- [x] Projects (including setting Webhooks)
79- [x] Protected Branches
80- [x] Protected Environments
81- [x] Protected Tags
82- [x] Repositories
83- [x] Repository Files
84- [x] Repository Submodules
85- [x] Runners
86- [x] Search
87- [x] Services
88- [x] Settings
89- [x] Sidekiq Metrics
90- [x] System Hooks
91- [x] Tags
92- [x] Todos
93- [x] Users
94- [x] Validate CI Configuration
95- [x] Version
96- [x] Wikis
97
98## Usage
99
100```go
101import "github.com/xanzy/go-gitlab"
102```
103
104Construct a new GitLab client, then use the various services on the client to
105access different parts of the GitLab API. For example, to list all
106users:
107
108```go
109git, err := gitlab.NewClient("yourtokengoeshere")
110if err != nil {
111  log.Fatalf("Failed to create client: %v", err)
112}
113users, _, err := git.Users.ListUsers(&gitlab.ListUsersOptions{})
114```
115
116There are a few `With...` option functions that can be used to customize
117the API client. For example, to set a custom base URL:
118
119```go
120git, err := gitlab.NewClient("yourtokengoeshere", gitlab.WithBaseURL("https://git.mydomain.com/api/v4"))
121if err != nil {
122  log.Fatalf("Failed to create client: %v", err)
123}
124users, _, err := git.Users.ListUsers(&gitlab.ListUsersOptions{})
125```
126
127Some API methods have optional parameters that can be passed. For example,
128to list all projects for user "svanharmelen":
129
130```go
131git := gitlab.NewClient("yourtokengoeshere")
132opt := &ListProjectsOptions{Search: gitlab.String("svanharmelen")}
133projects, _, err := git.Projects.ListProjects(opt)
134```
135
136### Examples
137
138The [examples](https://github.com/xanzy/go-gitlab/tree/master/examples) directory
139contains a couple for clear examples, of which one is partially listed here as well:
140
141```go
142package main
143
144import (
145	"log"
146
147	"github.com/xanzy/go-gitlab"
148)
149
150func main() {
151	git, err := gitlab.NewClient("yourtokengoeshere")
152	if err != nil {
153		log.Fatalf("Failed to create client: %v", err)
154	}
155
156	// Create new project
157	p := &gitlab.CreateProjectOptions{
158		Name:                 gitlab.String("My Project"),
159		Description:          gitlab.String("Just a test project to play with"),
160		MergeRequestsEnabled: gitlab.Bool(true),
161		SnippetsEnabled:      gitlab.Bool(true),
162		Visibility:           gitlab.Visibility(gitlab.PublicVisibility),
163	}
164	project, _, err := git.Projects.CreateProject(p)
165	if err != nil {
166		log.Fatal(err)
167	}
168
169	// Add a new snippet
170	s := &gitlab.CreateProjectSnippetOptions{
171		Title:           gitlab.String("Dummy Snippet"),
172		FileName:        gitlab.String("snippet.go"),
173		Content:         gitlab.String("package main...."),
174		Visibility:      gitlab.Visibility(gitlab.PublicVisibility),
175	}
176	_, _, err = git.ProjectSnippets.CreateSnippet(project.ID, s)
177	if err != nil {
178		log.Fatal(err)
179	}
180}
181```
182
183For complete usage of go-gitlab, see the full [package docs](https://godoc.org/github.com/xanzy/go-gitlab).
184
185## ToDo
186
187- The biggest thing this package still needs is tests :disappointed:
188
189## Issues
190
191- If you have an issue: report it on the [issue tracker](https://github.com/xanzy/go-gitlab/issues)
192
193## Author
194
195Sander van Harmelen (<sander@vanharmelen.nl>)
196
197## License
198
199Licensed 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>
200