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
2b55521f
Commit
2b55521f
authored
Oct 21, 2016
by
Tim Olshansky
Committed by
GitHub
Oct 21, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #166 from mfriedenhagen/owned-projects-and-project-triggers
Owned projects and project triggers
parents
fd82dab3
e71e9866
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
105 additions
and
0 deletions
+105
-0
GitlabAPI.java
src/main/java/org/gitlab/api/GitlabAPI.java
+30
-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 @
2b55521f
...
...
@@ -583,6 +583,18 @@ public class GitlabAPI {
return
retrieve
().
getAll
(
tailUrl
,
GitlabProject
[].
class
);
}
/**
*
* Get a list of projects owned by the authenticated user.
*
* @return A list of gitlab projects
* @throws IOException
*/
public
List
<
GitlabProject
>
getOwnedProjects
()
throws
IOException
{
String
tailUrl
=
GitlabProject
.
URL
+
"/owned"
;
return
retrieve
().
getAll
(
tailUrl
,
GitlabProject
[].
class
);
}
/**
*
* Get a list of projects accessible by the authenticated user.
...
...
@@ -2374,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 @
2b55521f
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