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
faeba637
Commit
faeba637
authored
Mar 09, 2016
by
Tim Olshansky
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #116 from wyb1108/master
implements api for get tags, add tag and delete tag
parents
b42a6fc8
cc562a01
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
93 additions
and
3 deletions
+93
-3
GitlabAPI.java
src/main/java/org/gitlab/api/GitlabAPI.java
+92
-0
GitlabTag.java
src/main/java/org/gitlab/api/models/GitlabTag.java
+1
-3
No files found.
src/main/java/org/gitlab/api/GitlabAPI.java
View file @
faeba637
...
...
@@ -1786,4 +1786,96 @@ public class GitlabAPI {
return
Arrays
.
asList
(
retrieve
().
to
(
tailUrl
,
CommitComment
[].
class
));
}
/**
* Get a list of tags in specific project
*
* @param projectId
* @return
* @throws IOException on gitlab api call error
*/
public
List
<
GitlabTag
>
getTags
(
Serializable
projectId
)
throws
IOException
{
String
tailUrl
=
GitlabProject
.
URL
+
"/"
+
sanitizeProjectId
(
projectId
)
+
GitlabTag
.
URL
;
GitlabTag
[]
tags
=
retrieve
().
to
(
tailUrl
,
GitlabTag
[].
class
);
return
Arrays
.
asList
(
tags
);
}
/**
* Get a list of tags in specific project
*
* @param project
* @return
* @throws IOException on gitlab api call error
*/
public
List
<
GitlabTag
>
getTags
(
GitlabProject
project
)
throws
IOException
{
String
tailUrl
=
GitlabProject
.
URL
+
"/"
+
project
.
getId
()
+
GitlabTag
.
URL
;
GitlabTag
[]
tags
=
retrieve
().
to
(
tailUrl
,
GitlabTag
[].
class
);
return
Arrays
.
asList
(
tags
);
}
/**
* Create tag in specific project
*
* @param projectId
* @param tagName
* @param ref
* @param message
* @param releaseDescription
* @return
* @throws IOException on gitlab api call error
*/
public
GitlabTag
addTag
(
Serializable
projectId
,
String
tagName
,
String
ref
,
String
message
,
String
releaseDescription
)
throws
IOException
{
String
tailUrl
=
GitlabProject
.
URL
+
"/"
+
sanitizeProjectId
(
projectId
)
+
GitlabTag
.
URL
;
return
dispatch
()
.
with
(
"tag_name"
,
tagName
)
.
with
(
"ref"
,
ref
)
.
with
(
"message"
,
message
)
.
with
(
"release_description"
,
releaseDescription
)
.
to
(
tailUrl
,
GitlabTag
.
class
);
}
/**
* Create tag in specific project
*
* @param project
* @param tagName
* @param ref
* @param message
* @param releaseDescription
* @return
* @throws IOException on gitlab api call error
*/
public
GitlabTag
addTag
(
GitlabProject
project
,
String
tagName
,
String
ref
,
String
message
,
String
releaseDescription
)
throws
IOException
{
String
tailUrl
=
GitlabProject
.
URL
+
"/"
+
project
.
getId
()
+
GitlabTag
.
URL
;
return
dispatch
()
.
with
(
"tag_name"
,
tagName
)
.
with
(
"ref"
,
ref
)
.
with
(
"message"
,
message
)
.
with
(
"release_description"
,
releaseDescription
)
.
to
(
tailUrl
,
GitlabTag
.
class
);
}
/**
* Delete tag in specific project
*
* @param projectId
* @param tagName
* @throws IOException on gitlab api call error
*/
public
void
deleteTag
(
Serializable
projectId
,
String
tagName
)
throws
IOException
{
String
tailUrl
=
GitlabProject
.
URL
+
"/"
+
sanitizeProjectId
(
projectId
)
+
GitlabTag
.
URL
+
"/"
+
tagName
;
retrieve
().
method
(
"DELETE"
).
to
(
tailUrl
,
Void
.
class
);
}
/**
* Delete tag in specific project
*
* @param project
* @param tagName
* @throws IOException on gitlab api call error
*/
public
void
deleteTag
(
GitlabProject
project
,
String
tagName
)
throws
IOException
{
String
tailUrl
=
GitlabProject
.
URL
+
"/"
+
project
+
GitlabTag
.
URL
+
"/"
+
tagName
;
retrieve
().
method
(
"DELETE"
).
to
(
tailUrl
,
Void
.
class
);
}
}
src/main/java/org/gitlab/api/models/GitlabTag.java
View file @
faeba637
package
org
.
gitlab
.
api
.
models
;
import
org.gitlab.api.models.GitlabBranchCommit
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
public
class
GitlabTag
{
public
final
static
String
URL
=
"/repository/tags
/
"
;
public
final
static
String
URL
=
"/repository/tags"
;
@JsonProperty
(
"commit"
)
private
GitlabBranchCommit
commit
;
...
...
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