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
d760a66e
Commit
d760a66e
authored
Feb 20, 2018
by
Sander van Harmelen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tweak naming and ordering (to match the docs order)
Sorry @Lorac I couldn’t resist
😉
parent
f8137824
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
29 deletions
+16
-29
gitlab.go
gitlab.go
+16
-29
No files found.
gitlab.go
View file @
d760a66e
...
...
@@ -38,13 +38,6 @@ const (
libraryVersion
=
"0.2.0"
defaultBaseURL
=
"https://gitlab.com/api/v4/"
userAgent
=
"go-gitlab/"
+
libraryVersion
headerNextPage
=
"X-Next-Page"
headerTotalPages
=
"X-Total-Pages"
headertotalResults
=
"X-Total"
headerCurrentPage
=
"X-Page"
headerPerPage
=
"X-Per-Page"
headerPrevPage
=
"X-Prev-Page"
)
// tokenType represents a token type within GitLab.
...
...
@@ -498,13 +491,12 @@ type Response struct {
// results. Any or all of these may be set to the zero value for
// responses that are not part of a paginated set, or for which there
// are no additional pages.
NextPage
int
PrevPage
int
CurrentPage
int
PerPage
int
TotalItems
int
TotalPages
int
TotalResults
int
ItemsPerPage
int
CurrentPage
int
NextPage
int
PreviousPage
int
}
// newResponse creates a new Response for the provided http.Response.
...
...
@@ -517,28 +509,23 @@ func newResponse(r *http.Response) *Response {
// populatePageValues parses the HTTP Link response headers and populates the
// various pagination link values in the Response.
func
(
r
*
Response
)
populatePageValues
()
{
if
total
Pages
:=
r
.
Response
.
Header
.
Get
(
headerTotalPages
);
totalPage
s
!=
""
{
r
.
Total
Pages
,
_
=
strconv
.
Atoi
(
totalPage
s
)
if
total
Items
:=
r
.
Response
.
Header
.
Get
(
"X-Total"
);
totalItem
s
!=
""
{
r
.
Total
Items
,
_
=
strconv
.
Atoi
(
totalItem
s
)
}
if
totalResults
:=
r
.
Response
.
Header
.
Get
(
headertotalResults
);
totalResults
!=
""
{
r
.
TotalResults
,
_
=
strconv
.
Atoi
(
totalResults
)
if
totalPages
:=
r
.
Response
.
Header
.
Get
(
"X-Total-Pages"
);
totalPages
!=
""
{
r
.
TotalPages
,
_
=
strconv
.
Atoi
(
totalPages
)
}
if
nextPage
:=
r
.
Response
.
Header
.
Get
(
headerNextPage
);
nextPage
!=
""
{
r
.
NextPage
,
_
=
strconv
.
Atoi
(
nextPage
)
if
itemsPerPage
:=
r
.
Response
.
Header
.
Get
(
"X-Per-Page"
);
itemsPerPage
!=
""
{
r
.
ItemsPerPage
,
_
=
strconv
.
Atoi
(
itemsPerPage
)
}
if
currentPage
:=
r
.
Response
.
Header
.
Get
(
headerCurrentPage
);
currentPage
!=
""
{
if
currentPage
:=
r
.
Response
.
Header
.
Get
(
"X-Page"
);
currentPage
!=
""
{
r
.
CurrentPage
,
_
=
strconv
.
Atoi
(
currentPage
)
}
if
perPage
:=
r
.
Response
.
Header
.
Get
(
headerPerPage
);
perPage
!=
""
{
r
.
PerPage
,
_
=
strconv
.
Atoi
(
perPage
)
if
nextPage
:=
r
.
Response
.
Header
.
Get
(
"X-Next-Page"
);
nextPage
!=
""
{
r
.
NextPage
,
_
=
strconv
.
Atoi
(
nextPage
)
}
if
prevPage
:=
r
.
Response
.
Header
.
Get
(
headerPrevPage
);
prevPage
!=
""
{
r
.
PrevPage
,
_
=
strconv
.
Atoi
(
prevPage
)
if
previousPage
:=
r
.
Response
.
Header
.
Get
(
"X-Prev-Page"
);
previousPage
!=
""
{
r
.
PreviousPage
,
_
=
strconv
.
Atoi
(
previousPage
)
}
}
...
...
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