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
9cac3b04
Commit
9cac3b04
authored
Aug 13, 2017
by
Greg Messner
Committed by
GitHub
Aug 13, 2017
Browse files
Added links to sub APIs.
parent
83184f99
Changes
1
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
9cac3b04
...
@@ -77,27 +77,26 @@ The API has been broken up into sub APIs classes to make it easier to learn and
...
@@ -77,27 +77,26 @@ The API has been broken up into sub APIs classes to make it easier to learn and
Available Sub APIs
Available Sub APIs
------------------
------------------
```
[
CommitsApi
](
#commitsapi
)
<br/>
CommitsApi
[
EventsApi
](
#eventsapi
)
<br/>
EventsApi
[
GroupApi
](
#groupapi
)
<br/>
GroupApi
[
JobApi
](
#jobapi
)
<br/>
JobApi
[
MergeRequestApi
](
#mergerequestapi
)
<br/>
MergeRequestApi
[
NamespaceApi
](
#namespaceapi
)
<br/>
NamespaceApi
[
NotesApi
](
#notesapi
)
<br/>
NotesApi
[
PipelineApi
](
#pipelineapi
)
<br/>
PipelineApi
[
ProjectApi
](
#projectapi
)
<br/>
ProjectApi
[
RepositoryApi
](
#repositoryapi
)
<br/>
RepositoryApi
[
RepositoryFileApi
](
#repositoryfileapi
)
<br/>
RepositoryFileApi
[
ServicesApi
](
#servicesapi
)
<br/>
ServicesApi
[
SessionApi
](
#sessionapi
)
<br/>
SessionApi
[
UserApi
](
#userapi
)
UserApi
```
Sub API Examples
Sub API Examples
----------------
----------------
CommitsApi
:
###
CommitsApi
```
java
```
java
// Get a list of commits associated with the specified branch that fall within the specified time window
// Get a list of commits associated with the specified branch that fall within the specified time window
// This uses the ISO8601 date utilities the in org.gitlab4j.api.utils.ISO8601 class
// This uses the ISO8601 date utilities the in org.gitlab4j.api.utils.ISO8601 class
...
@@ -106,7 +105,7 @@ Date until = new Date(); // now
...
@@ -106,7 +105,7 @@ Date until = new Date(); // now
List
<
Commit
>
commits
=
gitLabApi
.
getCommitsApi
().
getCommits
(
1234
,
"new-feature"
,
since
,
until
);
List
<
Commit
>
commits
=
gitLabApi
.
getCommitsApi
().
getCommits
(
1234
,
"new-feature"
,
since
,
until
);
```
```
EventsApi
:
###
EventsApi
```
java
```
java
// Get a list of Events for the authenticated user
// Get a list of Events for the authenticated user
Date
after
=
new
Date
(
0
);
// After Eposc
Date
after
=
new
Date
(
0
);
// After Eposc
...
@@ -115,37 +114,43 @@ List<Event> events = gitLabApi.getEventsApi().getAuthenticatedUserEvents(null, n
...
@@ -115,37 +114,43 @@ List<Event> events = gitLabApi.getEventsApi().getAuthenticatedUserEvents(null, n
assertNotNull
(
events
);
assertNotNull
(
events
);
```
```
GroupApi
:
###
GroupApi
```
java
```
java
// Get a list of groups that you have access to
// Get a list of groups that you have access to
List
<
Group
>
groups
=
gitLabApi
.
getGroupApi
().
getGroups
();
List
<
Group
>
groups
=
gitLabApi
.
getGroupApi
().
getGroups
();
```
```
JobApi
:
###
JobApi
```
java
```
java
// Get a list of jobs for the specified project ID
// Get a list of jobs for the specified project ID
List
<
Job
>
jobs
=
gitLabApi
.
getJobApi
().
getJobs
(
1234
);
List
<
Job
>
jobs
=
gitLabApi
.
getJobApi
().
getJobs
(
1234
);
```
```
MergeRequestApi
:
###
MergeRequestApi
```
java
```
java
// Get a list of the merge requests for the specified project
// Get a list of the merge requests for the specified project
List
<
MergeRequest
>
mergeRequests
=
gitLabApi
.
getMergeRequestApi
().
getMergeRequests
(
1234
);
List
<
MergeRequest
>
mergeRequests
=
gitLabApi
.
getMergeRequestApi
().
getMergeRequests
(
1234
);
```
```
NamespaceApi
:
###
NamespaceApi
```
java
```
java
// Get all namespaces that match "foobar" in their name or path
// Get all namespaces that match "foobar" in their name or path
List
<
Namespace
>
namespaces
=
gitLabApi
.
getNamespaceApi
().
findNamespaces
(
"foobar"
);
List
<
Namespace
>
namespaces
=
gitLabApi
.
getNamespaceApi
().
findNamespaces
(
"foobar"
);
```
```
PipelineApi:
### NotesApi
```
java
// Get a list of the issues's notes for project ID 1234, issue ID 1
List
<
Note
>
notes
=
getNotes
(
Integer
1234
,
Integer
1
);
```
### PipelineApi
```
java
```
java
// Get all pipelines for the specified project ID
// Get all pipelines for the specified project ID
List
<
Pipeline
>
pipelines
=
gitLabApi
.
getPipelineApi
().
getPipelines
(
1234
);
List
<
Pipeline
>
pipelines
=
gitLabApi
.
getPipelineApi
().
getPipelines
(
1234
);
```
```
ProjectApi
:
###
ProjectApi
```
java
```
java
// Get a list of accessible projects
// Get a list of accessible projects
public
List
<
Project
>
projects
=
gitLabApi
.
getProjectApi
().
getProjects
();
public
List
<
Project
>
projects
=
gitLabApi
.
getProjectApi
().
getProjects
();
...
@@ -164,31 +169,31 @@ Project projectSpec = new Project()
...
@@ -164,31 +169,31 @@ Project projectSpec = new Project()
Project
newProject
=
gitLabApi
.
getProjectApi
().
createProject
(
projectSpec
);
Project
newProject
=
gitLabApi
.
getProjectApi
().
createProject
(
projectSpec
);
```
```
RepositoryApi
:
###
RepositoryApi
```
java
```
java
// Get a list of repository branches from a project, sorted by name alphabetically
// Get a list of repository branches from a project, sorted by name alphabetically
List
<
Branch
>
branches
=
gitLabApi
.
getRepositoryApi
().
getBranches
();
List
<
Branch
>
branches
=
gitLabApi
.
getRepositoryApi
().
getBranches
();
```
```
RepositoryFileApi
:
###
RepositoryFileApi
```
java
```
java
// Get info (name, size, ...) and the content from a file in repository
// Get info (name, size, ...) and the content from a file in repository
RepositoryFile
file
=
gitLabApi
.
getRepositoryFileApi
().
getFile
(
"file-path"
,
1234
,
"ref"
);
RepositoryFile
file
=
gitLabApi
.
getRepositoryFileApi
().
getFile
(
"file-path"
,
1234
,
"ref"
);
```
```
ServicesApi
:
###
ServicesApi
```
java
```
java
// Activates the gitlab-ci service.
// Activates the gitlab-ci service.
getLabApi
.
getServicesApi
().
setGitLabCI
(
"project-name"
,
"auth-token"
,
"project-ci-url"
);
getLabApi
.
getServicesApi
().
setGitLabCI
(
"project-name"
,
"auth-token"
,
"project-ci-url"
);
```
```
SessionApi
:
###
SessionApi
```
java
```
java
// Log in to the GitLab server and get the session info
// Log in to the GitLab server and get the session info
getLabApi
.
getSessionApi
().
login
(
"your-username"
,
"your-email"
,
"your-password"
);
getLabApi
.
getSessionApi
().
login
(
"your-username"
,
"your-email"
,
"your-password"
);
```
```
UserApi
:
###
UserApi
```
java
```
java
// Get the User info for user_id 1
// Get the User info for user_id 1
User
user
=
gitLabApi
.
getUserApi
().
getUser
(
1
);
User
user
=
gitLabApi
.
getUserApi
().
getUser
(
1
);
...
...
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