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
b60c045d
Unverified
Commit
b60c045d
authored
Feb 09, 2024
by
Jérémie Bresson
Committed by
GitHub
Feb 09, 2024
Browse files
Update project model (#1088)
Fixes #1080
parent
d321fe52
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/gitlab4j/api/ProjectApi.java
View file @
b60c045d
...
...
@@ -1333,6 +1333,9 @@ public class ProjectApi extends AbstractApi implements Constants {
Visibility
visibility
=
(
project
.
getVisibility
()
!=
null
?
project
.
getVisibility
()
:
project
.
getPublic
()
==
Boolean
.
TRUE
?
Visibility
.
PUBLIC
:
null
);
formData
.
withParam
(
"visibility"
,
visibility
);
formData
.
withParam
(
"issue_branch_template"
,
project
.
getIssueBranchTemplate
());
formData
.
withParam
(
"merge_commit_template"
,
project
.
getMergeCommitTemplate
());
formData
.
withParam
(
"squash_commit_template"
,
project
.
getSquashCommitTemplate
());
if
(
project
.
getTagList
()
!=
null
&&
!
project
.
getTagList
().
isEmpty
())
{
formData
.
withParam
(
"tag_list"
,
String
.
join
(
","
,
project
.
getTagList
()));
...
...
src/main/java/org/gitlab4j/api/models/Namespace.java
View file @
b60c045d
...
...
@@ -12,6 +12,7 @@ public class Namespace implements Serializable {
private
String
path
;
private
String
kind
;
private
String
fullPath
;
private
Long
parentId
;
private
String
avatarUrl
;
private
String
webUrl
;
...
...
@@ -55,6 +56,14 @@ public class Namespace implements Serializable {
this
.
fullPath
=
fullPath
;
}
public
Long
getParentId
()
{
return
parentId
;
}
public
void
setParentId
(
Long
parentId
)
{
this
.
parentId
=
parentId
;
}
public
Namespace
withId
(
Long
id
)
{
this
.
id
=
id
;
return
this
;
...
...
src/main/java/org/gitlab4j/api/models/Project.java
View file @
b60c045d
...
...
@@ -2,6 +2,8 @@
package
org.gitlab4j.api.models
;
import
com.fasterxml.jackson.annotation.JsonCreator
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.fasterxml.jackson.annotation.JsonValue
;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
org.gitlab4j.api.Constants.AutoDevopsDeployStrategy
;
...
...
@@ -15,6 +17,7 @@ import org.gitlab4j.api.utils.JacksonJsonEnumHelper;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
public
class
Project
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
...
...
@@ -113,6 +116,11 @@ public class Project implements Serializable {
private
Boolean
emailsDisabled
;
private
String
suggestionCommitMessage
;
private
SquashOption
squashOption
;
private
String
mergeCommitTemplate
;
private
String
squashCommitTemplate
;
private
String
issueBranchTemplate
;
@JsonProperty
(
"_links"
)
private
Map
<
String
,
String
>
links
;
@JsonSerialize
(
using
=
JacksonJson
.
DateOnlySerializer
.
class
)
private
Date
markedForDeletionOn
;
...
...
@@ -917,4 +925,45 @@ public class Project implements Serializable {
this
.
squashOption
=
squashOption
;
return
this
;
}
public
String
getMergeCommitTemplate
()
{
return
mergeCommitTemplate
;
}
public
void
setMergeCommitTemplate
(
String
mergeCommitTemplate
)
{
this
.
mergeCommitTemplate
=
mergeCommitTemplate
;
}
public
String
getSquashCommitTemplate
()
{
return
squashCommitTemplate
;
}
public
void
setSquashCommitTemplate
(
String
squashCommitTemplate
)
{
this
.
squashCommitTemplate
=
squashCommitTemplate
;
}
public
String
getIssueBranchTemplate
()
{
return
issueBranchTemplate
;
}
public
void
setIssueBranchTemplate
(
String
issueBranchTemplate
)
{
this
.
issueBranchTemplate
=
issueBranchTemplate
;
}
public
Map
<
String
,
String
>
getLinks
()
{
return
links
;
}
public
void
setLinks
(
Map
<
String
,
String
>
links
)
{
this
.
links
=
links
;
}
@JsonIgnore
public
String
getLinkByName
(
String
name
)
{
if
(
links
==
null
||
links
.
isEmpty
())
{
return
(
null
);
}
return
(
links
.
get
(
name
));
}
}
src/test/resources/org/gitlab4j/api/project.json
View file @
b60c045d
{
"id"
:
3
,
"default_branch"
:
"master"
,
"public"
:
false
,
"visibility"
:
"private"
,
"ssh_url_to_repo"
:
"git@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"
,
"readme_url"
:
"http://example.com/diaspora/diaspora-project-site/blob/master/README.md"
,
"tag_list"
:
[
"example"
,
"disapora project"
],
"owner"
:
{
"id"
:
3
,
"name"
:
"Diaspora"
,
"created_at"
:
"2013-09-30T13:46:02Z"
"id"
:
3
,
"description"
:
"Some description"
,
"name"
:
"Diaspora Project Site"
,
"name_with_namespace"
:
"Diaspora / Diaspora Project Site"
,
"path"
:
"diaspora-project-site"
,
"path_with_namespace"
:
"diaspora/diaspora-project-site"
,
"created_at"
:
"2013-09-30T13:46:02Z"
,
"default_branch"
:
"master"
,
"tag_list"
:
[
"example"
,
"disapora project"
],
"topics"
:
[
],
"ssh_url_to_repo"
:
"git@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"
,
"readme_url"
:
"http://example.com/diaspora/diaspora-project-site/blob/master/README.md"
,
"forks_count"
:
0
,
"avatar_url"
:
"http://example.com/uploads/project/avatar/3/uploads/avatar.png"
,
"star_count"
:
0
,
"last_activity_at"
:
"2013-09-30T13:46:02Z"
,
"namespace"
:
{
"id"
:
3
,
"name"
:
"Diaspora"
,
"path"
:
"diaspora"
,
"kind"
:
"group"
,
"full_path"
:
"diaspora"
,
"parent_id"
:
4
,
"avatar_url"
:
"http://localhost:3000/uploads/group/avatar/3/foo.jpg"
,
"web_url"
:
"http://localhost:3000/groups/diaspora"
},
"name"
:
"Diaspora Project Site"
,
"name_with_namespace"
:
"Diaspora / Diaspora Project Site"
,
"path"
:
"diaspora-project-site"
,
"path_with_namespace"
:
"diaspora/diaspora-project-site"
,
"issues_enabled"
:
true
,
"open_issues_count"
:
1
,
"merge_requests_enabled"
:
true
,
"jobs_enabled"
:
true
,
"wiki_enabled"
:
true
,
"snippets_enabled"
:
false
,
"can_create_merge_request_in"
:
true
,
"resolve_outdated_diff_discussions"
:
false
,
"container_registry_enabled"
:
false
,
"created_at"
:
"2013-09-30T13:46:02Z"
,
"last_activity_at"
:
"2013-09-30T13:46:02Z"
,
"creator_id"
:
3
,
"namespace"
:
{
"id"
:
3
,
"name"
:
"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"
"_links"
:
{
"self"
:
"https://example.com/api/v4/projects/3"
,
"issues"
:
"https://example.com/api/v4/projects/3/issues"
,
"merge_requests"
:
"https://example.com/api/v4/projects/3/merge_requests"
,
"repo_branches"
:
"https://example.com/api/v4/projects/3/repository/branches"
,
"labels"
:
"https://example.com/api/v4/projects/3/labels"
,
"events"
:
"https://example.com/api/v4/projects/3/events"
,
"members"
:
"https://example.com/api/v4/projects/3/members"
,
"cluster_agents"
:
"https://example.com/api/v4/projects/3/cluster_agents"
},
"import_status"
:
"none"
,
"permissions"
:
{
"project_access"
:
{
"access_level"
:
10
,
"notification_level"
:
3
},
"group_access"
:
{
"access_level"
:
50
,
"notification_level"
:
3
"packages_enabled"
:
true
,
"empty_repo"
:
false
,
"archived"
:
false
,
"visibility"
:
"private"
,
"owner"
:
{
"id"
:
3
,
"username"
:
"user1234"
,
"name"
:
"Diaspora"
,
"state"
:
"active"
,
"avatar_url"
:
"https://secure.gravatar.com/avatar/9b7126c28ab977c4c4a351df3a1d1d24?s=80&d=identicon"
,
"web_url"
:
"https://example.com/user1234"
,
"created_at"
:
"2013-09-30T13:46:02Z"
},
"resolve_outdated_diff_discussions"
:
false
,
"issues_enabled"
:
true
,
"merge_requests_enabled"
:
true
,
"wiki_enabled"
:
true
,
"jobs_enabled"
:
true
,
"snippets_enabled"
:
false
,
"container_registry_enabled"
:
false
,
"can_create_merge_request_in"
:
true
,
"emails_disabled"
:
false
,
"shared_runners_enabled"
:
true
,
"lfs_enabled"
:
true
,
"creator_id"
:
3
,
"open_issues_count"
:
1
,
"ci_default_git_depth"
:
50
,
"ci_forward_deployment_enabled"
:
true
,
"build_git_strategy"
:
"fetch"
,
"runners_token"
:
"b8bc4a7a29eb76ea83cf79e4908c2b"
,
"auto_devops_enabled"
:
true
,
"auto_devops_deploy_strategy"
:
"continuous"
,
"ci_config_path"
:
""
,
"public_jobs"
:
true
,
"shared_with_groups"
:
[
{
"group_id"
:
4
,
"group_name"
:
"Twitter"
,
"group_full_path"
:
"twitter"
,
"group_access_level"
:
30
,
"expires_at"
:
"2023-11-19"
},
{
"group_id"
:
3
,
"group_name"
:
"Gitlab Org"
,
"group_full_path"
:
"gitlab-org"
,
"group_access_level"
:
10
,
"expires_at"
:
"2023-11-19"
}
],
"only_allow_merge_if_pipeline_succeeds"
:
false
,
"allow_merge_on_skipped_pipeline"
:
true
,
"request_access_enabled"
:
false
,
"only_allow_merge_if_all_discussions_are_resolved"
:
false
,
"remove_source_branch_after_merge"
:
false
,
"printing_merge_request_link_enabled"
:
true
,
"merge_method"
:
"merge"
,
"squash_option"
:
"default_off"
,
"suggestion_commit_message"
:
"Apply suggestions"
,
"merge_commit_template"
:
"Merge branch '%{source_branch}' into '%{target_branch}'"
,
"squash_commit_template"
:
"Commit %{title}"
,
"issue_branch_template"
:
"issue-%{id}"
,
"autoclose_referenced_issues"
:
true
,
"permissions"
:
{
"project_access"
:
{
"access_level"
:
10
,
"notification_level"
:
3
}
},
"archived"
:
false
,
"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"
"public"
:
false
,
"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
,
"forks_count"
:
0
,
"star_count"
:
0
,
"runners_token"
:
"b8bc4a7a29eb76ea83cf79e4908c2b"
,
"ci_default_git_depth"
:
50
,
"public_jobs"
:
true
,
"shared_with_groups"
:
[
{
"group_id"
:
4
,
"group_name"
:
"Twitter"
,
"group_full_path"
:
"twitter"
,
"group_access_level"
:
30
,
"expires_at"
:
"2023-11-19"
},
{
"group_id"
:
3
,
"group_name"
:
"Gitlab Org"
,
"group_full_path"
:
"gitlab-org"
,
"group_access_level"
:
10
,
"expires_at"
:
"2023-11-19"
}
],
"repository_storage"
:
"default"
,
"only_allow_merge_if_pipeline_succeeds"
:
false
,
"only_allow_merge_if_all_discussions_are_resolved"
:
false
,
"remove_source_branch_after_merge"
:
false
,
"request_access_enabled"
:
false
,
"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"
:
{
"commit_count"
:
37
,
"storage_size"
:
1038090
,
"repository_size"
:
1038090
,
"wiki_size"
:
0
,
"lfs_objects_size"
:
0
,
"job_artifacts_size"
:
0
,
"packages_size"
:
0
"repository_storage"
:
"default"
,
"approvals_before_merge"
:
0
,
"marked_for_deletion_on"
:
"2020-04-03"
,
"statistics"
:
{
"commit_count"
:
37
,
"storage_size"
:
1038090
,
"repository_size"
:
1038090
,
"wiki_size"
:
0
,
"lfs_objects_size"
:
0
,
"job_artifacts_size"
:
0
,
"packages_size"
:
0
},
"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