Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
golang-gitlab-gitlab-org-api-client-go
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Debian Go Packaging Team
packages
golang-gitlab-gitlab-org-api-client-go
Commits
ad922c4d
Commit
ad922c4d
authored
7 years ago
by
Maxime Roussin-Bélanger
Committed by
Sander van Harmelen
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add missing ListOptions to ListLabels (#337)
Fixes : #336
parent
79bdeb00
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
examples/labels.go
+1
-1
1 addition, 1 deletion
examples/labels.go
labels.go
+7
-2
7 additions, 2 deletions
labels.go
with
8 additions
and
3 deletions
examples/labels.go
+
1
−
1
View file @
ad922c4d
...
...
@@ -21,7 +21,7 @@ func labelExample() {
log
.
Printf
(
"Created label: %s
\n
With color: %s
\n
"
,
label
.
Name
,
label
.
Color
)
// List all labels
labels
,
_
,
err
:=
git
.
Labels
.
ListLabels
(
"myname/myproject"
)
labels
,
_
,
err
:=
git
.
Labels
.
ListLabels
(
"myname/myproject"
,
nil
)
if
err
!=
nil
{
log
.
Fatal
(
err
)
}
...
...
This diff is collapsed.
Click to expand it.
labels.go
+
7
−
2
View file @
ad922c4d
...
...
@@ -48,17 +48,22 @@ func (l Label) String() string {
return
Stringify
(
l
)
}
// ListLabelsOptions represents the available ListLabels() options.
//
// GitLab API docs: https://docs.gitlab.com/ce/api/labels.html#list-labels
type
ListLabelsOptions
ListOptions
// ListLabels gets all labels for given project.
//
// GitLab API docs: https://docs.gitlab.com/ce/api/labels.html#list-labels
func
(
s
*
LabelsService
)
ListLabels
(
pid
interface
{},
options
...
OptionFunc
)
([]
*
Label
,
*
Response
,
error
)
{
func
(
s
*
LabelsService
)
ListLabels
(
pid
interface
{},
opt
*
ListLabelsOptions
,
options
...
OptionFunc
)
([]
*
Label
,
*
Response
,
error
)
{
project
,
err
:=
parseID
(
pid
)
if
err
!=
nil
{
return
nil
,
nil
,
err
}
u
:=
fmt
.
Sprintf
(
"projects/%s/labels"
,
url
.
QueryEscape
(
project
))
req
,
err
:=
s
.
client
.
NewRequest
(
"GET"
,
u
,
nil
,
options
)
req
,
err
:=
s
.
client
.
NewRequest
(
"GET"
,
u
,
opt
,
options
)
if
err
!=
nil
{
return
nil
,
nil
,
err
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment