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
e71e9866
Commit
e71e9866
authored
Oct 19, 2016
by
Mirko Friedenhagen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create model and retrieval method for build triggers.
parent
a263f525
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
93 additions
and
0 deletions
+93
-0
GitlabAPI.java
src/main/java/org/gitlab/api/GitlabAPI.java
+18
-0
GitlabTrigger.java
src/main/java/org/gitlab/api/models/GitlabTrigger.java
+75
-0
No files found.
src/main/java/org/gitlab/api/GitlabAPI.java
View file @
e71e9866
...
...
@@ -2386,4 +2386,22 @@ public class GitlabAPI {
}
return
requestor
.
to
(
tailUrl
,
GitlabBuildVariable
.
class
);
}
/**
* Returns the list of build triggers for a project.
*
* @param project the project
* @return list of build triggers
* @throws IllegalStateException if builds are not enabled for the project
* @throws IOException
*/
public
List
<
GitlabTrigger
>
getBuildTriggers
(
GitlabProject
project
)
throws
IOException
{
if
(!
project
.
isBuildsEnabled
())
{
// if the project has not allowed builds, you will only get a 403 forbidden message which is
// not helpful.
throw
new
IllegalStateException
(
"Builds are not enabled for "
+
project
.
getNameWithNamespace
()
);
}
else
{
return
retrieve
().
getAll
(
GitlabProject
.
URL
+
"/"
+
project
.
getId
()
+
GitlabTrigger
.
URL
,
GitlabTrigger
[].
class
);
}
}
}
src/main/java/org/gitlab/api/models/GitlabTrigger.java
0 → 100644
View file @
e71e9866
package
org
.
gitlab
.
api
.
models
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
java.util.Date
;
/**
* [
* {
* "token": "7dfb8f45432193abcd54123456090f",
* "created_at": "2016-07-08T12:33:25.151Z",
* "updated_at": "2016-07-08T12:33:25.151Z",
* "deleted_at": null,
* "last_used": "2016-09-04T23:00:01.681Z"
* }
* ]
*/
public
class
GitlabTrigger
{
public
static
final
String
URL
=
"/triggers"
;
private
String
token
;
@JsonProperty
(
"created_at"
)
private
Date
createdAt
;
@JsonProperty
(
"updated_at"
)
private
Date
updatedAt
;
@JsonProperty
(
"deleted_at"
)
private
Date
deletedAt
;
@JsonProperty
(
"last_used"
)
private
Date
lastUsed
;
public
String
getToken
()
{
return
token
;
}
public
void
setToken
(
String
token
)
{
this
.
token
=
token
;
}
public
Date
getCreatedAt
()
{
return
createdAt
;
}
public
void
setCreatedAt
(
Date
createdAt
)
{
this
.
createdAt
=
createdAt
;
}
public
Date
getUpdatedAt
()
{
return
updatedAt
;
}
public
void
setUpdatedAt
(
Date
updatedAt
)
{
this
.
updatedAt
=
updatedAt
;
}
public
Date
getDeletedAt
()
{
return
deletedAt
;
}
public
void
setDeletedAt
(
Date
deletedAt
)
{
this
.
deletedAt
=
deletedAt
;
}
public
Date
getLastUsed
()
{
return
lastUsed
;
}
public
void
setLastUsed
(
Date
lastUsed
)
{
this
.
lastUsed
=
lastUsed
;
}
}
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