1
1
///usr/bin/env jbang "$0" "$@" ; exit $?
2
2
3
3
//DEPS info.picocli:picocli:4.6.3
4
- //DEPS https://github.com/unblu/gitlab-workitem-graphql-client/commit/96673d87850c148ef174fbf4c5d163db745ae3ea
5
- //DEPS io.smallrye:smallrye-graphql-client-implementation-vertx:2.11.0
4
+ //DEPS https://github.com/unblu/gitlab-workitem-graphql-client/commit/c9329cfc1c6fb35da6862869f3135045f7f08574
5
+ //DEPS patched.unblu. io.smallrye:smallrye-graphql-client-implementation-vertx:2.12.2-unblu-2
6
6
//DEPS org.jboss.logmanager:jboss-logmanager:3.1.1.Final
7
7
//JAVA 17
8
8
//RUNTIME_OPTIONS -Djava.util.logging.manager=org.jboss.logmanager.LogManager
19
19
import java .util .concurrent .Callable ;
20
20
21
21
import graphql .gitlab .api .WorkitemClientApi ;
22
+ import graphql .gitlab .model .Date ;
22
23
import graphql .gitlab .model .WorkItem ;
23
24
import graphql .gitlab .model .WorkItemConnection ;
24
25
import graphql .gitlab .model .WorkItemDeleteInput ;
28
29
import graphql .gitlab .model .WorkItemUpdatePayload ;
29
30
import graphql .gitlab .model .WorkItemWidgetHierarchyUpdateInputWithChildren ;
30
31
import graphql .gitlab .model .WorkItemWidgetHierarchyUpdateInputWithParent ;
32
+ import graphql .gitlab .model .WorkItemWidgetStartAndDueDateUpdateInput ;
31
33
import io .smallrye .graphql .client .typesafe .api .TypesafeGraphQLClientBuilder ;
32
34
import picocli .CommandLine ;
33
35
import picocli .CommandLine .Command ;
@@ -57,6 +59,9 @@ public class WorkItemScript implements Callable<Integer> {
57
59
@ Option (names = { "-s" , "--childId" }, description = "workitem childrenIds" )
58
60
private List <String > childrenIds ;
59
61
62
+ @ Option (names = { "-d" , "--dueDate" }, description = "workitem dueDate" )
63
+ private String dueDate ;
64
+
60
65
@ Option (names = { "-r" , "--ref" , "--reference" }, description = "references in the namespace" )
61
66
private List <String > refs ;
62
67
@@ -67,7 +72,7 @@ public class WorkItemScript implements Callable<Integer> {
67
72
Boolean logHttp ;
68
73
69
74
private static enum Action {
70
- GET_WORKITEM , DELETE_WORKITEM , ADD_PARENT , REMOVE_PARENT , ADD_CHILDREN
75
+ GET_WORKITEM , DELETE_WORKITEM , ADD_PARENT , REMOVE_PARENT , ADD_CHILDREN , UPDATE_DUE_DATE
71
76
}
72
77
73
78
@ Override
@@ -109,6 +114,9 @@ public Integer call() throws Exception {
109
114
case ADD_CHILDREN :
110
115
addChildren (api );
111
116
break ;
117
+ case UPDATE_DUE_DATE :
118
+ updateDueDate (api );
119
+ break ;
112
120
default :
113
121
throw new IllegalArgumentException ("Unexpected value: " + action );
114
122
}
@@ -157,6 +165,20 @@ private void deleteParent(WorkitemClientApi api) {
157
165
System .out .println (response );
158
166
}
159
167
168
+ private void updateDueDate (WorkitemClientApi api ) {
169
+ ensureExists (id , "id" );
170
+ WorkItemWidgetStartAndDueDateUpdateInput input = new WorkItemWidgetStartAndDueDateUpdateInput ()
171
+ .setIsFixed (true );
172
+ if (dueDate != null ) {
173
+ input .setDueDate (new Date (dueDate ));
174
+ }
175
+ WorkItemUpdateInput request = new WorkItemUpdateInput ()
176
+ .setId (new WorkItemID (id ))
177
+ .setStartAndDueDateWidget (input );
178
+ WorkItemUpdatePayload updateResponse = api .workItemUpdate (request );
179
+ System .out .println (updateResponse );
180
+ }
181
+
160
182
private void addChildren (WorkitemClientApi api ) {
161
183
ensureExists (id , "id" );
162
184
ensureExists (childrenIds , "childId" );
0 commit comments