From 6deb9e9c443895c2aeab690a41714f706a524039 Mon Sep 17 00:00:00 2001 From: Ruben Vitt Date: Wed, 15 Aug 2018 09:47:06 +0200 Subject: [PATCH 1/7] add fluent api to event-model --- .../java/org/gitlab4j/api/models/Event.java | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/src/main/java/org/gitlab4j/api/models/Event.java b/src/main/java/org/gitlab4j/api/models/Event.java index c88a91260..6c5405d68 100644 --- a/src/main/java/org/gitlab4j/api/models/Event.java +++ b/src/main/java/org/gitlab4j/api/models/Event.java @@ -140,4 +140,64 @@ public PushData getPushData() { public void setPushData(PushData pushData) { this.pushData = pushData; } + + public Event withActionName(String actionName) { + this.actionName = actionName; + return this; + } + + public Event withAuthor(Author author) { + this.author = author; + return this; + } + + public Event withAuthorId(Integer authorId) { + this.authorId = authorId; + return this; + } + + public Event withAuthorUsername(String authorUsername) { + this.authorUsername = authorUsername; + return this; + } + + public Event withData(EventData data) { + this.data = data; + return this; + } + + public Event withProjectId(Integer projectId) { + this.projectId = projectId; + return this; + } + + public Event withTargetId(Integer targetId) { + this.targetId = targetId; + return this; + } + + public Event withTargetIid(Integer targetIid) { + this.targetIid = targetIid; + return this; + } + + public Event withTargetTitle(String targetTitle) { + this.targetTitle = targetTitle; + return this; + } + + public Event withTargetType(TargetType targetType) { + this.targetType = targetType; + return this; + } + + public Event withTitle(String title) { + this.title = title; + return this; + } + + public Event withCreatedAt(Date createdAt) { + this.createdAt = createdAt; + return this; + } } From fe9aa21dba665a5358c96c94af1aea13767842dd Mon Sep 17 00:00:00 2001 From: Ruben Vitt Date: Wed, 15 Aug 2018 09:48:54 +0200 Subject: [PATCH 2/7] add fluent api to commit-model --- .../java/org/gitlab4j/api/models/Commit.java | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) diff --git a/src/main/java/org/gitlab4j/api/models/Commit.java b/src/main/java/org/gitlab4j/api/models/Commit.java index c62fef676..1de225c24 100644 --- a/src/main/java/org/gitlab4j/api/models/Commit.java +++ b/src/main/java/org/gitlab4j/api/models/Commit.java @@ -165,4 +165,90 @@ public String getUrl() { public void setUrl(String url) { this.url = url; } + + + public Commit withAuthor(Author author) { + this.author = author; + return this; + } + + public Commit withAuthoredDate(Date authoredDate) { + this.authoredDate = authoredDate; + return this; + } + + public Commit withAuthorEmail(String authorEmail) { + this.authorEmail = authorEmail; + return this; + } + + public Commit withAuthorName(String authorName) { + this.authorName = authorName; + return this; + } + + public Commit withCommittedDate(Date committedDate) { + this.committedDate = committedDate; + return this; + } + + public Commit withCommitterEmail(String committerEmail) { + this.committerEmail = committerEmail; + return this; + } + + public Commit withCommitterName(String committerName) { + this.committerName = committerName; + return this; + } + + public Commit withCreatedAt(Date createdAt) { + this.createdAt = createdAt; + return this; + } + + public Commit withId(String id) { + this.id = id; + return this; + } + + public Commit withMessage(String message) { + this.message = message; + return this; + } + + public Commit withParentIds(List parentIds) { + this.parentIds = parentIds; + return this; + } + + public Commit withShorwId(String shortId) { + this.shortId = shortId; + return this; + } + + public Commit withStats(CommitStats stats) { + this.stats = stats; + return this; + } + + public Commit withStatus(String status) { + this.status = status; + return this; + } + + public Commit withTimestamp(Date timestamp) { + this.timestamp = timestamp; + return this; + } + + public Commit withTitle(String title) { + this.title = title; + return this; + } + + public Commit withUrl(String url) { + this.url = url; + return this; + } } From 246a60cee51d3dec6984f2383c78594d10621624 Mon Sep 17 00:00:00 2001 From: Ruben Vitt Date: Wed, 15 Aug 2018 09:50:25 +0200 Subject: [PATCH 3/7] add fluent api to branch-model --- .../java/org/gitlab4j/api/models/Branch.java | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/main/java/org/gitlab4j/api/models/Branch.java b/src/main/java/org/gitlab4j/api/models/Branch.java index c796e469d..04285fc97 100644 --- a/src/main/java/org/gitlab4j/api/models/Branch.java +++ b/src/main/java/org/gitlab4j/api/models/Branch.java @@ -67,4 +67,35 @@ public void setProtected(Boolean isProtected) { public static final boolean isValid(Branch branch) { return (branch != null && branch.getName() != null); } + + + public Branch withCommit(Commit commit) { + this.commit = commit; + return this; + } + + public Branch withDevelopersCanMerge(Boolean developersCanMerge) { + this.developersCanMerge = developersCanMerge; + return this; + } + + public Branch withDevelopersCanPush(Boolean developersCanPush) { + this.developersCanPush = developersCanPush; + return this; + } + + public Branch withDerged(Boolean merged) { + this.merged = merged; + return this; + } + + public Branch withName(String name) { + this.name = name; + return this; + } + + public Branch withIsProtected(Boolean isProtected) { + this.isProtected = isProtected; + return this; + } } From 72fc3063034a048cd1d6b3176d2141b2f086bd21 Mon Sep 17 00:00:00 2001 From: Ruben Vitt Date: Wed, 15 Aug 2018 09:51:28 +0200 Subject: [PATCH 4/7] add fluent api to eventData-model --- .../org/gitlab4j/api/models/EventData.java | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/src/main/java/org/gitlab4j/api/models/EventData.java b/src/main/java/org/gitlab4j/api/models/EventData.java index a315c0d9b..5a21ca71e 100644 --- a/src/main/java/org/gitlab4j/api/models/EventData.java +++ b/src/main/java/org/gitlab4j/api/models/EventData.java @@ -83,4 +83,45 @@ public String getUserName() { public void setUserName(String userName) { this.userName = userName; } + + + public EventData withAfter(String after) { + this.after = after; + return this; + } + + public EventData withBefore(String before) { + this.before = before; + return this; + } + + public EventData withCommits(List commits) { + this.commits = commits; + return this; + } + + public EventData withRef(String ref) { + this.ref = ref; + return this; + } + + public EventData withRepository(Repository repository) { + this.repository = repository; + return this; + } + + public EventData withTotalCommitsCount(Integer totalCommitsCount) { + this.totalCommitsCount = totalCommitsCount; + return this; + } + + public EventData withUserId(Integer userId) { + this.userId = userId; + return this; + } + + public EventData withUserName(String userName) { + this.userName = userName; + return this; + } } From 54f837318d2a30f392c2f1dc4504150a7ab12fe8 Mon Sep 17 00:00:00 2001 From: Ruben Vitt Date: Wed, 15 Aug 2018 09:52:34 +0200 Subject: [PATCH 5/7] add fluent api to protectedBranch-model --- .../org/gitlab4j/api/models/ProtectedBranch.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/main/java/org/gitlab4j/api/models/ProtectedBranch.java b/src/main/java/org/gitlab4j/api/models/ProtectedBranch.java index 0f119c28e..d9f092b9e 100644 --- a/src/main/java/org/gitlab4j/api/models/ProtectedBranch.java +++ b/src/main/java/org/gitlab4j/api/models/ProtectedBranch.java @@ -41,4 +41,20 @@ public void setMergeAccessLevels(List mergeAccessLevels) { public static final boolean isValid(ProtectedBranch branch) { return (branch != null && branch.getName() != null); } + + + public ProtectedBranch withName(String name) { + this.name = name; + return this; + } + + public ProtectedBranch withPushAccessLevels(List pushAccessLevels) { + this.pushAccessLevels = pushAccessLevels; + return this; + } + + public ProtectedBranch withMergeAccessLevels(List mergeAccessLevels) { + this.mergeAccessLevels = mergeAccessLevels; + return this; + } } From 76abd45dd42c6189bc20045ab9951a77f0e054a0 Mon Sep 17 00:00:00 2001 From: Ruben Vitt Date: Wed, 15 Aug 2018 10:00:28 +0200 Subject: [PATCH 6/7] add fluent api to runner-model --- .../java/org/gitlab4j/api/models/Runner.java | 41 +++++++++++++++++ .../org/gitlab4j/api/models/RunnerDetail.java | 45 +++++++++++++++++++ 2 files changed, 86 insertions(+) diff --git a/src/main/java/org/gitlab4j/api/models/Runner.java b/src/main/java/org/gitlab4j/api/models/Runner.java index b967c421d..acbe6c432 100644 --- a/src/main/java/org/gitlab4j/api/models/Runner.java +++ b/src/main/java/org/gitlab4j/api/models/Runner.java @@ -109,4 +109,45 @@ public String getIpAddress() { public void setIpAddress(String ipAddress) { this.ipAddress = ipAddress; } + + + public Runner withId(Integer id) { + this.id = id; + return this; + } + + public Runner withDescription(String description) { + this.description = description; + return this; + } + + public Runner withActive(Boolean active) { + this.active = active; + return this; + } + + public Runner withIsShared(Boolean isShared) { + this.isShared = isShared; + return this; + } + + public Runner withName(String name) { + this.name = name; + return this; + } + + public Runner withOnline(Boolean online) { + this.online = online; + return this; + } + + public Runner withStatus(RunnerStatus status) { + this.status = status; + return this; + } + + public Runner withIpAddress(String ipAddress) { + this.ipAddress = ipAddress; + return this; + } } diff --git a/src/main/java/org/gitlab4j/api/models/RunnerDetail.java b/src/main/java/org/gitlab4j/api/models/RunnerDetail.java index e7e6f2ed9..db45d2089 100644 --- a/src/main/java/org/gitlab4j/api/models/RunnerDetail.java +++ b/src/main/java/org/gitlab4j/api/models/RunnerDetail.java @@ -121,4 +121,49 @@ public RunnerAccessLevel getAccessLevel() { public void setAccessLevel(RunnerAccessLevel accessLevel) { this.accessLevel = accessLevel; } + + public RunnerDetail withArchitecture(String architecture) { + this.architecture = architecture; + return this; + } + + public RunnerDetail withPlatform(String platform) { + this.platform = platform; + return this; + } + + public RunnerDetail withContactedAt(Date contactedAt) { + this.contactedAt = contactedAt; + return this; + } + + public RunnerDetail withProjects(List projects) { + this.projects = projects; + return this; + } + + public RunnerDetail withToken(String token) { + this.token = token; + return this; + } + + public RunnerDetail withRevision(String revision) { + this.revision = revision; + return this; + } + + public RunnerDetail withTagList(List tagList) { + this.tagList = tagList; + return this; + } + + public RunnerDetail withVersion(String version) { + this.version = version; + return this; + } + + public RunnerDetail withAccessLevel(RunnerAccessLevel accessLevel) { + this.accessLevel = accessLevel; + return this; + } } From dbe28da19a750fd59225d8acaac294aa86dfb20c Mon Sep 17 00:00:00 2001 From: Ruben Vitt Date: Wed, 15 Aug 2018 10:27:00 +0200 Subject: [PATCH 7/7] add fluent api to job-model --- .../java/org/gitlab4j/api/models/Job.java | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/src/main/java/org/gitlab4j/api/models/Job.java b/src/main/java/org/gitlab4j/api/models/Job.java index 4b5a3e70a..8a809e60c 100644 --- a/src/main/java/org/gitlab4j/api/models/Job.java +++ b/src/main/java/org/gitlab4j/api/models/Job.java @@ -144,4 +144,80 @@ public Runner getRunner() { public void setRunner(Runner runner) { this.runner = runner; } + + + public Job withId(Integer id) { + this.id = id; + return this; + } + + public Job withCommit(Commit commit) { + this.commit = commit; + return this; + } + + public Job withCoverage(String coverage) { + this.coverage = coverage; + return this; + } + + public Job withCreatedAt(Date createdAt) { + this.createdAt = createdAt; + return this; + } + + public Job withFinishedAt(Date finishedAt) { + this.finishedAt = finishedAt; + return this; + } + + public Job withName(String name) { + this.name = name; + return this; + } + + public Job withPipeline(Pipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + public Job withRef(String ref) { + this.ref = ref; + return this; + } + + public Job withRunner(Runner runner) { + this.runner = runner; + return this; + } + + public Job withUser(User user) { + this.user = user; + return this; + } + + public Job withStartedAt(Date startedAt) { + this.startedAt = startedAt; + return this; + } + + public Job withArtifactsFile(ArtifactsFile artifactsFile) { + this.artifactsFile = artifactsFile; + return this; + } + + public Job withTag(Boolean tag) { + this.tag = tag; + return this; + } + + public Job withStage(String stage) { + this.stage = stage; + return this; + } + + public Job withStatus(JobStatus status) { + this.status = status; + return this; + } }