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
87fda5b9
Commit
87fda5b9
authored
Dec 05, 2018
by
孙长纪
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加查询最近项目的变动查询api
parent
995b7c6f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
387 additions
and
5 deletions
+387
-5
build.gradle
build.gradle
+1
-1
GitlabAPI.java
src/main/java/org/gitlab/api/GitlabAPI.java
+71
-4
GitabProjectLatelyChangeQry.java
...va/org/gitlab/api/models/GitabProjectLatelyChangeQry.java
+73
-0
GitlabProjectMerges.java
src/main/java/org/gitlab/api/models/GitlabProjectMerges.java
+171
-0
GitlabUserSimpleInfo.java
...main/java/org/gitlab/api/models/GitlabUserSimpleInfo.java
+71
-0
No files found.
build.gradle
View file @
87fda5b9
...
...
@@ -15,7 +15,7 @@ sourceCompatibility = 1.8
targetCompatibility
=
1.8
group
=
'cn.com.duiba.tool'
version
=
'1.3.
7-SNAPSHOT
'
version
=
'1.3.
8
'
repositories
{
mavenLocal
()
...
...
src/main/java/org/gitlab/api/GitlabAPI.java
View file @
87fda5b9
...
...
@@ -2,18 +2,63 @@ package org.gitlab.api;
import
com.fasterxml.jackson.databind.DeserializationFeature
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
org.gitlab.api.http.GitlabHTTPRequestor
;
import
org.gitlab.api.http.Query
;
import
org.gitlab.api.models.*
;
import
java.io.*
;
import
org.gitlab.api.models.CommitComment
;
import
org.gitlab.api.models.CreateGroupRequest
;
import
org.gitlab.api.models.CreateUserRequest
;
import
org.gitlab.api.models.DeployKey
;
import
org.gitlab.api.models.GitLabTimeTracking
;
import
org.gitlab.api.models.GitabProjectLatelyChangeQry
;
import
org.gitlab.api.models.GitlabAccessLevel
;
import
org.gitlab.api.models.GitlabAward
;
import
org.gitlab.api.models.GitlabBranch
;
import
org.gitlab.api.models.GitlabBuildVariable
;
import
org.gitlab.api.models.GitlabCommit
;
import
org.gitlab.api.models.GitlabCommitComparison
;
import
org.gitlab.api.models.GitlabCommitDiff
;
import
org.gitlab.api.models.GitlabCommitStatus
;
import
org.gitlab.api.models.GitlabEmailonPushProperties
;
import
org.gitlab.api.models.GitlabGroup
;
import
org.gitlab.api.models.GitlabGroupMember
;
import
org.gitlab.api.models.GitlabIssue
;
import
org.gitlab.api.models.GitlabJiraProperties
;
import
org.gitlab.api.models.GitlabJob
;
import
org.gitlab.api.models.GitlabLabel
;
import
org.gitlab.api.models.GitlabMergeRequest
;
import
org.gitlab.api.models.GitlabMergeRequestApprovals
;
import
org.gitlab.api.models.GitlabMilestone
;
import
org.gitlab.api.models.GitlabNamespace
;
import
org.gitlab.api.models.GitlabNote
;
import
org.gitlab.api.models.GitlabProject
;
import
org.gitlab.api.models.GitlabProjectHook
;
import
org.gitlab.api.models.GitlabProjectMember
;
import
org.gitlab.api.models.GitlabProjectMerges
;
import
org.gitlab.api.models.GitlabRepositoryFile
;
import
org.gitlab.api.models.GitlabRepositoryTree
;
import
org.gitlab.api.models.GitlabSSHKey
;
import
org.gitlab.api.models.GitlabServiceEmailOnPush
;
import
org.gitlab.api.models.GitlabServiceJira
;
import
org.gitlab.api.models.GitlabSession
;
import
org.gitlab.api.models.GitlabSimpleRepositoryFile
;
import
org.gitlab.api.models.GitlabSystemHook
;
import
org.gitlab.api.models.GitlabTag
;
import
org.gitlab.api.models.GitlabTrigger
;
import
org.gitlab.api.models.GitlabUpload
;
import
org.gitlab.api.models.GitlabUser
;
import
org.gitlab.api.models.GitlabVersion
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.Serializable
;
import
java.io.UnsupportedEncodingException
;
import
java.net.Proxy
;
import
java.net.URL
;
import
java.net.URLEncoder
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.List
;
...
...
@@ -2994,4 +3039,26 @@ public class GitlabAPI {
String
tailUrl
=
GitlabProject
.
URL
+
"/"
+
projectId
+
"/"
+
GitlabMergeRequest
.
URL
+
"/"
+
mergeRequestId
+
"/time_stats"
;
return
retrieve
().
to
(
tailUrl
,
GitLabTimeTracking
.
class
);
}
/**
* 查询项目分支下最近一次变动信息
*
* @param qry 查询参数
*/
public
List
<
GitlabProjectMerges
>
getLatelyMergeInfo
(
GitabProjectLatelyChangeQry
qry
)
throws
IOException
{
Query
query
=
new
Pagination
()
.
withPage
(
qry
.
getPage
())
.
withPerPage
(
qry
.
getPrePage
()).
asQuery
();
query
.
appendIf
(
"state"
,
qry
.
getState
())
.
append
(
"target_branch"
,
qry
.
getTargetBranch
());
String
tailUrl
=
GitlabProject
.
URL
+
"/"
+
qry
.
getId
()
+
GitlabMergeRequest
.
URL
+
query
;
GitlabProjectMerges
[]
requests
=
retrieve
().
to
(
tailUrl
,
GitlabProjectMerges
[].
class
);
if
(
requests
==
null
||
requests
.
length
==
0
)
{
return
Collections
.
emptyList
();
}
return
Arrays
.
asList
(
requests
);
}
}
src/main/java/org/gitlab/api/models/GitabProjectLatelyChangeQry.java
0 → 100644
View file @
87fda5b9
package
org
.
gitlab
.
api
.
models
;
/**
* http://gitlab2.dui88.com/help/api/merge_requests.md
* List project merge requests
* 查询最近一个项目一个分支下最新代码变动查询条件封装对象
*
* Created by sunchangji on 2018/12/5.
*/
public
class
GitabProjectLatelyChangeQry
{
/**
* 项目id
*/
private
Integer
id
;
/**
* Return all merge requests or just those that are opened, closed, locked, or merged
*/
private
String
state
=
"merged"
;
/**
* Return merge requests with the given target branch
*/
private
String
targetBranch
;
/**
* 分页信息
*/
private
Integer
page
=
1
;
private
Integer
prePage
=
1
;
public
Integer
getId
()
{
return
id
;
}
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
public
String
getState
()
{
return
state
;
}
public
void
setState
(
String
state
)
{
this
.
state
=
state
;
}
public
String
getTargetBranch
()
{
return
targetBranch
;
}
public
void
setTargetBranch
(
String
targetBranch
)
{
this
.
targetBranch
=
targetBranch
;
}
public
Integer
getPage
()
{
return
page
;
}
public
void
setPage
(
Integer
page
)
{
this
.
page
=
page
;
}
public
Integer
getPrePage
()
{
return
prePage
;
}
public
void
setPrePage
(
Integer
prePage
)
{
this
.
prePage
=
prePage
;
}
}
src/main/java/org/gitlab/api/models/GitlabProjectMerges.java
0 → 100644
View file @
87fda5b9
package
org
.
gitlab
.
api
.
models
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
java.util.Date
;
/**
* http://gitlab2.dui88.com/help/api/merge_requests.md
* project merge requests
* Created by sunchangji on 2018/12/5.
*/
public
class
GitlabProjectMerges
{
@JsonProperty
(
"project_id"
)
private
Integer
projectId
;
private
String
state
;
private
String
title
;
private
String
description
;
@JsonProperty
(
"merged_at"
)
private
Date
mergedAt
;
@JsonProperty
(
"created_at"
)
private
Date
createdAt
;
@JsonProperty
(
"updated_at"
)
private
Date
updatedAt
;
@JsonProperty
(
"target_branch"
)
private
String
targetBranch
;
@JsonProperty
(
"source_branch"
)
private
String
sourceBranch
;
@JsonProperty
(
"source_project_id"
)
private
Integer
sourceProjectId
;
@JsonProperty
(
"target_project_id"
)
private
Integer
targetProjectId
;
/**
* 合并人信息,就是这个变动合并时谁合并的
*/
@JsonProperty
(
"merged_by"
)
private
GitlabUserSimpleInfo
mergedBy
;
/**
* 修改代码人员信息,也是提交合并请求人的信息
*/
private
GitlabUserSimpleInfo
author
;
/**
* 指订审核的人员信息
*/
private
GitlabUserSimpleInfo
assignee
;
public
Integer
getProjectId
()
{
return
projectId
;
}
public
void
setProjectId
(
Integer
projectId
)
{
this
.
projectId
=
projectId
;
}
public
String
getState
()
{
return
state
;
}
public
void
setState
(
String
state
)
{
this
.
state
=
state
;
}
public
String
getTitle
()
{
return
title
;
}
public
void
setTitle
(
String
title
)
{
this
.
title
=
title
;
}
public
String
getDescription
()
{
return
description
;
}
public
void
setDescription
(
String
description
)
{
this
.
description
=
description
;
}
public
Date
getMergedAt
()
{
return
mergedAt
;
}
public
void
setMergedAt
(
Date
mergedAt
)
{
this
.
mergedAt
=
mergedAt
;
}
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
String
getTargetBranch
()
{
return
targetBranch
;
}
public
void
setTargetBranch
(
String
targetBranch
)
{
this
.
targetBranch
=
targetBranch
;
}
public
String
getSourceBranch
()
{
return
sourceBranch
;
}
public
void
setSourceBranch
(
String
sourceBranch
)
{
this
.
sourceBranch
=
sourceBranch
;
}
public
Integer
getSourceProjectId
()
{
return
sourceProjectId
;
}
public
void
setSourceProjectId
(
Integer
sourceProjectId
)
{
this
.
sourceProjectId
=
sourceProjectId
;
}
public
Integer
getTargetProjectId
()
{
return
targetProjectId
;
}
public
void
setTargetProjectId
(
Integer
targetProjectId
)
{
this
.
targetProjectId
=
targetProjectId
;
}
public
GitlabUserSimpleInfo
getMergedBy
()
{
return
mergedBy
;
}
public
void
setMergedBy
(
GitlabUserSimpleInfo
mergedBy
)
{
this
.
mergedBy
=
mergedBy
;
}
public
GitlabUserSimpleInfo
getAuthor
()
{
return
author
;
}
public
void
setAuthor
(
GitlabUserSimpleInfo
author
)
{
this
.
author
=
author
;
}
public
GitlabUserSimpleInfo
getAssignee
()
{
return
assignee
;
}
public
void
setAssignee
(
GitlabUserSimpleInfo
assignee
)
{
this
.
assignee
=
assignee
;
}
}
src/main/java/org/gitlab/api/models/GitlabUserSimpleInfo.java
0 → 100644
View file @
87fda5b9
package
org
.
gitlab
.
api
.
models
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
/**
* Created by sunchangji on 2018/12/5.
*/
public
class
GitlabUserSimpleInfo
{
private
Integer
id
;
private
String
name
;
private
String
username
;
private
String
state
;
@JsonProperty
(
"avatar_url"
)
private
String
avatarUrl
;
@JsonProperty
(
"web_url"
)
private
String
webUrl
;
public
Integer
getId
()
{
return
id
;
}
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getUsername
()
{
return
username
;
}
public
void
setUsername
(
String
username
)
{
this
.
username
=
username
;
}
public
String
getState
()
{
return
state
;
}
public
void
setState
(
String
state
)
{
this
.
state
=
state
;
}
public
String
getAvatarUrl
()
{
return
avatarUrl
;
}
public
void
setAvatarUrl
(
String
avatarUrl
)
{
this
.
avatarUrl
=
avatarUrl
;
}
public
String
getWebUrl
()
{
return
webUrl
;
}
public
void
setWebUrl
(
String
webUrl
)
{
this
.
webUrl
=
webUrl
;
}
}
郭燕飞
💬
@gyf
mentioned in commit
7e7851f3
·
Aug 30, 2019
mentioned in commit
7e7851f3
mentioned in commit 7e7851f3ecf9ac1efdc5a0d2fe2a29a7635de6f7
Toggle commit list
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