Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
java-gitlab-api
Project
Project
Details
Activity
Releases
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
沈俊林
java-gitlab-api
Commits
2c7dec24
Commit
2c7dec24
authored
Jan 31, 2016
by
Tim Olshansky
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #112 from rockwotj/master
Added builds API for projects and commits
parents
13259f51
41232852
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
231 additions
and
0 deletions
+231
-0
GitlabAPI.java
src/main/java/org/gitlab/api/GitlabAPI.java
+37
-0
GitlabBuild.java
src/main/java/org/gitlab/api/models/GitlabBuild.java
+140
-0
GitlabRunner.java
src/main/java/org/gitlab/api/models/GitlabRunner.java
+54
-0
No files found.
src/main/java/org/gitlab/api/GitlabAPI.java
View file @
2c7dec24
...
...
@@ -586,6 +586,32 @@ public class GitlabAPI {
return
retrieve
().
getAll
(
tailUrl
,
GitlabProject
[].
class
);
}
/**
*
* Gets a list of a project's builds in Gitlab
*
* @param project the project
* @return A list of project builds
* @throws IOException
*/
public
List
<
GitlabBuild
>
getProjectBuilds
(
GitlabProject
project
)
throws
IOException
{
return
getProjectBuilds
(
project
.
getId
());
}
/**
*
* Gets a list of a project's builds in Gitlab
*
* @param projectId the project id
* @return A list of project builds
* @throws IOException
*/
public
List
<
GitlabBuild
>
getProjectBuilds
(
Integer
projectId
)
throws
IOException
{
String
tailUrl
=
GitlabProject
.
URL
+
"/"
+
sanitizeProjectId
(
projectId
)
+
GitlabBuild
.
URL
;
return
retrieve
().
getAll
(
tailUrl
,
GitlabBuild
[].
class
);
}
/**
* Creates a private Project
*
...
...
@@ -875,6 +901,17 @@ public class GitlabAPI {
return
retrieve
().
to
(
tailUrl
,
GitlabCommit
.
class
);
}
public
List
<
GitlabBuild
>
getCommitBuilds
(
GitlabProject
projectId
,
String
commitHash
)
throws
IOException
{
return
getCommitBuilds
(
projectId
.
getId
(),
commitHash
);
}
public
List
<
GitlabBuild
>
getCommitBuilds
(
Serializable
projectId
,
String
commitHash
)
throws
IOException
{
String
tailUrl
=
GitlabProject
.
URL
+
"/"
+
sanitizeProjectId
(
projectId
)
+
"/repository/commits/"
+
commitHash
+
GitlabBuild
.
URL
;
return
retrieve
().
getAll
(
tailUrl
,
GitlabBuild
[].
class
);
}
public
List
<
GitlabCommit
>
getCommits
(
GitlabMergeRequest
mergeRequest
)
throws
IOException
{
return
getCommits
(
mergeRequest
,
new
Pagination
());
}
...
...
src/main/java/org/gitlab/api/models/GitlabBuild.java
0 → 100644
View file @
2c7dec24
package
org
.
gitlab
.
api
.
models
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
public
class
GitlabBuild
{
public
final
static
String
URL
=
"/builds"
;
private
GitlabCommit
commit
;
private
String
coverage
;
@JsonProperty
(
"created_at"
)
private
String
createdAt
;
@JsonProperty
(
"download_url"
)
private
String
downloadUrl
;
@JsonProperty
(
"finishedAt"
)
private
String
finishedAt
;
private
Integer
id
;
private
String
name
;
private
String
ref
;
private
GitlabRunner
runner
;
private
String
stage
;
@JsonProperty
(
"started_at"
)
private
String
startedAt
;
private
String
status
;
private
Boolean
tag
;
private
GitlabUser
user
;
public
GitlabUser
getUser
()
{
return
user
;
}
public
void
setUser
(
GitlabUser
user
)
{
this
.
user
=
user
;
}
public
Boolean
getTag
()
{
return
tag
;
}
public
void
setTag
(
Boolean
tag
)
{
this
.
tag
=
tag
;
}
public
String
getStatus
()
{
return
status
;
}
public
void
setStatus
(
String
status
)
{
this
.
status
=
status
;
}
public
String
getStartedAt
()
{
return
startedAt
;
}
public
void
setStartedAt
(
String
startedAt
)
{
this
.
startedAt
=
startedAt
;
}
public
String
getStage
()
{
return
stage
;
}
public
void
setStage
(
String
stage
)
{
this
.
stage
=
stage
;
}
public
GitlabRunner
getRunner
()
{
return
runner
;
}
public
void
setRunner
(
GitlabRunner
runner
)
{
this
.
runner
=
runner
;
}
public
String
getRef
()
{
return
ref
;
}
public
void
setRef
(
String
ref
)
{
this
.
ref
=
ref
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
Integer
getId
()
{
return
id
;
}
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
public
String
getFinishedAt
()
{
return
finishedAt
;
}
public
void
setFinishedAt
(
String
finishedAt
)
{
this
.
finishedAt
=
finishedAt
;
}
public
String
getDownloadUrl
()
{
return
downloadUrl
;
}
public
void
setDownloadUrl
(
String
downloadUrl
)
{
this
.
downloadUrl
=
downloadUrl
;
}
public
String
getCreatedAt
()
{
return
createdAt
;
}
public
void
setCreatedAt
(
String
createdAt
)
{
this
.
createdAt
=
createdAt
;
}
public
String
getCoverage
()
{
return
coverage
;
}
public
void
setCoverage
(
String
coverage
)
{
this
.
coverage
=
coverage
;
}
public
GitlabCommit
getCommit
()
{
return
commit
;
}
public
void
setCommit
(
GitlabCommit
commit
)
{
this
.
commit
=
commit
;
}
}
src/main/java/org/gitlab/api/models/GitlabRunner.java
0 → 100644
View file @
2c7dec24
package
org
.
gitlab
.
api
.
models
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
public
class
GitlabRunner
{
private
Integer
id
;
private
String
description
;
private
Boolean
active
;
@JsonProperty
(
"is_shared"
)
private
Boolean
isShared
;
private
String
name
;
public
Integer
getId
()
{
return
id
;
}
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
public
String
getDescription
()
{
return
description
;
}
public
void
setDescription
(
String
description
)
{
this
.
description
=
description
;
}
public
Boolean
getActive
()
{
return
active
;
}
public
void
setActive
(
Boolean
active
)
{
this
.
active
=
active
;
}
public
Boolean
getShared
()
{
return
isShared
;
}
public
void
setShared
(
Boolean
shared
)
{
isShared
=
shared
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
}
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