Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
佳 邓
Gitlab4j Api
Commits
24b111cf
Commit
24b111cf
authored
Feb 28, 2020
by
Greg Messner
Browse files
Changed methods to call Pager method directly.
parent
c405df19
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/gitlab4j/api/RepositoryApi.java
View file @
24b111cf
...
@@ -42,7 +42,7 @@ public class RepositoryApi extends AbstractApi {
...
@@ -42,7 +42,7 @@ public class RepositoryApi extends AbstractApi {
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
List
<
Branch
>
getBranches
(
Object
projectIdOrPath
)
throws
GitLabApiException
{
public
List
<
Branch
>
getBranches
(
Object
projectIdOrPath
)
throws
GitLabApiException
{
return
getBranches
(
projectIdOrPath
,
null
);
return
getBranches
(
projectIdOrPath
,
null
,
getDefaultPerPage
()).
all
(
);
}
}
/**
/**
...
@@ -87,7 +87,7 @@ public class RepositoryApi extends AbstractApi {
...
@@ -87,7 +87,7 @@ public class RepositoryApi extends AbstractApi {
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
Stream
<
Branch
>
getBranchesStream
(
Object
projectIdOrPath
)
throws
GitLabApiException
{
public
Stream
<
Branch
>
getBranchesStream
(
Object
projectIdOrPath
)
throws
GitLabApiException
{
return
getBranches
Stream
(
projectIdOrPath
,
null
);
return
getBranches
(
projectIdOrPath
,
null
,
getDefaultPerPage
()).
stream
(
);
}
}
/**
/**
...
@@ -121,38 +121,38 @@ public class RepositoryApi extends AbstractApi {
...
@@ -121,38 +121,38 @@ public class RepositoryApi extends AbstractApi {
}
}
/**
/**
* Get a
Stream
of repository branches from a project, sorted by name alphabetically, filter by the search term.
* Get a
Pager
of repository branches from a project, sorted by name alphabetically, filter by the search term.
*
*
* <pre><code>GitLab Endpoint: GET /projects/:id/repository/branches?search=:search</code></pre>
* <pre><code>GitLab Endpoint: GET /projects/:id/repository/branches?search=:search</code></pre>
*
*
* @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param search the branch name search term
* @param search the branch name search term
* @return the Stream of repository branches for the specified project ID and search term
* @param itemsPerPage the number of Project instances that will be fetched per page
* @return the list of repository branches for the specified project ID and search term
*
*
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
Stream
<
Branch
>
getBranchesStream
(
Object
projectIdOrPath
,
String
search
)
throws
GitLabApiException
{
public
Pager
<
Branch
>
getBranches
(
Object
projectIdOrPath
,
String
search
,
int
itemsPerPage
)
throws
GitLabApiException
{
return
(
getBranches
(
projectIdOrPath
,
search
,
getDefaultPerPage
()).
stream
());
MultivaluedMap
<
String
,
String
>
queryParams
=
(
search
==
null
?
null
:
new
GitLabApiForm
().
withParam
(
"search"
,
urlEncode
(
search
)).
asMap
()
);
return
(
new
Pager
<
Branch
>(
this
,
Branch
.
class
,
itemsPerPage
,
queryParams
,
"projects"
,
getProjectIdOrPath
(
projectIdOrPath
),
"repository"
,
"branches"
));
}
}
/**
/**
* Get a
Pager
of repository branches from a project, sorted by name alphabetically, filter by the search term.
* Get a
Stream
of repository branches from a project, sorted by name alphabetically, filter by the search term.
*
*
* <pre><code>GitLab Endpoint: GET /projects/:id/repository/branches?search=:search</code></pre>
* <pre><code>GitLab Endpoint: GET /projects/:id/repository/branches?search=:search</code></pre>
*
*
* @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param search the branch name search term
* @param search the branch name search term
* @param itemsPerPage the number of Project instances that will be fetched per page
* @return the Stream of repository branches for the specified project ID and search term
* @return the list of repository branches for the specified project ID and search term
*
*
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
Pager
<
Branch
>
getBranches
(
Object
projectIdOrPath
,
String
search
,
int
itemsPerPage
)
throws
GitLabApiException
{
public
Stream
<
Branch
>
getBranchesStream
(
Object
projectIdOrPath
,
String
search
)
throws
GitLabApiException
{
MultivaluedMap
<
String
,
String
>
queryParams
=
(
search
==
null
?
null
:
return
(
getBranches
(
projectIdOrPath
,
search
,
getDefaultPerPage
()).
stream
());
new
GitLabApiForm
().
withParam
(
"search"
,
urlEncode
(
search
)).
asMap
()
);
return
(
new
Pager
<
Branch
>(
this
,
Branch
.
class
,
itemsPerPage
,
queryParams
,
"projects"
,
getProjectIdOrPath
(
projectIdOrPath
),
"repository"
,
"branches"
));
}
}
/**
/**
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment