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
e054e8d6
Commit
e054e8d6
authored
Jul 30, 2016
by
Wayne Nugent
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding gitlab awardables
parent
4d93aa57
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
262 additions
and
0 deletions
+262
-0
GitlabAPI.java
src/main/java/org/gitlab/api/GitlabAPI.java
+170
-0
GitlabAward.java
src/main/java/org/gitlab/api/models/GitlabAward.java
+92
-0
No files found.
src/main/java/org/gitlab/api/GitlabAPI.java
View file @
e054e8d6
...
@@ -2008,4 +2008,174 @@ public class GitlabAPI {
...
@@ -2008,4 +2008,174 @@ public class GitlabAPI {
String
tailUrl
=
GitlabProject
.
URL
+
"/"
+
project
+
GitlabTag
.
URL
+
"/"
+
tagName
;
String
tailUrl
=
GitlabProject
.
URL
+
"/"
+
project
+
GitlabTag
.
URL
+
"/"
+
tagName
;
retrieve
().
method
(
"DELETE"
).
to
(
tailUrl
,
Void
.
class
);
retrieve
().
method
(
"DELETE"
).
to
(
tailUrl
,
Void
.
class
);
}
}
/**
* Get all awards for a merge request
*
* @param mergeRequest
* @throws IOException on gitlab api call error
*/
public
List
<
GitlabAward
>
getAllAwards
(
GitlabMergeRequest
mergeRequest
)
throws
IOException
{
String
tailUrl
=
GitlabProject
.
URL
+
"/"
+
mergeRequest
.
getProjectId
()
+
GitlabMergeRequest
.
URL
+
"/"
+
mergeRequest
.
getId
()
+
GitlabAward
.
URL
;
return
retrieve
().
getAll
(
tailUrl
,
GitlabAward
[].
class
);
}
/**
* Get a specific award for a merge request
*
* @param mergeRequest
* @param awardId
* @throws IOException on gitlab api call error
*/
public
GitlabAward
getAward
(
GitlabMergeRequest
mergeRequest
,
Integer
awardId
)
throws
IOException
{
String
tailUrl
=
GitlabProject
.
URL
+
"/"
+
mergeRequest
.
getProjectId
()
+
GitlabMergeRequest
.
URL
+
"/"
+
mergeRequest
.
getId
()
+
GitlabAward
.
URL
+
"/"
+
awardId
;
return
retrieve
().
to
(
tailUrl
,
GitlabAward
.
class
);
}
/**
* Create an award for a merge request
*
* @param mergeRequest
* @param awardName
* @throws IOException on gitlab api call error
*/
public
GitlabAward
createAward
(
GitlabMergeRequest
mergeRequest
,
String
awardName
)
throws
IOException
{
Query
query
=
new
Query
().
append
(
"name"
,
awardName
);
String
tailUrl
=
GitlabProject
.
URL
+
"/"
+
mergeRequest
.
getProjectId
()
+
GitlabMergeRequest
.
URL
+
"/"
+
mergeRequest
.
getId
()
+
GitlabAward
.
URL
+
query
.
toString
();
return
dispatch
().
to
(
tailUrl
,
GitlabAward
.
class
);
}
/**
* Delete an award for a merge request
*
* @param mergeRequest
* @param award
* @throws IOException on gitlab api call error
*/
public
void
deleteAward
(
GitlabMergeRequest
mergeRequest
,
GitlabAward
award
)
throws
IOException
{
String
tailUrl
=
GitlabProject
.
URL
+
"/"
+
mergeRequest
.
getProjectId
()
+
GitlabMergeRequest
.
URL
+
"/"
+
mergeRequest
.
getId
()
+
GitlabAward
.
URL
+
"/"
+
award
.
getId
();
retrieve
().
method
(
"DELETE"
).
to
(
tailUrl
,
Void
.
class
);
}
/**
* Get all awards for an issue
*
* @param issue
* @throws IOException on gitlab api call error
*/
public
List
<
GitlabAward
>
getAllAwards
(
GitlabIssue
issue
)
throws
IOException
{
String
tailUrl
=
GitlabProject
.
URL
+
"/"
+
issue
.
getProjectId
()
+
GitlabIssue
.
URL
+
"/"
+
issue
.
getId
()
+
GitlabAward
.
URL
;
return
retrieve
().
getAll
(
tailUrl
,
GitlabAward
[].
class
);
}
/**
* Get a specific award for an issue
*
* @param issue
* @param awardId
* @throws IOException on gitlab api call error
*/
public
GitlabAward
getAward
(
GitlabIssue
issue
,
Integer
awardId
)
throws
IOException
{
String
tailUrl
=
GitlabProject
.
URL
+
"/"
+
issue
.
getProjectId
()
+
GitlabIssue
.
URL
+
"/"
+
issue
.
getId
()
+
GitlabAward
.
URL
+
"/"
+
awardId
;
return
retrieve
().
to
(
tailUrl
,
GitlabAward
.
class
);
}
/**
* Create an award for an issue
*
* @param issue
* @param awardName
* @throws IOException on gitlab api call error
*/
public
GitlabAward
createAward
(
GitlabIssue
issue
,
String
awardName
)
throws
IOException
{
Query
query
=
new
Query
().
append
(
"name"
,
awardName
);
String
tailUrl
=
GitlabProject
.
URL
+
"/"
+
issue
.
getProjectId
()
+
GitlabIssue
.
URL
+
"/"
+
issue
.
getId
()
+
GitlabAward
.
URL
+
query
.
toString
();
return
dispatch
().
to
(
tailUrl
,
GitlabAward
.
class
);
}
/**
* Delete an award for an issue
*
* @param issue
* @param award
* @throws IOException on gitlab api call error
*/
public
void
deleteAward
(
GitlabIssue
issue
,
GitlabAward
award
)
throws
IOException
{
String
tailUrl
=
GitlabProject
.
URL
+
"/"
+
issue
.
getProjectId
()
+
GitlabIssue
.
URL
+
"/"
+
issue
.
getId
()
+
GitlabAward
.
URL
+
"/"
+
award
.
getId
();
retrieve
().
method
(
"DELETE"
).
to
(
tailUrl
,
Void
.
class
);
}
/**
* Get all awards for an issue note
*
* @param issue
* @param noteId
* @throws IOException on gitlab api call error
*/
public
List
<
GitlabAward
>
getAllAwards
(
GitlabIssue
issue
,
Integer
noteId
)
throws
IOException
{
String
tailUrl
=
GitlabProject
.
URL
+
"/"
+
issue
.
getProjectId
()
+
GitlabIssue
.
URL
+
"/"
+
issue
.
getId
()
+
GitlabNote
.
URL
+
noteId
+
GitlabAward
.
URL
;
return
retrieve
().
getAll
(
tailUrl
,
GitlabAward
[].
class
);
}
/**
* Get a specific award for an issue note
*
* @param issue
* @param noteId
* @param awardId
* @throws IOException on gitlab api call error
*/
public
GitlabAward
getAward
(
GitlabIssue
issue
,
Integer
noteId
,
Integer
awardId
)
throws
IOException
{
String
tailUrl
=
GitlabProject
.
URL
+
"/"
+
issue
.
getProjectId
()
+
GitlabIssue
.
URL
+
"/"
+
issue
.
getId
()
+
GitlabNote
.
URL
+
noteId
+
GitlabAward
.
URL
+
"/"
+
awardId
;
return
retrieve
().
to
(
tailUrl
,
GitlabAward
.
class
);
}
/**
* Create an award for an issue note
*
* @param issue
* @param noteId
* @param awardName
* @throws IOException on gitlab api call error
*/
public
GitlabAward
createAward
(
GitlabIssue
issue
,
Integer
noteId
,
String
awardName
)
throws
IOException
{
Query
query
=
new
Query
().
append
(
"name"
,
awardName
);
String
tailUrl
=
GitlabProject
.
URL
+
"/"
+
issue
.
getProjectId
()
+
GitlabIssue
.
URL
+
"/"
+
issue
.
getId
()
+
GitlabNote
.
URL
+
noteId
+
GitlabAward
.
URL
+
query
.
toString
();
return
dispatch
().
to
(
tailUrl
,
GitlabAward
.
class
);
}
/**
* Delete an award for an issue note
*
* @param issue
* @param noteId
* @param award
* @throws IOException on gitlab api call error
*/
public
void
deleteAward
(
GitlabIssue
issue
,
Integer
noteId
,
GitlabAward
award
)
throws
IOException
{
String
tailUrl
=
GitlabProject
.
URL
+
"/"
+
issue
.
getProjectId
()
+
GitlabIssue
.
URL
+
"/"
+
issue
.
getId
()
+
GitlabNote
.
URL
+
noteId
+
GitlabAward
.
URL
+
"/"
+
award
.
getId
();
retrieve
().
method
(
"DELETE"
).
to
(
tailUrl
,
Void
.
class
);
}
}
}
src/main/java/org/gitlab/api/models/GitlabAward.java
0 → 100644
View file @
e054e8d6
package
org
.
gitlab
.
api
.
models
;
import
java.util.Date
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
public
class
GitlabAward
{
public
static
final
String
THUMBSUP
=
"thumbsup"
;
public
static
final
String
THUMBSDOWN
=
"thumbsdown"
;
public
static
final
String
ISSUE
=
"Issue"
;
public
static
final
String
NOTE
=
"Note"
;
public
static
final
String
URL
=
"/award_emoji"
;
private
Integer
id
;
private
String
name
;
private
GitlabUser
user
;
@JsonProperty
(
"created_at"
)
private
Date
createdAt
;
@JsonProperty
(
"updated_at"
)
private
Date
updatedAt
;
@JsonProperty
(
"awardable_id"
)
private
Integer
awardableId
;
@JsonProperty
(
"awardable_type"
)
private
String
awardableType
;
public
Integer
getId
()
{
return
id
;
}
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
public
String
getName
()
{
return
name
;
}
public
void
setBody
(
String
body
)
{
this
.
name
=
body
;
}
public
GitlabUser
getUser
()
{
return
user
;
}
public
void
setUser
(
GitlabUser
user
)
{
this
.
user
=
user
;
}
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
Integer
getAwardableId
()
{
return
awardableId
;
}
public
void
setAwardableId
(
Integer
awardableId
)
{
this
.
awardableId
=
awardableId
;
}
public
String
getAwardableType
()
{
return
awardableType
;
}
public
void
setAwardableType
(
String
awardableType
)
{
this
.
awardableType
=
awardableType
;
}
}
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