Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
go-gitlab
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
go-gitlab
Commits
ad922c4d
Commit
ad922c4d
authored
Feb 20, 2018
by
Maxime Roussin-Bélanger
Committed by
Sander van Harmelen
Feb 20, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add missing ListOptions to ListLabels (#337)
Fixes : #336
parent
79bdeb00
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
3 deletions
+8
-3
labels.go
examples/labels.go
+1
-1
labels.go
labels.go
+7
-2
No files found.
examples/labels.go
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
)
}
...
...
labels.go
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
,
opt
ions
...
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
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment