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
a3507a0c
Commit
a3507a0c
authored
Nov 03, 2015
by
Martin Sefcik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added pagination parameters for all API calls where it is supported
parent
4b8992ab
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
112 additions
and
26 deletions
+112
-26
commits.go
commits.go
+1
-0
projects.go
examples/projects.go
+1
-1
groups.go
groups.go
+10
-2
merge_requests.go
merge_requests.go
+12
-2
milestones.go
milestones.go
+12
-2
namespaces.go
namespaces.go
+10
-2
notes.go
notes.go
+13
-2
project_snippets.go
project_snippets.go
+16
-7
projects.go
projects.go
+26
-6
users.go
users.go
+11
-2
No files found.
commits.go
View file @
a3507a0c
...
...
@@ -54,6 +54,7 @@ func (c Commit) String() string {
//
// GitLab API docs: http://doc.gitlab.com/ce/api/commits.html#list-commits
type
ListCommitsOptions
struct
{
ListOptions
RefName
string
`url:"ref_name,omitempty"`
}
...
...
examples/projects.go
View file @
a3507a0c
...
...
@@ -35,7 +35,7 @@ func projectExample() {
}
// List all project snippets
snippets
,
_
,
err
:=
git
.
ProjectSnippets
.
ListSnipp
i
ts
(
project
.
PathWithNamespace
)
snippets
,
_
,
err
:=
git
.
ProjectSnippets
.
ListSnipp
e
ts
(
project
.
PathWithNamespace
)
if
err
!=
nil
{
log
.
Fatal
(
err
)
}
...
...
groups.go
View file @
a3507a0c
...
...
@@ -40,12 +40,20 @@ type Group struct {
Projects
*
[]
Project
`json:"projects,omitempty"`
}
// ListGroupsOptions represents the available ListGroups() options.
//
// GitLab API docs: http://doc.gitlab.com/ce/api/groups.html#list-project-groups
type
ListGroupsOptions
struct
{
ListOptions
Search
string
`url:"search,omitempty"`
}
// ListGroups gets a list of groups. (As user: my groups, as admin: all groups)
//
// GitLab API docs:
// http://doc.gitlab.com/ce/api/groups.html#list-project-groups
func
(
s
*
GroupsService
)
ListGroups
()
([]
*
Group
,
*
Response
,
error
)
{
req
,
err
:=
s
.
client
.
NewRequest
(
"GET"
,
"groups"
,
nil
)
func
(
s
*
GroupsService
)
ListGroups
(
opt
*
ListGroupsOptions
)
([]
*
Group
,
*
Response
,
error
)
{
req
,
err
:=
s
.
client
.
NewRequest
(
"GET"
,
"groups"
,
opt
)
if
err
!=
nil
{
return
nil
,
nil
,
err
}
...
...
merge_requests.go
View file @
a3507a0c
...
...
@@ -320,6 +320,15 @@ func (m MergeRequestComment) String() string {
return
Stringify
(
m
)
}
// GetMergeRequestCommentsOptions represents the available GetMergeRequestComments()
// options.
//
// GitLab API docs:
// http://doc.gitlab.com/ce/api/merge_requests.html#get-the-comments-on-a-mr
type
GetMergeRequestCommentsOptions
struct
{
ListOptions
}
// GetMergeRequestComments gets all the comments associated with a merge
// request.
//
...
...
@@ -327,14 +336,15 @@ func (m MergeRequestComment) String() string {
// http://doc.gitlab.com/ce/api/merge_requests.html#get-the-comments-on-a-mr
func
(
s
*
MergeRequestsService
)
GetMergeRequestComments
(
pid
interface
{},
mergeRequest
int
)
([]
*
MergeRequestComment
,
*
Response
,
error
)
{
mergeRequest
int
,
opt
*
GetMergeRequestCommentsOptions
)
([]
*
MergeRequestComment
,
*
Response
,
error
)
{
project
,
err
:=
parseID
(
pid
)
if
err
!=
nil
{
return
nil
,
nil
,
err
}
u
:=
fmt
.
Sprintf
(
"projects/%s/merge_request/%d/comments"
,
url
.
QueryEscape
(
project
),
mergeRequest
)
req
,
err
:=
s
.
client
.
NewRequest
(
"GET"
,
u
,
nil
)
req
,
err
:=
s
.
client
.
NewRequest
(
"GET"
,
u
,
opt
)
if
err
!=
nil
{
return
nil
,
nil
,
err
}
...
...
milestones.go
View file @
a3507a0c
...
...
@@ -54,6 +54,7 @@ func (m Milestone) String() string {
// GitLab API docs:
// http://doc.gitlab.com/ce/api/milestones.html#list-project-milestones
type
ListMilestonesOptions
struct
{
ListOptions
IID
int
`url:"iid,omitempty"`
}
...
...
@@ -187,20 +188,29 @@ func (s *MilestonesService) UpdateMilestone(
return
m
,
resp
,
err
}
// GetMilestoneIssuesOptions represents the available GetMilestoneIssues() options.
//
// GitLab API docs:
// http://doc.gitlab.com/ce/api/milestones.html#get-all-issues-assigned-to-a-single-milestone
type
GetMilestoneIssuesOptions
struct
{
ListOptions
}
// GetMilestoneIssues gets all issues assigned to a single project milestone.
//
// GitLab API docs:
// http://doc.gitlab.com/ce/api/milestones.html#get-all-issues-assigned-to-a-single-milestone
func
(
s
*
MilestonesService
)
GetMilestoneIssues
(
pid
interface
{},
milestone
int
)
([]
*
Issue
,
*
Response
,
error
)
{
milestone
int
,
opt
*
GetMilestoneIssuesOptions
)
([]
*
Issue
,
*
Response
,
error
)
{
project
,
err
:=
parseID
(
pid
)
if
err
!=
nil
{
return
nil
,
nil
,
err
}
u
:=
fmt
.
Sprintf
(
"projects/%s/milestones/%d/issues"
,
url
.
QueryEscape
(
project
),
milestone
)
req
,
err
:=
s
.
client
.
NewRequest
(
"GET"
,
u
,
nil
)
req
,
err
:=
s
.
client
.
NewRequest
(
"GET"
,
u
,
opt
)
if
err
!=
nil
{
return
nil
,
nil
,
err
}
...
...
namespaces.go
View file @
a3507a0c
...
...
@@ -37,11 +37,19 @@ func (n Namespace) String() string {
return
Stringify
(
n
)
}
// ListNamespacesOptions represents the available ListNamespaces() options.
//
// GitLab API docs: http://doc.gitlab.com/ce/api/namespaces.html#list-namespaces
type
ListNamespacesOptions
struct
{
ListOptions
Search
string
`url:"search,omitempty"`
}
// ListNamespaces gets a list of projects accessible by the authenticated user.
//
// GitLab API docs: http://doc.gitlab.com/ce/api/namespaces.html#list-namespaces
func
(
s
*
NamespacesService
)
ListNamespaces
()
([]
*
Namespace
,
*
Response
,
error
)
{
req
,
err
:=
s
.
client
.
NewRequest
(
"GET"
,
"namespaces"
,
nil
)
func
(
s
*
NamespacesService
)
ListNamespaces
(
opt
*
ListNamespacesOptions
)
([]
*
Namespace
,
*
Response
,
error
)
{
req
,
err
:=
s
.
client
.
NewRequest
(
"GET"
,
"namespaces"
,
opt
)
if
err
!=
nil
{
return
nil
,
nil
,
err
}
...
...
notes.go
View file @
a3507a0c
...
...
@@ -56,18 +56,29 @@ func (n Note) String() string {
return
Stringify
(
n
)
}
// ListIssueNotesOptions represents the available ListIssueNotes() options.
//
// GitLab API docs:
// http://doc.gitlab.com/ce/api/notes.html#list-project-issue-notes
type
ListIssueNotesOptions
struct
{
ListOptions
}
// ListIssueNotes gets a list of all notes for a single issue.
//
// GitLab API docs:
// http://doc.gitlab.com/ce/api/notes.html#list-project-issue-notes
func
(
s
*
NotesService
)
ListIssueNotes
(
pid
interface
{},
issue
int
)
([]
*
Note
,
*
Response
,
error
)
{
func
(
s
*
NotesService
)
ListIssueNotes
(
pid
interface
{},
issue
int
,
opt
*
ListIssueNotesOptions
)
([]
*
Note
,
*
Response
,
error
)
{
project
,
err
:=
parseID
(
pid
)
if
err
!=
nil
{
return
nil
,
nil
,
err
}
u
:=
fmt
.
Sprintf
(
"projects/%s/issues/%d/notes"
,
url
.
QueryEscape
(
project
),
issue
)
req
,
err
:=
s
.
client
.
NewRequest
(
"GET"
,
u
,
nil
)
req
,
err
:=
s
.
client
.
NewRequest
(
"GET"
,
u
,
opt
)
if
err
!=
nil
{
return
nil
,
nil
,
err
}
...
...
project_snippets.go
View file @
a3507a0c
...
...
@@ -55,17 +55,26 @@ func (s Snippet) String() string {
return
Stringify
(
s
)
}
// ListSnipp
its gets a list of project snippet
s.
// ListSnipp
etsOptions represents the available ListSnippets() option
s.
//
// GitLab API docs: http://doc.gitlab.com/ce/api/project_snippets.html#list-snippets
func
(
s
*
ProjectSnippetsService
)
ListSnippits
(
pid
interface
{})
([]
*
Snippet
,
*
Response
,
error
)
{
type
ListSnippetsOptions
struct
{
ListOptions
}
// ListSnippets gets a list of project snippets.
//
// GitLab API docs: http://doc.gitlab.com/ce/api/project_snippets.html#list-snippets
func
(
s
*
ProjectSnippetsService
)
ListSnippets
(
pid
interface
{},
opt
*
ListSnippetsOptions
)
([]
*
Snippet
,
*
Response
,
error
)
{
project
,
err
:=
parseID
(
pid
)
if
err
!=
nil
{
return
nil
,
nil
,
err
}
u
:=
fmt
.
Sprintf
(
"projects/%s/snippets"
,
url
.
QueryEscape
(
project
))
req
,
err
:=
s
.
client
.
NewRequest
(
"GET"
,
u
,
nil
)
req
,
err
:=
s
.
client
.
NewRequest
(
"GET"
,
u
,
opt
)
if
err
!=
nil
{
return
nil
,
nil
,
err
}
...
...
@@ -79,11 +88,11 @@ func (s *ProjectSnippetsService) ListSnippits(pid interface{}) ([]*Snippet, *Res
return
ps
,
resp
,
err
}
// GetSnipp
i
t gets a single project snippet
// GetSnipp
e
t gets a single project snippet
//
// GitLab API docs:
// http://doc.gitlab.com/ce/api/project_snippets.html#single-snippet
func
(
s
*
ProjectSnippetsService
)
GetSnipp
i
t
(
func
(
s
*
ProjectSnippetsService
)
GetSnipp
e
t
(
pid
interface
{},
snippet
int
)
(
*
Snippet
,
*
Response
,
error
)
{
project
,
err
:=
parseID
(
pid
)
...
...
@@ -211,11 +220,11 @@ func (s *ProjectSnippetsService) DeleteSnippet(pid interface{}, snippet int) (*R
return
resp
,
err
}
// Snipp
i
tContent returns the raw project snippet as plain text.
// Snipp
e
tContent returns the raw project snippet as plain text.
//
// GitLab API docs:
// http://doc.gitlab.com/ce/api/project_snippets.html#snippet-content
func
(
s
*
ProjectSnippetsService
)
Snipp
i
tContent
(
func
(
s
*
ProjectSnippetsService
)
Snipp
e
tContent
(
pid
interface
{},
snippet
int
)
([]
byte
,
*
Response
,
error
)
{
project
,
err
:=
parseID
(
pid
)
...
...
projects.go
View file @
a3507a0c
...
...
@@ -76,6 +76,7 @@ func (s Project) String() string {
//
// GitLab API docs: http://doc.gitlab.com/ce/api/projects.html#list-projects
type
ListProjectsOptions
struct
{
ListOptions
Archived
bool
`url:"archived,omitempty"`
OrderBy
string
`url:"order_by,omitempty"`
Sort
string
`url:"sort,omitempty"`
...
...
@@ -172,8 +173,7 @@ func (s *ProjectsService) GetProject(pid interface{}) (*Project, *Response, erro
// GitLab API docs:
// http://doc.gitlab.com/ce/api/projects.html#search-for-projects-by-name
type
SearchProjectsOptions
struct
{
PerPage
int
`url:"per_page,omitempty"`
Page
int
`url:"page,omitempty"`
ListOptions
OrderBy
string
`url:"order_by,omitempty"`
Sort
string
`url:"sort,omitempty"`
}
...
...
@@ -245,19 +245,29 @@ func (s ProjectEvent) String() string {
return
Stringify
(
s
)
}
// GetProjectEventsOptions represents the available GetProjectEvents() options.
//
// GitLab API docs:
// http://doc.gitlab.com/ce/api/projects.html#get-project-events
type
GetProjectEventsOptions
struct
{
ListOptions
}
// GetProjectEvents gets the events for the specified project. Sorted from
// newest to latest.
//
// GitLab API docs:
// http://doc.gitlab.com/ce/api/projects.html#get-project-events
func
(
s
*
ProjectsService
)
GetProjectEvents
(
pid
interface
{})
([]
*
ProjectEvent
,
*
Response
,
error
)
{
func
(
s
*
ProjectsService
)
GetProjectEvents
(
pid
interface
{},
opt
*
GetProjectEventsOptions
)
([]
*
ProjectEvent
,
*
Response
,
error
)
{
project
,
err
:=
parseID
(
pid
)
if
err
!=
nil
{
return
nil
,
nil
,
err
}
u
:=
fmt
.
Sprintf
(
"projects/%s/events"
,
url
.
QueryEscape
(
project
))
req
,
err
:=
s
.
client
.
NewRequest
(
"GET"
,
u
,
nil
)
req
,
err
:=
s
.
client
.
NewRequest
(
"GET"
,
u
,
opt
)
if
err
!=
nil
{
return
nil
,
nil
,
err
}
...
...
@@ -460,6 +470,7 @@ type ProjectMember struct {
// GitLab API docs:
// http://doc.gitlab.com/ce/api/projects.html#list-project-team-members
type
ListProjectMembersOptions
struct
{
ListOptions
Query
string
`url:"query,omitempty"`
}
...
...
@@ -630,18 +641,27 @@ type ProjectHook struct {
CreatedAt
time
.
Time
`json:"created_at"`
}
// ListProjectHooksOptions represents the available ListProjectHooks() options.
//
// GitLab API docs: http://doc.gitlab.com/ce/api/projects.html#list-project-hooks
type
ListProjectHooksOptions
struct
{
ListOptions
}
// ListProjectHooks gets a list of project hooks.
//
// GitLab API docs:
// http://doc.gitlab.com/ce/api/projects.html#list-project-hooks
func
(
s
*
ProjectsService
)
ListProjectHooks
(
pid
interface
{})
([]
*
ProjectHook
,
*
Response
,
error
)
{
func
(
s
*
ProjectsService
)
ListProjectHooks
(
pid
interface
{},
opt
*
ListProjectHooksOptions
)
([]
*
ProjectHook
,
*
Response
,
error
)
{
project
,
err
:=
parseID
(
pid
)
if
err
!=
nil
{
return
nil
,
nil
,
err
}
u
:=
fmt
.
Sprintf
(
"projects/%s/hooks"
,
url
.
QueryEscape
(
project
))
req
,
err
:=
s
.
client
.
NewRequest
(
"GET"
,
u
,
nil
)
req
,
err
:=
s
.
client
.
NewRequest
(
"GET"
,
u
,
opt
)
if
err
!=
nil
{
return
nil
,
nil
,
err
}
...
...
users.go
View file @
a3507a0c
...
...
@@ -57,11 +57,20 @@ type User struct {
TwoFactorEnabled
bool
`json:"two_factor_enabled"`
}
// ListUsersOptions represents the available ListUsers() options.
//
// GitLab API docs: http://doc.gitlab.com/ce/api/users.html#list-users
type
ListUsersOptions
struct
{
ListOptions
Active
bool
`url:"active,omitempty"`
Search
string
`url:"search,omitempty"`
}
// ListUsers gets a list of users.
//
// GitLab API docs: http://doc.gitlab.com/ce/api/users.html#list-users
func
(
s
*
UsersService
)
ListUsers
()
([]
*
User
,
*
Response
,
error
)
{
req
,
err
:=
s
.
client
.
NewRequest
(
"GET"
,
"users"
,
nil
)
func
(
s
*
UsersService
)
ListUsers
(
opt
*
ListUsersOptions
)
([]
*
User
,
*
Response
,
error
)
{
req
,
err
:=
s
.
client
.
NewRequest
(
"GET"
,
"users"
,
opt
)
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