@@ -21,6 +21,7 @@ public function getAll(): Dto\Issues
2121 id
2222 title
2323 description
24+ number
2425 priority
2526 priorityLabel
2627 state {
@@ -105,19 +106,16 @@ public function delete(Dto\Issue $issue): bool
105106
106107 public function create (string $ title , string $ description , Dto \Team $ team , ?Dto \Project $ project = null ): Dto \Issue
107108 {
108- if (is_null ($ project )) {
109- $ projectQL = 'projectId: null ' ;
110- } else {
111- $ projectQL = "projectId: \"{$ project ->id }\"" ;
112- }
109+ $ input = [
110+ 'title ' => $ title ,
111+ 'description ' => $ description ,
112+ 'teamId ' => $ team ->id ,
113+ 'projectId ' => $ issue ->project ->id ?? null ,
114+ ];
115+
113116 $ query = "
114- mutation IssueCreate {
115- issueCreate(input: {
116- title: \"$ title \",
117- description: \"$ description \",
118- teamId: \"{$ team ->id }\"
119- $ projectQL
120- }) {
117+ mutation ( \$input: IssueCreateInput!) {
118+ issueCreate(input: \$input) {
121119 issue {
122120 id
123121 title
@@ -139,7 +137,10 @@ public function create(string $title, string $description, Dto\Team $team, ?Dto\
139137 }
140138 }
141139 " ;
142- $ response = $ this ->http ->post ('/ ' , ['query ' => $ query ]);
140+
141+ $ qx = ['query ' => $ query , 'variables ' => ['input ' => $ input ]];
142+
143+ $ response = $ this ->http ->post ('/ ' , $ qx );
143144
144145 $ issueArr = $ this ->process ($ response );
145146
@@ -152,20 +153,17 @@ public function create(string $title, string $description, Dto\Team $team, ?Dto\
152153
153154 public function update (Dto \Issue $ issue ): Dto \Issue
154155 {
155- if (!isset ($ issue ->project ->id )) {
156- $ projectQL = 'projectId: null ' ;
157- } else {
158- $ projectQL = "projectId: \"{$ issue ->project ->id }\"" ;
159- }
156+ $ input = [
157+ 'title ' => $ issue ->title ,
158+ 'description ' => $ issue ->description ,
159+ 'projectId ' => $ issue ->project ->id ?? null ,
160+ ];
161+
160162 $ query = "
161- mutation IssueUpdate {
163+ mutation ( \$ input: IssueUpdateInput!) {
162164 issueUpdate(
163165 id: \"{$ issue ->id }\",
164- input: {
165- title: \"{$ issue ->title }\",
166- description: \"{$ issue ->description }\"
167- $ projectQL
168- }) {
166+ input: \$input) {
169167 issue {
170168 id
171169 title
@@ -187,7 +185,9 @@ public function update(Dto\Issue $issue): Dto\Issue
187185 }
188186 }
189187 " ;
190- $ response = $ this ->http ->post ('/ ' , ['query ' => $ query ]);
188+ $ qx = ['query ' => $ query , 'variables ' => ['input ' => $ input ]];
189+
190+ $ response = $ this ->http ->post ('/ ' , $ qx );
191191
192192 $ issueArr = $ this ->process ($ response );
193193
0 commit comments