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
32bf9344
Unverified
Commit
32bf9344
authored
Mar 25, 2021
by
Gautier de Saint Martin Lacaze
Committed by
GitHub
Mar 25, 2021
Browse files
Merge pull request #675 from gitlab4j/issue-613
feat: Add various fields to project model
parents
40066545
645d5fb6
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/gitlab4j/api/Constants.java
View file @
32bf9344
...
@@ -848,5 +848,26 @@ public interface Constants {
...
@@ -848,5 +848,26 @@ public interface Constants {
return
(
enumHelper
.
toString
(
this
));
return
(
enumHelper
.
toString
(
this
));
}
}
}
}
enum
AutoDevopsDeployStrategy
{
CONTINUOUS
,
MANUAL
,
TIMED_INCREMENTAL
;
private
static
JacksonJsonEnumHelper
<
AutoDevopsDeployStrategy
>
enumHelper
=
new
JacksonJsonEnumHelper
<>(
AutoDevopsDeployStrategy
.
class
);
@JsonCreator
public
static
AutoDevopsDeployStrategy
forValue
(
String
value
)
{
return
enumHelper
.
forValue
(
value
);
}
@JsonValue
public
String
toValue
()
{
return
(
enumHelper
.
toString
(
this
));
}
@Override
public
String
toString
()
{
return
(
enumHelper
.
toString
(
this
));
}
}
}
}
src/main/java/org/gitlab4j/api/models/Namespace.java
View file @
32bf9344
...
@@ -9,6 +9,8 @@ public class Namespace {
...
@@ -9,6 +9,8 @@ public class Namespace {
private
String
path
;
private
String
path
;
private
String
kind
;
private
String
kind
;
private
String
fullPath
;
private
String
fullPath
;
private
String
avatarUrl
;
private
String
webUrl
;
public
Integer
getId
()
{
public
Integer
getId
()
{
return
this
.
id
;
return
this
.
id
;
...
@@ -75,6 +77,22 @@ public class Namespace {
...
@@ -75,6 +77,22 @@ public class Namespace {
return
this
;
return
this
;
}
}
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
;
}
@Override
@Override
public
String
toString
()
{
public
String
toString
()
{
return
(
JacksonJson
.
toJsonString
(
this
));
return
(
JacksonJson
.
toJsonString
(
this
));
...
...
src/main/java/org/gitlab4j/api/models/Project.java
View file @
32bf9344
...
@@ -4,7 +4,10 @@ package org.gitlab4j.api.models;
...
@@ -4,7 +4,10 @@ package org.gitlab4j.api.models;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
org.gitlab4j.api.Constants.AutoDevopsDeployStrategy
;
import
org.gitlab4j.api.Constants.BuildGitStrategy
;
import
org.gitlab4j.api.ProjectLicense
;
import
org.gitlab4j.api.ProjectLicense
;
import
org.gitlab4j.api.models.ImportStatus.Status
;
import
org.gitlab4j.api.utils.JacksonJson
;
import
org.gitlab4j.api.utils.JacksonJson
;
import
org.gitlab4j.api.utils.JacksonJsonEnumHelper
;
import
org.gitlab4j.api.utils.JacksonJsonEnumHelper
;
...
@@ -12,8 +15,6 @@ import com.fasterxml.jackson.annotation.JsonCreator;
...
@@ -12,8 +15,6 @@ import com.fasterxml.jackson.annotation.JsonCreator;
import
com.fasterxml.jackson.annotation.JsonValue
;
import
com.fasterxml.jackson.annotation.JsonValue
;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
org.gitlab4j.api.Constants.BuildGitStrategy
;
public
class
Project
{
public
class
Project
{
// Enum for the merge_method of the Project instance.
// Enum for the merge_method of the Project instance.
...
@@ -94,6 +95,15 @@ public class Project {
...
@@ -94,6 +95,15 @@ public class Project {
private
List
<
CustomAttribute
>
customAttributes
;
private
List
<
CustomAttribute
>
customAttributes
;
private
String
buildCoverageRegex
;
private
String
buildCoverageRegex
;
private
BuildGitStrategy
buildGitStrategy
;
private
BuildGitStrategy
buildGitStrategy
;
private
String
readmeUrl
;
private
Boolean
canCreateMergeRequestIn
;
private
Status
importStatus
;
private
Integer
ciDefaultGitDepth
;
private
Boolean
removeSourceBranchAfterMerge
;
private
Boolean
autoDevopsEnabled
;
private
AutoDevopsDeployStrategy
autoDevopsDeployStrategy
;
private
Boolean
autocloseReferencedIssues
;
private
Boolean
emailsDisabled
;
@JsonSerialize
(
using
=
JacksonJson
.
DateOnlySerializer
.
class
)
@JsonSerialize
(
using
=
JacksonJson
.
DateOnlySerializer
.
class
)
private
Date
markedForDeletionOn
;
private
Date
markedForDeletionOn
;
...
@@ -736,4 +746,81 @@ public class Project {
...
@@ -736,4 +746,81 @@ public class Project {
this
.
buildGitStrategy
=
buildGitStrategy
;
this
.
buildGitStrategy
=
buildGitStrategy
;
return
this
;
return
this
;
}
}
public
String
getReadmeUrl
()
{
return
readmeUrl
;
}
public
void
setReadmeUrl
(
String
readmeUrl
)
{
this
.
readmeUrl
=
readmeUrl
;
}
public
Boolean
getCanCreateMergeRequestIn
()
{
return
canCreateMergeRequestIn
;
}
public
void
setCanCreateMergeRequestIn
(
Boolean
canCreateMergeRequestIn
)
{
this
.
canCreateMergeRequestIn
=
canCreateMergeRequestIn
;
}
public
Status
getImportStatus
()
{
return
importStatus
;
}
public
void
setImportStatus
(
Status
importStatus
)
{
this
.
importStatus
=
importStatus
;
}
public
Integer
getCiDefaultGitDepth
()
{
return
ciDefaultGitDepth
;
}
public
void
setCiDefaultGitDepth
(
Integer
ciDefaultGitDepth
)
{
this
.
ciDefaultGitDepth
=
ciDefaultGitDepth
;
}
public
Boolean
getRemoveSourceBranchAfterMerge
()
{
return
removeSourceBranchAfterMerge
;
}
public
void
setRemoveSourceBranchAfterMerge
(
Boolean
removeSourceBranchAfterMerge
)
{
this
.
removeSourceBranchAfterMerge
=
removeSourceBranchAfterMerge
;
}
public
Boolean
getAutoDevopsEnabled
()
{
return
autoDevopsEnabled
;
}
public
void
setAutoDevopsEnabled
(
Boolean
autoDevopsEnabled
)
{
this
.
autoDevopsEnabled
=
autoDevopsEnabled
;
}
public
AutoDevopsDeployStrategy
getAutoDevopsDeployStrategy
()
{
return
autoDevopsDeployStrategy
;
}
public
void
setAutoDevopsDeployStrategy
(
AutoDevopsDeployStrategy
autoDevopsDeployStrategy
)
{
this
.
autoDevopsDeployStrategy
=
autoDevopsDeployStrategy
;
}
public
Boolean
getAutocloseReferencedIssues
()
{
return
autocloseReferencedIssues
;
}
public
void
setAutocloseReferencedIssues
(
Boolean
autocloseReferencedIssues
)
{
this
.
autocloseReferencedIssues
=
autocloseReferencedIssues
;
}
public
Boolean
getEmailsDisabled
()
{
return
emailsDisabled
;
}
public
void
setEmailsDisabled
(
Boolean
emailsDisabled
)
{
this
.
emailsDisabled
=
emailsDisabled
;
}
public
Project
withEmailsDisabled
(
Boolean
emailsDisabled
)
{
this
.
emailsDisabled
=
emailsDisabled
;
return
this
;
}
}
}
src/main/java/org/gitlab4j/api/models/ProjectSharedGroup.java
View file @
32bf9344
...
@@ -3,9 +3,10 @@ package org.gitlab4j.api.models;
...
@@ -3,9 +3,10 @@ package org.gitlab4j.api.models;
import
org.gitlab4j.api.utils.JacksonJson
;
import
org.gitlab4j.api.utils.JacksonJson
;
public
class
ProjectSharedGroup
{
public
class
ProjectSharedGroup
{
private
Integer
groupId
;
private
Integer
groupId
;
private
String
groupName
;
private
String
groupName
;
private
String
groupFullPath
;
private
AccessLevel
groupAccessLevel
;
private
AccessLevel
groupAccessLevel
;
public
int
getGroupId
()
{
public
int
getGroupId
()
{
...
@@ -32,6 +33,14 @@ public class ProjectSharedGroup {
...
@@ -32,6 +33,14 @@ public class ProjectSharedGroup {
this
.
groupAccessLevel
=
accessLevel
;
this
.
groupAccessLevel
=
accessLevel
;
}
}
public
String
getGroupFullPath
()
{
return
groupFullPath
;
}
public
void
setGroupFullPath
(
String
groupFullPath
)
{
this
.
groupFullPath
=
groupFullPath
;
}
@Override
@Override
public
String
toString
()
{
public
String
toString
()
{
return
(
JacksonJson
.
toJsonString
(
this
));
return
(
JacksonJson
.
toJsonString
(
this
));
...
...
src/main/java/org/gitlab4j/api/models/ProjectStatistics.java
View file @
32bf9344
...
@@ -16,6 +16,7 @@ public class ProjectStatistics {
...
@@ -16,6 +16,7 @@ public class ProjectStatistics {
long
wikiSize
;
long
wikiSize
;
long
lfsObjectsSize
;
long
lfsObjectsSize
;
long
jobArtifactsSize
;
long
jobArtifactsSize
;
long
packagesSize
;
public
long
getCommitCount
()
{
public
long
getCommitCount
()
{
return
commitCount
;
return
commitCount
;
...
@@ -65,6 +66,14 @@ public class ProjectStatistics {
...
@@ -65,6 +66,14 @@ public class ProjectStatistics {
this
.
jobArtifactsSize
=
jobArtifactsSize
;
this
.
jobArtifactsSize
=
jobArtifactsSize
;
}
}
public
long
getPackagesSize
()
{
return
packagesSize
;
}
public
void
setPackagesSize
(
long
packagesSize
)
{
this
.
packagesSize
=
packagesSize
;
}
@Override
@Override
public
String
toString
()
{
public
String
toString
()
{
return
(
JacksonJson
.
toJsonString
(
this
));
return
(
JacksonJson
.
toJsonString
(
this
));
...
...
src/test/resources/org/gitlab4j/api/project.json
View file @
32bf9344
...
@@ -2,10 +2,11 @@
...
@@ -2,10 +2,11 @@
"id"
:
3
,
"id"
:
3
,
"default_branch"
:
"master"
,
"default_branch"
:
"master"
,
"public"
:
false
,
"public"
:
false
,
"visibility
_level"
:
0
,
"visibility
"
:
"private"
,
"ssh_url_to_repo"
:
"git@example.com:diaspora/diaspora-project-site.git"
,
"ssh_url_to_repo"
:
"git@example.com:diaspora/diaspora-project-site.git"
,
"http_url_to_repo"
:
"http://example.com/diaspora/diaspora-project-site.git"
,
"http_url_to_repo"
:
"http://example.com/diaspora/diaspora-project-site.git"
,
"web_url"
:
"http://example.com/diaspora/diaspora-project-site"
,
"web_url"
:
"http://example.com/diaspora/diaspora-project-site"
,
"readme_url"
:
"http://example.com/diaspora/diaspora-project-site/blob/master/README.md"
,
"tag_list"
:
[
"tag_list"
:
[
"example"
,
"example"
,
"disapora project"
"disapora project"
...
@@ -25,6 +26,8 @@
...
@@ -25,6 +26,8 @@
"jobs_enabled"
:
true
,
"jobs_enabled"
:
true
,
"wiki_enabled"
:
true
,
"wiki_enabled"
:
true
,
"snippets_enabled"
:
false
,
"snippets_enabled"
:
false
,
"can_create_merge_request_in"
:
true
,
"resolve_outdated_diff_discussions"
:
false
,
"container_registry_enabled"
:
false
,
"container_registry_enabled"
:
false
,
"created_at"
:
"2013-09-30T13:46:02Z"
,
"created_at"
:
"2013-09-30T13:46:02Z"
,
"last_activity_at"
:
"2013-09-30T13:46:02Z"
,
"last_activity_at"
:
"2013-09-30T13:46:02Z"
,
...
@@ -32,8 +35,13 @@
...
@@ -32,8 +35,13 @@
"namespace"
:
{
"namespace"
:
{
"id"
:
3
,
"id"
:
3
,
"name"
:
"Diaspora"
,
"name"
:
"Diaspora"
,
"path"
:
"diaspora"
"path"
:
"diaspora"
,
"kind"
:
"group"
,
"full_path"
:
"diaspora"
,
"avatar_url"
:
"http://localhost:3000/uploads/group/avatar/3/foo.jpg"
,
"web_url"
:
"http://localhost:3000/groups/diaspora"
},
},
"import_status"
:
"none"
,
"permissions"
:
{
"permissions"
:
{
"project_access"
:
{
"project_access"
:
{
"access_level"
:
10
,
"access_level"
:
10
,
...
@@ -44,47 +52,56 @@
...
@@ -44,47 +52,56 @@
"notification_level"
:
3
"notification_level"
:
3
}
}
},
},
"empty_repo"
:
true
,
"archived"
:
false
,
"archived"
:
false
,
"avatar_url"
:
"http://example.com/uploads/project/avatar/3/uploads/avatar.png"
,
"avatar_url"
:
"http://example.com/uploads/project/avatar/3/uploads/avatar.png"
,
"license_url"
:
"http://example.com/diaspora/diaspora-client/blob/master/LICENSE"
,
"license"
:
{
"key"
:
"lgpl-3.0"
,
"name"
:
"GNU Lesser General Public License v3.0"
,
"nickname"
:
"GNU LGPLv3"
,
"html_url"
:
"http://choosealicense.com/licenses/lgpl-3.0/"
,
"source_url"
:
"http://www.gnu.org/licenses/lgpl-3.0.txt"
},
"shared_runners_enabled"
:
true
,
"shared_runners_enabled"
:
true
,
"forks_count"
:
0
,
"forks_count"
:
0
,
"star_count"
:
0
,
"star_count"
:
0
,
"runners_token"
:
"b8bc4a7a29eb76ea83cf79e4908c2b"
,
"runners_token"
:
"b8bc4a7a29eb76ea83cf79e4908c2b"
,
"ci_default_git_depth"
:
50
,
"public_jobs"
:
true
,
"public_jobs"
:
true
,
"shared_with_groups"
:
[
"shared_with_groups"
:
[
{
{
"group_id"
:
4
,
"group_id"
:
4
,
"group_name"
:
"Twitter"
,
"group_name"
:
"Twitter"
,
"group_full_path"
:
"twitter"
,
"group_access_level"
:
30
"group_access_level"
:
30
},
},
{
{
"group_id"
:
3
,
"group_id"
:
3
,
"group_name"
:
"Gitlab Org"
,
"group_name"
:
"Gitlab Org"
,
"group_full_path"
:
"gitlab-org"
,
"group_access_level"
:
10
"group_access_level"
:
10
}
}
],
],
"repository_storage"
:
"default"
,
"repository_storage"
:
"default"
,
"only_allow_merge_if_pipeline_succeeds"
:
false
,
"only_allow_merge_if_pipeline_succeeds"
:
false
,
"only_allow_merge_if_all_discussions_are_resolved"
:
false
,
"only_allow_merge_if_all_discussions_are_resolved"
:
false
,
"remove_source_branch_after_merge"
:
false
,
"request_access_enabled"
:
false
,
"request_access_enabled"
:
false
,
"merge_method"
:
"merge"
,
"merge_method"
:
"merge"
,
"auto_devops_enabled"
:
true
,
"auto_devops_deploy_strategy"
:
"continuous"
,
"approvals_before_merge"
:
0
,
"packages_enabled"
:
true
,
"autoclose_referenced_issues"
:
true
,
"marked_for_deletion_on"
:
"2020-04-03"
,
"statistics"
:
{
"statistics"
:
{
"commit_count"
:
9827
,
"commit_count"
:
37
,
"storage_size"
:
169043997645
,
"storage_size"
:
1038090
,
"repository_size"
:
388717608
,
"repository_size"
:
1038090
,
"wiki_size"
:
52428
,
"wiki_size"
:
0
,
"lfs_objects_size"
:
2118052893
,
"lfs_objects_size"
:
0
,
"job_artifacts_size"
:
166537174716
"job_artifacts_size"
:
0
,
},
"packages_size"
:
0
"marked_for_deletion_on"
:
"2016-06-17"
,
"license_url"
:
"http://example.com/diaspora/diaspora-client/blob/master/LICENSE"
,
"license"
:
{
"key"
:
"lgpl-3.0"
,
"name"
:
"GNU Lesser General Public License v3.0"
,
"nickname"
:
"GNU LGPLv3"
,
"html_url"
:
"http://choosealicense.com/licenses/lgpl-3.0/"
,
"source_url"
:
"http://www.gnu.org/licenses/lgpl-3.0.txt"
},
},
"custom_attributes"
:
[]
"custom_attributes"
:
[]
}
}
\ No newline at end of file
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