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
08995aee
Commit
08995aee
authored
Aug 25, 2017
by
Sander van Harmelen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Small refactor to make things a bit cleaner (#199)
parent
94597a28
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
18 deletions
+17
-18
gitlab.go
gitlab.go
+3
-6
issues.go
issues.go
+7
-6
merge_requests.go
merge_requests.go
+7
-6
No files found.
gitlab.go
View file @
08995aee
...
...
@@ -160,9 +160,6 @@ type Client struct {
// User agent used when communicating with the GitLab API.
UserAgent
string
// timeStats is an internal service used by other services.
timeStats
*
timeStatsService
// Services used for talking to different parts of the GitLab API.
Branches
*
BranchesService
BuildVariables
*
BuildVariablesService
...
...
@@ -231,7 +228,7 @@ func newClient(httpClient *http.Client, tokenType tokenType, token string) *Clie
}
// Create the internal timeStats service.
c
.
timeStats
=
&
timeStatsService
{
client
:
c
}
timeStats
:
=
&
timeStatsService
{
client
:
c
}
// Create all the public services.
c
.
Branches
=
&
BranchesService
{
client
:
c
}
...
...
@@ -240,10 +237,10 @@ func newClient(httpClient *http.Client, tokenType tokenType, token string) *Clie
c
.
DeployKeys
=
&
DeployKeysService
{
client
:
c
}
c
.
Features
=
&
FeaturesService
{
client
:
c
}
c
.
Groups
=
&
GroupsService
{
client
:
c
}
c
.
Issues
=
&
IssuesService
{
client
:
c
}
c
.
Issues
=
&
IssuesService
{
client
:
c
,
timeStats
:
timeStats
}
c
.
Jobs
=
&
JobsService
{
client
:
c
}
c
.
Labels
=
&
LabelsService
{
client
:
c
}
c
.
MergeRequests
=
&
MergeRequestsService
{
client
:
c
}
c
.
MergeRequests
=
&
MergeRequestsService
{
client
:
c
,
timeStats
:
timeStats
}
c
.
Milestones
=
&
MilestonesService
{
client
:
c
}
c
.
Namespaces
=
&
NamespacesService
{
client
:
c
}
c
.
Notes
=
&
NotesService
{
client
:
c
}
...
...
issues.go
View file @
08995aee
...
...
@@ -29,7 +29,8 @@ import (
//
// GitLab API docs: https://docs.gitlab.com/ce/api/issues.html
type
IssuesService
struct
{
client
*
Client
client
*
Client
timeStats
*
timeStatsService
}
// Issue represents a GitLab issue.
...
...
@@ -309,7 +310,7 @@ func (s *IssuesService) DeleteIssue(pid interface{}, issue int, options ...Optio
// GitLab API docs:
// https://docs.gitlab.com/ce/api/issues.html#set-a-time-estimate-for-an-issue
func
(
s
*
IssuesService
)
SetTimeEstimate
(
pid
interface
{},
issue
int
,
opt
*
SetTimeEstimateOptions
,
options
...
OptionFunc
)
(
*
TimeStats
,
*
Response
,
error
)
{
return
s
.
client
.
timeStats
.
setTimeEstimate
(
pid
,
"issues"
,
issue
,
opt
,
options
...
)
return
s
.
timeStats
.
setTimeEstimate
(
pid
,
"issues"
,
issue
,
opt
,
options
...
)
}
// ResetTimeEstimate resets the time estimate for a single project issue.
...
...
@@ -317,7 +318,7 @@ func (s *IssuesService) SetTimeEstimate(pid interface{}, issue int, opt *SetTime
// GitLab API docs:
// https://docs.gitlab.com/ce/api/issues.html#reset-the-time-estimate-for-an-issue
func
(
s
*
IssuesService
)
ResetTimeEstimate
(
pid
interface
{},
issue
int
,
options
...
OptionFunc
)
(
*
TimeStats
,
*
Response
,
error
)
{
return
s
.
client
.
timeStats
.
resetTimeEstimate
(
pid
,
"issues"
,
issue
,
options
...
)
return
s
.
timeStats
.
resetTimeEstimate
(
pid
,
"issues"
,
issue
,
options
...
)
}
// AddSpentTime adds spent time for a single project issue.
...
...
@@ -325,7 +326,7 @@ func (s *IssuesService) ResetTimeEstimate(pid interface{}, issue int, options ..
// GitLab API docs:
// https://docs.gitlab.com/ce/api/issues.html#add-spent-time-for-an-issue
func
(
s
*
IssuesService
)
AddSpentTime
(
pid
interface
{},
issue
int
,
opt
*
AddSpentTimeOptions
,
options
...
OptionFunc
)
(
*
TimeStats
,
*
Response
,
error
)
{
return
s
.
client
.
timeStats
.
addSpentTime
(
pid
,
"issues"
,
issue
,
opt
,
options
...
)
return
s
.
timeStats
.
addSpentTime
(
pid
,
"issues"
,
issue
,
opt
,
options
...
)
}
// ResetSpentTime resets the spent time for a single project issue.
...
...
@@ -333,7 +334,7 @@ func (s *IssuesService) AddSpentTime(pid interface{}, issue int, opt *AddSpentTi
// GitLab API docs:
// https://docs.gitlab.com/ce/api/issues.html#reset-spent-time-for-an-issue
func
(
s
*
IssuesService
)
ResetSpentTime
(
pid
interface
{},
issue
int
,
options
...
OptionFunc
)
(
*
TimeStats
,
*
Response
,
error
)
{
return
s
.
client
.
timeStats
.
resetSpentTime
(
pid
,
"issues"
,
issue
,
options
...
)
return
s
.
timeStats
.
resetSpentTime
(
pid
,
"issues"
,
issue
,
options
...
)
}
// GetTimeSpent gets the spent time for a single project issue.
...
...
@@ -341,5 +342,5 @@ func (s *IssuesService) ResetSpentTime(pid interface{}, issue int, options ...Op
// GitLab API docs:
// https://docs.gitlab.com/ce/api/issues.html#get-time-tracking-stats
func
(
s
*
IssuesService
)
GetTimeSpent
(
pid
interface
{},
issue
int
,
options
...
OptionFunc
)
(
*
TimeStats
,
*
Response
,
error
)
{
return
s
.
client
.
timeStats
.
getTimeSpent
(
pid
,
"issues"
,
issue
,
options
...
)
return
s
.
timeStats
.
getTimeSpent
(
pid
,
"issues"
,
issue
,
options
...
)
}
merge_requests.go
View file @
08995aee
...
...
@@ -28,7 +28,8 @@ import (
// GitLab API docs:
// https://gitlab.com/gitlab-org/gitlab-ce/blob/8-16-stable/doc/api/merge_requests.md
type
MergeRequestsService
struct
{
client
*
Client
client
*
Client
timeStats
*
timeStatsService
}
// MergeRequest represents a GitLab merge request.
...
...
@@ -342,7 +343,7 @@ func (s *MergeRequestsService) AcceptMergeRequest(pid interface{}, mergeRequest
// GitLab API docs:
// https://docs.gitlab.com/ce/api/merge_requests.html#set-a-time-estimate-for-a-merge-request
func
(
s
*
MergeRequestsService
)
SetTimeEstimate
(
pid
interface
{},
mergeRequest
int
,
opt
*
SetTimeEstimateOptions
,
options
...
OptionFunc
)
(
*
TimeStats
,
*
Response
,
error
)
{
return
s
.
client
.
timeStats
.
setTimeEstimate
(
pid
,
"merge_requests"
,
mergeRequest
,
opt
,
options
...
)
return
s
.
timeStats
.
setTimeEstimate
(
pid
,
"merge_requests"
,
mergeRequest
,
opt
,
options
...
)
}
// ResetTimeEstimate resets the time estimate for a single project merge request.
...
...
@@ -350,7 +351,7 @@ func (s *MergeRequestsService) SetTimeEstimate(pid interface{}, mergeRequest int
// GitLab API docs:
// https://docs.gitlab.com/ce/api/merge_requests.html#reset-the-time-estimate-for-a-merge-request
func
(
s
*
MergeRequestsService
)
ResetTimeEstimate
(
pid
interface
{},
mergeRequest
int
,
options
...
OptionFunc
)
(
*
TimeStats
,
*
Response
,
error
)
{
return
s
.
client
.
timeStats
.
resetTimeEstimate
(
pid
,
"merge_requests"
,
mergeRequest
,
options
...
)
return
s
.
timeStats
.
resetTimeEstimate
(
pid
,
"merge_requests"
,
mergeRequest
,
options
...
)
}
// AddSpentTime adds spent time for a single project merge request.
...
...
@@ -358,7 +359,7 @@ func (s *MergeRequestsService) ResetTimeEstimate(pid interface{}, mergeRequest i
// GitLab API docs:
// https://docs.gitlab.com/ce/api/merge_requests.html#add-spent-time-for-a-merge-request
func
(
s
*
MergeRequestsService
)
AddSpentTime
(
pid
interface
{},
mergeRequest
int
,
opt
*
AddSpentTimeOptions
,
options
...
OptionFunc
)
(
*
TimeStats
,
*
Response
,
error
)
{
return
s
.
client
.
timeStats
.
addSpentTime
(
pid
,
"merge_requests"
,
mergeRequest
,
opt
,
options
...
)
return
s
.
timeStats
.
addSpentTime
(
pid
,
"merge_requests"
,
mergeRequest
,
opt
,
options
...
)
}
// ResetSpentTime resets the spent time for a single project merge request.
...
...
@@ -366,7 +367,7 @@ func (s *MergeRequestsService) AddSpentTime(pid interface{}, mergeRequest int, o
// GitLab API docs:
// https://docs.gitlab.com/ce/api/merge_requests.html#reset-spent-time-for-a-merge-request
func
(
s
*
MergeRequestsService
)
ResetSpentTime
(
pid
interface
{},
mergeRequest
int
,
options
...
OptionFunc
)
(
*
TimeStats
,
*
Response
,
error
)
{
return
s
.
client
.
timeStats
.
resetSpentTime
(
pid
,
"merge_requests"
,
mergeRequest
,
options
...
)
return
s
.
timeStats
.
resetSpentTime
(
pid
,
"merge_requests"
,
mergeRequest
,
options
...
)
}
// GetTimeSpent gets the spent time for a single project merge request.
...
...
@@ -374,5 +375,5 @@ func (s *MergeRequestsService) ResetSpentTime(pid interface{}, mergeRequest int,
// GitLab API docs:
// https://docs.gitlab.com/ce/api/merge_requests.html#get-time-tracking-stats
func
(
s
*
MergeRequestsService
)
GetTimeSpent
(
pid
interface
{},
mergeRequest
int
,
options
...
OptionFunc
)
(
*
TimeStats
,
*
Response
,
error
)
{
return
s
.
client
.
timeStats
.
getTimeSpent
(
pid
,
"merge_requests"
,
mergeRequest
,
options
...
)
return
s
.
timeStats
.
getTimeSpent
(
pid
,
"merge_requests"
,
mergeRequest
,
options
...
)
}
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