Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
佳 邓
Gitlab4j Api
Commits
e602c343
Commit
e602c343
authored
Feb 06, 2017
by
Greg Messner
Browse files
More mods to support GitLab 8
parent
c2af9a23
Changes
9
Hide whitespace changes
Inline
Side-by-side
src/main/java/com/messners/gitlab/api/JacksonJson.java
View file @
e602c343
...
...
@@ -138,7 +138,6 @@ public class JacksonJson extends JacksonJaxbJsonProvider implements ContextResol
}
}
/**
* JsonSerializer for serializing AccessLevel values.
*/
...
...
src/main/java/com/messners/gitlab/api/models/AccessLevel.java
View file @
e602c343
...
...
@@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonValue;
public
enum
AccessLevel
{
GUEST
(
10
),
REPORTER
(
20
),
DEVELOPER
(
30
),
MASTER
(
40
),
OWNER
(
50
);
NONE
(
0
),
GUEST
(
10
),
REPORTER
(
20
),
DEVELOPER
(
30
),
MASTER
(
40
),
OWNER
(
50
);
public
final
int
value
;
...
...
@@ -16,7 +16,7 @@ public enum AccessLevel {
this
.
value
=
value
;
}
private
static
Map
<
Integer
,
AccessLevel
>
valuesMap
=
new
HashMap
<
Integer
,
AccessLevel
>(
5
);
private
static
Map
<
Integer
,
AccessLevel
>
valuesMap
=
new
HashMap
<
Integer
,
AccessLevel
>(
6
);
static
{
for
(
AccessLevel
accessLevel
:
AccessLevel
.
values
())
valuesMap
.
put
(
accessLevel
.
value
,
accessLevel
);
...
...
src/main/java/com/messners/gitlab/api/models/Session.java
View file @
e602c343
...
...
@@ -27,7 +27,8 @@ public class Session {
private
String
linkedin
;
private
String
name
;
private
String
privateToken
;
private
Integer
projectLimit
;
private
Integer
projectsLimit
;
private
String
state
;
private
String
skype
;
private
Integer
themeId
;
private
String
twitter
;
...
...
@@ -163,12 +164,20 @@ public class Session {
this
.
privateToken
=
privateToken
;
}
public
Integer
getProjectLimit
()
{
return
projectLimit
;
public
Integer
getProject
s
Limit
()
{
return
project
s
Limit
;
}
public
void
setProjectLimit
(
Integer
projectLimit
)
{
this
.
projectLimit
=
projectLimit
;
public
void
setProjectsLimit
(
Integer
projectsLimit
)
{
this
.
projectsLimit
=
projectsLimit
;
}
public
String
getState
()
{
return
state
;
}
public
void
setState
(
String
state
)
{
this
.
state
=
state
;
}
public
String
getSkype
()
{
...
...
src/main/java/com/messners/gitlab/api/webhook/EventObject.java
View file @
e602c343
...
...
@@ -11,7 +11,7 @@ import javax.xml.bind.annotation.XmlRootElement;
@JsonTypeInfo
(
use
=
JsonTypeInfo
.
Id
.
NAME
,
include
=
JsonTypeInfo
.
As
.
PROPERTY
,
property
=
"object
K
ind"
,
property
=
"object
_k
ind"
,
visible
=
true
)
@JsonSubTypes
({
...
...
src/main/java/com/messners/gitlab/api/webhook/IssueEvent.java
View file @
e602c343
package
com.messners.gitlab.api.webhook
;
import
java.util.Date
;
import
javax.xml.bind.annotation.XmlAccessType
;
import
javax.xml.bind.annotation.XmlAccessorType
;
import
com.messners.gitlab.api.models.Assignee
;
import
com.messners.gitlab.api.models.User
;
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
public
class
IssueEvent
extends
EventObject
{
public
static
final
String
OBJECT_KIND
=
"issue"
;
private
EventObjectAttributes
objectAttributes
;
private
User
user
;
private
EventProject
project
;
private
EventRepository
repository
;
private
ObjectAttributes
objectAttributes
;
private
Assignee
assignee
;
public
User
getUser
()
{
return
user
;
}
public
void
setUser
(
User
user
)
{
this
.
user
=
user
;
}
public
EventProject
getProject
()
{
return
project
;
}
public
void
setProject
(
EventProject
project
)
{
this
.
project
=
project
;
}
public
EventRepository
getRepository
()
{
return
repository
;
}
public
void
setRepository
(
EventRepository
repository
)
{
this
.
repository
=
repository
;
}
public
Assignee
getAssignee
()
{
return
assignee
;
}
public
EventObjectAttributes
getObjectAttributes
()
{
public
void
setAssignee
(
Assignee
assignee
)
{
this
.
assignee
=
assignee
;
}
public
ObjectAttributes
getObjectAttributes
()
{
return
this
.
objectAttributes
;
}
public
void
setObjectAttributes
(
Event
ObjectAttributes
objectAttributes
)
{
public
void
setObjectAttributes
(
ObjectAttributes
objectAttributes
)
{
this
.
objectAttributes
=
objectAttributes
;
}
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
public
static
class
ObjectAttributes
{
private
Integer
assigneeId
;
private
Integer
authorId
;
private
String
branchName
;
private
Date
createdAt
;
private
String
description
;
private
Integer
id
;
private
Integer
iid
;
private
String
milestoneId
;
private
Integer
position
;
private
Integer
projectId
;
private
String
state
;
private
String
title
;
private
Date
updatedAt
;
private
String
url
;
private
String
action
;
public
Integer
getAssigneeId
()
{
return
this
.
assigneeId
;
}
public
void
setAssigneeId
(
Integer
assigneeId
)
{
this
.
assigneeId
=
assigneeId
;
}
public
Integer
getAuthorId
()
{
return
this
.
authorId
;
}
public
void
setAuthorId
(
Integer
authorId
)
{
this
.
authorId
=
authorId
;
}
public
String
getBranchName
()
{
return
this
.
branchName
;
}
public
void
setBranchName
(
String
branchName
)
{
this
.
branchName
=
branchName
;
}
public
Date
getCreatedAt
()
{
return
this
.
createdAt
;
}
public
void
setCreatedAt
(
Date
createdAt
)
{
this
.
createdAt
=
createdAt
;
}
public
String
getDescription
()
{
return
this
.
description
;
}
public
void
setDescription
(
String
description
)
{
this
.
description
=
description
;
}
public
Integer
getId
()
{
return
this
.
id
;
}
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
public
Integer
getIid
()
{
return
this
.
iid
;
}
public
void
setIid
(
Integer
iid
)
{
this
.
iid
=
iid
;
}
public
String
getMilestoneId
()
{
return
this
.
milestoneId
;
}
public
void
setMilestoneId
(
String
milestoneId
)
{
this
.
milestoneId
=
milestoneId
;
}
public
Integer
getPosition
()
{
return
this
.
position
;
}
public
void
setPosition
(
Integer
position
)
{
this
.
position
=
position
;
}
public
Integer
getProjectId
()
{
return
this
.
projectId
;
}
public
void
setProjectId
(
Integer
projectId
)
{
this
.
projectId
=
projectId
;
}
public
String
getState
()
{
return
this
.
state
;
}
public
void
setState
(
String
state
)
{
this
.
state
=
state
;
}
public
String
getTitle
()
{
return
this
.
title
;
}
public
void
setTitle
(
String
title
)
{
this
.
title
=
title
;
}
public
Date
getUpdatedAt
()
{
return
this
.
updatedAt
;
}
public
void
setUpdatedAt
(
Date
updatedAt
)
{
this
.
updatedAt
=
updatedAt
;
}
public
String
getUrl
()
{
return
url
;
}
public
void
setUrl
(
String
url
)
{
this
.
url
=
url
;
}
public
String
getAction
()
{
return
action
;
}
public
void
setAction
(
String
action
)
{
this
.
action
=
action
;
}
}
}
src/main/java/com/messners/gitlab/api/webhook/MergeRequestEvent.java
View file @
e602c343
package
com.messners.gitlab.api.webhook
;
import
java.util.Date
;
import
javax.xml.bind.annotation.XmlAccessType
;
import
javax.xml.bind.annotation.XmlAccessorType
;
import
com.messners.gitlab.api.models.Assignee
;
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
public
class
MergeRequestEvent
extends
EventObject
{
public
static
final
String
OBJECT_KIND
=
"merge_request"
;
private
Event
ObjectAttributes
objectAttributes
;
private
ObjectAttributes
objectAttributes
;
public
Event
ObjectAttributes
getObjectAttributes
()
{
public
ObjectAttributes
getObjectAttributes
()
{
return
this
.
objectAttributes
;
}
public
void
setObjectAttributes
(
Event
ObjectAttributes
objectAttributes
)
{
public
void
setObjectAttributes
(
ObjectAttributes
objectAttributes
)
{
this
.
objectAttributes
=
objectAttributes
;
}
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
public
static
class
ObjectAttributes
{
private
Integer
assigneeId
;
private
Integer
authorId
;
private
String
branchName
;
private
Date
createdAt
;
private
String
description
;
private
Integer
id
;
private
Integer
iid
;
private
String
mergeStatus
;
private
String
milestoneId
;
private
Integer
position
;
private
Integer
projectId
;
private
String
sourceBranch
;
private
Integer
sourceProjectId
;
private
String
stCommits
;
private
String
stDiffs
;
private
String
state
;
private
String
targetBranch
;
private
Integer
targetProjectId
;
private
String
title
;
private
Date
updatedAt
;
private
EventProject
source
;
private
EventProject
target
;
private
EventCommit
lastCommit
;
private
Boolean
workInProgress
;
private
String
url
;
private
String
action
;
private
Assignee
assigneee
;
public
Integer
getAssigneeId
()
{
return
this
.
assigneeId
;
}
public
void
setAssigneeId
(
Integer
assigneeId
)
{
this
.
assigneeId
=
assigneeId
;
}
public
Integer
getAuthorId
()
{
return
this
.
authorId
;
}
public
void
setAuthorId
(
Integer
authorId
)
{
this
.
authorId
=
authorId
;
}
public
String
getBranchName
()
{
return
this
.
branchName
;
}
public
void
setBranchName
(
String
branchName
)
{
this
.
branchName
=
branchName
;
}
public
Date
getCreatedAt
()
{
return
this
.
createdAt
;
}
public
void
setCreatedAt
(
Date
createdAt
)
{
this
.
createdAt
=
createdAt
;
}
public
String
getDescription
()
{
return
this
.
description
;
}
public
void
setDescription
(
String
description
)
{
this
.
description
=
description
;
}
public
Integer
getId
()
{
return
this
.
id
;
}
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
public
Integer
getIid
()
{
return
this
.
iid
;
}
public
void
setIid
(
Integer
iid
)
{
this
.
iid
=
iid
;
}
public
String
getMergeStatus
()
{
return
this
.
mergeStatus
;
}
public
void
setMergeStatus
(
String
mergeStatus
)
{
this
.
mergeStatus
=
mergeStatus
;
}
public
String
getMilestoneId
()
{
return
this
.
milestoneId
;
}
public
void
setMilestoneId
(
String
milestoneId
)
{
this
.
milestoneId
=
milestoneId
;
}
public
Integer
getPosition
()
{
return
this
.
position
;
}
public
void
setPosition
(
Integer
position
)
{
this
.
position
=
position
;
}
public
Integer
getProjectId
()
{
return
this
.
projectId
;
}
public
void
setProjectId
(
Integer
projectId
)
{
this
.
projectId
=
projectId
;
}
public
String
getSourceBranch
()
{
return
this
.
sourceBranch
;
}
public
void
setSourceBranch
(
String
sourceBranch
)
{
this
.
sourceBranch
=
sourceBranch
;
}
public
Integer
getSourceProjectId
()
{
return
this
.
sourceProjectId
;
}
public
void
setSourceProjectId
(
Integer
sourceProjectId
)
{
this
.
sourceProjectId
=
sourceProjectId
;
}
public
String
getStCommits
()
{
return
this
.
stCommits
;
}
public
void
setStCommits
(
String
stCommits
)
{
this
.
stCommits
=
stCommits
;
}
public
String
getStDiffs
()
{
return
this
.
stDiffs
;
}
public
void
setStDiffs
(
String
stDiffs
)
{
this
.
stDiffs
=
stDiffs
;
}
public
String
getState
()
{
return
this
.
state
;
}
public
void
setState
(
String
state
)
{
this
.
state
=
state
;
}
public
String
getTargetBranch
()
{
return
this
.
targetBranch
;
}
public
void
setTargetBranch
(
String
targetBranch
)
{
this
.
targetBranch
=
targetBranch
;
}
public
Integer
getTargetProjectId
()
{
return
this
.
targetProjectId
;
}
public
void
setTargetProjectId
(
Integer
targetProjectId
)
{
this
.
targetProjectId
=
targetProjectId
;
}
public
String
getTitle
()
{
return
this
.
title
;
}
public
void
setTitle
(
String
title
)
{
this
.
title
=
title
;
}
public
Date
getUpdatedAt
()
{
return
this
.
updatedAt
;
}
public
void
setUpdatedAt
(
Date
updatedAt
)
{
this
.
updatedAt
=
updatedAt
;
}
public
EventProject
getSource
()
{
return
source
;
}
public
void
setSource
(
EventProject
source
)
{
this
.
source
=
source
;
}
public
EventProject
getTarget
()
{
return
target
;
}
public
void
setTarget
(
EventProject
target
)
{
this
.
target
=
target
;
}
public
EventCommit
getLastCommit
()
{
return
lastCommit
;
}
public
void
setLastCommit
(
EventCommit
lastCommit
)
{
this
.
lastCommit
=
lastCommit
;
}
public
Boolean
getWorkInProgress
()
{
return
workInProgress
;
}
public
void
setWorkInProgress
(
Boolean
workInProgress
)
{
this
.
workInProgress
=
workInProgress
;
}
public
String
getUrl
()
{
return
url
;
}
public
void
setUrl
(
String
url
)
{
this
.
url
=
url
;
}
public
String
getAction
()
{
return
action
;
}
public
void
setAction
(
String
action
)
{
this
.
action
=
action
;
}
public
Assignee
getAssigneee
()
{
return
assigneee
;
}
public
void
setAssigneee
(
Assignee
assigneee
)
{
this
.
assigneee
=
assigneee
;
}
}
}
src/main/java/com/messners/gitlab/api/webhook/PushEvent.java
View file @
e602c343
...
...
@@ -7,9 +7,6 @@ import javax.xml.bind.annotation.XmlAccessType;
import
javax.xml.bind.annotation.XmlAccessorType
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.messners.gitlab.api.models.Commit
;
import
com.messners.gitlab.api.models.Project
;
import
com.messners.gitlab.api.models.Repository
;
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
public
class
PushEvent
extends
EventObject
{
...
...
@@ -27,9 +24,9 @@ public class PushEvent extends EventObject {
private
String
userAvatar
;
private
Integer
projectId
;
private
Project
project
;
private
Repository
repository
;
private
List
<
Commit
>
commits
;
private
Event
Project
project
;
private
Event
Repository
repository
;
private
List
<
Event
Commit
>
commits
;
private
Integer
totalCommitsCount
;
public
String
getAfter
()
{
...
...
@@ -104,27 +101,27 @@ public class PushEvent extends EventObject {
this
.
projectId
=
projectId
;
}
public
Project
getProject
()
{
public
Event
Project
getProject
()
{
return
project
;
}
public
void
setProject
(
Project
project
)
{
public
void
setProject
(
Event
Project
project
)
{
this
.
project
=
project
;
}
public
Repository
getRepository
()
{
public
Event
Repository
getRepository
()
{
return
this
.
repository
;
}
public
void
setRepository
(
Repository
repository
)
{
public
void
setRepository
(
Event
Repository
repository
)
{
this
.
repository
=
repository
;
}
public
List
<
Commit
>
getCommits
()
{
public
List
<
Event
Commit
>
getCommits
()
{
return
this
.
commits
;
}
public
void
setCommits
(
List
<
Commit
>
commits
)
{
public
void
setCommits
(
List
<
Event
Commit
>
commits
)
{
this
.
commits
=
commits
;
}
...
...
src/test/resources/com/messners/gitlab/api/push-event.json
View file @
e602c343
...
...
@@ -13,7 +13,6 @@
"name"
:
"Diaspora"
,
"description"
:
""
,
"web_url"
:
"http://example.com/mike/diaspora"
,
"avatar_url"
:
null
,
"git_ssh_url"
:
"git@example.com:mike/diaspora.git"
,
"git_http_url"
:
"http://example.com/mike/diaspora.git"
,
"namespace"
:
"Mike"
,
...
...
@@ -25,33 +24,42 @@
"ssh_url"
:
"git@example.com:mike/diaspora.git"
,
"http_url"
:
"http://example.com/mike/diaspora.git"
},
"repository"
:
{
"repository"
:{
"name"
:
"Diaspora"
,
"url"
:
"git@
localhost:
diaspora.git"
,
"url"
:
"git@
example.com:mike/
diaspora.git"
,
"description"
:
""
,
"homepage"
:
"http://localhost/diaspora"
"homepage"
:
"http://example.com/mike/diaspora"
,
"git_http_url"
:
"http://example.com/mike/diaspora.git"
,
"git_ssh_url"
:
"git@example.com:mike/diaspora.git"
,
"visibility_level"
:
0
},
"commits"
:
[
{
"id"
:
"b6568db1bc1dcd7f8b4d5a946b0b91f9dacd7327"
,
"message"
:
"Update Catalan translation to e38cb41."
,
"timestamp"
:
"2011-12-12T1
2
:27:31Z"
,
"url"
:
"http://
localhost
/diaspora/commit
s
/b6568db1bc1dcd7f8b4d5a946b0b91f9dacd7327"
,
"timestamp"
:
"2011-12-12T1
4
:27:31Z"
,
"url"
:
"http://
example.com/mike
/diaspora/commit/b6568db1bc1dcd7f8b4d5a946b0b91f9dacd7327"
,
"author"
:
{
"name"
:
"Jordi Mallach"
,
"email"
:
"jordi@softcatala.org"
}
},
"added"
:
[
"CHANGELOG"
],
"modified"
:
[
"app/controller/application.rb"
],
"removed"
:
[]
},
{
"id"
:
"da1560886d4f094c3e6c9ef40349f7d38b5d27d7"
,
"message"
:
"fixed readme"
,
"timestamp"
:
"2012-01-03T2
1
:36:29Z"
,
"url"
:
"http://
localhost
/diaspora/commit
s
/da1560886d4f094c3e6c9ef40349f7d38b5d27d7"
,
"timestamp"
:
"2012-01-03T2
3
:36:29Z"
,
"url"
:
"http://
example.com/mike
/diaspora/commit/da1560886d4f094c3e6c9ef40349f7d38b5d27d7"
,
"author"
:
{
"name"
:
"GitLab dev user"
,
"email"
:
"gitlabdev@dv6700.(none)"
}
},
"added"
:
[
"CHANGELOG"
],
"modified"
:
[
"app/controller/application.rb"
],
"removed"
:
[]
}
],
"total_commits_count"
:
2
}
"total_commits_count"
:
4
}
\ No newline at end of file
src/test/resources/com/messners/gitlab/api/session.json
View file @
e602c343
...
...
@@ -3,10 +3,8 @@
"username"
:
"john_smith"
,
"id"
:
32
,
"state"
:
"active"
,
"avatar_url"
:
null
,
"created_at"
:
"2015-01-29T21:07:19.440Z"
,
"is_admin"
:
true
,
"bio"
:
null
,
"skype"
:
""
,
"linkedin"
:
""
,
"twitter"
:
""
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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