1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package com.linecorp.centraldogma.client;
17
18 import static java.util.Objects.requireNonNull;
19
20 import java.util.concurrent.CompletableFuture;
21
22 import com.linecorp.centraldogma.common.Change;
23 import com.linecorp.centraldogma.common.Commit;
24 import com.linecorp.centraldogma.common.Markup;
25 import com.linecorp.centraldogma.common.PushResult;
26 import com.linecorp.centraldogma.common.Revision;
27
28
29
30
31
32 public final class CommitRequest {
33
34 private final CentralDogmaRepository centralDogmaRepo;
35 private final String summary;
36 private final Iterable<? extends Change<?>> changes;
37
38 private String detail = "";
39 private Markup markup = Markup.PLAINTEXT;
40
41 CommitRequest(CentralDogmaRepository centralDogmaRepo,
42 String summary, Iterable<? extends Change<?>> changes) {
43 this.centralDogmaRepo = centralDogmaRepo;
44 this.summary = summary;
45 this.changes = changes;
46 }
47
48
49
50
51 public CommitRequest detail(String detail, Markup markup) {
52 this.detail = requireNonNull(detail, "detail");
53 this.markup = requireNonNull(markup, "markup");
54 return this;
55 }
56
57
58
59
60
61
62 public CompletableFuture<PushResult> push() {
63 return push(Revision.HEAD);
64 }
65
66
67
68
69
70
71 public CompletableFuture<PushResult> push(Revision baseRevision) {
72 requireNonNull(baseRevision, "baseRevision");
73 return centralDogmaRepo.centralDogma().push(centralDogmaRepo.projectName(),
74 centralDogmaRepo.repositoryName(),
75 baseRevision, summary, detail, markup, changes);
76 }
77 }