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
e380c5ad
Commit
e380c5ad
authored
Mar 08, 2014
by
Paul Weingardt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added GitlabIssue (only get issues and notes for a project)
parent
5daa647d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
167 additions
and
2 deletions
+167
-2
GitlabAPI.java
src/main/java/org/gitlab/api/GitlabAPI.java
+20
-0
GitlabHTTPRequestor.java
src/main/java/org/gitlab/api/http/GitlabHTTPRequestor.java
+0
-2
GitlabIssue.java
src/main/java/org/gitlab/api/models/GitlabIssue.java
+128
-0
GitlabSession.java
src/main/java/org/gitlab/api/models/GitlabSession.java
+19
-0
No files found.
src/main/java/org/gitlab/api/GitlabAPI.java
View file @
e380c5ad
...
...
@@ -5,10 +5,12 @@ import org.codehaus.jackson.map.ObjectMapper;
import
org.gitlab.api.http.GitlabHTTPRequestor
;
import
org.gitlab.api.models.GitlabBranch
;
import
org.gitlab.api.models.GitlabCommit
;
import
org.gitlab.api.models.GitlabIssue
;
import
org.gitlab.api.models.GitlabMergeRequest
;
import
org.gitlab.api.models.GitlabNote
;
import
org.gitlab.api.models.GitlabProject
;
import
org.gitlab.api.models.GitlabProjectHook
;
import
org.gitlab.api.models.GitlabSession
;
import
java.io.IOException
;
import
java.net.URL
;
...
...
@@ -34,6 +36,13 @@ public class GitlabAPI {
_hostUrl
=
hostUrl
.
endsWith
(
"/"
)
?
hostUrl
.
replaceAll
(
"/$"
,
""
)
:
hostUrl
;
_apiToken
=
apiToken
;
}
public
static
GitlabSession
connect
(
String
hostUrl
,
String
username
,
String
password
)
throws
IOException
{
String
tailUrl
=
GitlabSession
.
URL
;
GitlabAPI
api
=
connect
(
hostUrl
,
null
);
return
api
.
dispatch
().
with
(
"login"
,
username
).
with
(
"password"
,
password
)
.
to
(
tailUrl
,
GitlabSession
.
class
);
}
public
static
GitlabAPI
connect
(
String
hostUrl
,
String
apiToken
)
{
return
new
GitlabAPI
(
hostUrl
,
apiToken
);
...
...
@@ -244,4 +253,15 @@ public class GitlabAPI {
GitlabMergeRequest
[]
mergeRequests
=
retrieve
().
to
(
tailUrl
,
GitlabMergeRequest
[].
class
);
return
Arrays
.
asList
(
mergeRequests
);
}
public
List
<
GitlabIssue
>
getIssues
(
GitlabProject
project
)
throws
IOException
{
String
tailUrl
=
GitlabProject
.
URL
+
"/"
+
project
.
getId
()
+
GitlabIssue
.
URL
;
return
Arrays
.
asList
(
retrieve
().
to
(
tailUrl
,
GitlabIssue
[].
class
));
}
public
List
<
GitlabNote
>
getNotes
(
GitlabIssue
issue
)
throws
IOException
{
String
tailUrl
=
GitlabProject
.
URL
+
"/"
+
issue
.
getProjectId
()
+
GitlabIssue
.
URL
+
"/"
+
issue
.
getId
()
+
GitlabNote
.
URL
;
return
Arrays
.
asList
(
retrieve
().
to
(
tailUrl
,
GitlabNote
[].
class
));
}
}
src/main/java/org/gitlab/api/http/GitlabHTTPRequestor.java
View file @
e380c5ad
...
...
@@ -149,7 +149,6 @@ public class GitlabHTTPRequestor {
}
}
@Override
public
boolean
hasNext
()
{
fetch
();
if
(
_next
.
getClass
().
isArray
())
{
...
...
@@ -160,7 +159,6 @@ public class GitlabHTTPRequestor {
}
}
@Override
public
T
next
()
{
fetch
();
T
record
=
_next
;
...
...
src/main/java/org/gitlab/api/models/GitlabIssue.java
0 → 100644
View file @
e380c5ad
package
org
.
gitlab
.
api
.
models
;
import
java.util.Date
;
import
org.codehaus.jackson.annotate.JsonProperty
;
public
class
GitlabIssue
{
public
static
final
String
URL
=
"/issues"
;
private
int
_id
;
private
int
_iid
;
@JsonProperty
(
"project_id"
)
private
int
_projectId
;
private
String
_title
;
private
String
_description
;
private
String
[]
_labels
;
private
String
_milestone
;
private
GitlabUser
_assignee
;
private
GitlabUser
_author
;
private
String
_state
;
@JsonProperty
(
"updated_at"
)
private
Date
_updatedAt
;
@JsonProperty
(
"created_at"
)
private
Date
_createdAt
;
public
int
getId
()
{
return
_id
;
}
public
void
setId
(
int
id
)
{
_id
=
id
;
}
public
int
getIid
()
{
return
_iid
;
}
public
void
setIid
(
int
iid
)
{
_iid
=
iid
;
}
public
int
getProjectId
()
{
return
_projectId
;
}
public
void
setProjectId
(
int
projectId
)
{
_projectId
=
projectId
;
}
public
String
getTitle
()
{
return
_title
;
}
public
void
setTitle
(
String
title
)
{
_title
=
title
;
}
public
String
getDescription
()
{
return
_description
;
}
public
void
setDescription
(
String
description
)
{
_description
=
description
;
}
public
String
[]
getLabels
()
{
return
_labels
;
}
public
void
setLabels
(
String
[]
labels
)
{
_labels
=
labels
;
}
public
String
getMilestone
()
{
return
_milestone
;
}
public
void
setMilestone
(
String
milestone
)
{
_milestone
=
milestone
;
}
public
GitlabUser
getAssignee
()
{
return
_assignee
;
}
public
void
setAssignee
(
GitlabUser
assignee
)
{
_assignee
=
assignee
;
}
public
GitlabUser
getAuthor
()
{
return
_author
;
}
public
void
setAuthor
(
GitlabUser
author
)
{
_author
=
author
;
}
public
String
getState
()
{
return
_state
;
}
public
void
setState
(
String
state
)
{
_state
=
state
;
}
public
Date
getUpdatedAt
()
{
return
_updatedAt
;
}
public
void
setUpdatedAt
(
Date
updatedAt
)
{
_updatedAt
=
updatedAt
;
}
public
Date
getCreatedAt
()
{
return
_createdAt
;
}
public
void
setCreatedAt
(
Date
createdAt
)
{
_createdAt
=
createdAt
;
}
}
src/main/java/org/gitlab/api/models/GitlabSession.java
0 → 100644
View file @
e380c5ad
package
org
.
gitlab
.
api
.
models
;
import
org.codehaus.jackson.annotate.JsonProperty
;
public
class
GitlabSession
extends
GitlabUser
{
public
static
final
String
URL
=
"/session"
;
@JsonProperty
(
"private_token"
)
private
String
_privateToken
;
public
String
getPrivateToken
()
{
return
_privateToken
;
}
public
void
setPrivateToken
(
String
privateToken
)
{
_privateToken
=
privateToken
;
}
}
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